]> git.mxchange.org Git - friendica.git/commitdiff
Merge branch 'pull'
authorfriendica <info@friendica.com>
Thu, 15 Mar 2012 08:48:10 +0000 (01:48 -0700)
committerfriendica <info@friendica.com>
Thu, 15 Mar 2012 08:48:10 +0000 (01:48 -0700)
18 files changed:
boot.php
include/conversation.php
include/items.php
include/nav.php
mod/admin.php
mod/contacts.php
mod/dfrn_notify.php
mod/dfrn_request.php
mod/manage.php
mod/message.php
mod/network.php
mod/notifications.php
mod/notify.php
mod/profiles.php
mod/settings.php
view/admin_site.tpl
view/login.tpl
view/logout.tpl

index 749ef6e3f3ae30ee5dc7d3f7497cd9cfaf44f12e..04f36093bfffb38359a9a780999aef30e24c1eba 100755 (executable)
--- a/boot.php
+++ b/boot.php
@@ -9,8 +9,8 @@ require_once('include/nav.php');
 require_once('include/cache.php');
 
 define ( 'FRIENDICA_PLATFORM',     'Friendica');
-define ( 'FRIENDICA_VERSION',      '2.3.1280' );
-define ( 'DFRN_PROTOCOL_VERSION',  '2.22'    );
+define ( 'FRIENDICA_VERSION',      '2.3.1281' );
+define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
 define ( 'DB_UPDATE_VERSION',      1131      );
 
 define ( 'EOL',                    "<br />\r\n"     );
@@ -379,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 : '' );
@@ -685,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) {
@@ -704,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);
index 117127a287fa04b86227538316cb53a9c6418d16..88ecf502b222e4b66867f0115cc82e8410b6f8e3 100755 (executable)
@@ -186,6 +186,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
 
        require_once('bbcode.php');
 
+       $ssl_state = ((local_user()) ? true : false);
+
        $profile_owner = 0;
        $page_writeable      = false;
 
@@ -345,7 +347,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                        'like' => '',
                                        'dislike' => '',
                                        'comment' => '',
-                                       'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl() . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))),
+                                       'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state) . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))),
                                        'previewing' => $previewing,
                                        'wait' => t('Please wait'),
                                );
@@ -461,7 +463,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                        $comment_lastcollapsed = true;
                                }
 
-                               $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
+                               $redirect_url = $a->get_baseurl($ssl_state) . '/redir/' . $item['cid'] ;
 
                                $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) 
                                        || strlen($item['deny_cid']) || strlen($item['deny_gid']))))
@@ -543,7 +545,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                }
 
                                $edpost = (((($profile_owner == local_user()) && ($toplevelpost) && (intval($item['wall']) == 1)) || ($mode === 'notes'))
-                                               ? array($a->get_baseurl()."/editpost/".$item['id'], t("Edit"))
+                                               ? array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit"))
                                                : False);
 
 
@@ -697,7 +699,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
 
        $page_template = get_markup_template("conversation.tpl");
        $o .= replace_macros($page_template, array(
-               '$baseurl' => $a->get_baseurl(),
+               '$baseurl' => $a->get_baseurl($ssl_state),
                '$mode' => $mode,
                '$user' => $a->user,
                '$threads' => $threads,
@@ -707,7 +709,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
        return $o;
 }}
 
