localisation path for all view templates

This commit is contained in:
Mike Macgirvin 2010-09-22 18:00:19 -07:00
parent 124129e2a0
commit d5a13b1e4c
28 changed files with 113 additions and 100 deletions

View file

@ -154,9 +154,8 @@ class App {
} }
function init_pagehead() { function init_pagehead() {
if(file_exists("view/head.tpl")) $tpl = load_view_file("view/head.tpl");
$s = file_get_contents("view/head.tpl"); $this->page['htmlhead'] = replace_macros($tpl,array(
$this->page['htmlhead'] = replace_macros($s,array(
'$baseurl' => $this->get_baseurl() '$baseurl' => $this->get_baseurl()
)); ));
} }
@ -331,14 +330,14 @@ function escape_tags($string) {
if(! function_exists('login')) { if(! function_exists('login')) {
function login($register = false) { function login($register = false) {
$o = ""; $o = "";
$register_html = (($register) ? file_get_contents("view/register-link.tpl") : ""); $register_html = (($register) ? load_view_file("view/register-link.tpl") : "");
if(x($_SESSION,'authenticated')) { if(x($_SESSION,'authenticated')) {
$o = file_get_contents("view/logout.tpl"); $o = load_view_file("view/logout.tpl");
} }
else { else {
$o = file_get_contents("view/login.tpl"); $o = load_view_file("view/login.tpl");
$o = replace_macros($o,array('$register_html' => $register_html )); $o = replace_macros($o,array('$register_html' => $register_html ));
} }
@ -870,3 +869,12 @@ function format_like($cnt,$arr,$type,$id) {
return $o; return $o;
}} }}
if(! function_exists('load_view_file')) {
function load_view_file($s) {
$b = basename($s);
$d = dirname($s);
$lang = get_config('system','language');
if($lang && file_exists("$d/$lang/$b"))
return file_get_contents("$d/$lang/$b");
return file_get_contents($s);
}}

View file

@ -1,6 +1,6 @@
<?php <?php
$tpl = file_get_contents('view/xrd_host.tpl'); $tpl = load_view_file('view/xrd_host.tpl');
echo str_replace('$domain',$this->hostname,$tpl); echo str_replace('$domain',$this->hostname,$tpl);
session_write_close(); session_write_close();
exit(); exit();

View file

@ -116,10 +116,10 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) {
$items = $r; $items = $r;
$feed_template = file_get_contents('view/atom_feed.tpl'); $feed_template = load_view_file('view/atom_feed.tpl');
$tomb_template = file_get_contents('view/atom_tomb.tpl'); $tomb_template = load_view_file('view/atom_tomb.tpl');
$item_template = file_get_contents('view/atom_item.tpl'); $item_template = load_view_file('view/atom_item.tpl');
$cmnt_template = file_get_contents('view/atom_cmnt.tpl'); $cmnt_template = load_view_file('view/atom_cmnt.tpl');
$atom = ''; $atom = '';

View file

@ -126,13 +126,13 @@
$contacts = $r; $contacts = $r;
$tomb_template = file_get_contents('view/atom_tomb.tpl'); $tomb_template = load_view_file('view/atom_tomb.tpl');
$item_template = file_get_contents('view/atom_item.tpl'); $item_template = load_view_file('view/atom_item.tpl');
$cmnt_template = file_get_contents('view/atom_cmnt.tpl'); $cmnt_template = load_view_file('view/atom_cmnt.tpl');
} }
$feed_template = file_get_contents('view/atom_feed.tpl'); $feed_template = load_view_file('view/atom_feed.tpl');
$mail_template = file_get_contents('view/atom_mail.tpl'); $mail_template = load_view_file('view/atom_mail.tpl');
$atom = ''; $atom = '';

View file

