From 11c06e21b7a656c4aeae0d5c157e1db97d6db02e Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Tue, 25 Dec 2012 11:48:02 -0700 Subject: [PATCH] simplify by making Smarty include directives behave like Friendica native ones --- boot.php | 19 +---- include/friendica_smarty.php | 20 +++-- include/text.php | 16 +--- mod/admin.php | 29 +------ mod/contacts.php | 15 +--- mod/filer.php | 9 +- mod/group.php | 8 +- mod/install.php | 35 ++++---- mod/message.php | 8 +- mod/nogroup.php | 8 +- mod/notifications.php | 49 ++--------- mod/notify.php | 7 +- mod/photos.php | 8 +- mod/poco.php | 8 +- mod/settings.php | 65 ++------------ mod/uimport.php | 8 +- mod/viewcontacts.php | 8 +- view/admin_logs.tpl | 6 +- view/admin_remoteupdate.tpl | 8 +- view/admin_site.tpl | 84 +++++++++---------- view/api_friends_xml.tpl | 2 +- view/api_timeline_xml.tpl | 2 +- view/contact_edit.tpl | 2 +- view/contacts-template.tpl | 2 +- view/field.tpl | 2 +- view/filer_dialog.tpl | 2 +- view/group_edit.tpl | 4 +- view/install_db.tpl | 8 +- view/install_settings.tpl | 2 +- view/intros.tpl | 4 +- view/login.tpl | 8 +- view/mail_display.tpl | 4 +- view/nogroup-template.tpl | 2 +- view/notifications.tpl | 2 +- view/pagetypes.tpl | 10 +-- view/photos_recent.tpl | 2 +- view/poco_xml.tpl | 2 +- view/profile_vcard.tpl | 2 +- view/settings.tpl | 52 ++++++------ view/settings_connectors.tpl | 20 ++--- view/settings_display.tpl | 10 +-- view/settings_features.tpl | 2 +- view/settings_oauth_edit.tpl | 10 +-- view/suggestions.tpl | 2 +- view/theme/cleanzero/config.php | 9 +- view/theme/cleanzero/theme_settings.tpl | 8 +- view/theme/diabook/communityhome.tpl | 28 +++---- view/theme/diabook/config.php | 10 +-- view/theme/diabook/login.tpl | 6 +- view/theme/diabook/mail_display.tpl | 4 +- view/theme/diabook/profile_vcard.tpl | 2 +- view/theme/diabook/theme.php | 21 ++--- view/theme/diabook/theme_settings.tpl | 36 ++++---- view/theme/dispy/config.php | 8 +- view/theme/dispy/profile_vcard.tpl | 2 +- view/theme/duepuntozero/profile_vcard.tpl | 2 +- view/theme/facepark/profile_vcard.tpl | 2 +- view/theme/frost-mobile/admin_site.tpl | 68 +++++++-------- view/theme/frost-mobile/contacts-template.tpl | 2 +- view/theme/frost-mobile/login.tpl | 8 +- view/theme/frost-mobile/profile_vcard.tpl | 2 +- view/theme/frost-mobile/settings.tpl | 50 +++++------ view/theme/frost/admin_site.tpl | 81 ++++++++++-------- view/theme/frost/contacts-template.tpl | 2 +- view/theme/frost/login.tpl | 8 +- view/theme/frost/profile_vcard.tpl | 2 +- view/theme/quattro/config.php | 8 +- view/theme/quattro/mail_display.tpl | 4 +- view/theme/quattro/profile_vcard.tpl | 2 +- view/theme/smoothly/login.tpl | 6 +- view/theme/testbubble/profile_vcard.tpl | 2 +- view/uimport.tpl | 2 +- view/viewcontact_template.tpl | 2 +- 73 files changed, 376 insertions(+), 587 deletions(-) diff --git a/boot.php b/boot.php index d8bc174b4..640fef541 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,7 @@ if(! function_exists('login')) { '$lostpass' => t('Forgot your password?'), '$lostlink' => t('Password Reset'), + )); call_hooks('login_hook',$o); @@ -1348,15 +1340,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, 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..58f69449f 100644 --- a/include/text.php +++ b/include/text.php @@ -477,6 +477,7 @@ function get_markup_template($s, $root = '') { // $tt = microtime() - $ts; // $a->page['debug'] .= "$tt
\n"; // return $file_contents; +// logger($template_file); return file_get_contents($template_file); } }} @@ -499,21 +500,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/filer.php b/mod/filer.php index c811ba6e2..4e79f337d 100644 --- a/mod/filer.php +++ b/mod/filer.php @@ -24,14 +24,9 @@ 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,$includes + array( + $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..26275ceab 100644 --- a/mod/message.php +++ b/mod/message.php @@ -497,12 +497,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 +504,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, 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..128317eb4 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,12 +216,7 @@ 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, '$notif_content' => $notif_content, @@ -317,12 +302,7 @@ 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, '$notif_content' => $notif_content, @@ -352,12 +332,7 @@ 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, '$notif_content' => $notif_content, @@ -452,12 +427,7 @@ 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, '$notif_content' => $notif_content, @@ -538,12 +508,7 @@ 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, '$notif_content' => $notif_content, diff --git a/mod/notify.php b/mod/notify.php index 3abc1185c..6ff437a38 100644 --- a/mod/notify.php +++ b/mod/notify.php @@ -61,12 +61,7 @@ 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, '$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/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/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 @@
- {{ inc $field_checkbox with $field=$debugging }}{{ endinc }} - {{ inc $field_input with $field=$logfile }}{{ endinc }} - {{ inc $field_select with $field=$loglevel }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$debugging }}{{ endinc }} + {{ inc field_input.tpl with $field=$logfile }}{{ endinc }} + {{ inc field_select.tpl with $field=$loglevel }}{{ endinc }}
diff --git a/view/admin_remoteupdate.tpl b/view/admin_remoteupdate.tpl index 844cbad27..874c6e626 100644 --- a/view/admin_remoteupdate.tpl +++ b/view/admin_remoteupdate.tpl @@ -84,10 +84,10 @@

