]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
Merge branch 'master', remote-tracking branch 'remotes/upstream/master'
[friendica.git] / boot.php
index 7564615a5d4aa6ddf72e030415ee0870cc89516d..b41b8d9a0e93d9d982a2d4fb9f905735de931263 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -9,9 +9,9 @@ require_once('include/nav.php');
 require_once('include/cache.php');
 
 define ( 'FRIENDICA_PLATFORM',     'Friendica');
-define ( 'FRIENDICA_VERSION',      '2.3.1326' );
+define ( 'FRIENDICA_VERSION',      '3.0.1355' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
-define ( 'DB_UPDATE_VERSION',      1139      );
+define ( 'DB_UPDATE_VERSION',      1144      );
 
 define ( 'EOL',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
@@ -29,6 +29,12 @@ define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
 
 define ( 'JPEG_QUALITY',            100  );
 
+/**
+ * Not yet used
+ */
+
+define ( 'DEFAULT_DB_ENGINE',  'MyISAM'  );
+
 /**
  * SSL redirection policies
  */
@@ -73,6 +79,14 @@ define ( 'HOOK_HOOK',      0);
 define ( 'HOOK_FILE',      1);
 define ( 'HOOK_FUNCTION',  2);
 
+/**
+ * DB update return values
+ */
+
+define ( 'UPDATE_SUCCESS', 0);
+define ( 'UPDATE_FAILED',  1);
+
+
 /**
  *
  * page/profile types
@@ -109,6 +123,8 @@ define ( 'NETWORK_XMPP',             'xmpp');    // XMPP
 define ( 'NETWORK_MYSPACE',          'mysp');    // MySpace
 define ( 'NETWORK_GPLUS',            'goog');    // Google+
 
+define ( 'NETWORK_PHANTOM',          'unkn');    // Place holder
+
 /**
  * These numbers are used in stored permissions
  * and existing allocations MUST NEVER BE CHANGED
@@ -128,6 +144,8 @@ $netgroup_ids = array(
        NETWORK_XMPP     => (-10),
        NETWORK_MYSPACE  => (-11),
        NETWORK_GPLUS    => (-12),
+
+       NETWORK_PHANTOM  => (-127),
 );
 
 
@@ -193,6 +211,8 @@ define ( 'ACTIVITY_REQ_FRIEND',  NAMESPACE_ACTIVITY_SCHEMA . 'request-friend' );
 define ( 'ACTIVITY_UNFRIEND',    NAMESPACE_ACTIVITY_SCHEMA . 'remove-friend' );
 define ( 'ACTIVITY_FOLLOW',      NAMESPACE_ACTIVITY_SCHEMA . 'follow' );
 define ( 'ACTIVITY_UNFOLLOW',    NAMESPACE_ACTIVITY_SCHEMA . 'stop-following' );
+define ( 'ACTIVITY_JOIN',        NAMESPACE_ACTIVITY_SCHEMA . 'join' );
+
 define ( 'ACTIVITY_POST',        NAMESPACE_ACTIVITY_SCHEMA . 'post' );
 define ( 'ACTIVITY_UPDATE',      NAMESPACE_ACTIVITY_SCHEMA . 'update' );
 define ( 'ACTIVITY_TAG',         NAMESPACE_ACTIVITY_SCHEMA . 'tag' );
@@ -205,6 +225,7 @@ define ( 'ACTIVITY_OBJ_PHOTO',   NAMESPACE_ACTIVITY_SCHEMA . 'photo' );
 define ( 'ACTIVITY_OBJ_P_PHOTO', NAMESPACE_ACTIVITY_SCHEMA . 'profile-photo' );
 define ( 'ACTIVITY_OBJ_ALBUM',   NAMESPACE_ACTIVITY_SCHEMA . 'photo-album' );
 define ( 'ACTIVITY_OBJ_EVENT',   NAMESPACE_ACTIVITY_SCHEMA . 'event' );
+define ( 'ACTIVITY_OBJ_GROUP',   NAMESPACE_ACTIVITY_SCHEMA . 'group' );
 define ( 'ACTIVITY_OBJ_TAGTERM', NAMESPACE_DFRN            . '/tagterm' );
 define ( 'ACTIVITY_OBJ_PROFILE', NAMESPACE_DFRN            . '/profile' );
 
@@ -420,22 +441,19 @@ if(! class_exists('App')) {
                                if(intval($this->config['system']['ssl_policy']) === intval(SSL_POLICY_FULL))
                                        $scheme = 'https';
 
-                               //                      We need to populate the $ssl flag across the entire program before turning this on.
-                               //                      Basically, we'll have $ssl = true on any links which can only be seen by a logged in user
-                               //                      (and also the login link). Anything seen by an outsider will have it turned off.
-                               //                      At present, setting SSL_POLICY_SELFSIGN will only force remote contacts to update their
-                               //                      contact links to this site with "http:" if they are currently using "https:"
-
-                               //                      if($this->config['system']['ssl_policy'] == SSL_POLICY_SELFSIGN) {
-                               //                              if($ssl)
-                               //                                      $scheme = 'https';
-                               //                              else
-                               //                                      $scheme = 'http';
-                                       //                      }
-               }
+                               //      Basically, we have $ssl = true on any links which can only be seen by a logged in user
+                               //      (and also the login link). Anything seen by an outsider will have it turned off.
+
+                               if($this->config['system']['ssl_policy'] == SSL_POLICY_SELFSIGN) {
+                                       if($ssl)
+                                               $scheme = 'https';
+                                       else
+                                               $scheme = 'http';
+                               }
+                       }
 
-                               $this->baseurl = $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' );
-                               return $this->baseurl;
+                       $this->baseurl = $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' );
+                       return $this->baseurl;
                }
 
                function set_baseurl($url) {
@@ -490,6 +508,7 @@ if(! class_exists('App')) {
                        $tpl = file_get_contents('view/head.tpl');
                        $this->page['htmlhead'] = replace_macros($tpl,array(
                                '$baseurl' => $this->get_baseurl(), // FIXME for z_path!!!!
+                               '$local_user' => local_user(),
                                '$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION,
                                '$delitem' => t('Delete this item?'),
                                '$comment' => t('Comment'),
@@ -659,11 +678,11 @@ if(! function_exists('check_config')) {
                                                        // call the specific update
 
                                                        $func = 'update_' . $x;
-                                                       $retval = $func($a);
+                                                       $retval = $func();
                                                        if($retval) {
                                                                //send the administrator an e-mail
                                                                $email_tpl = get_intltext_template("update_fail_eml.tpl");
-                                                               $email_tpl = replace_macros($email_tpl, array(
+                                                               $email_msg = replace_macros($email_tpl, array(
                                                                        '$sitename' => $a->config['sitename'],
                                                                        '$siteurl' =>  $a->get_baseurl(),
                                                                        '$update' => $x,
@@ -671,13 +690,16 @@ if(! function_exists('check_config')) {
                                                                ));
                                                                $subject=sprintf(t('Update Error at %s'), $a->get_baseurl());
                                                                        
-                                                               mail($a->config['admin_email'], $subject, $text,
+                                                               mail($a->config['admin_email'], $subject, $email_msg,
                                                                        'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
                                                                        . 'Content-type: text/plain; charset=UTF-8' . "\n"
                                                                        . 'Content-transfer-encoding: 8bit' );
                                                                //try the logger
                                                                logger('CRITICAL: Update Failed: '. $x);
                                                        }
+                                                       else
+                                                               set_config('database','update_' . $x, 'success');
+                                                               
                                                }
                                        }
                                        set_config('system','build', DB_UPDATE_VERSION);
@@ -719,9 +741,10 @@ if(! function_exists('check_config')) {
                        foreach($installed as $i) {
                                if(! in_array($i['name'],$plugins_arr)) {
                                        uninstall_plugin($i['name']);
-                       }
-                               else
+                               }
+                               else {
                                        $installed_arr[] = $i['name'];
+                               }
                        }
                }
 
@@ -1298,6 +1321,25 @@ if(! function_exists('proc_run')) {
                $a = get_app();
 
                $args = func_get_args();
+
+               $newargs = array();
+               if(! count($args))
+                       return;
+
+               // expand any arrays
+
+               foreach($args as $arg) {
+                       if(is_array($arg)) {
+                               foreach($arg as $n) {
+                                       $newargs[] = $n;
+                               }
+                       }
+                       else
+                               $newargs[] = $arg;
+               }
+
+               $args = $newargs;
+               
                $arr = array('args' => $args, 'run_cmd' => true);
 
                call_hooks("proc_run", $arr);
@@ -1457,16 +1499,19 @@ if(! function_exists('profile_tabs')){
                                'label'=>t('Status'),
                                'url' => $url,
                                'sel' => ((!isset($tab)&&$a->argv[0]=='profile')?'active':''),
+                               'title' => t('Status Messages and Posts'),
                        ),
                        array(
                                'label' => t('Profile'),
                                'url'   => $url.'/?tab=profile',
                                'sel'   => ((isset($tab) && $tab=='profile')?'active':''),
+                               'title' => t('Profile Details'),
                        ),
                        array(
                                'label' => t('Photos'),
                                'url'   => $a->get_baseurl() . '/photos/' . $nickname,
                                'sel'   => ((!isset($tab)&&$a->argv[0]=='photos')?'active':''),
+                               'title' => t('Photo Albums'),
                        ),
                );
        
@@ -1475,11 +1520,13 @@ if(! function_exists('profile_tabs')){
                                'label' => t('Events'),
                                'url'   => $a->get_baseurl() . '/events',
                                'sel'   =>((!isset($tab)&&$a->argv[0]=='events')?'active':''),
+                               'title' => t('Events and Calendar'),
                        );
                        $tabs[] = array(
                                'label' => t('Personal Notes'),
                                'url'   => $a->get_baseurl() . '/notes',
                                'sel'   =>((!isset($tab)&&$a->argv[0]=='notes')?'active':''),
+                               'title' => t('Only You Can See This'),
                        );
                }
 
@@ -1499,6 +1546,15 @@ function get_my_url() {
        return false;
 }
 
+function zrl_init(&$a) {
+       $tmp_str = get_my_url();
+       if(validate_url($tmp_str)) {
+               proc_run('php','include/gprobe.php',bin2hex($tmp_str));
+               $arr = array('zrl' => $tmp_str, 'url' => $a->cmd);
+               call_hooks('zrl_init',$arr);
+       }
+}
+
 function zrl($s,$force = false) {
        if(! strlen($s))
                return $s;