]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
missing close double quote in mail_list.tpl
[friendica.git] / boot.php
index a861dff678b2ba65f62b382efe2a72959872be0e..86da3cd2eb02ed14510228e92a78c34c82c870d0 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.1243' );
-define ( 'DFRN_PROTOCOL_VERSION',  '2.22'    );
-define ( 'DB_UPDATE_VERSION',      1120      );
+define ( 'FRIENDICA_VERSION',      '2.3.1282' );
+define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
+define ( 'DB_UPDATE_VERSION',      1132      );
 
 define ( 'EOL',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
@@ -125,14 +125,15 @@ define ( 'ZCURL_TIMEOUT' , (-1));
  * email notification options
  */
 
-define ( 'NOTIFY_INTRO',   0x0001 );
-define ( 'NOTIFY_CONFIRM', 0x0002 );
-define ( 'NOTIFY_WALL',    0x0004 );
-define ( 'NOTIFY_COMMENT', 0x0008 );
-define ( 'NOTIFY_MAIL',    0x0010 );
-define ( 'NOTIFY_SUGGEST', 0x0020 );
-define ( 'NOTIFY_PROFILE', 0x0040 );
-
+define ( 'NOTIFY_INTRO',    0x0001 );
+define ( 'NOTIFY_CONFIRM',  0x0002 );
+define ( 'NOTIFY_WALL',     0x0004 );
+define ( 'NOTIFY_COMMENT',  0x0008 );
+define ( 'NOTIFY_MAIL',     0x0010 );
+define ( 'NOTIFY_SUGGEST',  0x0020 );
+define ( 'NOTIFY_PROFILE',  0x0040 );
+define ( 'NOTIFY_TAGSELF',  0x0080 );
+define ( 'NOTIFY_TAGSHARE', 0x0100 );
 
 /**
  * various namespaces we may need to parse
@@ -308,8 +309,12 @@ class App {
                        . 'library/phpsec' . PATH_SEPARATOR 
                        . '.' );
 
-               if((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,2) === "q=")
+               if((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,2) === "q=") {
                        $this->query_string = substr($_SERVER['QUERY_STRING'],2);
+                       // removing trailing / - maybe a nginx problem
+                       if (substr($this->query_string, 0, 1) == "/")
+                               $this->query_string = substr($this->query_string, 1);
+               }
                if(x($_GET,'q'))
                        $this->cmd = trim($_GET['q'],'/\\');
 
@@ -374,11 +379,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($this->config['system']['ssl_policy'] == 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 : '' );
@@ -680,6 +696,7 @@ function get_guid($size=16) {
 
 if(! function_exists('login')) {
 function login($register = false, $hiddens=false) {
+       $a = get_app();
        $o = "";
        $reg = false;
        if ($register) {
@@ -699,23 +716,26 @@ function login($register = false, $hiddens=false) {
 
        }
 
+       $dest_url = $a->get_baseurl(true) . '/' . $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);
@@ -818,7 +838,7 @@ function profile_load(&$a, $nickname, $profile = 0) {
        } 
 
        $r = null;
-
+                          
        if($profile) {
                $profile_int = intval($profile);
                $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile` 
@@ -828,7 +848,7 @@ function profile_load(&$a, $nickname, $profile = 0) {
                        intval($profile_int)
                );
        }
-       if(! count($r)) {       
+       if((! $r) && (!  count($r))) {  
                $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile` 
                        left join `contact` on `contact`.`uid` = `profile`.`uid` LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid`
                        WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` = 1 and `contact`.`self` = 1 LIMIT 1",
@@ -841,6 +861,16 @@ function profile_load(&$a, $nickname, $profile = 0) {
                $a->error = 404;
                return;
        }
+       
+       // fetch user tags if this isn't the default profile
+
+       if(! $r[0]['is-default']) {
+               $x = q("select `pub_keywords` from `profile` where uid = %d and `is-default` = 1 limit 1",
+                       intval($profile_uid)
+               );
+               if($x && count($x))
+                       $r[0]['pub_keywords'] = $x[0]['pub_keywords'];
+       }
 
        $a->profile = $r[0];
 
@@ -1194,7 +1224,7 @@ function current_theme(){
        $a = get_app();
        
        $system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : '');
-       $theme_name = ((is_array($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $system_theme);
+       $theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $system_theme);
        
        if($theme_name && file_exists('view/theme/' . $theme_name . '/style.css'))
                return($theme_name);
@@ -1320,7 +1350,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
                array(
                        'label' => t('Profile'),
                        'url'   => $url.'/?tab=profile',
-                       'sel'   => (($tab=='profile')?'active':''),
+                       'sel'   => ((isset($tab) && $tab=='profile')?'active':''),
                ),
                array(
                        'label' => t('Photos'),