Your friendica installation is not writable by web server.

{{ if $canftp }}

You can try to update via FTP

- {{ inc $field_input with $field=$ftphost }}{{ endinc }} - {{ inc $field_input with $field=$ftppath }}{{ endinc }} - {{ inc $field_input with $field=$ftpuser }}{{ endinc }} - {{ inc $field_password with $field=$ftppwd }}{{ endinc }} + {{ inc field_input.tpl with $field=$ftphost }}{{ endinc }} + {{ inc field_input.tpl with $field=$ftppath }}{{ endinc }} + {{ inc field_input.tpl with $field=$ftpuser }}{{ endinc }} + {{ inc field_password.tpl with $field=$ftppwd }}{{ endinc }}
{{ endif }} {{ endif }} diff --git a/view/admin_site.tpl b/view/admin_site.tpl index 24cd12b0c..38d1fb8d0 100644 --- a/view/admin_site.tpl +++ b/view/admin_site.tpl @@ -41,65 +41,65 @@ - {{ inc $field_input with $field=$sitename }}{{ endinc }} - {{ inc $field_textarea with $field=$banner }}{{ endinc }} - {{ inc $field_select with $field=$language }}{{ endinc }} - {{ inc $field_select with $field=$theme }}{{ endinc }} - {{ inc $field_select with $field=$theme_mobile }}{{ endinc }} - {{ inc $field_select with $field=$ssl_policy }}{{ endinc }} - {{ inc $field_checkbox with $field=$new_share }}{{ endinc }} + {{ inc field_input.tpl with $field=$sitename }}{{ endinc }} + {{ inc field_textarea.tpl with $field=$banner }}{{ endinc }} + {{ inc field_select.tpl with $field=$language }}{{ endinc }} + {{ inc field_select.tpl with $field=$theme }}{{ endinc }} + {{ inc field_select.tpl with $field=$theme_mobile }}{{ endinc }} + {{ inc field_select.tpl with $field=$ssl_policy }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$new_share }}{{ endinc }}

$registration

- {{ inc $field_input with $field=$register_text }}{{ endinc }} - {{ inc $field_select with $field=$register_policy }}{{ endinc }} - {{ inc $field_input with $field=$daily_registrations }}{{ endinc }} - {{ inc $field_checkbox with $field=$no_multi_reg }}{{ endinc }} - {{ inc $field_checkbox with $field=$no_openid }}{{ endinc }} - {{ inc $field_checkbox with $field=$no_regfullname }}{{ endinc }} + {{ inc field_input.tpl with $field=$register_text }}{{ endinc }} + {{ inc field_select.tpl with $field=$register_policy }}{{ endinc }} + {{ inc field_input.tpl with $field=$daily_registrations }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$no_multi_reg }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$no_openid }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$no_regfullname }}{{ endinc }}

$upload

- {{ inc $field_input with $field=$maximagesize }}{{ endinc }} - {{ inc $field_input with $field=$maximagelength }}{{ endinc }} - {{ inc $field_input with $field=$jpegimagequality }}{{ endinc }} + {{ inc field_input.tpl with $field=$maximagesize }}{{ endinc }} + {{ inc field_input.tpl with $field=$maximagelength }}{{ endinc }} + {{ inc field_input.tpl with $field=$jpegimagequality }}{{ endinc }}

$corporate