-function best_link_url($item,&$sparkle) {
+function best_link_url($item,&$sparkle,$ssl_state = false) {
 
        $a = get_app();
 
@@ -719,7 +721,7 @@ function best_link_url($item,&$sparkle) {
        if((local_user()) && (local_user() == $item['uid'])) {
                if(isset($a->contacts) && x($a->contacts,$clean_url)) {
                        if($a->contacts[$clean_url]['network'] === NETWORK_DFRN) {
-                               $best_url = $a->get_baseurl() . '/redir/' . $a->contacts[$clean_url]['id'];
+                               $best_url = $a->get_baseurl($ssl_state) . '/redir/' . $a->contacts[$clean_url]['id'];
                                $sparkle = true;
                        }
                        else
@@ -740,10 +742,14 @@ function best_link_url($item,&$sparkle) {
 if(! function_exists('item_photo_menu')){
 function item_photo_menu($item){
        $a = get_app();
-       
-       if (local_user() && (! count($a->contacts)))
-               load_contact_links(local_user());
 
+       $ssl_state = false;
+
+       if(local_user()) {
+               $ssl_state = true;
+                if(! count($a->contacts))
+                       load_contact_links(local_user());
+       }
        $contact_url="";
        $pm_url="";
        $status_link="";
@@ -751,7 +757,7 @@ function item_photo_menu($item){
        $posts_link="";
 
        $sparkle = false;
-    $profile_link = best_link_url($item,$sparkle);
+    $profile_link = best_link_url($item,$sparkle,$ssl_state);
        if($profile_link === 'mailbox')
                $profile_link = '';
 
@@ -760,7 +766,7 @@ function item_photo_menu($item){
                $status_link = $profile_link . "?url=status";
                $photos_link = $profile_link . "?url=photos";
                $profile_link = $profile_link . "?url=profile";
-               $pm_url = $a->get_baseurl() . '/message/new/' . $cid;
+               $pm_url = $a->get_baseurl($ssl_state) . '/message/new/' . $cid;
        }
        else {
                if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) {
@@ -771,8 +777,8 @@ function item_photo_menu($item){
                }
        }
        if(($cid) && (! $item['self'])) {
-               $contact_url = $a->get_baseurl() . '/contacts/' . $cid;
-               $posts_link = $a->get_baseurl() . '/network/?cid=' . $cid;
+               $contact_url = $a->get_baseurl($ssl_state) . '/contacts/' . $cid;
+               $posts_link = $a->get_baseurl($ssl_state) . '/network/?cid=' . $cid;
        }
 
        $menu = Array(
@@ -808,7 +814,7 @@ function like_puller($a,$item,&$arr,$mode) {
        if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) {
                $url = $item['author-link'];
                if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === 'dfrn') && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) {
-                       $url = $a->get_baseurl() . '/redir/' . $item['contact-id'];
+                       $url = $a->get_baseurl(true) . '/redir/' . $item['contact-id'];
                        $sparkle = ' class="sparkle" ';
                }
                if(! ((isset($arr[$item['parent'] . '-l'])) && (is_array($arr[$item['parent'] . '-l']))))
@@ -870,7 +876,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
        
        $a->page['htmlhead'] .= replace_macros($tpl, array(
                '$newpost' => 'true',
-               '$baseurl' => $a->get_baseurl(),
+               '$baseurl' => $a->get_baseurl(true),
                '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
                '$geotag' => $geotag,
                '$nickname' => $x['nickname'],
@@ -921,7 +927,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
 
        $o .= replace_macros($tpl,array(
                '$return_path' => $a->cmd,
-               '$action' =>  $a->get_baseurl().'/item',
+               '$action' =>  $a->get_baseurl(true) . '/item',
                '$share' => (x($x,'button') ? $x['button'] : t('Share')),
                '$upload' => t('Upload photo'),
                '$shortupload' => t('upload photo'),
@@ -945,7 +951,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
                '$ptyp' => (($notes_cid) ? 'note' : 'wall'),
                '$content' => '',
                '$post_id' => '',
-               '$baseurl' => $a->get_baseurl(),
+               '$baseurl' => $a->get_baseurl(true),
                '$defloc' => $x['default_location'],
                '$visitor' => $x['visitor'],
                '$pvisit' => (($notes_cid) ? 'none' : $x['visitor']),
index 70c72ae165315f7975df384bf8805b308600d224..4b1523ff65397c4ac84330002708ea10484716b9 100755 (executable)
@@ -1046,6 +1046,21 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
        if(! $rino_enable)
                $rino = 0;
 
+       $ssl_val = intval(get_config('system','ssl_policy'));
+       $ssl_policy = '';
+       switch($ssl_val){
+               case SSL_POLICY_FULL:
+                       $ssl_policy = 'full';
+                       break;
+               case SSL_POLICY_SELFSIGN:
+                       $ssl_policy = 'self';
+                       break;                  
+               case SSL_POLICY_NONE:
+               default:
+                       $ssl_policy = 'none';
+                       break;
+       }
+
        $url = $contact['notify'] . '&dfrn_id=' . $idtosend . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . (($rino) ? '&rino=1' : '');
 
        logger('dfrn_deliver: ' . $url);
@@ -1118,6 +1133,8 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
                $postvars['perm'] = 'r';
        }
 
+       $postvars['ssl_policy'] = $ssl_policy;
+
        if($rino && $rino_allowed && (! $dissolve)) {
                $key = substr(random_string(),0,16);
                $data = bin2hex(aes_encrypt($postvars['data'],$key));
index aadfa82fd852c8a20f02a8e4b90c3649f46d0254..e28081839965731b7aa2135e71fb8c3f805c9e27 100755 (executable)
@@ -8,6 +8,8 @@ function nav(&$a) {
         *
         */
 
+       $ssl_state = ((local_user()) ? true : false);
+
        if(!(x($a->page,'nav')))
                $a->page['nav'] = '';
 
@@ -27,7 +29,7 @@ function nav(&$a) {
 
        $myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : '');
                
-       $sitelocation = $myident . substr($a->get_baseurl(),strpos($a->get_baseurl(),'//') + 2 );
+       $sitelocation = $myident . substr($a->get_baseurl($ssl_state),strpos($a->get_baseurl($ssl_state),'//') + 2 );
 
 
        // nav links: array of array('href', 'text', 'extra css classes', 'title')
@@ -53,7 +55,7 @@ function nav(&$a) {
                // user info
                $r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
                $userinfo = array(
-                       'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl()."/images/default-profile-mm.jpg"),
+                       'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl($ssl_state)."/images/default-profile-mm.jpg"),
                        'name' => $a->user['username'],
                );
                
@@ -76,7 +78,7 @@ function nav(&$a) {
        if(($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user()))
                $nav['register'] = array('register',t('Register'), "", t('Create an account'));
 
-       $help_url = $a->get_baseurl() . '/help';
+       $help_url = $a->get_baseurl($ssl_state) . '/help';
 
        if(! get_config('system','hide_help'))
                $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'));
index 93714bb5f9079c695da18bdb63333df38a84ea0a..88ccad6d3e42f9c7f970eba972f04417f132d3bd 100755 (executable)
@@ -37,7 +37,7 @@ function admin_post(&$a){
                                                        $func($a);
                                                }
                                }
-                               goaway($a->get_baseurl() . '/admin/plugins/' . $a->argv[2] );
+                               goaway($a->get_baseurl(true) . '/admin/plugins/' . $a->argv[2] );
                                return; // NOTREACHED
                                break;
                        case 'logs':
@@ -49,7 +49,7 @@ function admin_post(&$a){
                }
        }
 
-       goaway($a->get_baseurl() . '/admin' );
+       goaway($a->get_baseurl(true) . '/admin' );
        return; // NOTREACHED   
 }
 
@@ -68,11 +68,11 @@ function admin_content(&$a) {
 
        // array( url, name, extra css classes )
        $aside = Array(
-               'site'   =>     Array($a->get_baseurl()."/admin/site/", t("Site") , "site"),
-               'users'  =>     Array($a->get_baseurl()."/admin/users/", t("Users") , "users"),
-               'plugins'=>     Array($a->get_baseurl()."/admin/plugins/", t("Plugins") , "plugins"),
-               'themes' =>     Array($a->get_baseurl()."/admin/themes/", t("Themes") , "themes"),
-               'update' =>     Array($a->get_baseurl()."/admin/update/", t("Update") , "update")
+               'site'   =>     Array($a->get_baseurl(true)."/admin/site/", t("Site") , "site"),
+               'users'  =>     Array($a->get_baseurl(true)."/admin/users/", t("Users") , "users"),
+               'plugins'=>     Array($a->get_baseurl(true)."/admin/plugins/", t("Plugins") , "plugins"),
+               'themes' =>     Array($a->get_baseurl(true)."/admin/themes/", t("Themes") , "themes"),
+               'update' =>     Array($a->get_baseurl(true)."/admin/update/", t("Update") , "update")
        );
        
        /* get plugins admin page */
@@ -81,18 +81,18 @@ function admin_content(&$a) {
        $aside['plugins_admin']=Array();
        foreach ($r as $h){
                $plugin =$h['name'];
-               $aside['plugins_admin'][] = Array($a->get_baseurl()."/admin/plugins/".$plugin, $plugin, "plugin");
+               $aside['plugins_admin'][] = Array($a->get_baseurl(true)."/admin/plugins/".$plugin, $plugin, "plugin");
                // temp plugins with admin
                $a->plugins_admin[] = $plugin;
        }
                
-       $aside['logs'] = Array($a->get_baseurl()."/admin/logs/", t("Logs"), "logs");
+       $aside['logs'] = Array($a->get_baseurl(true)."/admin/logs/", t("Logs"), "logs");
 
        $t = get_markup_template("admin_aside.tpl");
        $a->page['aside'] = replace_macros( $t, array(
                        '$admin' => $aside, 
                        '$h_pending' => t('User registrations waiting for confirmation'),
-                       '$admurl'=> $a->get_baseurl()."/admin/"
+                       '$admurl'=> $a->get_baseurl(true)."/admin/"
        ));
 
 
@@ -151,11 +151,7 @@ function admin_page_summary(&$a) {
 
        $r = q("SELECT COUNT(id) as `count` FROM `register`");
        $pending = $r[0]['count'];
-       
-       
-       
-       
-       
+               
        $t = get_markup_template("admin_summary.tpl");
        return replace_macros($t, array(
                '$title' => t('Administration'),
@@ -210,7 +206,7 @@ function admin_page_site_post(&$a){
        $dfrn_only          =   ((x($_POST,'dfrn_only'))            ? True      :       False);
     $ostatus_disabled   =   !((x($_POST,'ostatus_disabled')) ? True  :   False);
        $diaspora_enabled   =   ((x($_POST,'diaspora_enabled')) ? True   :  False);
-
+       $ssl_policy         =   ((x($_POST,'ssl_policy')) ? intval($_POST['ssl_policy']) : 0);
 
        set_config('config','sitename',$sitename);
        if ($banner==""){
@@ -222,6 +218,7 @@ function admin_page_site_post(&$a){
        } else {
                set_config('system','banner', $banner);
        }
+       set_config('system','ssl_policy',$ssl_policy);
        set_config('system','language', $language);
        set_config('system','theme', $theme);
        set_config('system','maximagesize', $maximagesize);
@@ -258,7 +255,7 @@ function admin_page_site_post(&$a){
        set_config('system','diaspora_enabled', $diaspora_enabled);
 
        info( t('Site settings updated.') . EOL);
-       goaway($a->get_baseurl() . '/admin/site' );
+       goaway($a->get_baseurl(true) . '/admin/site' );
        return; // NOTREACHED   
        
 }
@@ -305,6 +302,12 @@ function admin_page_site(&$a) {
                REGISTER_APPROVE => t("Requires approval"),
                REGISTER_OPEN => t("Open")
        ); 
+
+       $ssl_choices = array(
+               SSL_POLICY_NONE => t("No SSL policy, links will track page SSL state"),
+               SSL_POLICY_FULL => t("Force all links to use SSL"),
+               SSL_POLICY_SELFSIGN => t("Self-signed certificate, use SSL for local links only (discouraged)")
+       );
        
        $t = get_markup_template("admin_site.tpl");
        return replace_macros($t, array(
@@ -316,13 +319,13 @@ function admin_page_site(&$a) {
                '$corporate' => t('Policies'),
                '$advanced' => t('Advanced'),
                
-               '$baseurl' => $a->get_baseurl(),
+               '$baseurl' => $a->get_baseurl(true),
                                                                        // name, label, value, help string, extra data...
                '$sitename'             => array('sitename', t("Site name"), htmlentities($a->config['sitename'], ENT_QUOTES), ""),
                '$banner'                       => array('banner', t("Banner/Logo"), $banner, ""),
                '$language'             => array('language', t("System language"), get_config('system','language'), "", $lang_choices),
                '$theme'                        => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles"), $theme_choices),
-
+               '$ssl_policy'       => array('ssl_policy', t("SSL link policy"), get_config('system','ssl_policy'), t("Determines whether generated links should be forced to use SSL"), $ssl_choices),
                '$maximagesize'         => array('maximagesize', t("Maximum image size"), get_config('system','maximagesize'), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")),
 
                '$register_policy'      => array('register_policy', t("Register policy"), $a->config['register_policy'], "", $register_choices),
@@ -389,7 +392,7 @@ function admin_page_users_post(&$a){
                        user_deny($hash);
                }
        }
-       goaway($a->get_baseurl() . '/admin/users' );
+       goaway($a->get_baseurl(true) . '/admin/users' );
        return; // NOTREACHED   
 }
  
@@ -399,7 +402,7 @@ function admin_page_users(&$a){
                $user = q("SELECT * FROM `user` WHERE `uid`=%d", intval($uid));
                if (count($user)==0){
                        notice( 'User not found' . EOL);
-                       goaway($a->get_baseurl() . '/admin/users' );
+                       goaway($a->get_baseurl(true) . '/admin/users' );
                        return; // NOTREACHED                                           
                }               
                switch($a->argv[2]){
@@ -418,7 +421,7 @@ function admin_page_users(&$a){
                                notice( sprintf( ($user[0]['blocked']?t("User '%s' unblocked"):t("User '%s' blocked")) , $user[0]['username']) . EOL);
                        }; break;
                }
-               goaway($a->get_baseurl() . '/admin/users' );
+               goaway($a->get_baseurl(true) . '/admin/users' );
                return; // NOTREACHED   
                
        }
@@ -497,7 +500,7 @@ function admin_page_users(&$a){
 
 
                // values //
-               '$baseurl' => $a->get_baseurl(),
+               '$baseurl' => $a->get_baseurl(true),
 
                '$pending' => $pending,
                '$users' => $users,
@@ -536,7 +539,7 @@ function admin_page_plugins(&$a){
                                info( sprintf( t("Plugin %s enabled."), $plugin ) );
                        }
                        set_config("system","addon", implode(", ",$a->plugins));
-                       goaway($a->get_baseurl() . '/admin/plugins' );
+                       goaway($a->get_baseurl(true) . '/admin/plugins' );
                        return; // NOTREACHED   
                }
                // display plugin details
@@ -569,7 +572,7 @@ function admin_page_plugins(&$a){
                        '$page' => t('Plugins'),
                        '$toggle' => t('Toggle'),
                        '$settings' => t('Settings'),
-                       '$baseurl' => $a->get_baseurl(),
+                       '$baseurl' => $a->get_baseurl(true),
                
                        '$plugin' => $plugin,
                        '$status' => $status,
@@ -607,7 +610,7 @@ function admin_page_plugins(&$a){
                '$title' => t('Administration'),
                '$page' => t('Plugins'),
                '$submit' => t('Submit'),
-               '$baseurl' => $a->get_baseurl(),
+               '$baseurl' => $a->get_baseurl(true),
                '$function' => 'plugins',       
                '$plugins' => $plugins
        ));
@@ -713,7 +716,7 @@ function admin_page_themes(&$a){
                                info( sprintf('Theme %s disabled.',$theme));
 
                        set_config('system','allowed_themes',$s);
-                       goaway($a->get_baseurl() . '/admin/themes' );
+                       goaway($a->get_baseurl(true) . '/admin/themes' );
                        return; // NOTREACHED   
                }
 
@@ -742,7 +745,7 @@ function admin_page_themes(&$a){
                        '$page' => t('Themes'),
                        '$toggle' => t('Toggle'),
                        '$settings' => t('Settings'),
-                       '$baseurl' => $a->get_baseurl(),
+                       '$baseurl' => $a->get_baseurl(true),
                
                        '$plugin' => $theme,
                        '$status' => $status,
@@ -774,7 +777,7 @@ function admin_page_themes(&$a){
                '$title' => t('Administration'),
                '$page' => t('Themes'),
                '$submit' => t('Submit'),
-               '$baseurl' => $a->get_baseurl(),
+               '$baseurl' => $a->get_baseurl(true),
                '$function' => 'themes',
                '$plugins' => $xthemes,
                '$experimental' => t('[Experimental]'),
@@ -802,7 +805,7 @@ function admin_page_logs_post(&$a) {
        }
 
        info( t("Log settings updated.") );
-       goaway($a->get_baseurl() . '/admin/logs' );
+       goaway($a->get_baseurl(true) . '/admin/logs' );
        return; // NOTREACHED   
 }
  
@@ -856,7 +859,7 @@ readable.");
                '$submit' => t('Submit'),
                '$clear' => t('Clear'),
                '$data' => $data,
-               '$baseurl' => $a->get_baseurl(),
+               '$baseurl' => $a->get_baseurl(true),
                '$logname' =>  get_config('system','logfile'),
                
                                                                        // name, label, value, help string, extra data...
@@ -901,7 +904,7 @@ function admin_page_remoteupdate(&$a) {
        
        $tpl = get_markup_template("admin_remoteupdate.tpl");
        return replace_macros($tpl, array(
-               '$baseurl' => $a->get_baseurl(),
+               '$baseurl' => $a->get_baseurl(true),
                '$submit' => t("Update now"),
                '$close' => t("Close"),
                '$localversion' => FRIENDICA_VERSION,
index 38ca570ddfd1bf5df6902a9f53b38deb2fa18034..78c8d40928c2b6461d2faa35539356a9d1128ee2 100755 (executable)
@@ -61,7 +61,7 @@ function contacts_post(&$a) {
 
        if(! count($orig_record)) {
                notice( t('Could not access contact record.') . EOL);
-               goaway($a->get_baseurl() . '/contacts');
+               goaway($a->get_baseurl(true) . '/contacts');
                return; // NOTREACHED
        }
 
@@ -141,7 +141,7 @@ function contacts_content(&$a) {
 
                if(! count($orig_record)) {
                        notice( t('Could not access contact record.') . EOL);
-                       goaway($a->get_baseurl() . '/contacts');
+                       goaway($a->get_baseurl(true) . '/contacts');
                        return; // NOTREACHED
                }
 
@@ -149,7 +149,7 @@ function contacts_content(&$a) {
 
                        // pull feed and consume it, which should subscribe to the hub.
                        proc_run('php',"include/poller.php","$contact_id");
-                       goaway($a->get_baseurl() . '/contacts/' . $contact_id);
+                       goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
                        // NOTREACHED
                }
 
@@ -164,7 +164,7 @@ function contacts_content(&$a) {
                                //notice( t('Contact has been ') . (($blocked) ? t('blocked') : t('unblocked')) . EOL );
                                info( (($blocked) ? t('Contact has been blocked') : t('Contact has been unblocked')) . EOL );
                        }
-                       goaway($a->get_baseurl() . '/contacts/' . $contact_id);
+                       goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
                        return; // NOTREACHED
                }
 
@@ -178,7 +178,7 @@ function contacts_content(&$a) {
                        if($r) {
                                info( (($readonly) ? t('Contact has been ignored') : t('Contact has been unignored')) . EOL );
                        }
-                       goaway($a->get_baseurl() . '/contacts/' . $contact_id);
+                       goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
                        return; // NOTREACHED
                }
 
@@ -220,9 +220,9 @@ function contacts_content(&$a) {
                        contact_remove($orig_record[0]['id']);
                        info( t('Contact has been removed.') . EOL );
                        if(x($_SESSION,'return_url'))
-                               goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
+                               goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
                        else
-                               goaway($a->get_baseurl() . '/contacts');
+                               goaway($a->get_baseurl(true) . '/contacts');
                        return; // NOTREACHED
                }
        }
@@ -233,7 +233,7 @@ function contacts_content(&$a) {
                $contact = $a->data['contact'];
 
                $tpl = get_markup_template('contact_head.tpl');
-               $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl()));
+               $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl(true)));
 
                require_once('include/contact_selectors.php');
 
@@ -295,17 +295,17 @@ function contacts_content(&$a) {
                $tabs = array(
                        array(
                                'label' => (($contact['blocked']) ? t('Unblock') : t('Block') ),
-                               'url'   => $a->get_baseurl() . '/contacts/' . $contact_id . '/block',
+                               'url'   => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/block',
                                'sel'   => '',
                        ),
                        array(
                                'label' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ),
-                               'url'   => $a->get_baseurl() . '/contacts/' . $contact_id . '/ignore',
+                               'url'   => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/ignore',
                                'sel'   => '',
                        ),
                        array(
                                'label' => t('Repair'),
-                               'url'   => $a->get_baseurl() . '/crepair/' . $contact_id,
+                               'url'   => $a->get_baseurl(true) . '/crepair/' . $contact_id,
                                'sel'   => '',
                        )
                );
@@ -322,7 +322,7 @@ function contacts_content(&$a) {
                        '$lbl_info1' => t('Contact Information / Notes'),
                        '$infedit' => t('Edit contact notes'),
                        '$common_text' => $common_text,
-                       '$common_link' => $a->get_baseurl() . '/common/' . $contact['id'],
+                       '$common_link' => $a->get_baseurl(true) . '/common/' . $contact['id'],
                        '$all_friends' => $all_friends,
                        '$relation_text' => $relation_text,
                        '$visit' => sprintf( t('Visit %s\'s profile [%s]'),$contact['name'],$contact['url']),
@@ -397,30 +397,30 @@ function contacts_content(&$a) {
        $tabs = array(
                array(
                        'label' => t('All Contacts'),
-                       'url'   => $a->get_baseurl() . '/contacts/all', 
+                       'url'   => $a->get_baseurl(true) . '/contacts/all', 
                        'sel'   => ($all) ? 'active' : '',
                ),
                array(
                        'label' => t('Unblocked Contacts'),
-                       'url'   => $a->get_baseurl() . '/contacts',
+                       'url'   => $a->get_baseurl(true) . '/contacts',
                        'sel'   => ((! $all) && (! $blocked) && (! $hidden) && (! $search) && (! $nets) && (! $ignored)) ? 'active' : '',
                ),
 
                array(
                        'label' => t('Blocked Contacts'),
-                       'url'   => $a->get_baseurl() . '/contacts/blocked',
+                       'url'   => $a->get_baseurl(true) . '/contacts/blocked',
                        'sel'   => ($blocked) ? 'active' : '',
                ),
 
                array(
                        'label' => t('Ignored Contacts'),
-                       'url'   => $a->get_baseurl() . '/contacts/ignored',
+                       'url'   => $a->get_baseurl(true) . '/contacts/ignored',
                        'sel'   => ($ignored) ? 'active' : '',
                ),
 
                array(
                        'label' => t('Hidden Contacts'),
-                       'url'   => $a->get_baseurl() . '/contacts/hidden',
+                       'url'   => $a->get_baseurl(true) . '/contacts/hidden',
                        'sel'   => ($hidden) ? 'active' : '',
                ),
 
index 0c0c27e3d67a465c2118bf2db20ead142d511488..3dbdc5b328953a55c142340bd00956c96c44b669 100755 (executable)
@@ -14,6 +14,7 @@ function dfrn_notify_post(&$a) {
        $key          = ((x($_POST,'key'))          ? $_POST['key']                     : '');
        $dissolve     = ((x($_POST,'dissolve'))     ? intval($_POST['dissolve'])        :  0);
        $perm         = ((x($_POST,'perm'))         ? notags(trim($_POST['perm']))      : 'r');
+       $ssl_policy   = ((x($_POST,'ssl_policy'))   ? notags(trim($_POST['ssl_policy'])): 'none');
 
        $writable = (-1);
        if($dfrn_version >= 2.21) {
@@ -94,6 +95,65 @@ function dfrn_notify_post(&$a) {
                $importer['writable'] = $writable;
        }
 
+       // if contact's ssl policy changed, update our links
+
+       $ssl_changed = false;
+
+       if($ssl_policy == 'self' && strstr($importer['url'],'https:')) {
+               $ssl_changed = true;
+               $importer['url']     =  str_replace('https:','http:',$importer['url']);
+               $importer['nurl']    = normalise_link($importer['url']);
+               $importer['photo']   =  str_replace('https:','http:',$importer['photo']);
+               $importer['thumb']   =  str_replace('https:','http:',$importer['thumb']);
+               $importer['micro']   =  str_replace('https:','http:',$importer['micro']);
+               $importer['request'] =  str_replace('https:','http:',$importer['request']);
+               $importer['notify']  =  str_replace('https:','http:',$importer['notify']);
+               $importer['poll']    =  str_replace('https:','http:',$importer['poll']);
+               $importer['confirm'] =  str_replace('https:','http:',$importer['confirm']);
+               $importer['poco']    =  str_replace('https:','http:',$importer['poco']);
+       }
+
+       if($ssl_policy == 'full' && strstr($importer['url'],'http:')) {
+               $ssl_changed = true;
+               $importer['url']     =  str_replace('http:','https:',$importer['url']);
+               $importer['nurl']    = normalise_link($importer['url']);
+               $importer['photo']   =  str_replace('http:','https:',$importer['photo']);
+               $importer['thumb']   =  str_replace('http:','https:',$importer['thumb']);
+               $importer['micro']   =  str_replace('http:','https:',$importer['micro']);
+               $importer['request'] =  str_replace('http:','https:',$importer['request']);
+               $importer['notify']  =  str_replace('http:','https:',$importer['notify']);
+               $importer['poll']    =  str_replace('http:','https:',$importer['poll']);
+               $importer['confirm'] =  str_replace('http:','https:',$importer['confirm']);
+               $importer['poco']    =  str_replace('http:','https:',$importer['poco']);
+       }
+
+       if($ssl_changed) {
+               q("update contact set 
+                       url = '%s', 
+                       nurl = '%s',
+                       photo = '%s',
+                       thumb = '%s',
+                       micro = '%s',
+                       request = '%s',
+                       notify = '%s',
+                       poll = '%s',
+                       confirm = '%s',
+                       poco = '%s'
+                       where id = %d limit 1",
+                       dbesc($importer['url']),
+                       dbesc($importer['nurl']),
+                       dbesc($importer['photo']),
+                       dbesc($importer['thumb']),
+                       dbesc($importer['micro']),
+                       dbesc($importer['request']),
+                       dbesc($importer['notify']),
+                       dbesc($importer['poll']),
+                       dbesc($importer['confirm']),
+                       dbesc($importer['poco']),
+                       intval($importer['id'])
+               );
+       }
+                       
        logger('dfrn_notify: received notify from ' . $importer['name'] . ' for ' . $importer['username']);
        logger('dfrn_notify: data: ' . $data, LOGGER_DATA);
 
index 4acb5c9bb51905d01f8d970cded159551c0f1c12..c2d37dac7e094d625a085d7571d80bac58b89387 100755 (executable)
@@ -77,9 +77,10 @@ function dfrn_request_post(&$a) {
                                 * Lookup the contact based on their URL (which is the only unique thing we have at the moment)
                                 */
        
-                               $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1",
+                               $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND (`url` = '%s' OR `nurl` = '%s') AND `self` = 0 LIMIT 1",
                                        intval(local_user()),
-                                       dbesc($dfrn_url)
+                                       dbesc($dfrn_url),
+                                       dbesc(normalise_link($dfrn_url))
                                );
        
                                if(count($r)) {
@@ -668,7 +669,21 @@ function dfrn_request_content(&$a) {
 
                $page_desc .= t("Please enter your 'Identity Address' from one of the following supported communications networks:");
 
-               $emailnet = t("<strike>Connect as an email follower</strike> \x28Coming soon\x29");
+               // see if we are allowed to have NETWORK_MAIL2 contacts
+
+               $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
+               if(get_config('system','dfrn_only'))
+                       $mail_disabled = 1;
+
+               if(! $mail_disabled) {
+                       $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
+                               intval($a->profile['uid'])
+                       );
+                       if(! count($r))
+                               $mail_disabled = 1;
+               }
+
+               $emailnet = (($mail_disabled) ? '' : t("<strike>Connect as an email follower</strike> \x28Coming soon\x29"));
 
                $invite_desc = t('If you are not yet a member of the free social web, <a href="http://dir.friendica.com/siteinfo">follow this link to find a public Friendica site and join us today</a>.');
 
index ec4dcd8a00922e0125aca2ae3a690df2a4a6153e..84dfa6917c3529c05293fcf39d83c06d692b1dfb 100755 (executable)
@@ -74,7 +74,7 @@ function manage_post(&$a) {
        if($limited_id)
                $_SESSION['submanage'] = $original_id;
 
-       goaway($a->get_baseurl() . '/profile/' . $a->user['nickname']);
+       goaway($a->get_baseurl(true) . '/profile/' . $a->user['nickname']);
        // NOTREACHED
 }
 
index 65f692f3d52767adab1837cc4dc6bdef1f39958e..55e313776d6c0897f0cf2f426377c19891c1c048 100755 (executable)
@@ -56,23 +56,23 @@ function message_content(&$a) {
                return;
        }
 
-       $myprofile = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
+       $myprofile = $a->get_baseurl(true) . '/profile/' . $a->user['nickname'];
 
 
        $tabs = array(
                array(
                        'label' => t('Inbox'),
-                       'url'=> $a->get_baseurl() . '/message',
+                       'url'=> $a->get_baseurl(true) . '/message',
                        'sel'=> (($a->argc == 1) ? 'active' : ''),
                ),
                array(
                        'label' => t('Outbox'),
-                       'url' => $a->get_baseurl() . '/message/sent',
+                       'url' => $a->get_baseurl(true) . '/message/sent',
                        'sel'=> (($a->argv[1] == 'sent') ? 'active' : ''),
                ),
                array(
                        'label' => t('New Message'),
-                       'url' => $a->get_baseurl() . '/message/new',
+                       'url' => $a->get_baseurl(true) . '/message/new',
                        'sel'=> (($a->argv[1] == 'new') ? 'active' : ''),
                ),
        );
@@ -99,7 +99,7 @@ function message_content(&$a) {
                        if($r) {
                                info( t('Message deleted.') . EOL );
                        }
-                       goaway($a->get_baseurl() . '/message' );
+                       goaway($a->get_baseurl(true) . '/message' );
                }
                else {
                        $r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1",
@@ -129,7 +129,7 @@ function message_content(&$a) {
                                if($r)
                                        info( t('Conversation removed.') . EOL );
                        } 
-                       goaway($a->get_baseurl() . '/message' );
+                       goaway($a->get_baseurl(true) . '/message' );
                }       
        
        }
@@ -146,7 +146,7 @@ function message_content(&$a) {
                $tpl = get_markup_template('msg-header.tpl');
 
                $a->page['htmlhead'] .= replace_macros($tpl, array(
-                       '$baseurl' => $a->get_baseurl(),
+                       '$baseurl' => $a->get_baseurl(true),
                        '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
                        '$nickname' => $a->user['nickname'],
                        '$linkurl' => t('Please enter a link URL:')
@@ -210,7 +210,7 @@ function message_content(&$a) {
                        $o .= replace_macros($tpl, array(
                                '$id' => $rr['id'],
                                '$from_name' =>$rr['from-name'],
-                               '$from_url' => (($rr['network'] === NETWORK_DFRN) ? $a->get_baseurl() . '/redir/' . $rr['contact-id'] : $rr['url']),
+                               '$from_url' => (($rr['network'] === NETWORK_DFRN) ? $a->get_baseurl(true) . '/redir/' . $rr['contact-id'] : $rr['url']),
                                '$sparkle' => ' sparkle',
                                '$from_photo' => $rr['thumb'],
                                '$subject' => template_escape((($rr['mailseen']) ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>')),
@@ -267,7 +267,7 @@ function message_content(&$a) {
        
                $a->page['htmlhead'] .= replace_macros($tpl, array(
                        '$nickname' => $a->user['nickname'],
-                       '$baseurl' => $a->get_baseurl()
+                       '$baseurl' => $a->get_baseurl(true)
                ));
 
 
@@ -278,7 +278,7 @@ function message_content(&$a) {
                                $sparkle = '';
                        }
                        else {
-                               $from_url = $a->get_baseurl() . '/redir/' . $message['contact-id'];
+                               $from_url = $a->get_baseurl(true) . '/redir/' . $message['contact-id'];
                                $sparkle = ' sparkle';
                        }
                        $o .= replace_macros($tpl, array(
index e9f3913ff43a7ef3f8267bfb946566fe17d5dbcd..d0f1733f46120e5c6cec659491ddda9cc17b8398 100755 (executable)
@@ -44,14 +44,16 @@ function network_init(&$a) {
        }
        
        $a->page['aside'] .= group_side('network','network',true,$group_id);
-       $a->page['aside'] .= networks_widget($a->get_baseurl() . '/network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
+       $a->page['aside'] .= networks_widget($a->get_baseurl(true) . '/network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
        $a->page['aside'] .= saved_searches($search);
-       $a->page['aside'] .= fileas_widget($a->get_baseurl() . '/network',(x($_GET, 'file') ? $_GET['file'] : ''));
+       $a->page['aside'] .= fileas_widget($a->get_baseurl(true) . '/network',(x($_GET, 'file') ? $_GET['file'] : ''));
 
 }
 
 function saved_searches($search) {
 
+       $a = get_app();
+
        $srchurl = '/network?f=' 
                . ((x($_GET,'cid'))   ? '&cid='   . $_GET['cid']   : '') 
                . ((x($_GET,'star'))  ? '&star='  . $_GET['star']  : '')
@@ -88,7 +90,7 @@ function saved_searches($search) {
        $o = replace_macros($tpl, array(
                '$title'         => t('Saved Searches'),
                '$add'           => t('add'),
-               '$searchbox' => search($search,'netsearch-box',$srchurl,true),
+               '$searchbox' => search($search,'netsearch-box',$a->get_baseurl(true) . $srchurl,true),
                '$saved'         => $saved,
        ));
        
@@ -167,38 +169,38 @@ function network_content(&$a, $update = 0) {
        $tabs = array(
                array(
                        'label' => t('Commented Order'),
-                       'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '?f=&cid=' . $_GET['cid'] : ''), 
+                       'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '?f=&cid=' . $_GET['cid'] : ''), 
                        'sel'=>$all_active,
                ),
                array(
                        'label' => t('Posted Order'),
-                       'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), 
+                       'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), 
                        'sel'=>$postord_active,
                ),
 
                array(
                        'label' => t('Personal'),
-                       'url' => $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&conv=1',
+                       'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&conv=1',
                        'sel' => $conv_active,
                ),
                array(
                        'label' => t('New'),
-                       'url' => $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . '/new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''),
+                       'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . '/new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''),
                        'sel' => $new_active,
                ),
                array(
                        'label' => t('Starred'),
-                       'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&star=1',
+                       'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&star=1',
                        'sel'=>$starred_active,
                ),
                array(
                        'label' => t('Shared Links'),
-                       'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&bmark=1',
+                       'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&bmark=1',
                        'sel'=>$bookmarked_active,
                ),      
 //             array(
 //                     'label' => t('Spam'),
-//                     'url'=>$a->get_baseurl() . '/network?f=&spam=1'
+//                     'url'=>$a->get_baseurl(true) . '/network?f=&spam=1'
 //                     'sel'=> $spam_active,
 //             ),      
 
@@ -300,7 +302,7 @@ function network_content(&$a, $update = 0) {
                        if($update)
                                killme();
                        notice( t('No such group') . EOL );
-                       goaway($a->get_baseurl() . '/network');
+                       goaway($a->get_baseurl(true) . '/network');
                        // NOTREACHED
                }
 
@@ -332,7 +334,7 @@ function network_content(&$a, $update = 0) {
                }
                else {
                        notice( t('Invalid contact.') . EOL);
-                       goaway($a->get_baseurl() . '/network');
+                       goaway($a->get_baseurl(true) . '/network');
                        // NOTREACHED
                }
        }
index 99031a1d59f0dee8a2050e08def1082dc0f1cf98..d478b51634a3f3bb1349d2e1709f398ad7497b8a 100755 (executable)
@@ -42,12 +42,12 @@ function notifications_post(&$a) {
                                        intval(local_user())
                                );
                        }
-                       goaway($a->get_baseurl() . '/notifications/intros');
+                       goaway($a->get_baseurl(true) . '/notifications/intros');
                }
                if($_POST['submit'] == t('Ignore')) {
                        $r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d LIMIT 1",
                                intval($intro_id));
-                       goaway($a->get_baseurl() . '/notifications/intros');
+                       goaway($a->get_baseurl(true) . '/notifications/intros');
                }
        }
 }
@@ -69,32 +69,32 @@ function notifications_content(&$a) {
        $tabs = array(
                array(
                        'label' => t('System'),
-                       'url'=>$a->get_baseurl() . '/notifications/system',
+                       'url'=>$a->get_baseurl(true) . '/notifications/system',
                        'sel'=> (($a->argv[1] == 'system') ? 'active' : ''),
                ),
                array(
                        'label' => t('Network'),
-                       'url'=>$a->get_baseurl() . '/notifications/network',
+                       'url'=>$a->get_baseurl(true) . '/notifications/network',
                        'sel'=> (($a->argv[1] == 'network') ? 'active' : ''),
                ),
                array(
                        'label' => t('Personal'),
-                       'url'=>$a->get_baseurl() . '/notifications/personal',
+                       'url'=>$a->get_baseurl(true) . '/notifications/personal',
                        'sel'=> (($a->argv[1] == 'personal') ? 'active' : ''),
                ),
                array(
                        'label' => t('Home'),
-                       'url' => $a->get_baseurl() . '/notifications/home',
+                       'url' => $a->get_baseurl(true) . '/notifications/home',
                        'sel'=> (($a->argv[1] == 'home') ? 'active' : ''),
                ),
                array(
                        'label' => t('Introductions'),
-                       'url' => $a->get_baseurl() . '/notifications/intros',
+                       'url' => $a->get_baseurl(true) . '/notifications/intros',
                        'sel'=> (($a->argv[1] == 'intros') ? 'active' : ''),
                ),
                array(
                        'label' => t('Messages'),
-                       'url' => $a->get_baseurl() . '/message',
+                       'url' => $a->get_baseurl(true) . '/message',
                        'sel'=> '',
                ),
        );
@@ -244,7 +244,7 @@ function notifications_content(&$a) {
                                switch($it['verb']){
                                        case ACTIVITY_LIKE:
                                                $notif_content .= replace_macros($tpl_item_likes,array(
-                                                       '$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'],
+                                                       '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        '$item_image' => $it['author-avatar'],
                                                        '$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
                                                        '$item_when' => relative_date($it['created'])
@@ -253,7 +253,7 @@ function notifications_content(&$a) {
                                                
                                        case ACTIVITY_DISLIKE:
                                                $notif_content .= replace_macros($tpl_item_dislikes,array(
-                                                       '$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'],
+                                                       '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        '$item_image' => $it['author-avatar'],
                                                        '$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
                                                        '$item_when' => relative_date($it['created'])
@@ -267,7 +267,7 @@ function notifications_content(&$a) {
                                                $it['fname'] = $obj->title;
                                                
                                                $notif_content .= replace_macros($tpl_item_friends,array(
-                                                       '$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'],
+                                                       '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        '$item_image' => $it['author-avatar'],
                                                        '$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
                                                        '$item_when' => relative_date($it['created'])
@@ -281,7 +281,7 @@ function notifications_content(&$a) {
                                                $tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments);
 
                                                $notif_content .= replace_macros($tpl,array(
-                                                       '$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'],
+                                                       '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        '$item_image' => $it['author-avatar'],
                                                        '$item_text' => $item_text,
                                                        '$item_when' => relative_date($it['created'])
@@ -314,7 +314,7 @@ function notifications_content(&$a) {
                if (count($r) > 0) {
                        foreach ($r as $it) {
                                $notif_content .= replace_macros($not_tpl,array(
-                                       '$item_link' => $a->get_baseurl().'/notify/view/'. $it['id'],
+                                       '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'],
                                        '$item_image' => $it['photo'],
                                        '$item_text' => strip_tags(bbcode($it['msg'])),
                                        '$item_when' => relative_date($it['date'])
@@ -334,7 +334,7 @@ function notifications_content(&$a) {
                
                $notif_tpl = get_markup_template('notifications.tpl');
                
-               $myurl = $a->get_baseurl() . '/profile/'. $a->user['nickname'];
+               $myurl = $a->get_baseurl(true) . '/profile/'. $a->user['nickname'];
                $myurl = substr($myurl,strpos($myurl,'://')+3);
                $myurl = str_replace(array('www.','.'),array('','\\.'),$myurl);
                $diasp_url = str_replace('/profile/','/u/',$myurl);
@@ -369,7 +369,7 @@ function notifications_content(&$a) {
                                switch($it['verb']){
                                        case ACTIVITY_LIKE:
                                                $notif_content .= replace_macros($tpl_item_likes,array(
-                                                       '$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'],
+                                                       '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        '$item_image' => $it['author-avatar'],
                                                        '$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
                                                        '$item_when' => relative_date($it['created'])
@@ -378,7 +378,7 @@ function notifications_content(&$a) {
                                                
                                        case ACTIVITY_DISLIKE:
                                                $notif_content .= replace_macros($tpl_item_dislikes,array(
-                                                       '$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'],
+                                                       '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        '$item_image' => $it['author-avatar'],
                                                        '$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
                                                        '$item_when' => relative_date($it['created'])
@@ -392,7 +392,7 @@ function notifications_content(&$a) {
                                                $it['fname'] = $obj->title;
                                                
                                                $notif_content .= replace_macros($tpl_item_friends,array(
-                                                       '$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'],
+                                                       '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        '$item_image' => $it['author-avatar'],
                                                        '$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
                                                        '$item_when' => relative_date($it['created'])
@@ -406,7 +406,7 @@ function notifications_content(&$a) {
                                                $tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments);
 
                                                $notif_content .= replace_macros($tpl,array(
-                                                       '$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'],
+                                                       '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        '$item_image' => $it['author-avatar'],
                                                        '$item_text' => $item_text,
                                                        '$item_when' => relative_date($it['created'])
@@ -456,7 +456,7 @@ function notifications_content(&$a) {
                                switch($it['verb']){
                                        case ACTIVITY_LIKE:
                                                $notif_content .= replace_macros($tpl_item_likes,array(
-                                                       '$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'],
+                                                       '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        '$item_image' => $it['author-avatar'],
                                                        '$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
                                                        '$item_when' => relative_date($it['created'])
@@ -465,7 +465,7 @@ function notifications_content(&$a) {
                                                break;
                                        case ACTIVITY_DISLIKE:
                                                $notif_content .= replace_macros($tpl_item_dislikes,array(
-                                                       '$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'],
+                                                       '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        '$item_image' => $it['author-avatar'],
                                                        '$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
                                                        '$item_when' => relative_date($it['created'])
@@ -479,7 +479,7 @@ function notifications_content(&$a) {
                                                $it['fname'] = $obj->title;
                                                
                                                $notif_content .= replace_macros($tpl_item_friends,array(
-                                                       '$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'],
+                                                       '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        '$item_image' => $it['author-avatar'],
                                                        '$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
                                                        '$item_when' => relative_date($it['created'])
@@ -488,7 +488,7 @@ function notifications_content(&$a) {
                                                break;
                                        default:
                                                $notif_content .= replace_macros($tpl_item_comments,array(
-                                                       '$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'],
+                                                       '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        '$item_image' => $it['author-avatar'],
                                                        '$item_text' => sprintf( t("%s commented on %s's post"), $it['author-name'], $it['pname']),
                                                        '$item_when' => relative_date($it['created'])
index a572b15344269f8c4d0bcd9776c6c1cd8b696195..ae8273a1d3eda064c7a7b2f5697162e3955f018c 100644 (file)
@@ -20,7 +20,7 @@ function notify_init(&$a) {
                        goaway($r[0]['link']);
                }
 
-               goaway($a->get_baseurl());
+               goaway($a->get_baseurl(true));
        }
 
        if($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all' ) {
@@ -51,7 +51,7 @@ function notify_content(&$a) {
                if (count($r) > 0) {
                        foreach ($r as $it) {
                                $notif_content .= replace_macros($not_tpl,array(
-                                       '$item_link' => $a->get_baseurl().'/notify/view/'. $it['id'],
+                                       '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'],
                                        '$item_image' => $it['photo'],
                                        '$item_text' => strip_tags(bbcode($it['msg'])),
                                        '$item_when' => relative_date($it['date'])
index b307a2d43bfe3af50b8c81f1b885e56ea93e62df..7b3b6ccc1eb5ea1451bcf361768c53f73f117379 100755 (executable)
@@ -240,7 +240,7 @@ function profiles_content(&$a) {
                );
                if(! count($r)) {
                        notice( t('Profile not found.') . EOL);
-                       goaway($a->get_baseurl() . '/profiles');
+                       goaway($a->get_baseurl(true) . '/profiles');
                        return; // NOTREACHED
                }
                
@@ -260,7 +260,7 @@ function profiles_content(&$a) {
                if($r)
                        info( t('Profile deleted.') . EOL);
 
-               goaway($a->get_baseurl() . '/profiles');
+               goaway($a->get_baseurl(true) . '/profiles');
                return; // NOTREACHED
        }
 
@@ -297,9 +297,9 @@ function profiles_content(&$a) {
 
                info( t('New profile created.') . EOL);
                if(count($r3) == 1)
-                       goaway($a->get_baseurl() . '/profiles/' . $r3[0]['id']);
+                       goaway($a->get_baseurl(true) . '/profiles/' . $r3[0]['id']);
                
-               goaway($a->get_baseurl() . '/profiles');
+               goaway($a->get_baseurl(true) . '/profiles');
        } 
 
        if(($a->argc > 2) && ($a->argv[1] === 'clone')) {
@@ -339,9 +339,9 @@ function profiles_content(&$a) {
                );
                info( t('New profile created.') . EOL);
                if(count($r3) == 1)
-                       goaway($a->get_baseurl() . '/profiles/' . $r3[0]['id']);
+                       goaway($a->get_baseurl(true) . '/profiles/' . $r3[0]['id']);
                
-               goaway($a->get_baseurl() . '/profiles');
+               goaway($a->get_baseurl(true) . '/profiles');
                
                return; // NOTREACHED
        }
@@ -373,7 +373,7 @@ function profiles_content(&$a) {
                ));
 
 
-               $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl()));
+               $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl(true)));
                $a->page['htmlhead'] .= "<script type=\"text/javascript\" src=\"js/country.js\" ></script>";
 
                $f = get_config('system','birthday_input_format');
@@ -425,7 +425,7 @@ function profiles_content(&$a) {
                        '$lbl_work' => t('Work/employment'),
                        '$lbl_school' => t('School/education'),
                        '$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''),
-                       '$baseurl' => $a->get_baseurl(),
+                       '$baseurl' => $a->get_baseurl(true),
                        '$profile_id' => $r[0]['id'],
                        '$profile_name' => $r[0]['profile-name'],
                        '$default' => (($is_default) ? '<p id="profile-edit-default-desc">' . t('This is your <strong>public</strong> profile.<br />It <strong>may</strong> be visible to anybody using the internet.') . '</p>' : ""),
@@ -489,7 +489,7 @@ function profiles_content(&$a) {
                                        '$alt' => t('Profile Image'),
                                        '$profile_name' => $rr['profile-name'],
                                        '$visible' => (($rr['is-default']) ? '<strong>' . t('visible to everybody') . '</strong>' 
-                                               : '<a href="' . $a->get_baseurl() . '/profperm/' . $rr['id'] . '" />' . t('Edit visibility') . '</a>')
+                                               : '<a href="' . $a->get_baseurl(true) . '/profperm/' . $rr['id'] . '" />' . t('Edit visibility') . '</a>')
                                ));
                        }
                }
index 15fd0c352ef897bd8fedd971770131f046ced63f..f694b5840f088887819e37911b69b88828786094 100755 (executable)
@@ -59,7 +59,7 @@ function settings_post(&$a) {
                q("DELETE FROM tokens WHERE id='%s' AND uid=%d",
                        dbesc($key),
                        local_user());
-               goaway($a->get_baseurl()."/settings/oauth/");
+               goaway($a->get_baseurl(true)."/settings/oauth/");
                return;                 
        }
 
@@ -104,7 +104,7 @@ function settings_post(&$a) {
                                                local_user());
                        }
                }
-               goaway($a->get_baseurl()."/settings/oauth/");
+               goaway($a->get_baseurl(true)."/settings/oauth/");
                return;
        }
 
@@ -411,7 +411,7 @@ function settings_post(&$a) {
 
        }
 
-       goaway($a->get_baseurl() . '/settings' );
+       goaway($a->get_baseurl(true) . '/settings' );
        return; // NOTREACHED
 }
                
@@ -435,27 +435,27 @@ function settings_content(&$a) {
        $tabs = array(
                array(
                        'label' => t('Account settings'),
-                       'url'   => $a->get_baseurl().'/settings',
+                       'url'   => $a->get_baseurl(true).'/settings',
                        'sel'   => (($a->argc == 1)?'active':''),
                ),      
                array(
                        'label' => t('Connector settings'),
-                       'url'   => $a->get_baseurl().'/settings/connectors',
+                       'url'   => $a->get_baseurl(true).'/settings/connectors',
                        'sel'   => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''),
                ),
                array(
                        'label' => t('Plugin settings'),
-                       'url'   => $a->get_baseurl().'/settings/addon',
+                       'url'   => $a->get_baseurl(true).'/settings/addon',
                        'sel'   => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''),
                ),
                array(
                        'label' => t('Connections'),
-                       'url' => $a->get_baseurl() . '/settings/oauth',
+                       'url' => $a->get_baseurl(true) . '/settings/oauth',
                        'sel' => (($a->argc > 1) && ($a->argv[1] === 'oauth')?'active':''),
                ),
                array(
                        'label' => t('Export personal data'),
-                       'url' => $a->get_baseurl() . '/uexport',
+                       'url' => $a->get_baseurl(true) . '/uexport',
                        'sel' => ''
                )
        );
@@ -517,7 +517,7 @@ function settings_content(&$a) {
                        $r = q("DELETE FROM clients WHERE client_id='%s' AND uid=%d",
                                        dbesc($a->argv[3]),
                                        local_user());
-                       goaway($a->get_baseurl()."/settings/oauth/");
+                       goaway($a->get_baseurl(true)."/settings/oauth/");
                        return;                 
                }
                
@@ -533,7 +533,7 @@ function settings_content(&$a) {
                $tpl = get_markup_template("settings_oauth.tpl");
                $o .= replace_macros($tpl, array(
                        '$form_security_token' => get_form_security_token("settings_oauth"),
-                       '$baseurl'      => $a->get_baseurl(),
+                       '$baseurl'      => $a->get_baseurl(true),
                        '$title'        => t('Connected Apps'),
                        '$add'          => t('Add application'),
                        '$edit'         => t('Edit'),
@@ -789,7 +789,7 @@ function settings_content(&$a) {
        $theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']);
 
 
-       $subdir = ((strlen($a->get_path())) ? '<br />' . t('or') . ' ' . $a->get_baseurl() . '/profile/' . $nickname : '');
+       $subdir = ((strlen($a->get_path())) ? '<br />' . t('or') . ' ' . $a->get_baseurl(true) . '/profile/' . $nickname : '');
 
        $tpl_addr = get_markup_template("settings_nick_set.tpl");
 
@@ -819,7 +819,7 @@ function settings_content(&$a) {
                '$ptitle'       => t('Account Settings'),
 
                '$submit'       => t('Submit'),
-               '$baseurl' => $a->get_baseurl(),
+               '$baseurl' => $a->get_baseurl(true),
                '$uid' => local_user(),
                '$form_security_token' => get_form_security_token("settings"),
                
index 9a122984546080450117655176e396a4623db839..01fe893c6551b8966294391da86340b4757bc1f9 100755 (executable)
@@ -7,6 +7,7 @@
        {{ inc field_textarea.tpl with $field=$banner }}{{ endinc }}
        {{ inc field_select.tpl with $field=$language }}{{ endinc }}
        {{ inc field_select.tpl with $field=$theme }}{{ endinc }}
+       {{ inc field_select.tpl with $field=$ssl_policy }}{{ endinc }}
        
        <div class="submit"><input type="submit" name="page_site" value="$submit" /></div>
        
index 5349fa3d836876f186e1f1398723e178c735a399..4cbbb162400a76789950a012982153e2f2277ebd 100755 (executable)
@@ -1,5 +1,5 @@
 
-<form action="" method="post" >
+<form action="$dest_url" method="post" >
        <input type="hidden" name="auth-params" value="login" />
 
        <div id="login_standard">
index 6a84a5bbcf58ae49f676c1c9f0de5c97cebf66c8..efc971df8491a2c59d4e01c5add95f2e6c90c549 100755 (executable)
@@ -1,4 +1,4 @@
-<form action="" method="post" >
+<form action="$dest_url" method="post" >
 <div class="logout-wrapper">
 <input type="hidden" name="auth-params" value="logout" />
 <input type="submit" name="submit" id="logout-button" value="$logout" />