@ -102,10 +102,11 @@ $a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array(
$page = $a->page; $page = $a->page;
$profile = $a->profile; $profile = $a->profile;
$lang = get_config('system','language');
header("Content-type: text/html; charset=utf-8"); header("Content-type: text/html; charset=utf-8");
$template = "view/" $template = "view/" . (($lang) ? $lang . "/" : "")
. ((x($a->page,'template')) ? $a->page['template'] : 'default' ) . ((x($a->page,'template')) ? $a->page['template'] : 'default' )
. ".php"; . ".php";

View file

@ -148,7 +148,7 @@ function contacts_content(&$a) {
require_once('view/contact_selectors.php'); require_once('view/contact_selectors.php');
$tpl = file_get_contents("view/contact_edit.tpl"); $tpl = load_view_file("view/contact_edit.tpl");
switch($r[0]['rel']) { switch($r[0]['rel']) {
case REL_BUD: case REL_BUD:
@ -202,7 +202,7 @@ function contacts_content(&$a) {
$search = ((x($_GET,'search')) ? notags(trim($_GET['search'])) : ''); $search = ((x($_GET,'search')) ? notags(trim($_GET['search'])) : '');
$tpl = file_get_contents("view/contacts-top.tpl"); $tpl = load_view_file("view/contacts-top.tpl");
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$hide_url' => ((strlen($sql_extra)) ? 'contacts/all' : 'contacts' ), '$hide_url' => ((strlen($sql_extra)) ? 'contacts/all' : 'contacts' ),
'$hide_text' => ((strlen($sql_extra)) ? t('Show Blocked Connections') : t('Hide Blocked Connections')), '$hide_text' => ((strlen($sql_extra)) ? t('Show Blocked Connections') : t('Hide Blocked Connections')),
@ -235,7 +235,7 @@ function contacts_content(&$a) {
if(count($r)) { if(count($r)) {
$tpl = file_get_contents("view/contact_template.tpl"); $tpl = load_view_file("view/contact_template.tpl");
foreach($r as $rr) { foreach($r as $rr) {
if($rr['self']) if($rr['self'])

View file

@ -165,8 +165,8 @@ function dfrn_confirm_post(&$a) {
if((count($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) { if((count($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) {
$tpl = (($new_relation == $REL_BUD) $tpl = (($new_relation == $REL_BUD)
? file_get_contents('view/friend_complete_eml.tpl'); ? load_view_file('view/friend_complete_eml.tpl');
: file_get_contents('view/intro_complete_eml.tpl')); : load_view_file('view/intro_complete_eml.tpl'));
$email_tpl = replace_macros($tpl, array( $email_tpl = replace_macros($tpl, array(
'$sitename' => $a->config['sitename'], '$sitename' => $a->config['sitename'],

View file

@ -103,7 +103,7 @@ function dfrn_notify_post(&$a) {
require_once('bbcode.php'); require_once('bbcode.php');
if($importer['notify-flags'] & NOTIFY_MAIL) { if($importer['notify-flags'] & NOTIFY_MAIL) {
$tpl = file_get_contents('view/mail_received_eml.tpl'); $tpl = load_view_file('view/mail_received_eml.tpl');
$email_tpl = replace_macros($tpl, array( $email_tpl = replace_macros($tpl, array(
'$sitename' => $a->config['sitename'], '$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(), '$siteurl' => $a->get_baseurl(),
@ -241,7 +241,7 @@ function dfrn_notify_post(&$a) {
if(($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) { if(($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) {
require_once('bbcode.php'); require_once('bbcode.php');
$from = stripslashes($datarray['author-name']); $from = stripslashes($datarray['author-name']);
$tpl = file_get_contents('view/cmnt_received_eml.tpl'); $tpl = load_view_file('view/cmnt_received_eml.tpl');
$email_tpl = replace_macros($tpl, array( $email_tpl = replace_macros($tpl, array(
'$sitename' => $a->config['sitename'], '$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(), '$siteurl' => $a->get_baseurl(),
@ -307,7 +307,7 @@ function dfrn_notify_post(&$a) {
continue; continue;
require_once('bbcode.php'); require_once('bbcode.php');
$from = stripslashes($datarray['author-name']); $from = stripslashes($datarray['author-name']);
$tpl = file_get_contents('view/cmnt_received_eml.tpl'); $tpl = load_view_file('view/cmnt_received_eml.tpl');
$email_tpl = replace_macros($tpl, array( $email_tpl = replace_macros($tpl, array(
'$sitename' => $a->config['sitename'], '$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(), '$siteurl' => $a->get_baseurl(),

View file

@ -356,7 +356,7 @@ function dfrn_request_content(&$a) {
$dfrn_url = notags(trim(hex2bin($_GET['dfrn_url']))); $dfrn_url = notags(trim(hex2bin($_GET['dfrn_url'])));
$aes_allow = (((x($_GET,'aes_allow')) && ($_GET['aes_allow'] == 1)) ? 1 : 0); $aes_allow = (((x($_GET,'aes_allow')) && ($_GET['aes_allow'] == 1)) ? 1 : 0);
$confirm_key = (x($_GET,'confirm_key') ? $_GET['confirm_key'] : ""); $confirm_key = (x($_GET,'confirm_key') ? $_GET['confirm_key'] : "");
$o .= file_get_contents("view/dfrn_req_confirm.tpl"); $o .= load_view_file("view/dfrn_req_confirm.tpl");
$o = replace_macros($o,array( $o = replace_macros($o,array(
'$dfrn_url' => $dfrn_url, '$dfrn_url' => $dfrn_url,
'$aes_allow' => (($aes_allow) ? '<input type="hidden" name="aes_allow" value="1" />' : "" ), '$aes_allow' => (($aes_allow) ? '<input type="hidden" name="aes_allow" value="1" />' : "" ),
@ -388,7 +388,7 @@ function dfrn_request_content(&$a) {
if(count($r)) { if(count($r)) {
if($r[0]['notify-flags'] & NOTIFY_INTRO) { if($r[0]['notify-flags'] & NOTIFY_INTRO) {
$email_tpl = file_get_contents('view/request_notify_eml.tpl'); $email_tpl = load_view_file('view/request_notify_eml.tpl');
$email = replace_macros($email_tpl, array( $email = replace_macros($email_tpl, array(
'$requestor' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : t('[Name Withheld]')), '$requestor' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : t('[Name Withheld]')),
'$url' => stripslashes($r[0]['url']), '$url' => stripslashes($r[0]['url']),
@ -416,7 +416,7 @@ function dfrn_request_content(&$a) {
// Normal web request. Display our user's introduction form. // Normal web request. Display our user's introduction form.
$o = file_get_contents("view/dfrn_request.tpl"); $o = load_view_file("view/dfrn_request.tpl");
$o = replace_macros($o,array('$nickname' => $a->argv[1])); $o = replace_macros($o,array('$nickname' => $a->argv[1]));
return $o; return $o;
} }

View file

@ -8,7 +8,7 @@ function directory_content(&$a) {
$search = ((x($_GET,'search')) ? notags(trim($_GET['search'])) : ''); $search = ((x($_GET,'search')) ? notags(trim($_GET['search'])) : '');
$tpl .= file_get_contents('view/directory_header.tpl'); $tpl .= load_view_file('view/directory_header.tpl');
@ -34,7 +34,7 @@ function directory_content(&$a) {
); );
if(count($r)) { if(count($r)) {
$tpl = file_get_contents('view/directory_item.tpl'); $tpl = load_view_file('view/directory_item.tpl');
if(in_array('small', $a->argv)) if(in_array('small', $a->argv))
$photo = 'thumb'; $photo = 'thumb';

View file

@ -100,10 +100,10 @@ function display_content(&$a) {
); );
$cmnt_tpl = file_get_contents('view/comment_item.tpl'); $cmnt_tpl = load_view_file('view/comment_item.tpl');
$like_tpl = file_get_contents('view/like.tpl'); $like_tpl = load_view_file('view/like.tpl');
$tpl = file_get_contents('view/wall_item.tpl'); $tpl = load_view_file('view/wall_item.tpl');
$wallwall = file_get_contents('view/wallwall_item.tpl'); $wallwall = load_view_file('view/wallwall_item.tpl');
$return_url = $_SESSION['return_url'] = $a->cmd; $return_url = $_SESSION['return_url'] = $a->cmd;
@ -203,7 +203,7 @@ function display_content(&$a) {
$drop = ''; $drop = '';
if(($item['contact-id'] == $_SESSION['visitor_id']) || ($item['uid'] == get_uid())) if(($item['contact-id'] == $_SESSION['visitor_id']) || ($item['uid'] == get_uid()))
$drop = replace_macros(file_get_contents('view/wall_item_drop.tpl'), array('$id' => $item['id'])); $drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id']));
$like = (($alike[$item['id']]) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : ''); $like = (($alike[$item['id']]) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
$dislike = (($dlike[$item['id']]) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : ''); $dislike = (($dlike[$item['id']]) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');

View file

@ -89,7 +89,7 @@ function group_content(&$a) {
} }
if(($a->argc == 2) && ($a->argv[1] == 'new')) { if(($a->argc == 2) && ($a->argv[1] == 'new')) {
$tpl = file_get_contents('view/group_new.tpl'); $tpl = load_view_file('view/group_new.tpl');
$o .= replace_macros($tpl,array()); $o .= replace_macros($tpl,array());
return $o; return $o;
} }
@ -130,13 +130,13 @@ function group_content(&$a) {
$preselected[] = $p['id']; $preselected[] = $p['id'];
} }
$drop_tpl = file_get_contents('view/group_drop.tpl'); $drop_tpl = load_view_file('view/group_drop.tpl');
$drop_txt = replace_macros($drop_tpl, array( $drop_txt = replace_macros($drop_tpl, array(
'$id' => $group['id'], '$id' => $group['id'],
'$delete' => t('Delete') '$delete' => t('Delete')
)); ));
$tpl = file_get_contents('view/group_edit.tpl'); $tpl = load_view_file('view/group_edit.tpl');
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$gid' => $group['id'], '$gid' => $group['id'],
'$name' => $group['name'], '$name' => $group['name'],

View file

@ -23,7 +23,7 @@ function install_post(&$a) {
else else
notice( t('Connected to database.') . EOL); notice( t('Connected to database.') . EOL);
$tpl = file_get_contents('view/htconfig.tpl'); $tpl = load_view_file('view/htconfig.tpl');
$txt = replace_macros($tpl,array( $txt = replace_macros($tpl,array(
'$dbhost' => $dbhost, '$dbhost' => $dbhost,
'$dbuser' => $dbuser, '$dbuser' => $dbuser,
@ -79,7 +79,7 @@ function install_content(&$a) {
require_once('datetime.php'); require_once('datetime.php');
$tpl = file_get_contents('view/install_db.tpl'); $tpl = load_view_file('view/install_db.tpl');
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$tzselect' => ((x($_POST,'timezone')) ? select_timezone($_POST['timezone']) : select_timezone()), '$tzselect' => ((x($_POST,'timezone')) ? select_timezone($_POST['timezone']) : select_timezone()),
'$submit' => t('Submit'), '$submit' => t('Submit'),

View file

@ -42,7 +42,7 @@ function invite_content(&$a) {
return; return;
} }
$tpl = file_get_contents('view/invite.tpl'); $tpl = load_view_file('view/invite.tpl');
$o = replace_macros($tpl, array( $o = replace_macros($tpl, array(
'$invite' => t('Send invitations'), '$invite' => t('Send invitations'),

View file

@ -175,7 +175,7 @@ function item_post(&$a) {
if(($user['notify-flags'] & NOTIFY_COMMENT) && ($contact_record != $author)) { if(($user['notify-flags'] & NOTIFY_COMMENT) && ($contact_record != $author)) {
require_once('bbcode.php'); require_once('bbcode.php');
$from = $author['name']; $from = $author['name'];
$tpl = file_get_contents('view/cmnt_received_eml.tpl'); $tpl = load_view_file('view/cmnt_received_eml.tpl');
$email_tpl = replace_macros($tpl, array( $email_tpl = replace_macros($tpl, array(
'$sitename' => $a->config['sitename'], '$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(), '$siteurl' => $a->get_baseurl(),
@ -195,7 +195,7 @@ function item_post(&$a) {
if(($user['notify-flags'] & NOTIFY_WALL) && ($contact_record != $author)) { if(($user['notify-flags'] & NOTIFY_WALL) && ($contact_record != $author)) {
require_once('bbcode.php'); require_once('bbcode.php');
$from = $author['name']; $from = $author['name'];
$tpl = file_get_contents('view/wall_received_eml.tpl'); $tpl = load_view_file('view/wall_received_eml.tpl');
$email_tpl = replace_macros($tpl, array( $email_tpl = replace_macros($tpl, array(
'$sitename' => $a->config['sitename'], '$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(), '$siteurl' => $a->get_baseurl(),

View file

@ -25,7 +25,7 @@ function lostpass_post(&$a) {
if($r) if($r)
notice("Password reset request issued. Check your email."); notice("Password reset request issued. Check your email.");
$email_tpl = file_get_contents("view/lostpass_eml.tpl"); $email_tpl = load_view_file("view/lostpass_eml.tpl");
$email_tpl = replace_macros($email_tpl, array( $email_tpl = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'], '$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(), '$siteurl' => $a->get_baseurl(),
@ -69,7 +69,7 @@ function lostpass_content(&$a) {
intval($uid) intval($uid)
); );
if($r) { if($r) {
$tpl = file_get_contents('view/pwdreset.tpl'); $tpl = load_view_file('view/pwdreset.tpl');
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$newpass' => $new_password, '$newpass' => $new_password,
'$baseurl' => $a->get_baseurl() '$baseurl' => $a->get_baseurl()
@ -78,7 +78,7 @@ function lostpass_content(&$a) {
$email_tpl = file_get_contents("view/passchanged_eml.tpl"); $email_tpl = load_view_file("view/passchanged_eml.tpl");
$email_tpl = replace_macros($email_tpl, array( $email_tpl = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'], '$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(), '$siteurl' => $a->get_baseurl(),
@ -94,7 +94,7 @@ function lostpass_content(&$a) {
} }
else { else {
$tpl = file_get_contents('view/lostpass.tpl'); $tpl = load_view_file('view/lostpass.tpl');
$o .= $tpl; $o .= $tpl;

View file

@ -92,7 +92,7 @@ function message_content(&$a) {
$myprofile = $a->get_baseurl() . '/profile/' . $a->user['nickname']; $myprofile = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
$tpl = file_get_contents('view/mail_head.tpl'); $tpl = load_view_file('view/mail_head.tpl');
$header = replace_macros($tpl, array( $header = replace_macros($tpl, array(
'$messages' => t('Messages'), '$messages' => t('Messages'),
'$inbox' => t('Inbox'), '$inbox' => t('Inbox'),
@ -146,12 +146,12 @@ function message_content(&$a) {
if(($a->argc > 1) && ($a->argv[1] == 'new')) { if(($a->argc > 1) && ($a->argv[1] == 'new')) {
$tpl = file_get_contents('view/msg-header.tpl'); $tpl = load_view_file('view/msg-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl())); $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl()));
$select .= contact_select('messageto','message-to-select', false, 4, true); $select .= contact_select('messageto','message-to-select', false, 4, true);
$tpl = file_get_contents('view/prv_message.tpl'); $tpl = load_view_file('view/prv_message.tpl');
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$header' => t('Send Private Message'), '$header' => t('Send Private Message'),
'$to' => t('To:'), '$to' => t('To:'),
@ -201,7 +201,7 @@ function message_content(&$a) {
return $o; return $o;
} }
$tpl = file_get_contents('view/mail_list.tpl'); $tpl = load_view_file('view/mail_list.tpl');
foreach($r as $rr) { foreach($r as $rr) {
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$id' => $rr['id'], '$id' => $rr['id'],
@ -250,12 +250,12 @@ function message_content(&$a) {
require_once("include/bbcode.php"); require_once("include/bbcode.php");
$tpl = file_get_contents('view/msg-header.tpl'); $tpl = load_view_file('view/msg-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl())); $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl()));
$tpl = file_get_contents('view/mail_conv.tpl'); $tpl = load_view_file('view/mail_conv.tpl');
foreach($messages as $message) { foreach($messages as $message) {
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$id' => $message['id'], '$id' => $message['id'],
@ -273,7 +273,7 @@ function message_content(&$a) {
} }
$select = $message['name'] . '<input type="hidden" name="messageto" value="' . $contact_id . '" />'; $select = $message['name'] . '<input type="hidden" name="messageto" value="' . $contact_id . '" />';
$parent = '<input type="hidden" name="replyto" value="' . $message['parent-uri'] . '" />'; $parent = '<input type="hidden" name="replyto" value="' . $message['parent-uri'] . '" />';
$tpl = file_get_contents('view/prv_message.tpl'); $tpl = load_view_file('view/prv_message.tpl');
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$header' => t('Send Reply'), '$header' => t('Send Reply'),
'$to' => t('To:'), '$to' => t('To:'),

View file

@ -28,13 +28,13 @@ function network_content(&$a, $update = 0) {
} }
$_SESSION['return_url'] = $a->cmd; $_SESSION['return_url'] = $a->cmd;
$tpl = file_get_contents('view/jot-header.tpl'); $tpl = load_view_file('view/jot-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl())); $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl()));
require_once('view/acl_selectors.php'); require_once('view/acl_selectors.php');
$tpl = file_get_contents("view/jot.tpl"); $tpl = load_view_file("view/jot.tpl");
if(($group) || (is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) if(($group) || (is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid'])))))
$lockstate = 'lock'; $lockstate = 'lock';
@ -124,10 +124,10 @@ function network_content(&$a, $update = 0) {
); );
$cmnt_tpl = file_get_contents('view/comment_item.tpl'); $cmnt_tpl = load_view_file('view/comment_item.tpl');
$like_tpl = file_get_contents('view/like.tpl'); $like_tpl = load_view_file('view/like.tpl');
$tpl = file_get_contents('view/wall_item.tpl'); $tpl = load_view_file('view/wall_item.tpl');
$wallwall = file_get_contents('view/wallwall_item.tpl'); $wallwall = load_view_file('view/wallwall_item.tpl');
$alike = array(); $alike = array();
$dlike = array(); $dlike = array();
@ -219,7 +219,7 @@ function network_content(&$a, $update = 0) {
} }
$drop = replace_macros(file_get_contents('view/wall_item_drop.tpl'), array('$id' => $item['id'])); $drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id']));

View file

@ -65,7 +65,7 @@ function notifications_content(&$a) {
$sql_extra = " AND `ignore` = 0 "; $sql_extra = " AND `ignore` = 0 ";
$tpl = file_get_contents('view/intros-top.tpl'); $tpl = load_view_file('view/intros-top.tpl');
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$hide_url' => ((strlen($sql_extra)) ? 'notifications/all' : 'notifications' ), '$hide_url' => ((strlen($sql_extra)) ? 'notifications/all' : 'notifications' ),
'$hide_text' => ((strlen($sql_extra)) ? t('Show Ignored Requests') : t('Hide Ignored Requests')) '$hide_text' => ((strlen($sql_extra)) ? t('Show Ignored Requests') : t('Hide Ignored Requests'))
@ -79,7 +79,7 @@ function notifications_content(&$a) {
if(($r !== false) && (count($r))) { if(($r !== false) && (count($r))) {
$tpl = file_get_contents("view/intros.tpl"); $tpl = load_view_file("view/intros.tpl");
foreach($r as $rr) { foreach($r as $rr) {

View file

@ -458,7 +458,7 @@ function photos_content(&$a) {
} }
} }
$albumselect .= '</select>'; $albumselect .= '</select>';
$tpl = file_get_contents('view/photos_upload.tpl'); $tpl = load_view_file('view/photos_upload.tpl');
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$pagename' => t('Upload Photos'), '$pagename' => t('Upload Photos'),
'$sessid' => session_id(), '$sessid' => session_id(),
@ -504,7 +504,7 @@ function photos_content(&$a) {
if($cmd == 'edit') { if($cmd == 'edit') {
if(($album != t('Profile Photos')) && ($album != t('Contact Photos'))) { if(($album != t('Profile Photos')) && ($album != t('Contact Photos'))) {
if(local_user() && (get_uid() == $a->data['user']['uid'])) { if(local_user() && (get_uid() == $a->data['user']['uid'])) {
$edit_tpl = file_get_contents('view/album_edit.tpl'); $edit_tpl = load_view_file('view/album_edit.tpl');
$o .= replace_macros($edit_tpl,array( $o .= replace_macros($edit_tpl,array(
'$nametext' => t('New album name: '), '$nametext' => t('New album name: '),
'$album' => $album, '$album' => $album,
@ -524,7 +524,7 @@ function photos_content(&$a) {
} }
} }
} }
$tpl = file_get_contents('view/photo_album.tpl'); $tpl = load_view_file('view/photo_album.tpl');
if(count($r)) if(count($r))
foreach($r as $rr) { foreach($r as $rr) {
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
@ -636,7 +636,7 @@ function photos_content(&$a) {
} }
if($cmd == 'edit') { if($cmd == 'edit') {
$edit_tpl = file_get_contents('view/photo_edit.tpl'); $edit_tpl = load_view_file('view/photo_edit.tpl');
$o .= replace_macros($edit_tpl, array( $o .= replace_macros($edit_tpl, array(
'$id' => $ph[0]['id'], '$id' => $ph[0]['id'],
'$resource_id' => $ph[0]['resource-id'], '$resource_id' => $ph[0]['resource-id'],
@ -654,8 +654,8 @@ function photos_content(&$a) {
if(count($i1)) { if(count($i1)) {
// pull out how many people like the photo // pull out how many people like the photo
$cmnt_tpl = file_get_contents('view/comment_item.tpl'); $cmnt_tpl = load_view_file('view/comment_item.tpl');
$tpl = file_get_contents('view/photo_item.tpl'); $tpl = load_view_file('view/photo_item.tpl');
$return_url = $a->cmd; $return_url = $a->cmd;
if(can_write_wall($a,$a->data['user']['uid'])) { if(can_write_wall($a,$a->data['user']['uid'])) {
@ -706,7 +706,7 @@ function photos_content(&$a) {
$drop = ''; $drop = '';
if(($item['contact-id'] == $_SESSION['visitor_id']) || ($item['uid'] == get_uid())) if(($item['contact-id'] == $_SESSION['visitor_id']) || ($item['uid'] == get_uid()))
$drop = replace_macros(file_get_contents('view/wall_item_drop.tpl'), array('$id' => $item['id'])); $drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id']));
$o .= replace_macros($template,array( $o .= replace_macros($template,array(
@ -755,7 +755,7 @@ function photos_content(&$a) {
. $a->data['user']['nickname'] . '/upload' . '">' . t('Upload New Photos') . '</a></div>'; . $a->data['user']['nickname'] . '/upload' . '">' . t('Upload New Photos') . '</a></div>';
} }
$tpl = file_get_contents('view/photo_top.tpl'); $tpl = load_view_file('view/photo_top.tpl');
if(count($r)) { if(count($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(

View file

@ -124,7 +124,7 @@ function profile_content(&$a, $update = 0) {
if(x($_GET,'tab')) if(x($_GET,'tab'))
$tab = notags(trim($_GET['tab'])); $tab = notags(trim($_GET['tab']));
$tpl = file_get_contents('view/profile_tabs.tpl'); $tpl = load_view_file('view/profile_tabs.tpl');
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$url' => $a->get_baseurl() . '/' . $a->cmd, '$url' => $a->get_baseurl() . '/' . $a->cmd,
@ -133,17 +133,21 @@ function profile_content(&$a, $update = 0) {
if($tab == 'profile') { if($tab == 'profile') {
$lang = config_get('system','language');
if($lang && file_exists("view/$lang/profile_advanced.php"))
require_once("view/$lang/profile_advanced.php");
else
require_once('view/profile_advanced.php'); require_once('view/profile_advanced.php');
return $o; return $o;
} }
if(can_write_wall($a,$a->profile['profile_uid'])) { if(can_write_wall($a,$a->profile['profile_uid'])) {
$tpl = file_get_contents('view/jot-header.tpl'); $tpl = load_view_file('view/jot-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl())); $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl()));
require_once('view/acl_selectors.php'); require_once('view/acl_selectors.php');
$tpl = file_get_contents("view/jot.tpl"); $tpl = load_view_file("view/jot.tpl");
if(is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid'])))) if(is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))
$lockstate = 'lock'; $lockstate = 'lock';
else else
@ -246,14 +250,14 @@ function profile_content(&$a, $update = 0) {
); );
$cmnt_tpl = file_get_contents('view/comment_item.tpl'); $cmnt_tpl = load_view_file('view/comment_item.tpl');
$like_tpl = file_get_contents('view/like.tpl'); $like_tpl = load_view_file('view/like.tpl');
$tpl = file_get_contents('view/wall_item.tpl'); $tpl = load_view_file('view/wall_item.tpl');
$droptpl = file_get_contents('view/wall_item_drop.tpl'); $droptpl = load_view_file('view/wall_item_drop.tpl');
$fakedrop = file_get_contents('view/wall_fake_drop.tpl'); $fakedrop = load_view_file('view/wall_fake_drop.tpl');
if($update) if($update)
$return_url = $_SESSION['return_url']; $return_url = $_SESSION['return_url'];

View file

@ -139,7 +139,7 @@ function profile_photo_post(&$a) {
$a->config['imagecrop'] = $hash; $a->config['imagecrop'] = $hash;
$a->config['imagecrop_resolution'] = $smallest; $a->config['imagecrop_resolution'] = $smallest;
$a->page['htmlhead'] .= file_get_contents("view/crophead.tpl"); $a->page['htmlhead'] .= load_view_file("view/crophead.tpl");
return; return;
} }
@ -154,7 +154,7 @@ function profile_photo_content(&$a) {
if(! x($a->config,'imagecrop')) { if(! x($a->config,'imagecrop')) {
$tpl = file_get_contents('view/profile_photo.tpl'); $tpl = load_view_file('view/profile_photo.tpl');
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
@ -165,7 +165,7 @@ function profile_photo_content(&$a) {
else { else {
$filename = $a->config['imagecrop'] . '-' . $a->config['imagecrop_resolution'] . '.jpg'; $filename = $a->config['imagecrop'] . '-' . $a->config['imagecrop_resolution'] . '.jpg';
$resolution = $a->config['imagecrop_resolution']; $resolution = $a->config['imagecrop_resolution'];
$tpl = file_get_contents("view/cropbody.tpl"); $tpl = load_view_file("view/cropbody.tpl");
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$filename' => $filename, '$filename' => $filename,
'$resource' => $a->config['imagecrop'] . '-' . $a->config['imagecrop_resolution'], '$resource' => $a->config['imagecrop'] . '-' . $a->config['imagecrop_resolution'],

View file

@ -281,9 +281,9 @@ function profiles_content(&$a) {
require_once('view/profile_selectors.php'); require_once('view/profile_selectors.php');
$tpl = file_get_contents('view/profed_head.tpl'); $tpl = load_view_file('view/profed_head.tpl');
$opt_tpl = file_get_contents("view/profile-hide-friends.tpl"); $opt_tpl = load_view_file("view/profile-hide-friends.tpl");
$hide_friends = replace_macros($opt_tpl,array( $hide_friends = replace_macros($opt_tpl,array(
'$yes_selected' => (($r[0]['hide-friends']) ? " checked=\"checked\" " : ""), '$yes_selected' => (($r[0]['hide-friends']) ? " checked=\"checked\" " : ""),
'$no_selected' => (($r[0]['hide-friends'] == 0) ? " checked=\"checked\" " : "") '$no_selected' => (($r[0]['hide-friends'] == 0) ? " checked=\"checked\" " : "")
@ -298,7 +298,7 @@ function profiles_content(&$a) {
$is_default = (($r[0]['is-default']) ? 1 : 0); $is_default = (($r[0]['is-default']) ? 1 : 0);
$tpl = file_get_contents("view/profile_edit.tpl"); $tpl = load_view_file("view/profile_edit.tpl");
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''), '$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(),
@ -342,9 +342,9 @@ function profiles_content(&$a) {
$_SESSION['uid']); $_SESSION['uid']);
if(count($r)) { if(count($r)) {
$o .= file_get_contents('view/profile_listing_header.tpl'); $o .= load_view_file('view/profile_listing_header.tpl');
$tpl_default = file_get_contents('view/profile_entry_default.tpl'); $tpl_default = load_view_file('view/profile_entry_default.tpl');
$tpl = file_get_contents('view/profile_entry.tpl'); $tpl = load_view_file('view/profile_entry.tpl');
foreach($r as $rr) { foreach($r as $rr) {
$template = (($rr['is-default']) ? $tpl_default : $tpl); $template = (($rr['is-default']) ? $tpl_default : $tpl);

View file

@ -169,7 +169,7 @@ function register_post(&$a) {
} }
if( $a->config['register_policy'] == REGISTER_OPEN ) { if( $a->config['register_policy'] == REGISTER_OPEN ) {
$email_tpl = file_get_contents("view/register_open_eml.tpl"); $email_tpl = load_view_file("view/register_open_eml.tpl");
$email_tpl = replace_macros($email_tpl, array( $email_tpl = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'], '$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(), '$siteurl' => $a->get_baseurl(),
@ -204,7 +204,7 @@ function register_post(&$a) {
dbesc($new_password) dbesc($new_password)
); );
$email_tpl = file_get_contents("view/register_verify_eml.tpl"); $email_tpl = load_view_file("view/register_verify_eml.tpl");
$email_tpl = replace_macros($email_tpl, array( $email_tpl = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'], '$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(), '$siteurl' => $a->get_baseurl(),
@ -241,7 +241,7 @@ function register_content(&$a) {
return; return;
} }
$o = file_get_contents("view/register.tpl"); $o = load_view_file("view/register.tpl");
$o = replace_macros($o, array( $o = replace_macros($o, array(
'$registertext' =>((x($a->config,'register_text')) '$registertext' =>((x($a->config,'register_text'))
? '<div class="error-message">' . $a->config['register_text'] . '</div>' ? '<div class="error-message">' . $a->config['register_text'] . '</div>'

View file

@ -63,7 +63,7 @@ function regmod_content(&$a) {
intval($register[0]['uid']) intval($register[0]['uid'])
); );
$email_tpl = file_get_contents("view/register_open_eml.tpl"); $email_tpl = load_view_file("view/register_open_eml.tpl");
$email_tpl = replace_macros($email_tpl, array( $email_tpl = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'], '$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(), '$siteurl' => $a->get_baseurl(),

View file

@ -181,14 +181,14 @@ function settings_content(&$a) {
$timezone = date_default_timezone_get(); $timezone = date_default_timezone_get();
$opt_tpl = file_get_contents("view/profile-in-directory.tpl"); $opt_tpl = load_view_file("view/profile-in-directory.tpl");
$profile_in_dir = replace_macros($opt_tpl,array( $profile_in_dir = replace_macros($opt_tpl,array(
'$yes_selected' => (($profile['publish']) ? " checked=\"checked\" " : ""), '$yes_selected' => (($profile['publish']) ? " checked=\"checked\" " : ""),
'$no_selected' => (($profile['publish'] == 0) ? " checked=\"checked\" " : "") '$no_selected' => (($profile['publish'] == 0) ? " checked=\"checked\" " : "")
)); ));
if(strlen(get_config('system','directory_submit_url'))) { if(strlen(get_config('system','directory_submit_url'))) {
$opt_tpl = file_get_contents("view/profile-in-netdir.tpl"); $opt_tpl = load_view_file("view/profile-in-netdir.tpl");
$profile_in_net_dir = replace_macros($opt_tpl,array( $profile_in_net_dir = replace_macros($opt_tpl,array(
'$yes_selected' => (($profile['net-publish']) ? " checked=\"checked\" " : ""), '$yes_selected' => (($profile['net-publish']) ? " checked=\"checked\" " : ""),
@ -198,11 +198,11 @@ function settings_content(&$a) {
else else
$profile_in_net_dir = ''; $profile_in_net_dir = '';
$nickname_block = file_get_contents("view/settings_nick_set.tpl"); $nickname_block = load_view_file("view/settings_nick_set.tpl");
$nickname_subdir = ''; $nickname_subdir = '';
if(strlen($a->get_path())) { if(strlen($a->get_path())) {
$subdir_tpl = file_get_contents('view/settings_nick_subdir.tpl'); $subdir_tpl = load_view_file('view/settings_nick_subdir.tpl');
$nickname_subdir = replace_macros($subdir_tpl, array( $nickname_subdir = replace_macros($subdir_tpl, array(
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(),
'$nickname' => $nickname, '$nickname' => $nickname,
@ -230,7 +230,7 @@ function settings_content(&$a) {
'$basepath' => $a->get_hostname(), '$basepath' => $a->get_hostname(),
'$baseurl' => $a->get_baseurl())); '$baseurl' => $a->get_baseurl()));
$stpl = file_get_contents('view/settings.tpl'); $stpl = load_view_file('view/settings.tpl');
$o .= replace_macros($stpl,array( $o .= replace_macros($stpl,array(
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(),

View file

@ -34,7 +34,7 @@ function viewcontacts_content(&$a) {
return $o; return $o;
} }
$tpl = file_get_contents("view/viewcontact_template.tpl"); $tpl = load_view_file("view/viewcontact_template.tpl");
foreach($r as $rr) { foreach($r as $rr) {
if($rr['self']) if($rr['self'])

View file

@ -16,7 +16,7 @@ function xrd_content(&$a) {
if(! count($r)) if(! count($r))
killme(); killme();
$tpl = file_get_contents('view/xrd_person.tpl'); $tpl = load_view_file('view/xrd_person.tpl');
$o = replace_macros($tpl, array( $o = replace_macros($tpl, array(
'$accturi' => $uri, '$accturi' => $uri,