- {{ inc $field_input with $field=$allowed_sites }}{{ endinc }} - {{ inc $field_input with $field=$allowed_email }}{{ endinc }} - {{ inc $field_checkbox with $field=$block_public }}{{ endinc }} - {{ inc $field_checkbox with $field=$force_publish }}{{ endinc }} - {{ inc $field_checkbox with $field=$no_community_page }}{{ endinc }} - {{ inc $field_checkbox with $field=$ostatus_disabled }}{{ endinc }} - {{ inc $field_checkbox with $field=$diaspora_enabled }}{{ endinc }} - {{ inc $field_checkbox with $field=$dfrn_only }}{{ endinc }} - {{ inc $field_input with $field=$global_directory }}{{ endinc }} - {{ inc $field_checkbox with $field=$thread_allow }}{{ endinc }} - {{ inc $field_checkbox with $field=$newuser_private }}{{ endinc }} + {{ inc field_input.tpl with $field=$allowed_sites }}{{ endinc }} + {{ inc field_input.tpl with $field=$allowed_email }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$block_public }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$force_publish }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$no_community_page }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$ostatus_disabled }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$diaspora_enabled }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$dfrn_only }}{{ endinc }} + {{ inc field_input.tpl with $field=$global_directory }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$thread_allow }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$newuser_private }}{{ endinc }}

$advanced

- {{ inc $field_checkbox with $field=$no_utf }}{{ endinc }} - {{ inc $field_checkbox with $field=$verifyssl }}{{ endinc }} - {{ inc $field_input with $field=$proxy }}{{ endinc }} - {{ inc $field_input with $field=$proxyuser }}{{ endinc }} - {{ inc $field_input with $field=$timeout }}{{ endinc }} - {{ inc $field_input with $field=$delivery_interval }}{{ endinc }} - {{ inc $field_input with $field=$poll_interval }}{{ endinc }} - {{ inc $field_input with $field=$maxloadavg }}{{ endinc }} - {{ inc $field_input with $field=$abandon_days }}{{ endinc }} - {{ inc $field_input with $field=$lockpath }}{{ endinc }} - {{ inc $field_input with $field=$temppath }}{{ endinc }} - {{ inc $field_input with $field=$basepath }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$no_utf }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$verifyssl }}{{ endinc }} + {{ inc field_input.tpl with $field=$proxy }}{{ endinc }} + {{ inc field_input.tpl with $field=$proxyuser }}{{ endinc }} + {{ inc field_input.tpl with $field=$timeout }}{{ endinc }} + {{ inc field_input.tpl with $field=$delivery_interval }}{{ endinc }} + {{ inc field_input.tpl with $field=$poll_interval }}{{ endinc }} + {{ inc field_input.tpl with $field=$maxloadavg }}{{ endinc }} + {{ inc field_input.tpl with $field=$abandon_days }}{{ endinc }} + {{ inc field_input.tpl with $field=$lockpath }}{{ endinc }} + {{ inc field_input.tpl with $field=$temppath }}{{ endinc }} + {{ inc field_input.tpl with $field=$basepath }}{{ endinc }}

$performance

- {{ inc $field_checkbox with $field=$use_fulltext_engine }}{{ endinc }} - {{ inc $field_input with $field=$itemcache }}{{ endinc }} - {{ inc $field_input with $field=$itemcache_duration }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$use_fulltext_engine }}{{ endinc }} + {{ inc field_input.tpl with $field=$itemcache }}{{ endinc }} + {{ inc field_input.tpl with $field=$itemcache_duration }}{{ endinc }}
diff --git a/view/api_friends_xml.tpl b/view/api_friends_xml.tpl index 1cabd295d..9bdf53222 100644 --- a/view/api_friends_xml.tpl +++ b/view/api_friends_xml.tpl @@ -2,6 +2,6 @@ {{for $users as $u }} - {{inc $api_user_xml with $user=$u }}{{endinc}} + {{inc api_user_xml.tpl with $user=$u }}{{endinc}} {{endfor}} diff --git a/view/api_timeline_xml.tpl b/view/api_timeline_xml.tpl index df55d807a..4a32b411b 100644 --- a/view/api_timeline_xml.tpl +++ b/view/api_timeline_xml.tpl @@ -10,7 +10,7 @@ $status.in_reply_to_screen_name $status.geo $status.favorited -{{ inc $api_user_xml with $user=$status.user }}{{ endinc }} $status.statusnet_html +{{ inc api_user_xml.tpl with $user=$status.user }}{{ endinc }} $status.statusnet_html $status.statusnet_conversation_id $status.url $status.coordinates diff --git a/view/contact_edit.tpl b/view/contact_edit.tpl index a11e252b4..c68ca7f1d 100644 --- a/view/contact_edit.tpl +++ b/view/contact_edit.tpl @@ -65,7 +65,7 @@ {{ endif }}
- {{inc $field_checkbox with $field=$hidden }}{{endinc}} + {{inc field_checkbox.tpl with $field=$hidden }}{{endinc}}

