'template_engine' => 'internal',
);
- public $smarty3_ldelim = '{{';
- public $smarty3_rdelim = '}}';
+ private $ldelim = array(
+ 'internal' => '',
+ 'smarty3' => '{{'
+ );
+ private $rdelim = array(
+ 'internal' => '',
+ 'smarty3' => '}}'
+ );
private $scheme;
private $hostname;
// replacing $stylesheet until later, we need to replace it now
// with another variable name
if($this->theme['template_engine'] === 'smarty3')
- $stylesheet = $this->smarty3_ldelim . '$stylesheet' . $this->smarty3_rdelim;
+ $stylesheet = $this->get_template_ldelim('smarty3') . '$stylesheet' . $this->get_template_rdelim('smarty3');
else
$stylesheet = '$stylesheet';
return $this->cached_profile_image[$avatar_image];
}
+ function get_template_engine() {
+ return $this->theme['template_engine'];
+ }
+
+ function set_template_engine($engine = 'internal') {
+
+ $this->theme['template_engine'] = 'internal';
+
+ switch($engine) {
+ case 'smarty3':
+ if(is_writable('view/smarty3/'))
+ $this->theme['template_engine'] = 'smarty3';
+ break;
+ default:
+ break;
+ }
+ }
+
+ function get_template_ldelim($engine = 'internal') {
+ return $this->ldelim[$engine];
+ }
+
+ function get_template_rdelim($engine = 'internal') {
+ return $this->rdelim[$engine];
+ }
}
}
$retval = $func();
if($retval) {
//send the administrator an e-mail
-
- $engine = get_app()->get_template_engine();
- get_app()->set_template_engine();
-
$email_tpl = get_intltext_template("update_fail_eml.tpl");
$email_msg = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'],
'$update' => $x,
'$error' => sprintf( t('Update %s failed. See error logs.'), $x)
));
-
- get_app()->set_template_engine($engine);
-
$subject=sprintf(t('Update Error at %s'), $a->get_baseurl());
require_once('include/email.php');
$subject = email_header_encode($subject,'UTF-8');
* load/reload current theme info
*/
- set_template_engine($a); // reset the template engine to the default in case the user's theme doesn't specify one
+ $a->set_template_engine(); // reset the template engine to the default in case the user's theme doesn't specify one
$theme_info_file = "view/theme/".current_theme()."/theme.php";
if (file_exists($theme_info_file)){
}
function set_template_engine(&$a, $engine = 'internal') {
+// This function is no longer necessary, but keep it as a wrapper to the class method
+// to avoid breaking themes again unnecessarily
- $a->theme['template_engine'] = 'internal';
-
- if(is_writable('view/smarty3/')) {
- switch($engine) {
- case 'smarty3':
- $a->theme['template_engine'] = 'smarty3';
- break;
- default:
- break;
- }
- }
+ $a->set_template_engine($engine);
}
-function get_template_engine($a) {
- return $a->theme['template_engine'];
-}
\ No newline at end of file
$this->setConfigDir('view/smarty3/config/');
$this->setCacheDir('view/smarty3/cache/');
- $this->left_delimiter = $a->smarty3_ldelim;
- $this->right_delimiter = $a->smarty3_rdelim;
+ $this->left_delimiter = $a->get_template_ldelim('smarty3');
+ $this->right_delimiter = $a->get_template_rdelim('smarty3');
+
+ // Don't report errors so verbosely
+ $this->error_reporting = E_ALL & ~E_NOTICE;
}
function parsed($template = '') {
}
if(($r[0]['notify-flags'] & NOTIFY_INTRO) && ($r[0]['page-flags'] == PAGE_NORMAL)) {
-
- $engine = get_app()->get_template_engine();
- get_app()->set_template_engine();
-
$email_tpl = get_intltext_template('follow_notify_eml.tpl');
$email = replace_macros($email_tpl, array(
'$requestor' => ((strlen($name)) ? $name : t('[Name Withheld]')),
'$siteurl' => $a->get_baseurl(),
'$sitename' => $a->config['sitename']
));
-
- get_app()->set_template_engine($engine);
-
$res = mail($r[0]['email'],
email_header_encode((($sharing) ? t('A new person is sharing with you at ') : t("You have a new follower at ")) . $a->config['sitename'],'UTF-8'),
$email,
? get_intltext_template('friend_complete_eml.tpl')
: get_intltext_template('intro_complete_eml.tpl'));
-
- $engine = get_app()->get_template_engine();
- get_app()->set_template_engine();
-
-
$email_tpl = replace_macros($tpl, array(
'$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(),
'$dfrn_url' => $r[0]['url'],
'$uid' => $newuid )
);
-
-
- get_app()->set_template_engine($engine);
-
require_once('include/email.php');
$res = mail($r[0]['email'], email_header_encode( sprintf( t("Connection accepted at %s") , $a->config['sitename']),'UTF-8'),
// connect to db
$db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true);
- // disable smarty for this template
- $engine = $a->get_template_engine();
- $a->set_template_engine();
$tpl = get_intltext_template('htconfig.tpl');
$txt = replace_macros($tpl,array(
'$dbhost' => $dbhost,
'$phpath' => $phpath,
'$adminmail' => $adminmail
));
- $a->set_template_engine($engine);
$result = file_put_contents('.htconfig.php', $txt);
if(! $result) {
if($r)
info( t('Password reset request issued. Check your email.') . EOL);
- $engine = get_app()->get_template_engine();
- get_app()->set_template_engine();
-
$email_tpl = get_intltext_template("lostpass_eml.tpl");
$email_tpl = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'],
'$reset_link' => $a->get_baseurl() . '/lostpass?verify=' . $new_password
));
- get_app()->set_template_engine($engine);
-
$res = mail($email, email_header_encode(sprintf( t('Password reset requested at %s'),$a->config['sitename']),'UTF-8'),
$email_tpl,
'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME'] . "\n"
info("Your password has been reset." . EOL);
- $engine = get_app()->get_template_engine();
- get_app()->set_template_engine();
$email_tpl = get_intltext_template("passchanged_eml.tpl");
$email_tpl = replace_macros($email_tpl, array(
'$new_password' => $new_password,
'$uid' => $newuid ));
- get_app()->set_template_engine($engine);
-
$subject = sprintf( t('Your password has been changed at %s'), $a->config['sitename']);
$res = mail($email, email_header_encode( $subject, 'UTF-8'), $email_tpl,
set_pconfig($user['uid'],'system','invites_remaining',$num_invites);
}
- $engine = get_app()->get_template_engine();
- get_app()->set_template_engine();
-
-
$email_tpl = get_intltext_template("register_open_eml.tpl");
$email_tpl = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'],
'$password' => $result['password'],
'$uid' => $user['uid'] ));
-
- get_app()->set_template_engine($engine);
-
-
$res = mail($user['email'], email_header_encode( sprintf( t('Registration details for %s'), $a->config['sitename']),'UTF-8'),
$email_tpl,
'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME'] . "\n"
set_pconfig($user['uid'],'system','invites_remaining',$num_invites);
}
-
- $engine = get_app()->get_template_engine();
- get_app()->set_template_engine();
-
$email_tpl = get_intltext_template("register_verify_eml.tpl");
$email_tpl = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'],
'$hash' => $hash
));
- get_app()->set_template_engine($engine);
-
-
$res = mail($a->config['admin_email'], email_header_encode( sprintf(t('Registration request at %s'), $a->config['sitename']),'UTF-8'),
$email_tpl,
'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME'] . "\n"
push_lang($register[0]['language']);
- $engine = get_app()->get_template_engine();
- get_app()->set_template_engine();
-
$email_tpl = get_intltext_template("register_open_eml.tpl");
$email_tpl = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'],
'$uid' => $user[0]['uid']
));
-
- get_app()->set_template_engine($engine);
-
-
$res = mail($user[0]['email'], email_header_encode( sprintf(t('Registration details for %s'), $a->config['sitename']), 'UTF-8'),
$email_tpl,
'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME'] . "\n"