diff --git a/boot.php b/boot.php index f4dce840f..77be9ac26 100644 --- a/boot.php +++ b/boot.php @@ -969,16 +969,7 @@ if(! function_exists('login')) { $a->module = 'login'; } - - $includes = array( - '$field_input' => 'field_input.tpl', - '$field_password' => 'field_password.tpl', - '$field_openid' => 'field_openid.tpl', - '$field_checkbox' => 'field_checkbox.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($tpl,$includes + array( + $o .= replace_macros($tpl, array( '$dest_url' => $dest_url, '$logout' => t('Logout'), @@ -997,6 +988,13 @@ if(! function_exists('login')) { '$lostpass' => t('Forgot your password?'), '$lostlink' => t('Password Reset'), + + '$tostitle' => t('Website Terms of Service'), + '$toslink' => t('terms of service'), + + '$privacytitle' => t('Website Privacy Policy'), + '$privacylink' => t('privacy policy'), + )); call_hooks('login_hook',$o); @@ -1348,15 +1346,10 @@ if(! function_exists('profile_sidebar')) { $tpl = get_markup_template('profile_vcard.tpl'); - $includes = array( - '$diaspora_vcard' => 'diaspora_vcard.tpl' - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - if($a->theme['template_engine'] === 'internal') $location = template_escape($location); - $o .= replace_macros($tpl, $includes + array( + $o .= replace_macros($tpl, array( '$profile' => $profile, '$connect' => $connect, '$wallmessage' => $wallmessage, @@ -1365,7 +1358,7 @@ if(! function_exists('profile_sidebar')) { '$pdesc' => $pdesc, '$marital' => $marital, '$homepage' => $homepage, - '$diaspora_info' => $diaspora, + '$diaspora' => $diaspora, '$contact_block' => $contact_block, )); @@ -1946,3 +1939,18 @@ function clear_cache($basepath = "", $path = "") { closedir($dh); } } + +function set_template_engine(&$a, $engine = 'internal') { + + $a->theme['template_engine'] = 'internal'; + + if(is_writable('view/smarty3/')) { + switch($engine) { + case 'smarty3': + $a->theme['template_engine'] = 'smarty3'; + break; + default: + break; + } + } +} diff --git a/include/auth.php b/include/auth.php index b534d4a4d..4c695cc1e 100644 --- a/include/auth.php +++ b/include/auth.php @@ -5,6 +5,8 @@ require_once('include/security.php'); require_once('include/datetime.php'); function nuke_session() { + new_cookie(0); // make sure cookie is deleted on browser close, as a security measure + unset($_SESSION['authenticated']); unset($_SESSION['uid']); unset($_SESSION['visitor_id']); @@ -187,18 +189,10 @@ else { // (i.e. expire when the browser is closed), even when there's a time expiration // on the cookie if($_POST['remember']) { - $old_sid = session_id(); - session_set_cookie_params('31449600'); // one year - session_regenerate_id(false); - - q("UPDATE session SET sid = '%s' WHERE sid = '%s'", dbesc(session_id()), dbesc($old_sid)); + new_cookie(31449600); // one year } else { - $old_sid = session_id(); - session_set_cookie_params('0'); - session_regenerate_id(false); - - q("UPDATE session SET sid = '%s' WHERE sid = '%s'", dbesc(session_id()), dbesc($old_sid)); + new_cookie(0); // 0 means delete on browser exit } // if we haven't failed up this point, log them in. @@ -208,4 +202,10 @@ else { } } +function new_cookie($time) { + $old_sid = session_id(); + session_set_cookie_params("$time"); + session_regenerate_id(false); + q("UPDATE session SET sid = '%s' WHERE sid = '%s'", dbesc(session_id()), dbesc($old_sid)); +} diff --git a/include/conversation.php b/include/conversation.php index 9cc6a8342..1f416f352 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -703,6 +703,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $o = replace_macros($page_template, array( '$baseurl' => $a->get_baseurl($ssl_state), '$live_update' => $live_update_div, + '$remove' => t('remove'), '$mode' => $mode, '$user' => $a->user, '$threads' => $threads, @@ -920,7 +921,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) { $o = ''; - $geotag = (($x['allow_location']) ? get_markup_template('jot_geotag.tpl') : ''); + $geotag = (($x['allow_location']) ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : ''); /* $plaintext = false; if( local_user() && (intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext')) ) diff --git a/include/friendica_smarty.php b/include/friendica_smarty.php index 2a294e9e2..9ad14ad8a 100644 --- a/include/friendica_smarty.php +++ b/include/friendica_smarty.php @@ -5,20 +5,24 @@ require_once("library/Smarty/libs/Smarty.class.php"); class FriendicaSmarty extends Smarty { public $filename; - public $root; function __construct() { parent::__construct(); $a = get_app(); + $theme = current_theme(); - //$this->root = $_SERVER['DOCUMENT_ROOT'] . '/'; - $this->root = ''; + // setTemplateDir can be set to an array, which Smarty will parse in order. + // The order is thus very important here + $template_dirs = array('theme' => "view/theme/$theme/smarty3/"); + if( x($a->theme_info,"extends") ) + $template_dirs = $template_dirs + array('extends' => "view/theme/".$a->theme_info["extends"]."/smarty3/"); + $template_dirs = $template_dirs + array('base' => 'view/smarty3/'); + $this->setTemplateDir($template_dirs); - $this->setTemplateDir($this->root . 'view/smarty3/'); - $this->setCompileDir($this->root . 'view/smarty3/compiled/'); - $this->setConfigDir($this->root . 'view/smarty3/config/'); - $this->setCacheDir($this->root . 'view/smarty3/cache/'); + $this->setCompileDir('view/smarty3/compiled/'); + $this->setConfigDir('view/smarty3/config/'); + $this->setCacheDir('view/smarty3/cache/'); $this->left_delimiter = $a->smarty3_ldelim; $this->right_delimiter = $a->smarty3_rdelim; @@ -28,7 +32,7 @@ class FriendicaSmarty extends Smarty { if($template) { return $this->fetch('string:' . $template); } - return $this->fetch('file:' . $this->root . $this->filename); + return $this->fetch('file:' . $this->filename); } } diff --git a/include/text.php b/include/text.php index 0591390a8..628da1c1b 100644 --- a/include/text.php +++ b/include/text.php @@ -499,21 +499,6 @@ function get_template_file($a, $filename, $root = '') { return $template_file; }} -if(! function_exists("set_template_includes")) { -function set_template_includes($engine, $includes) { - if($engine === 'smarty3') { - $a = get_app(); - foreach($includes as $name=>$path) { -// $sm_includes[$name] = $_SERVER['DOCUMENT_ROOT'] . '/' . get_template_file($a, 'smarty3/' . $path); - $sm_includes[$name] = get_template_file($a, 'smarty3/' . $path); - } - return $sm_includes; - } - else { - return $includes; - } -}} - diff --git a/mod/admin.php b/mod/admin.php index c951dd8b9..0381fcf4c 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -455,16 +455,7 @@ function admin_page_site(&$a) { ); $t = get_markup_template("admin_site.tpl"); - - $includes = array( - '$field_checkbox' => 'field_checkbox.tpl', - '$field_input' => 'field_input.tpl', - '$field_select' => 'field_select.tpl', - '$field_textarea' => 'field_textarea.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - return replace_macros($t, $includes + array( + return replace_macros($t, array( '$title' => t('Administration'), '$page' => t('Site'), '$submit' => t('Submit'), @@ -1144,14 +1135,7 @@ readable."); } } - $includes = array( - '$field_checkbox' => 'field_checkbox.tpl', - '$field_input' => 'field_input.tpl', - '$field_select' => 'field_select.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - return replace_macros($t, $includes + array( + return replace_macros($t, array( '$title' => t('Administration'), '$page' => t('Logs'), '$submit' => t('Submit'), @@ -1210,14 +1194,7 @@ function admin_page_remoteupdate(&$a) { } $tpl = get_markup_template("admin_remoteupdate.tpl"); - - $includes = array( - '$field_input' => 'field_input.tpl', - '$field_password' => 'field_password.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - return replace_macros($tpl, $includes + array( + return replace_macros($tpl, array( '$baseurl' => $a->get_baseurl(true), '$submit' => t("Update now"), '$close' => t("Close"), diff --git a/mod/contacts.php b/mod/contacts.php index 1a57afbf5..6e62ec8ef 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -346,12 +346,7 @@ function contacts_content(&$a) { $lost_contact = (($contact['archive'] && $contact['term-date'] != '0000-00-00 00:00:00' && $contact['term-date'] < datetime_convert('','','now')) ? t('Communications lost with this contact!') : ''); - $includes = array( - '$field_checkbox' => 'field_checkbox.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($tpl,$includes + array( + $o .= replace_macros($tpl, array( '$header' => t('Contact Editor'), '$tab_str' => $tab_str, '$submit' => t('Submit'), @@ -576,13 +571,7 @@ function contacts_content(&$a) { } $tpl = get_markup_template("contacts-template.tpl"); - - $includes = array( - '$contact_template' => 'contact_template.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($tpl,$includes + array( + $o .= replace_macros($tpl, array( '$header' => t('Contacts') . (($nets) ? ' - ' . network_to_name($nets) : ''), '$tabs' => $t, '$total' => $total, diff --git a/mod/fbrowser.php b/mod/fbrowser.php index 92c6bd3b4..075846e50 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -78,6 +78,7 @@ function fbrowser_content($a){ '$path' => $path, '$folders' => $albums, '$files' =>$files, + '$cancel' => t('Cancel'), )); @@ -112,6 +113,7 @@ function fbrowser_content($a){ '$path' => array( array($a->get_baseurl()."/fbrowser/image/", t("Files")) ), '$folders' => false, '$files' =>$files, + '$cancel' => t('Cancel'), )); } diff --git a/mod/filer.php b/mod/filer.php index 7b0fd59d5..4e79f337d 100644 --- a/mod/filer.php +++ b/mod/filer.php @@ -24,13 +24,8 @@ function filer_content(&$a) { $filetags = get_pconfig(local_user(),'system','filetags'); $filetags = file_tag_file_to_list($filetags,'file'); $filetags = explode(",", $filetags); + $tpl = get_markup_template("filer_dialog.tpl"); - - $includes = array( - '$field_combobox' => 'field_combobox.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - $o = replace_macros($tpl, array( '$field' => array('term', t("Save to Folder:"), '', '', $filetags, t('- select -')), '$submit' => t('Save'), diff --git a/mod/group.php b/mod/group.php index f5a37819e..13a899ed9 100644 --- a/mod/group.php +++ b/mod/group.php @@ -83,13 +83,7 @@ function group_content(&$a) { $tpl = get_markup_template('group_edit.tpl'); - $includes = array( - '$field_input' => 'field_input.tpl', - '$groupeditortpl' => 'groupeditor.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $context = $includes + array( + $context = array( '$submit' => t('Submit'), ); diff --git a/mod/install.php b/mod/install.php index ab6d7d204..d4e04c1a9 100755 --- a/mod/install.php +++ b/mod/install.php @@ -177,6 +177,8 @@ function install_content(&$a) { check_htconfig($checks); + check_smarty3($checks); + check_keys($checks); if(x($_POST,'phpath')) @@ -220,14 +222,7 @@ function install_content(&$a) { $tpl = get_markup_template('install_db.tpl'); - - $includes = array( - '$field_input' => 'field_input.tpl', - '$field_password' => 'field_password.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($tpl,$includes + array( + $o .= replace_macros($tpl, array( '$title' => $install_title, '$pass' => t('Database connection'), '$info_01' => t('In order to install Friendica we need to know how to connect to your database.'), @@ -267,13 +262,7 @@ function install_content(&$a) { $timezone = ((x($_POST,'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles'); $tpl = get_markup_template('install_settings.tpl'); - - $includes = array( - '$field_input' => 'field_input.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($tpl, $includes + array( + $o .= replace_macros($tpl, array( '$title' => $install_title, '$pass' => t('Site settings'), @@ -441,6 +430,22 @@ function check_htconfig(&$checks) { } +function check_smarty3(&$checks) { + $status = true; + $help = ""; + if( !is_writable('view/smarty3') ) { + + $status=false; + $help = t('Friendica uses the Smarty3 template engine to render its web views. Smarty3 compiles templates to PHP to speed up rendering.') .EOL; + $help .= t('In order to store these compiled templates, the web server needs to have write access to the directory view/smarty3/ under the Friendica top level folder.').EOL; + $help .= t('Please ensure that the user that your web server runs as (e.g. www-data) has write access to this folder.').EOL; + $help .= t('Note: as a security measure, you should give the web server write access to view/smarty3/ only--not the template files (.tpl) that it contains.').EOL; + } + + check_add($checks, t('view/smarty3 is writable'), $status, true, $help); + +} + function check_htaccess(&$checks) { $a = get_app(); $status = true; diff --git a/mod/message.php b/mod/message.php index 7ca3fba70..057797ddd 100644 --- a/mod/message.php +++ b/mod/message.php @@ -282,25 +282,23 @@ function message_content(&$a) { $tpl = get_markup_template('prv_message.tpl'); $o .= replace_macros($tpl,array( - '$reply' => array( - 'header' => t('Send Private Message'), - 'to' => t('To:'), - 'showinputs' => 'true', - 'prefill' => $prefill, - 'autocomp' => $autocomp, - 'preid' => $preid, - 'subject' => t('Subject:'), - 'subjtxt' => ((x($_REQUEST,'subject')) ? strip_tags($_REQUEST['subject']) : ''), - 'text' => ((x($_REQUEST,'body')) ? escape_tags(htmlspecialchars($_REQUEST['body'])) : ''), - 'readonly' => '', - 'yourmessage' => t('Your message:'), - 'select' => $select, - 'parent' => '', - 'upload' => t('Upload photo'), - 'insert' => t('Insert web link'), - 'wait' => t('Please wait'), - 'submit' => t('Submit') - ) + '$header' => t('Send Private Message'), + '$to' => t('To:'), + '$showinputs' => 'true', + '$prefill' => $prefill, + '$autocomp' => $autocomp, + '$preid' => $preid, + '$subject' => t('Subject:'), + '$subjtxt' => ((x($_REQUEST,'subject')) ? strip_tags($_REQUEST['subject']) : ''), + '$text' => ((x($_REQUEST,'body')) ? escape_tags(htmlspecialchars($_REQUEST['body'])) : ''), + '$readonly' => '', + '$yourmessage' => t('Your message:'), + '$select' => $select, + '$parent' => '', + '$upload' => t('Upload photo'), + '$insert' => t('Insert web link'), + '$wait' => t('Please wait'), + '$submit' => t('Submit') )); return $o; @@ -497,12 +495,6 @@ function message_content(&$a) { $tpl = get_markup_template('mail_display.tpl'); - $includes = array( - '$mail_conv' => 'mail_conv.tpl', - '$prv_message' => 'prv_message.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - if($a->theme['template_engine'] === 'internal') { $subjtxt_e = template_escape($message['title']); } @@ -510,7 +502,7 @@ function message_content(&$a) { $subjtxt_e = $message['title']; } - $o = replace_macros($tpl, $includes + array( + $o = replace_macros($tpl, array( '$thread_id' => $a->argv[1], '$thread_subject' => $message['title'], '$thread_seen' => $seen, @@ -520,22 +512,20 @@ function message_content(&$a) { '$mails' => $mails, // reply - '$reply_info' => array( - 'header' => t('Send Reply'), - 'to' => t('To:'), - 'showinputs' => '', - 'subject' => t('Subject:'), - 'subjtxt' => $subjtxt_e, - 'readonly' => ' readonly="readonly" style="background: #BBBBBB;" ', - 'yourmessage' => t('Your message:'), - 'text' => '', - 'select' => $select, - 'parent' => $parent, - 'upload' => t('Upload photo'), - 'insert' => t('Insert web link'), - 'submit' => t('Submit'), - 'wait' => t('Please wait'), - ), + '$header' => t('Send Reply'), + '$to' => t('To:'), + '$showinputs' => '', + '$subject' => t('Subject:'), + '$subjtxt' => template_escape($message['title']), + '$readonly' => ' readonly="readonly" style="background: #BBBBBB;" ', + '$yourmessage' => t('Your message:'), + '$text' => '', + '$select' => $select, + '$parent' => $parent, + '$upload' => t('Upload photo'), + '$insert' => t('Insert web link'), + '$submit' => t('Submit'), + '$wait' => t('Please wait') )); diff --git a/mod/nogroup.php b/mod/nogroup.php index 885ba62c6..24d99a59b 100644 --- a/mod/nogroup.php +++ b/mod/nogroup.php @@ -55,13 +55,7 @@ function nogroup_content(&$a) { } $tpl = get_markup_template("nogroup-template.tpl"); - - $includes = array( - '$contact_template' => 'contact_template.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($tpl,$includes + array( + $o .= replace_macros($tpl, array( '$header' => t('Contacts who are not members of a group'), '$contacts' => $contacts, '$paginate' => paginate($a), diff --git a/mod/notifications.php b/mod/notifications.php index 03a39a268..9c14737f7 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -145,12 +145,7 @@ function notifications_content(&$a) { $return_addr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : '')); - $includes = array( - '$field_checkbox' => 'field_checkbox.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $notif_content .= replace_macros($sugg,$includes + array( + $notif_content .= replace_macros($sugg, array( '$str_notifytype' => t('Notification type: '), '$notify_type' => t('Friend Suggestion'), '$intro_id' => $rr['intro_id'], @@ -196,12 +191,7 @@ function notifications_content(&$a) { )); } - $includes = array( - '$field_checkbox' => 'field_checkbox.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $notif_content .= replace_macros($tpl,$includes + array( + $notif_content .= replace_macros($tpl, array( '$str_notifytype' => t('Notification type: '), '$notify_type' => (($rr['network'] !== NETWORK_OSTATUS) ? t('Friend/Connect Request') : t('New Follower')), '$dfrn_text' => $dfrn_text, @@ -226,14 +216,9 @@ function notifications_content(&$a) { else info( t('No introductions.') . EOL); - $includes = array( - '$common_tabs' => 'common_tabs.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($notif_tpl,$includes + array( + $o .= replace_macros($notif_tpl, array( '$notif_header' => t('Notifications'), - '$tabs_data' => $tabs, + '$tabs' => $tabs, '$notif_content' => $notif_content, )); @@ -317,14 +302,9 @@ function notifications_content(&$a) { $notif_content = t('No more network notifications.'); } - $includes = array( - '$common_tabs' => 'common_tabs.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($notif_tpl,$includes + array( + $o .= replace_macros($notif_tpl, array( '$notif_header' => t('Network Notifications'), - '$tabs_data' => $tabs, + '$tabs' => $tabs, '$notif_content' => $notif_content, )); @@ -352,14 +332,9 @@ function notifications_content(&$a) { $notif_content .= t('No more system notifications.'); } - $includes = array( - '$common_tabs' => 'common_tabs.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($notif_tpl,$includes + array( + $o .= replace_macros($notif_tpl, array( '$notif_header' => t('System Notifications'), - '$tabs_data' => $tabs, + '$tabs' => $tabs, '$notif_content' => $notif_content, )); @@ -452,14 +427,9 @@ function notifications_content(&$a) { $notif_content = t('No more personal notifications.'); } - $includes = array( - '$common_tabs' => 'common_tabs.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($notif_tpl,$includes + array( + $o .= replace_macros($notif_tpl, array( '$notif_header' => t('Personal Notifications'), - '$tabs_data' => $tabs, + '$tabs' => $tabs, '$notif_content' => $notif_content, )); @@ -538,14 +508,9 @@ function notifications_content(&$a) { $notif_content = t('No more home notifications.'); } - $includes = array( - '$common_tabs' => 'common_tabs.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($notif_tpl,$includes + array( + $o .= replace_macros($notif_tpl, array( '$notif_header' => t('Home Notifications'), - '$tabs_data' => $tabs, + '$tabs' => $tabs, '$notif_content' => $notif_content, )); } diff --git a/mod/notify.php b/mod/notify.php index 3abc1185c..b4d60a747 100644 --- a/mod/notify.php +++ b/mod/notify.php @@ -61,14 +61,9 @@ function notify_content(&$a) { $notif_content .= t('No more system notifications.'); } - $includes = array( - '$common_tabs' => 'common_tabs.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($notif_tpl,$includes + array( + $o .= replace_macros($notif_tpl, array( '$notif_header' => t('System Notifications'), - '$tabs_data' => '', // $tabs, + '$tabs' => '', // $tabs, '$notif_content' => $notif_content, )); diff --git a/mod/photos.php b/mod/photos.php index 8ac4d8590..7035c6690 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1679,13 +1679,7 @@ function photos_content(&$a) { } $tpl = get_markup_template('photos_recent.tpl'); - - $includes = array( - '$photo_top' => 'photo_top.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($tpl,$includes + array( + $o .= replace_macros($tpl, array( '$title' => t('Recent Photos'), '$can_post' => $can_post, '$upload' => array(t('Upload New Photos'), $a->get_baseurl().'/photos/'.$a->data['user']['nickname'].'/upload'), diff --git a/mod/poco.php b/mod/poco.php index abe2c8e35..ae5f0cef4 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -147,13 +147,7 @@ function poco_init(&$a) { if($format === 'xml') { header('Content-type: text/xml'); - - $includes = array( - '$poco_entry_xml' => 'poco_entry_xml.tpl' - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - echo replace_macros(get_markup_template('poco_xml.tpl'),array_xmlify($includes + array('$response' => $ret))); + echo replace_macros(get_markup_template('poco_xml.tpl'),array_xmlify(array('$response' => $ret))); http_status_exit(500); } if($format === 'json') { diff --git a/mod/profile.php b/mod/profile.php index 15a022421..9e9af1983 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -33,7 +33,7 @@ function profile_init(&$a) { auto_redir($a, $which); } - $a->theme["template_engine"] = 'internal'; // reset the template engine to the default in case the user's theme doesn't specify one + set_template_engine($a); // reset the template engine to the default in case the user's theme doesn't specify one profile_load($a,$which,$profile); $blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false); diff --git a/mod/settings.php b/mod/settings.php index 09a45f832..dbdd40bc3 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -554,13 +554,7 @@ function settings_content(&$a) { if(($a->argc > 2) && ($a->argv[2] === 'add')) { $tpl = get_markup_template("settings_oauth_edit.tpl"); - - $includes = array( - '$field_input' => 'field_input.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($tpl, $includes + array( + $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_oauth"), '$title' => t('Add application'), '$submit' => t('Submit'), @@ -586,13 +580,7 @@ function settings_content(&$a) { $app = $r[0]; $tpl = get_markup_template("settings_oauth_edit.tpl"); - - $includes = array( - '$field_input' => 'field_input.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($tpl, $includes + array( + $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_oauth"), '$title' => t('Add application'), '$submit' => t('Update'), @@ -675,13 +663,7 @@ function settings_content(&$a) { $tpl = get_markup_template("settings_features.tpl"); - - $includes = array( - '$field_yesno' => 'field_yesno.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($tpl, $includes + array( + $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_features"), '$title' => t('Additional Features'), '$features' => $arr, @@ -733,16 +715,7 @@ function settings_content(&$a) { } - $includes = array( - '$field_checkbox' => 'field_checkbox.tpl', - '$field_input' => 'field_input.tpl', - '$field_select' => 'field_select.tpl', - '$field_custom' => 'field_custom.tpl', - '$field_password' => 'field_password.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($tpl, $includes + array( + $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_connectors"), '$title' => t('Connector Settings'), @@ -832,15 +805,7 @@ function settings_content(&$a) { } $tpl = get_markup_template("settings_display.tpl"); - - $includes = array( - '$field_themeselect' => 'field_themeselect.tpl', - '$field_checkbox' => 'field_checkbox.tpl', - '$field_input' => 'field_input.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o = replace_macros($tpl, $includes + array( + $o = replace_macros($tpl, array( '$ptitle' => t('Display Settings'), '$form_security_token' => get_form_security_token("settings_display"), '$submit' => t('Submit'), @@ -926,13 +891,7 @@ function settings_content(&$a) { $pageset_tpl = get_markup_template('pagetypes.tpl'); - - $includes = array( - '$field_radio' => 'field_radio.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $pagetype = replace_macros($pageset_tpl,$includes + array( + $pagetype = replace_macros($pageset_tpl, array( '$page_normal' => array('page-flags', t('Normal Account Page'), PAGE_NORMAL, t('This account is a normal personal profile'), ($a->user['page-flags'] == PAGE_NORMAL)), @@ -1053,17 +1012,7 @@ function settings_content(&$a) { require_once('include/group.php'); $group_select = mini_group_select(local_user(),$a->user['def_gid']); - $includes = array( - '$field_password' => 'field_password.tpl', - '$field_input' => 'field_input.tpl', - '$field_custom' => 'field_custom.tpl', - '$field_checkbox' => 'field_checkbox.tpl', - '$field_yesno' => 'field_yesno.tpl', - '$field_intcheckbox' => 'field_intcheckbox.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($stpl,$includes + array( + $o .= replace_macros($stpl, array( '$ptitle' => t('Account Settings'), '$submit' => t('Submit'), diff --git a/mod/uimport.php b/mod/uimport.php index d28198f69..6cca08cda 100644 --- a/mod/uimport.php +++ b/mod/uimport.php @@ -60,13 +60,7 @@ function uimport_content(&$a) { $tpl = get_markup_template("uimport.tpl"); - - $includes = array( - '$field_custom' => 'field_custom.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - return replace_macros($tpl, $includes + array( + return replace_macros($tpl, array( '$regbutt' => t('Import'), '$import' => array( 'title' => t("Move account"), diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php index f54a76be4..8e261e711 100644 --- a/mod/viewcontacts.php +++ b/mod/viewcontacts.php @@ -72,13 +72,7 @@ function viewcontacts_content(&$a) { $tpl = get_markup_template("viewcontact_template.tpl"); - - $includes = array( - '$contact_template' => 'contact_template.tpl', - ); - $includes = set_template_includes($a->theme['template_engine'], $includes); - - $o .= replace_macros($tpl, $includes + array( + $o .= replace_macros($tpl, array( '$title' => t('View Contacts'), '$contacts' => $contacts, '$paginate' => paginate($a), diff --git a/object/Item.php b/object/Item.php index 4da5b8a59..eef8a5058 100644 --- a/object/Item.php +++ b/object/Item.php @@ -285,7 +285,6 @@ class Item extends BaseObject { 'comment' => $this->get_comment_box($indent), 'previewing' => ($conv->is_preview() ? ' preview ' : ''), 'wait' => t('Please wait'), - 'remove' => t('remove'), 'thread_level' => $thread_level ); diff --git a/view/admin_logs.tpl b/view/admin_logs.tpl index db1b00c11..b777cf420 100644 --- a/view/admin_logs.tpl +++ b/view/admin_logs.tpl @@ -4,9 +4,9 @@