]> git.mxchange.org Git - friendica.git/commitdiff
localisation path for all view templates
authorMike Macgirvin <mike@macgirvin.com>
Thu, 23 Sep 2010 01:00:19 +0000 (18:00 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Thu, 23 Sep 2010 01:00:19 +0000 (18:00 -0700)
28 files changed:
boot.php
include/hostxrd.php
include/items.php
include/notifier.php
index.php
mod/contacts.php
mod/dfrn_confirm.php
mod/dfrn_notify.php
mod/dfrn_request.php
mod/directory.php
mod/display.php
mod/group.php
mod/install.php
mod/invite.php
mod/item.php
mod/lostpass.php
mod/message.php
mod/network.php
mod/notifications.php
mod/photos.php
mod/profile.php
mod/profile_photo.php
mod/profiles.php
mod/register.php
mod/regmod.php
mod/settings.php
mod/viewcontacts.php
mod/xrd.php

index 88aa8d0a775a324378ae14f98c9af89cade3454d..05ec444620aaaf77262bba9f9c03a549da82cad1 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -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
index 3279cea68e305934e95ba684216af966bd8786a2..f3bf9e769d593742f33101b4ee34743f133796ce 100644 (file)
@@ -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();
index c7738c3ed51fff4a4b14a4b5c634b6de903f08f3..822845dee7fde7b854dd7966d47fac7ddd205325 100644 (file)
@@ -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 = '';
 
index 4b80bd3b6c4b9e5b33ea8cddafb26c6caae15901..16f470f18313f4e22fcd6d254d9fa88b35e95e96 100644 (file)
 
                $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 = '';
 
index c4de99fb67454e6704e3e79ca390c834c7f91709..dca2515381b23e00c5f0dea5187d9ced829d023c 100644 (file)
--- a/index.php
+++ b/index.php
@@ -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";
 
index fa37399221d82fd62a3f26a4ff44d9f8a588572d..6541c1c0af0042bfaef271ffecbf12436da57ebb 100644 (file)
@@ -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'])
index 3a534fb6f213d15cd3b5a5557e81dcb892672eee..b8dc2d703e7fe51fb37b9dbac2d554f259ff0ea2 100644 (file)
@@ -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'],
index 61ea77c29ac68ba26b204263d9249c1971a8afb3..f2fadee8c77372c27b3b859d7265310eaa7e77f3 100644 (file)
@@ -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(),
index a22492fe66c9b5463cfbeb5d510bc19f7b0fca2e..1458ba8e467dadfb5eb235d5590570fed93cb254 100644 (file)
@@ -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;
        }
index 4e365767338b66c988d7a8cc71aa91d1bf7905e6..6aa890226b6479679e7a04c6188655dfd2304810 100644 (file)
@@ -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';
index ae26864a32ae318bfcbc5f16a2a1ea7291d31b47..5c4c5b12bc59c9fa98799feb562f6c15292d8a4a 100644 (file)
@@ -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']) : '');
index 201c61f2a234099a2374ecb3a4452893725a3dec..aa4751961775d8da4055133c173a3760cd5e93d7 100644 (file)
@@ -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'],
index dafc86ee69897126bc131b4e3cd61748cb69a478..4160445cc66aa943378492759db4348dc989d698 100644 (file)
@@ -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'),
index efe0a59b11d1a60adf215b3bf6188b318caa9edb..3f9efc57427a5a881fee5fe5fa22ceed718e6b57 100644 (file)
@@ -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'),
index c903a61c6f06c444603f32895794de93f7d0888f..c98d7733145a90e4882bb9445fc0c4d7d0b46e99 100644 (file)
@@ -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(),
index fb219072ef2258694c32124315d35f14dd7347ba..20d35133a47db0b6b5e31f3b02f83c9c1699b481 100644 (file)
@@ -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;
 
index 45908d2332248ee32c383f8dbe9cc1d156061f28..7406ef1781a1bdff00f76e30a400aa20b4d03e76 100644 (file)
@@ -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:'),
index ac6286e6d1a3be41d4e030660e5a96b00a44cafd..fa267fee21644c062ced231d4bcd76e3e2cb20cb 100644 (file)
@@ -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']));
 
 
        
index 96f50d90be6014c2d3dc140cdf448d19c71b4f17..f38f5ae37b214b2b6c2560d2b3c48a241147cd16 100644 (file)
@@ -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) {
 
index 04dc23e37bfbe0c033e157df5e81ab7437d32290..a807c926cdc1c3b93c107917884febda70fb3ed5 100644 (file)
@@ -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(
index dab4ee6f291aaa57b70b44a35b5cb92de2ab563d..ac9371ea0cfc86c335ebdfb0c8ea7e732d591080 100644 (file)
@@ -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'];
index e431e059de019e919f0abf14b99c12fc98d1d4c1..b7aaf6c1339902d3f284b6296e57388da0dff229 100644 (file)
@@ -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'],
index c9dc4c80c7d0e6d6a901a2bf9c378141477f4fdc..111610c666f55c3566ca78896d74e8cf5b2f8723 100644 (file)
@@ -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);
index 451cb12465635cda2fdc3dded1259e39b5f216ff..e65ba7c9b36aed9410664fc9e387a933ad1b52fc 100644 (file)
@@ -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>'
index abf673a92949d75bdf826d268697c49750726688..373180ba2704b0a50e15716c95a3aaa38b1c61b2 100644 (file)
@@ -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(),
index 2e14fcee5fdaaeecbd82d038c1325fc323ec148d..aef00c8c24b4d2f47aafcae7911f935fbb530e39 100644 (file)
@@ -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(),
index 2517298177b157bdc7a2962f1e6478988a89bf18..562b60c25cbb0de58ccd2805aa806a4af9802f1f 100644 (file)
@@ -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'])
index c6c5515c53dfcf8d2b26f5f83c9aec96663597ab..e60fda48dd5a6b7052aff1aff0ba754debb3851f 100644 (file)
@@ -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,