]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
revup
[friendica.git] / boot.php
index 67e3d65ae170e4d2f9a90681b847c1a024ccb430..fbf7df1e2529cb7f86988f04e0c70f76c00652ad 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -3,7 +3,8 @@
 set_time_limit(0);
 ini_set('pcre.backtrack_limit', 250000);
 
-define ( 'FRIENDIKA_VERSION',      '2.1.969' );
+
+define ( 'FRIENDIKA_VERSION',      '2.2.978' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.21'    );
 define ( 'DB_UPDATE_VERSION',      1054      );
 
@@ -20,7 +21,7 @@ define ( 'DOWN_ARROW',             '⇩'       );
  *
  */
 
-define ( 'JPEG_QUALITY',            100              );         
+define ( 'JPEG_QUALITY',            100  );         
 
 /**
  * SSL redirection policies
@@ -212,6 +213,7 @@ class App {
        public  $user;
        public  $cid;
        public  $contact;
+       public  $contacts;
        public  $page_contact;
        public  $content;
        public  $data;
@@ -288,7 +290,7 @@ class App {
                $this->argv = explode('/',$this->cmd);
                $this->argc = count($this->argv);
                if((array_key_exists('0',$this->argv)) && strlen($this->argv[0])) {
-                       $this->module = $this->argv[0];
+                       $this->module = str_replace(".", "_", $this->argv[0]);
                }
                else {
                        $this->module = 'home';
@@ -376,9 +378,9 @@ class App {
 
        function init_pagehead() {
                $this->page['title'] = $this->config['sitename'];
-               $tpl = load_view_file('view/head.tpl');
+               $tpl = file_get_contents('view/head.tpl');
                $this->page['htmlhead'] = replace_macros($tpl,array(
-                       '$baseurl' => $this->get_baseurl() . '/',
+                       '$baseurl' => $this->get_baseurl(),
                        '$generator' => 'Friendika' . ' ' . FRIENDIKA_VERSION,
                        '$delitem' => t('Delete this item?'),
                        '$comment' => t('Comment')
@@ -826,7 +828,7 @@ function escape_tags($string) {
 if(! function_exists('login')) {
 function login($register = false) {
        $o = "";
-       $register_tpl = (($register) ? load_view_file("view/register-link.tpl") : "");
+       $register_tpl = (($register) ? get_markup_template("register-link.tpl") : "");
        
        $register_html = replace_macros($register_tpl,array(
                '$title' => t('Create a New Account'),
@@ -850,10 +852,10 @@ function login($register = false) {
        $lostlink = t('Password Reset');
 
        if(local_user()) {
-               $tpl = load_view_file("view/logout.tpl");
+               $tpl = get_markup_template("logout.tpl");
        }
        else {
-               $tpl = load_view_file("view/login.tpl");
+               $tpl = get_markup_template("login.tpl");
 
        }
 
@@ -1862,6 +1864,8 @@ function allowed_email($email) {
 // wrapper to load a view template, checking for alternate
 // languages before falling back to the default
 
+// obsolete, deprecated.
+
 if(! function_exists('load_view_file')) {
 function load_view_file($s) {
        global $lang, $a;
@@ -1880,6 +1884,37 @@ function load_view_file($s) {
        return file_get_contents($s);
 }}
 
+if(! function_exists('get_intltext_template')) {
+function get_intltext_template($s) {
+       global $lang;
+
+       if(! isset($lang))
+               $lang = 'en';
+
+       if(file_exists("view/$lang/$s"))
+               return file_get_contents("view/$lang/$s");
+       elseif(file_exists("view/en/$s"))
+               return file_get_contents("view/en/$s");
+       else
+               return file_get_contents("view/$s");
+}}
+
+if(! function_exists('get_markup_template')) {
+function get_markup_template($s) {
+
+       $theme = current_theme();
+       
+       if(file_exists("view/theme/$theme/$s"))
+               return file_get_contents("view/theme/$theme/$s");
+       else
+               return file_get_contents("view/$s");
+
+}}
+
+
+
+
+
 // for html,xml parsing - let's say you've got
 // an attribute foobar="class1 class2 class3"
 // and you want to find out if it contains 'class3'.
@@ -2305,7 +2340,7 @@ function profile_sidebar($profile) {
 
        $homepage = ((x($profile,'homepage') == 1) ? '<div class="homepage"><span class="homepage-label">' . t('Homepage:') . ' </span><span class="homepage-url">' . linkify($profile['homepage']) . '</span></div><div class="profile-clear"></div>' : '');
 
-       $tpl = load_view_file('view/profile_vcard.tpl');
+       $tpl = get_markup_template('profile_vcard.tpl');
 
        $o .= replace_macros($tpl, array(
                '$fullname' => $fullname,
@@ -2430,28 +2465,34 @@ function get_birthdays() {
                        if(strlen($rr['name']))
                                $total ++;
 
-               $o .= '<div id="birthday-notice" class="birthday-notice fakelink" onclick=openClose(\'birthday-wrapper\'); >' . t('Birthday Reminders') . ' ' . '(' . $total . ')' . '</div>'; 
-               $o .= '<div id="birthday-wrapper" style="display: none;" ><div id="birthday-title">' . t('Birthdays this week:') . '</div>'; 
-               $o .= '<div id="birthday-adjust">' . t("\x28Adjusted for local time\x29") . '</div>';
-               $o .= '<div id="birthday-title-end"></div>';
+               if($total) {
+                       $o .= '<div id="birthday-notice" class="birthday-notice fakelink" onclick=openClose(\'birthday-wrapper\'); >' . t('Birthday Reminders') . ' ' . '(' . $total . ')' . '</div>'; 
+                       $o .= '<div id="birthday-wrapper" style="display: none;" ><div id="birthday-title">' . t('Birthdays this week:') . '</div>'; 
+                       $o .= '<div id="birthday-adjust">' . t("\x28Adjusted for local time\x29") . '</div>';
+                       $o .= '<div id="birthday-title-end"></div>';
 
-               foreach($r as $rr) {
-                       if(! strlen($rr['name']))
-                               continue;
-                       $now = strtotime('now');
-                       $today = (((strtotime($rr['start'] . ' +00:00') < $now) && (strtotime($rr['finish'] . ' +00:00') > $now)) ? true : false); 
-
-                       $o .= '<div class="birthday-list" id="birthday-' . $rr['eid'] . '"><a class="sparkle" href="' 
-                       . $a->get_baseurl() . '/redir/'  . $rr['cid'] . '">' . $rr['name'] . '</a> ' 
-                       . day_translate(datetime_convert('UTC', $a->timezone, $rr['start'], $bd_format)) . (($today) ?  ' ' . t('[today]') : '')
-                       . '</div>' ;
+                       foreach($r as $rr) {
+                               if(! strlen($rr['name']))
+                                       continue;
+                               $now = strtotime('now');
+                               $today = (((strtotime($rr['start'] . ' +00:00') < $now) && (strtotime($rr['finish'] . ' +00:00') > $now)) ? true : false); 
+       
+                               $o .= '<div class="birthday-list" id="birthday-' . $rr['eid'] . '"><a class="sparkle" href="' 
+                               . $a->get_baseurl() . '/redir/'  . $rr['cid'] . '">' . $rr['name'] . '</a> ' 
+                               . day_translate(datetime_convert('UTC', $a->timezone, $rr['start'], $bd_format)) . (($today) ?  ' ' . t('[today]') : '')
+                               . '</div>' ;
+                       }
+                       $o .= '</div></div>';
                }
-
-               $o .= '</div></div>';
        }
+       return $o;
+}}
 
-  return $o;
 
+if(! function_exists('normalise_link')) {
+function normalise_link($url) {
+       $ret = str_replace(array('https:','//www.'), array('http:','//'), $url);
+       return(rtrim($ret,'/'));
 }}
 
 /**
@@ -2467,9 +2508,7 @@ function get_birthdays() {
 
 if(! function_exists('link_compare')) {
 function link_compare($a,$b) {
-       $a1 = str_replace(array('https:','//www.'), array('http:','//'), $a);
-       $b1 = str_replace(array('https:','//www.'), array('http:','//'), $b);
-       if(strcasecmp($a1,$b1) === 0)
+       if(strcasecmp(normalise_link($a),normalise_link($b)) === 0)
                return true;
        return false;
 }}