]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
german translation of jot.tpl
[friendica.git] / boot.php
index e4a13ce92cefd219bf09f7be3dbf7e8bcbdf2aba..05b33abd6ef93d1d4d3f5cea4e5e0e5d8e806065 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -2,7 +2,8 @@
 
 set_time_limit(0);
 
-define ( 'BUILD_ID',               1030   );
+define ( 'BUILD_ID',               1033   );
+define ( 'FRIENDIKA_VERSION',      '2.01.1005' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.0'  );
 
 define ( 'EOL',                    "<br />\r\n"     );
@@ -102,7 +103,7 @@ define ( 'ACTIVITY_OBJ_HEART',   NAMESPACE_DFRN            . '/heart' );
 
 define ( 'ACTIVITY_FRIEND',      NAMESPACE_ACTIVITY_SCHEMA . 'make-friend' );
 define ( 'ACTIVITY_FOLLOW',      NAMESPACE_ACTIVITY_SCHEMA . 'follow' );
-define ( 'ACTIVITY_UNFOLLOW',    NAMESPACE_ACTIVITY_SCHEMA . 'unfollow' );
+define ( 'ACTIVITY_UNFOLLOW',    NAMESPACE_ACTIVITY_SCHEMA . 'stop-following' );
 define ( 'ACTIVITY_POST',        NAMESPACE_ACTIVITY_SCHEMA . 'post' );
 define ( 'ACTIVITY_UPDATE',      NAMESPACE_ACTIVITY_SCHEMA . 'update' );
 define ( 'ACTIVITY_TAG',         NAMESPACE_ACTIVITY_SCHEMA . 'tag' );
@@ -182,6 +183,7 @@ class App {
        public  $strings;   
        public  $path;
        public  $hooks;
+       public  $timezone;
        public  $interactive = true;
 
 
@@ -307,9 +309,11 @@ class App {
        } 
 
        function init_pagehead() {
+               $this->page['title'] = $this->config['sitename'];
                $tpl = load_view_file("view/head.tpl");
                $this->page['htmlhead'] = replace_macros($tpl,array(
-                       '$baseurl' => $this->get_baseurl() . '/'
+                       '$baseurl' => $this->get_baseurl() . '/',
+                       '$generator' => 'Friendika' . ' ' . FRIENDIKA_VERSION
                ));
        }
 
@@ -906,7 +910,6 @@ function xmlify($str) {
                        case "'" :
                                $buffer .= '&apos;';
                                break;
-
                        case "\"" :
                                $buffer .= '&quot;';
                                break;
@@ -942,6 +945,11 @@ function unxmlify($s) {
 
 if(! function_exists('hex2bin')) {
 function hex2bin($s) {
+       if(! ctype_xdigit($s)) {
+               logger('hex2bin: illegal input: ' . print_r(debug_backtrace(), true));
+               return($s);
+       }
+
        return(pack("H*",$s));
 }}
 
@@ -1095,7 +1103,6 @@ if(! function_exists('set_config')) {
 function set_config($family,$key,$value) {
 
        global $a;
-       $a->config[$family][$key] = $value;
 
        if(get_config($family,$key,true) === false) {
                $ret = q("INSERT INTO `config` ( `cat`, `k`, `v` ) VALUES ( '%s', '%s', '%s' ) ",
@@ -1112,6 +1119,9 @@ function set_config($family,$key,$value) {
                dbesc($family),
                dbesc($key)
        );
+
+       $a->config[$family][$key] = $value;
+
        if($ret)
                return $value;
        return $ret;
@@ -1148,11 +1158,13 @@ function get_pconfig($uid,$family, $key, $instore = false) {
                        return $a->config[$uid][$family][$key];
                }
        }
+
        $ret = q("SELECT `v` FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' LIMIT 1",
                intval($uid),
                dbesc($family),
                dbesc($key)
        );
+
        if(count($ret)) {
                $a->config[$uid][$family][$key] = $ret[0]['v'];
                return $ret[0]['v'];
@@ -1185,7 +1197,6 @@ if(! function_exists('set_pconfig')) {
 function set_pconfig($uid,$family,$key,$value) {
 
        global $a;
-       $a->config[$uid][$family][$key] = $value;
 
        if(get_pconfig($uid,$family,$key,true) === false) {
                $ret = q("INSERT INTO `pconfig` ( `uid`, `cat`, `k`, `v` ) VALUES ( %d, '%s', '%s', '%s' ) ",
@@ -1205,6 +1216,8 @@ function set_pconfig($uid,$family,$key,$value) {
                dbesc($key)
        );
 
+       $a->config[$uid][$family][$key] = $value;
+
        if($ret)
                return $value;
        return $ret;
@@ -1496,7 +1509,7 @@ function validate_email($addr) {
                return false;
        $h = substr($addr,strpos($addr,'@') + 1);
 
-       if(($h) && (dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR + DNS_MX))) {
+       if(($h) && (dns_get_record($h, DNS_A + DNS_CNAME + DNS_PTR + DNS_MX))) {
                return true;
        }
        return false;
@@ -1957,7 +1970,7 @@ function profile_load(&$a, $nickname, $profile = 0) {
        $a->profile = $r[0];
 
 
-       $a->page['title'] = $a->profile['name'];
+       $a->page['title'] = $a->profile['name'] . " @ " . $a->config['sitename'];
        $_SESSION['theme'] = $a->profile['theme'];
 
        if(! (x($a->page,'aside')))
@@ -1996,8 +2009,12 @@ function profile_sidebar($profile) {
        if((! is_array($profile)) && (! count($profile)))
                return $o;
 
+       call_hooks('profile_sidebar_enter', $profile);
+
        $fullname = '<div class="fn">' . $profile['name'] . '</div>';
 
+       $pdesc = '<div class="title">' . $profile['pdesc'] . '</div>';
+
        $tabs = '';
 
        $photo = '<div id="profile=photo-wrapper"><img class="photo" src="' . $profile['photo'] . '" alt="' . $profile['name'] . '" /></div>';
@@ -2036,6 +2053,7 @@ function profile_sidebar($profile) {
 
        $o .= replace_macros($tpl, array(
                '$fullname' => $fullname,
+               '$pdesc'    => $pdesc,
                '$tabs'     => $tabs,
                '$photo'    => $photo,
                '$connect'  => $connect,                
@@ -2046,7 +2064,10 @@ function profile_sidebar($profile) {
                '$homepage' => $homepage
        ));
 
-       call_hooks('profile_sidebar', $o);
+
+       $arr = array('profile' => $profile, 'entry' => $o);
+
+       call_hooks('profile_sidebar', $arr);
 
        return $o;
 }}
@@ -2112,3 +2133,80 @@ function call_hooks($name, &$data = null) {
        }
 }}
 
+
+if(! function_exists('day_translate')) {
+function day_translate($s) {
+       $ret = str_replace(array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'),
+               array( t('Monday'), t('Tuesday'), t('Wednesday'), t('Thursday'), t('Friday'), t('Saturday'), t('Sunday')),
+               $s);
+
+       $ret = str_replace(array('January','February','March','April','May','June','July','August','September','October','November','December'),
+               array( t('January'), t('February'), t('March'), t('April'), t('May'), t('June'), t('July'), t('August'), t('September'), t('October'), t('November'), t('December')),
+               $ret);
+
+       return $ret;
+}}
+
+if(! function_exists('get_birthdays')) {
+function get_birthdays() {
+
+       $a = get_app();
+       $o = '';
+
+       if(! local_user())
+               return $o;
+
+       $bd_format = get_config('system','birthday_format');
+       if(! $bd_format)
+               $bd_format = 'g A l F d' ; // 8 AM Friday January 18
+
+       $r = q("SELECT `event`.*, `event`.`id` AS `eid`, `contact`.* FROM `event` 
+               LEFT JOIN `contact` ON `contact`.`id` = `event`.`cid` 
+               WHERE `event`.`uid` = %d AND `type` = 'birthday' AND `start` < '%s' AND `finish` > '%s' 
+               ORDER BY `start` DESC ",
+               intval(local_user()),
+               dbesc(datetime_convert('UTC','UTC','now + 6 days')),
+               dbesc(datetime_convert('UTC','UTC','now'))
+       );
+
+       if($r && count($r)) {
+               $o .= '<div id="birthday-wrapper"><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) {
+                       $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>';
+       }
+
+  return $o;
+
+}}
+
+/**
+ *
+ * Compare two URLs to see if they are the same, but ignore
+ * slight but hopefully insignificant differences such as if one 
+ * is https and the other isn't, or if one is www.something and 
+ * the other isn't - and also ignore case differences.
+ *
+ * Return true if the URLs match, otherwise false.
+ *
+ */
+
+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)
+               return true;
+       return false;
+}}