$lbl_info1

diff --git a/view/contacts-template.tpl b/view/contacts-template.tpl index efd426bba..69e3202c3 100644 --- a/view/contacts-template.tpl +++ b/view/contacts-template.tpl @@ -15,7 +15,7 @@ $tabs {{ for $contacts as $c }} - {{ inc $contact_template with $contact=$c }}{{ endinc }} + {{ inc contact_template.tpl with $contact=$c }}{{ endinc }} {{ endfor }}
diff --git a/view/field.tpl b/view/field.tpl index 6119ccf22..35f5afd39 100644 --- a/view/field.tpl +++ b/view/field.tpl @@ -1,4 +1,4 @@ {{ if $field.0==select }} - {{ inc $field_select }}{{ endinc }} + {{ inc field_select.tpl }}{{ endinc }} {{ endif }} diff --git a/view/filer_dialog.tpl b/view/filer_dialog.tpl index f7a253ba5..ae837d6b7 100644 --- a/view/filer_dialog.tpl +++ b/view/filer_dialog.tpl @@ -1,4 +1,4 @@ -{{ inc $field_combobox }}{{ endinc }} +{{ inc field_combobox.tpl }}{{ endinc }}
diff --git a/view/group_edit.tpl b/view/group_edit.tpl index d60a1b0f9..35d298111 100644 --- a/view/group_edit.tpl +++ b/view/group_edit.tpl @@ -5,7 +5,7 @@ - {{ inc $field_input with $field=$gname }}{{ endinc }} + {{ inc field_input.tpl with $field=$gname }}{{ endinc }} {{ if $drop }}$drop{{ endif }}
@@ -17,7 +17,7 @@ {{ if $groupedit_info }}
- {{ inc $groupeditortpl with $groupeditor=$groupedit_info }}{{ endinc }} + {{ inc groupeditor.tpl with $groupeditor=$groupedit_info }}{{ endinc }}
{{ endif }} {{ if $desc }}
$desc
{{ endif }} diff --git a/view/install_db.tpl b/view/install_db.tpl index bf17256eb..1302b5a70 100644 --- a/view/install_db.tpl +++ b/view/install_db.tpl @@ -18,10 +18,10 @@ $info_03 -{{ inc $field_input with $field=$dbhost }}{{endinc}} -{{ inc $field_input with $field=$dbuser }}{{endinc}} -{{ inc $field_password with $field=$dbpass }}{{endinc}} -{{ inc $field_input with $field=$dbdata }}{{endinc}} +{{ inc field_input.tpl with $field=$dbhost }}{{endinc}} +{{ inc field_input.tpl with $field=$dbuser }}{{endinc}} +{{ inc field_password.tpl with $field=$dbpass }}{{endinc}} +{{ inc field_input.tpl with $field=$dbdata }}{{endinc}} diff --git a/view/install_settings.tpl b/view/install_settings.tpl index 453e2e5cc..05b87f904 100644 --- a/view/install_settings.tpl +++ b/view/install_settings.tpl @@ -16,7 +16,7 @@ -{{ inc $field_input with $field=$adminmail }}{{endinc}} +{{ inc field_input.tpl with $field=$adminmail }}{{endinc}} $timezone diff --git a/view/intros.tpl b/view/intros.tpl index 2dd684079..e7fd53ca4 100644 --- a/view/intros.tpl +++ b/view/intros.tpl @@ -14,8 +14,8 @@
-{{inc $field_checkbox with $field=$hidden }}{{endinc}} -{{inc $field_checkbox with $field=$activity }}{{endinc}} +{{inc field_checkbox.tpl with $field=$hidden }}{{endinc}} +{{inc field_checkbox.tpl with $field=$activity }}{{endinc}} diff --git a/view/login.tpl b/view/login.tpl index 21ed66a66..297b36c9a 100644 --- a/view/login.tpl +++ b/view/login.tpl @@ -3,17 +3,17 @@
- {{ inc $field_input with $field=$lname }}{{ endinc }} - {{ inc $field_password with $field=$lpassword }}{{ endinc }} + {{ inc field_input.tpl with $field=$lname }}{{ endinc }} + {{ inc field_password.tpl with $field=$lpassword }}{{ endinc }}
{{ if $openid }}
- {{ inc $field_openid with $field=$lopenid }}{{ endinc }} + {{ inc field_openid.tpl with $field=$lopenid }}{{ endinc }}
{{ endif }} - {{ inc $field_checkbox with $field=$lremember }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$lremember }}{{ endinc }}