]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
Merge branch 'pull'
[friendica.git] / boot.php
index 0fafa1cf304a4d584344aaecc5d1a6e68ebff6c7..b02e686bad289c4f59b68067c6c3720cb5372f00 100755 (executable)
--- 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.1278' );
-define ( 'DFRN_PROTOCOL_VERSION',  '2.22'    );
-define ( 'DB_UPDATE_VERSION',      1131      );
+define ( 'FRIENDICA_VERSION',      '2.3.1295' );
+define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
+define ( 'DB_UPDATE_VERSION',      1133      );
 
 define ( 'EOL',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
@@ -95,8 +95,8 @@ define ( 'PAGE_BLOG',              4 );
  * Network and protocol family types 
  */
 
-define ( 'NETWORK_ZOT',              'zot!');    // Zot!
 define ( 'NETWORK_DFRN',             'dfrn');    // Friendica, Mistpark, other DFRN implementations
+define ( 'NETWORK_ZOT',              'zot!');    // Zot!
 define ( 'NETWORK_OSTATUS',          'stat');    // status.net, identi.ca, GNU-social, other OStatus implementations
 define ( 'NETWORK_FEED',             'feed');    // RSS/Atom feeds with no known "post/notify" protocol
 define ( 'NETWORK_DIASPORA',         'dspr');    // Diaspora
@@ -108,6 +108,28 @@ define ( 'NETWORK_XMPP',             'xmpp');    // XMPP
 define ( 'NETWORK_MYSPACE',          'mysp');    // MySpace
 define ( 'NETWORK_GPLUS',            'goog');    // Google+
 
+/*
+ * These numbers are used in stored permissions
+ * and existing allocations MUST NEVER BE CHANGED
+ * OR RE-ASSIGNED! You may only add to them.
+ */
+
+$netgroup_ids = array(
+       NETWORK_DFRN     => (-1),
+       NETWORK_ZOT      => (-2),
+       NETWORK_OSTATUS  => (-3),
+       NETWORK_FEED     => (-4),
+       NETWORK_DIASPORA => (-5),
+       NETWORK_MAIL     => (-6),
+       NETWORK_MAIL2    => (-7),
+       NETWORK_FACEBOOK => (-8),
+       NETWORK_LINKEDIN => (-9),
+       NETWORK_XMPP     => (-10),
+       NETWORK_MYSPACE  => (-11),
+       NETWORK_GPLUS    => (-12),
+);
+
+
 /**
  * Maximum number of "people who like (or don't like) this"  that we will list by name
  */
@@ -135,6 +157,9 @@ define ( 'NOTIFY_PROFILE',  0x0040 );
 define ( 'NOTIFY_TAGSELF',  0x0080 );
 define ( 'NOTIFY_TAGSHARE', 0x0100 );
 
+define ( 'NOTIFY_SYSTEM',   0x8000 );
+
+
 /**
  * various namespaces we may need to parse
  */
@@ -286,7 +311,12 @@ class App {
 
                startup();
 
-               $this->scheme = ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS']))      ?  'https' : 'http' );
+               $this->scheme = 'http';
+               if(x($_SERVER,'HTTPS') && $_SERVER['HTTPS'])
+                       $this->scheme = 'https';
+               elseif(x($_SERVER,'SERVER_PORT') && (intval($_SERVER['SERVER_PORT']) == 443)) 
+                       $this->scheme = 'https';
+
 
                if(x($_SERVER,'SERVER_NAME')) {
                        $this->hostname = $_SERVER['SERVER_NAME'];
@@ -379,11 +409,22 @@ class App {
 
                $scheme = $this->scheme;
 
-               if(x($this->config,'ssl_policy')) {
-                       if(($ssl) || ($this->config['ssl_policy'] == SSL_POLICY_FULL)) 
-                               $scheme = 'https';
-                       if(($this->config['ssl_policy'] == SSL_POLICY_SELFSIGN) && (local_user() || x($_POST,'auth-params')))
+               if((x($this->config,'system')) && (x($this->config['system'],'ssl_policy'))) {
+                       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';
+//                     }
                }
 
                $this->baseurl = $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' );
@@ -544,6 +585,10 @@ function absurl($path) {
        return $path;
 }
 
+function is_ajax() {
+       return (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
+}
+
 
 // Primarily involved with database upgrade, but also sets the 
 // base url for use in cmdline programs which don't have
@@ -685,6 +730,7 @@ function get_guid($size=16) {
 
 if(! function_exists('login')) {
 function login($register = false, $hiddens=false) {
+       $a = get_app();
        $o = "";
        $reg = false;
        if ($register) {
@@ -696,31 +742,35 @@ function login($register = false, $hiddens=false) {
 
        $noid = get_config('system','no_openid');
        
+       $dest_url = $a->get_baseurl(true) . '/' . $a->query_string;
+
        if(local_user()) {
                $tpl = get_markup_template("logout.tpl");
        }
        else {
                $tpl = get_markup_template("login.tpl");
-
+               $_SESSION['return_url'] = $a->query_string;
        }
 
 
        $o .= replace_macros($tpl,array(
-               '$logout'        => t('Logout'),
-               '$login'                 => t('Login'),
+
+               '$dest_url'     => $dest_url,
+               '$logout'       => t('Logout'),
+               '$login'        => t('Login'),
                
                '$lname'                => array('username', t('Nickname or Email address: ') , '', ''),
                '$lpassword'    => array('password', t('Password: '), '', ''),
                
                '$openid'               => !$noid,
-               '$lopenid'      => array('openid_url', t('Or login using OpenID: '),'',''),
+               '$lopenid'      => array('openid_url', t('Or login using OpenID: '),'',''),
                
-               '$hiddens'      => $hiddens,
+               '$hiddens'      => $hiddens,
                
-               '$register'             => $reg,
+               '$register'     => $reg,
                
-               '$lostpass'      => t('Forgot your password?'),
-               '$lostlink'      => t('Password Reset'),
+               '$lostpass'     => t('Forgot your password?'),
+               '$lostlink'     => t('Password Reset'),
        ));
 
        call_hooks('login_hook',$o);
@@ -1357,6 +1407,11 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
                );
        }
 
+
+       $arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs);
+       call_hooks('profile_tabs', $arr);
+       
        $tpl = get_markup_template('common_tabs.tpl');
-       return replace_macros($tpl,array('$tabs'=>$tabs));
+
+       return replace_macros($tpl,array('$tabs' => $arr['tabs']));
 }}