diff options
author | Mike Macgirvin <mike@macgirvin.com> | 2010-09-22 18:00:19 -0700 |
---|---|---|
committer | Mike Macgirvin <mike@macgirvin.com> | 2010-09-22 18:00:19 -0700 |
commit | d5a13b1e4c0f35445aa539ff6b3779062907a9cb (patch) | |
tree | 1cc8fd26bb33981c2ab676a20aadec9d93b865ce | |
parent | 124129e2a06a6ae82c283c8c10b7c3c7d0a0fdae (diff) | |
download | volse-hubzilla-d5a13b1e4c0f35445aa539ff6b3779062907a9cb.tar.gz volse-hubzilla-d5a13b1e4c0f35445aa539ff6b3779062907a9cb.tar.bz2 volse-hubzilla-d5a13b1e4c0f35445aa539ff6b3779062907a9cb.zip |
localisation path for all view templates
-rw-r--r-- | boot.php | 20 | ||||
-rw-r--r-- | include/hostxrd.php | 2 | ||||
-rw-r--r-- | include/items.php | 8 | ||||
-rw-r--r-- | include/notifier.php | 10 | ||||
-rw-r--r-- | index.php | 3 | ||||
-rw-r--r-- | mod/contacts.php | 6 | ||||
-rw-r--r-- | mod/dfrn_confirm.php | 4 | ||||
-rw-r--r-- | mod/dfrn_notify.php | 6 | ||||
-rw-r--r-- | mod/dfrn_request.php | 6 | ||||
-rw-r--r-- | mod/directory.php | 4 | ||||
-rw-r--r-- | mod/display.php | 10 | ||||
-rw-r--r-- | mod/group.php | 6 | ||||
-rw-r--r-- | mod/install.php | 4 | ||||
-rw-r--r-- | mod/invite.php | 2 | ||||
-rw-r--r-- | mod/item.php | 4 | ||||
-rw-r--r-- | mod/lostpass.php | 8 | ||||
-rw-r--r-- | mod/message.php | 14 | ||||
-rw-r--r-- | mod/network.php | 14 | ||||
-rw-r--r-- | mod/notifications.php | 4 | ||||
-rw-r--r-- | mod/photos.php | 16 | ||||
-rw-r--r-- | mod/profile.php | 22 | ||||
-rw-r--r-- | mod/profile_photo.php | 6 | ||||
-rw-r--r-- | mod/profiles.php | 12 | ||||
-rw-r--r-- | mod/register.php | 6 | ||||
-rw-r--r-- | mod/regmod.php | 2 | ||||
-rw-r--r-- | mod/settings.php | 10 | ||||
-rw-r--r-- | mod/viewcontacts.php | 2 | ||||
-rw-r--r-- | mod/xrd.php | 2 |
28 files changed, 113 insertions, 100 deletions
@@ -154,9 +154,8 @@ class App { } function init_pagehead() { - if(file_exists("view/head.tpl")) - $s = file_get_contents("view/head.tpl"); - $this->page['htmlhead'] = replace_macros($s,array( + $tpl = load_view_file("view/head.tpl"); + $this->page['htmlhead'] = replace_macros($tpl,array( '$baseurl' => $this->get_baseurl() )); } @@ -331,14 +330,14 @@ function escape_tags($string) { if(! function_exists('login')) { function login($register = false) { $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')) { - $o = file_get_contents("view/logout.tpl"); + $o = load_view_file("view/logout.tpl"); } else { - $o = file_get_contents("view/login.tpl"); + $o = load_view_file("view/login.tpl"); $o = replace_macros($o,array('$register_html' => $register_html )); } @@ -870,3 +869,12 @@ function format_like($cnt,$arr,$type,$id) { 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); +}}
\ No newline at end of file diff --git a/include/hostxrd.php b/include/hostxrd.php index 3279cea68..f3bf9e769 100644 --- a/include/hostxrd.php +++ b/include/hostxrd.php @@ -1,6 +1,6 @@ <?php - $tpl = file_get_contents('view/xrd_host.tpl'); + $tpl = load_view_file('view/xrd_host.tpl'); echo str_replace('$domain',$this->hostname,$tpl); session_write_close(); exit(); diff --git a/include/items.php b/include/items.php index c7738c3ed..822845dee 100644 --- a/include/items.php +++ b/include/items.php @@ -116,10 +116,10 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) { $items = $r; - $feed_template = file_get_contents('view/atom_feed.tpl'); - $tomb_template = file_get_contents('view/atom_tomb.tpl'); - $item_template = file_get_contents('view/atom_item.tpl'); - $cmnt_template = file_get_contents('view/atom_cmnt.tpl'); + $feed_template = load_view_file('view/atom_feed.tpl'); + $tomb_template = load_view_file('view/atom_tomb.tpl'); + $item_template = load_view_file('view/atom_item.tpl'); + $cmnt_template = load_view_file('view/atom_cmnt.tpl'); $atom = ''; diff --git a/include/notifier.php b/include/notifier.php index 4b80bd3b6..16f470f18 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -126,13 +126,13 @@ $contacts = $r; - $tomb_template = file_get_contents('view/atom_tomb.tpl'); - $item_template = file_get_contents('view/atom_item.tpl'); - $cmnt_template = file_get_contents('view/atom_cmnt.tpl'); + $tomb_template = load_view_file('view/atom_tomb.tpl'); + $item_template = load_view_file('view/atom_item.tpl'); + $cmnt_template = load_view_file('view/atom_cmnt.tpl'); } - $feed_template = file_get_contents('view/atom_feed.tpl'); - $mail_template = file_get_contents('view/atom_mail.tpl'); + $feed_template = load_view_file('view/atom_feed.tpl'); + $mail_template = load_view_file('view/atom_mail.tpl'); $atom = ''; @@ -102,10 +102,11 @@ $a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array( $page = $a->page; $profile = $a->profile; +$lang = get_config('system','language'); header("Content-type: text/html; charset=utf-8"); -$template = "view/" +$template = "view/" . (($lang) ? $lang . "/" : "") . ((x($a->page,'template')) ? $a->page['template'] : 'default' ) . ".php"; diff --git a/mod/contacts.php b/mod/contacts.php index fa3739922..6541c1c0a 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -148,7 +148,7 @@ function contacts_content(&$a) { 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']) { case REL_BUD: @@ -202,7 +202,7 @@ function contacts_content(&$a) { $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( '$hide_url' => ((strlen($sql_extra)) ? 'contacts/all' : 'contacts' ), '$hide_text' => ((strlen($sql_extra)) ? t('Show Blocked Connections') : t('Hide Blocked Connections')), @@ -235,7 +235,7 @@ function contacts_content(&$a) { if(count($r)) { - $tpl = file_get_contents("view/contact_template.tpl"); + $tpl = load_view_file("view/contact_template.tpl"); foreach($r as $rr) { if($rr['self']) diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 3a534fb6f..b8dc2d703 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -165,8 +165,8 @@ function dfrn_confirm_post(&$a) { if((count($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) { $tpl = (($new_relation == $REL_BUD) - ? file_get_contents('view/friend_complete_eml.tpl'); - : file_get_contents('view/intro_complete_eml.tpl')); + ? load_view_file('view/friend_complete_eml.tpl'); + : load_view_file('view/intro_complete_eml.tpl')); $email_tpl = replace_macros($tpl, array( '$sitename' => $a->config['sitename'], diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 61ea77c29..f2fadee8c 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -103,7 +103,7 @@ function dfrn_notify_post(&$a) { require_once('bbcode.php'); 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( '$sitename' => $a->config['sitename'], '$siteurl' => $a->get_baseurl(), @@ -241,7 +241,7 @@ function dfrn_notify_post(&$a) { if(($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) { require_once('bbcode.php'); $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( '$sitename' => $a->config['sitename'], '$siteurl' => $a->get_baseurl(), @@ -307,7 +307,7 @@ function dfrn_notify_post(&$a) { continue; require_once('bbcode.php'); $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( '$sitename' => $a->config['sitename'], '$siteurl' => $a->get_baseurl(), diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index a22492fe6..1458ba8e4 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -356,7 +356,7 @@ function dfrn_request_content(&$a) { $dfrn_url = notags(trim(hex2bin($_GET['dfrn_url']))); $aes_allow = (((x($_GET,'aes_allow')) && ($_GET['aes_allow'] == 1)) ? 1 : 0); $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( '$dfrn_url' => $dfrn_url, '$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($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( '$requestor' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : t('[Name Withheld]')), '$url' => stripslashes($r[0]['url']), @@ -416,7 +416,7 @@ function dfrn_request_content(&$a) { // 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])); return $o; } diff --git a/mod/directory.php b/mod/directory.php index 4e3657673..6aa890226 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -8,7 +8,7 @@ function directory_content(&$a) { $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)) { - $tpl = file_get_contents('view/directory_item.tpl'); + $tpl = load_view_file('view/directory_item.tpl'); if(in_array('small', $a->argv)) $photo = 'thumb'; diff --git a/mod/display.php b/mod/display.php index ae26864a3..5c4c5b12b 100644 --- a/mod/display.php +++ b/mod/display.php @@ -100,10 +100,10 @@ function display_content(&$a) { ); - $cmnt_tpl = file_get_contents('view/comment_item.tpl'); - $like_tpl = file_get_contents('view/like.tpl'); - $tpl = file_get_contents('view/wall_item.tpl'); - $wallwall = file_get_contents('view/wallwall_item.tpl'); + $cmnt_tpl = load_view_file('view/comment_item.tpl'); + $like_tpl = load_view_file('view/like.tpl'); + $tpl = load_view_file('view/wall_item.tpl'); + $wallwall = load_view_file('view/wallwall_item.tpl'); $return_url = $_SESSION['return_url'] = $a->cmd; @@ -203,7 +203,7 @@ function display_content(&$a) { $drop = ''; 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']) : ''); $dislike = (($dlike[$item['id']]) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : ''); diff --git a/mod/group.php b/mod/group.php index 201c61f2a..aa4751961 100644 --- a/mod/group.php +++ b/mod/group.php @@ -89,7 +89,7 @@ function group_content(&$a) { } 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()); return $o; } @@ -130,13 +130,13 @@ function group_content(&$a) { $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( '$id' => $group['id'], '$delete' => t('Delete') )); - $tpl = file_get_contents('view/group_edit.tpl'); + $tpl = load_view_file('view/group_edit.tpl'); $o .= replace_macros($tpl, array( '$gid' => $group['id'], '$name' => $group['name'], diff --git a/mod/install.php b/mod/install.php index dafc86ee6..4160445cc 100644 --- a/mod/install.php +++ b/mod/install.php @@ -23,7 +23,7 @@ function install_post(&$a) { else 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( '$dbhost' => $dbhost, '$dbuser' => $dbuser, @@ -79,7 +79,7 @@ function install_content(&$a) { 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( '$tzselect' => ((x($_POST,'timezone')) ? select_timezone($_POST['timezone']) : select_timezone()), '$submit' => t('Submit'), diff --git a/mod/invite.php b/mod/invite.php index efe0a59b1..3f9efc574 100644 --- a/mod/invite.php +++ b/mod/invite.php @@ -42,7 +42,7 @@ function invite_content(&$a) { return; } - $tpl = file_get_contents('view/invite.tpl'); + $tpl = load_view_file('view/invite.tpl'); $o = replace_macros($tpl, array( '$invite' => t('Send invitations'), diff --git a/mod/item.php b/mod/item.php index c903a61c6..c98d77331 100644 --- a/mod/item.php +++ b/mod/item.php @@ -175,7 +175,7 @@ function item_post(&$a) { if(($user['notify-flags'] & NOTIFY_COMMENT) && ($contact_record != $author)) { require_once('bbcode.php'); $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( '$sitename' => $a->config['sitename'], '$siteurl' => $a->get_baseurl(), @@ -195,7 +195,7 @@ function item_post(&$a) { if(($user['notify-flags'] & NOTIFY_WALL) && ($contact_record != $author)) { require_once('bbcode.php'); $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( '$sitename' => $a->config['sitename'], '$siteurl' => $a->get_baseurl(), diff --git a/mod/lostpass.php b/mod/lostpass.php index fb219072e..20d35133a 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -25,7 +25,7 @@ function lostpass_post(&$a) { if($r) 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( '$sitename' => $a->config['sitename'], '$siteurl' => $a->get_baseurl(), @@ -69,7 +69,7 @@ function lostpass_content(&$a) { intval($uid) ); if($r) { - $tpl = file_get_contents('view/pwdreset.tpl'); + $tpl = load_view_file('view/pwdreset.tpl'); $o .= replace_macros($tpl,array( '$newpass' => $new_password, '$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( '$sitename' => $a->config['sitename'], '$siteurl' => $a->get_baseurl(), @@ -94,7 +94,7 @@ function lostpass_content(&$a) { } else { - $tpl = file_get_contents('view/lostpass.tpl'); + $tpl = load_view_file('view/lostpass.tpl'); $o .= $tpl; diff --git a/mod/message.php b/mod/message.php index 45908d233..7406ef178 100644 --- a/mod/message.php +++ b/mod/message.php @@ -92,7 +92,7 @@ function message_content(&$a) { $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( '$messages' => t('Messages'), '$inbox' => t('Inbox'), @@ -146,12 +146,12 @@ function message_content(&$a) { 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())); $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( '$header' => t('Send Private Message'), '$to' => t('To:'), @@ -201,7 +201,7 @@ function message_content(&$a) { return $o; } - $tpl = file_get_contents('view/mail_list.tpl'); + $tpl = load_view_file('view/mail_list.tpl'); foreach($r as $rr) { $o .= replace_macros($tpl, array( '$id' => $rr['id'], @@ -250,12 +250,12 @@ function message_content(&$a) { 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())); - $tpl = file_get_contents('view/mail_conv.tpl'); + $tpl = load_view_file('view/mail_conv.tpl'); foreach($messages as $message) { $o .= replace_macros($tpl, array( '$id' => $message['id'], @@ -273,7 +273,7 @@ function message_content(&$a) { } $select = $message['name'] . '<input type="hidden" name="messageto" value="' . $contact_id . '" />'; $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( '$header' => t('Send Reply'), '$to' => t('To:'), diff --git a/mod/network.php b/mod/network.php index ac6286e6d..fa267fee2 100644 --- a/mod/network.php +++ b/mod/network.php @@ -28,13 +28,13 @@ function network_content(&$a, $update = 0) { } $_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())); 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']))))) $lockstate = 'lock'; @@ -124,10 +124,10 @@ function network_content(&$a, $update = 0) { ); - $cmnt_tpl = file_get_contents('view/comment_item.tpl'); - $like_tpl = file_get_contents('view/like.tpl'); - $tpl = file_get_contents('view/wall_item.tpl'); - $wallwall = file_get_contents('view/wallwall_item.tpl'); + $cmnt_tpl = load_view_file('view/comment_item.tpl'); + $like_tpl = load_view_file('view/like.tpl'); + $tpl = load_view_file('view/wall_item.tpl'); + $wallwall = load_view_file('view/wallwall_item.tpl'); $alike = 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'])); diff --git a/mod/notifications.php b/mod/notifications.php index 96f50d90b..f38f5ae37 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -65,7 +65,7 @@ function notifications_content(&$a) { $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( '$hide_url' => ((strlen($sql_extra)) ? 'notifications/all' : 'notifications' ), '$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))) { - $tpl = file_get_contents("view/intros.tpl"); + $tpl = load_view_file("view/intros.tpl"); foreach($r as $rr) { diff --git a/mod/photos.php b/mod/photos.php index 04dc23e37..a807c926c 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -458,7 +458,7 @@ function photos_content(&$a) { } } $albumselect .= '</select>'; - $tpl = file_get_contents('view/photos_upload.tpl'); + $tpl = load_view_file('view/photos_upload.tpl'); $o .= replace_macros($tpl,array( '$pagename' => t('Upload Photos'), '$sessid' => session_id(), @@ -504,7 +504,7 @@ function photos_content(&$a) { if($cmd == 'edit') { if(($album != t('Profile Photos')) && ($album != t('Contact Photos'))) { 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( '$nametext' => t('New album name: '), '$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)) foreach($r as $rr) { $o .= replace_macros($tpl,array( @@ -636,7 +636,7 @@ function photos_content(&$a) { } 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( '$id' => $ph[0]['id'], '$resource_id' => $ph[0]['resource-id'], @@ -654,8 +654,8 @@ function photos_content(&$a) { if(count($i1)) { // pull out how many people like the photo - $cmnt_tpl = file_get_contents('view/comment_item.tpl'); - $tpl = file_get_contents('view/photo_item.tpl'); + $cmnt_tpl = load_view_file('view/comment_item.tpl'); + $tpl = load_view_file('view/photo_item.tpl'); $return_url = $a->cmd; if(can_write_wall($a,$a->data['user']['uid'])) { @@ -706,7 +706,7 @@ function photos_content(&$a) { $drop = ''; 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( @@ -755,7 +755,7 @@ function photos_content(&$a) { . $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)) { foreach($r as $rr) { $o .= replace_macros($tpl,array( diff --git a/mod/profile.php b/mod/profile.php index dab4ee6f2..ac9371ea0 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -124,7 +124,7 @@ function profile_content(&$a, $update = 0) { if(x($_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( '$url' => $a->get_baseurl() . '/' . $a->cmd, @@ -133,17 +133,21 @@ function profile_content(&$a, $update = 0) { if($tab == 'profile') { - require_once('view/profile_advanced.php'); + $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'); return $o; } 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())); 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'])))) $lockstate = 'lock'; 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'); - $fakedrop = file_get_contents('view/wall_fake_drop.tpl'); + $droptpl = load_view_file('view/wall_item_drop.tpl'); + $fakedrop = load_view_file('view/wall_fake_drop.tpl'); if($update) $return_url = $_SESSION['return_url']; diff --git a/mod/profile_photo.php b/mod/profile_photo.php index e431e059d..b7aaf6c13 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -139,7 +139,7 @@ function profile_photo_post(&$a) { $a->config['imagecrop'] = $hash; $a->config['imagecrop_resolution'] = $smallest; - $a->page['htmlhead'] .= file_get_contents("view/crophead.tpl"); + $a->page['htmlhead'] .= load_view_file("view/crophead.tpl"); return; } @@ -154,7 +154,7 @@ function profile_photo_content(&$a) { 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( @@ -165,7 +165,7 @@ function profile_photo_content(&$a) { else { $filename = $a->config['imagecrop'] . '-' . $a->config['imagecrop_resolution'] . '.jpg'; $resolution = $a->config['imagecrop_resolution']; - $tpl = file_get_contents("view/cropbody.tpl"); + $tpl = load_view_file("view/cropbody.tpl"); $o .= replace_macros($tpl,array( '$filename' => $filename, '$resource' => $a->config['imagecrop'] . '-' . $a->config['imagecrop_resolution'], diff --git a/mod/profiles.php b/mod/profiles.php index c9dc4c80c..111610c66 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -281,9 +281,9 @@ function profiles_content(&$a) { 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( '$yes_selected' => (($r[0]['hide-friends']) ? " 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); - $tpl = file_get_contents("view/profile_edit.tpl"); + $tpl = load_view_file("view/profile_edit.tpl"); $o .= replace_macros($tpl,array( '$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''), '$baseurl' => $a->get_baseurl(), @@ -342,9 +342,9 @@ function profiles_content(&$a) { $_SESSION['uid']); if(count($r)) { - $o .= file_get_contents('view/profile_listing_header.tpl'); - $tpl_default = file_get_contents('view/profile_entry_default.tpl'); - $tpl = file_get_contents('view/profile_entry.tpl'); + $o .= load_view_file('view/profile_listing_header.tpl'); + $tpl_default = load_view_file('view/profile_entry_default.tpl'); + $tpl = load_view_file('view/profile_entry.tpl'); foreach($r as $rr) { $template = (($rr['is-default']) ? $tpl_default : $tpl); diff --git a/mod/register.php b/mod/register.php index 451cb1246..e65ba7c9b 100644 --- a/mod/register.php +++ b/mod/register.php @@ -169,7 +169,7 @@ function register_post(&$a) { } 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( '$sitename' => $a->config['sitename'], '$siteurl' => $a->get_baseurl(), @@ -204,7 +204,7 @@ function register_post(&$a) { 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( '$sitename' => $a->config['sitename'], '$siteurl' => $a->get_baseurl(), @@ -241,7 +241,7 @@ function register_content(&$a) { return; } - $o = file_get_contents("view/register.tpl"); + $o = load_view_file("view/register.tpl"); $o = replace_macros($o, array( '$registertext' =>((x($a->config,'register_text')) ? '<div class="error-message">' . $a->config['register_text'] . '</div>' diff --git a/mod/regmod.php b/mod/regmod.php index abf673a92..373180ba2 100644 --- a/mod/regmod.php +++ b/mod/regmod.php @@ -63,7 +63,7 @@ function regmod_content(&$a) { 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( '$sitename' => $a->config['sitename'], '$siteurl' => $a->get_baseurl(), diff --git a/mod/settings.php b/mod/settings.php index 2e14fcee5..aef00c8c2 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -181,14 +181,14 @@ function settings_content(&$a) { $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( '$yes_selected' => (($profile['publish']) ? " checked=\"checked\" " : ""), '$no_selected' => (($profile['publish'] == 0) ? " checked=\"checked\" " : "") )); 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( '$yes_selected' => (($profile['net-publish']) ? " checked=\"checked\" " : ""), @@ -198,11 +198,11 @@ function settings_content(&$a) { else $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 = ''; 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( '$baseurl' => $a->get_baseurl(), '$nickname' => $nickname, @@ -230,7 +230,7 @@ function settings_content(&$a) { '$basepath' => $a->get_hostname(), '$baseurl' => $a->get_baseurl())); - $stpl = file_get_contents('view/settings.tpl'); + $stpl = load_view_file('view/settings.tpl'); $o .= replace_macros($stpl,array( '$baseurl' => $a->get_baseurl(), diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php index 251729817..562b60c25 100644 --- a/mod/viewcontacts.php +++ b/mod/viewcontacts.php @@ -34,7 +34,7 @@ function viewcontacts_content(&$a) { return $o; } - $tpl = file_get_contents("view/viewcontact_template.tpl"); + $tpl = load_view_file("view/viewcontact_template.tpl"); foreach($r as $rr) { if($rr['self']) diff --git a/mod/xrd.php b/mod/xrd.php index c6c5515c5..e60fda48d 100644 --- a/mod/xrd.php +++ b/mod/xrd.php @@ -16,7 +16,7 @@ function xrd_content(&$a) { if(! count($r)) killme(); - $tpl = file_get_contents('view/xrd_person.tpl'); + $tpl = load_view_file('view/xrd_person.tpl'); $o = replace_macros($tpl, array( '$accturi' => $uri, |