]> git.mxchange.org Git - friendica.git/commitdiff
some more zot changes migrating back to f9a mainline
authorFriendika <info@friendika.com>
Tue, 2 Aug 2011 04:02:25 +0000 (21:02 -0700)
committerFriendika <info@friendika.com>
Tue, 2 Aug 2011 04:02:25 +0000 (21:02 -0700)
15 files changed:
addon/facebook/facebook.php
boot.php
include/auth.php
include/hostxrd.php
mod/dfrn_confirm.php
mod/dfrn_poll.php
mod/dfrn_request.php
mod/friendika.php
mod/lostpass.php
mod/notifications.php
mod/openid.php
mod/redir.php
mod/register.php
mod/removeme.php
view/xrd_host.tpl

index 73518afb2dae851519e62531a2685933008b84c3..10db7652a95a1df41ad06ef1eb2ca0147479ad7d 100644 (file)
@@ -564,7 +564,7 @@ function facebook_post_hook(&$a,&$b) {
 
                                $msg = preg_replace("/\[img\](.*?)\[\/img\]/is", t('Image: ') . '$1', $msg);
 
-                               if((strpos($link,$a->get_baseurl()) !== false) && (! $image))
+                               if((strpos($link,z_root()) !== false) && (! $image))
                                        $image = $a->get_baseurl() . '/images/friendika-64.jpg';
 
                                $msg = trim(strip_tags(bbcode($msg)));
index 35cb152392687659d6d9929091820d3430ed483a..fd5de0e94b88b87ebfbb8e937241e37fa9c12d04 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -325,7 +325,7 @@ class App {
 
                if($this->cmd === '.well-known/host-meta') {
                        require_once('include/hostxrd.php');
-                       hostxrd($this->get_baseurl());
+                       hostxrd();
                        // NOTREACHED
                }
 
@@ -402,7 +402,7 @@ class App {
                $this->page['title'] = $this->config['sitename'];
                $tpl = file_get_contents('view/head.tpl');
                $this->page['htmlhead'] = replace_macros($tpl,array(
-                       '$baseurl' => $this->get_baseurl(),
+                       '$baseurl' => $this->get_baseurl(), // FIXME for z_path!!!!
                        '$generator' => 'Friendika' . ' ' . FRIENDIKA_VERSION,
                        '$delitem' => t('Delete this item?'),
                        '$comment' => t('Comment')
@@ -475,6 +475,34 @@ function system_unavailable() {
 }}
 
 
+
+function clean_urls() {
+       global $a;
+//     if($a->config['system']['clean_urls'])
+               return true;
+//     return false;
+}
+
+function z_path() {
+       global $a;
+       $base = $a->get_baseurl();
+       if(! clean_urls())
+               $base .= '/?q=';
+       return $base;
+}
+
+function z_root() {
+       global $a;
+       return $a->get_baseurl();
+}
+
+function absurl($path) {
+       if(strpos($path,'/') === 0)
+               return z_path() . $path;
+       return $path;
+}
+
+
 // Primarily involved with database upgrade, but also sets the 
 // base url for use in cmdline programs which don't have
 // $_SERVER variables, and synchronising the state of installed plugins.
index d1eb9d131c7e27a6f090be7acf0698c8d9d2d8e5..768af626fb5863a697e358cda29a793d82cf76e1 100644 (file)
@@ -25,7 +25,7 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p
 
                nuke_session();
                info( t('Logged out.') . EOL);
-               goaway($a->get_baseurl());
+               goaway(z_root());
        }
 
        if(x($_SESSION,'visitor_id') && (! x($_SESSION,'uid'))) {
@@ -45,7 +45,7 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p
                // extra paranoia - if the IP changed, log them out
                if($check && ($_SESSION['addr'] != $_SERVER['REMOTE_ADDR'])) {
                        nuke_session();
-                       goaway($a->get_baseurl());
+                       goaway(z_root());
                }
 
                $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
@@ -54,7 +54,7 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p
 
                if(! count($r)) {
                        nuke_session();
-                       goaway($a->get_baseurl());
+                       goaway(z_root());
                }
 
                // initialise user environment
@@ -118,7 +118,7 @@ else {
                        if(($noid) || (strpos($temp_string,'@')) || (! validate_url($temp_string))) {
                                $a = get_app();
                                notice( t('Login failed.') . EOL);
-                               goaway($a->get_baseurl());
+                               goaway(z_root());
                                // NOTREACHED
                        }
 
@@ -143,7 +143,7 @@ else {
                                if($a->config['register_policy'] == REGISTER_CLOSED) {
                                        $a = get_app();
                                        notice( t('Login failed.') . EOL);
-                                       goaway($a->get_baseurl());
+                                       goaway(z_root());
                                        // NOTREACHED
                                }
                                // new account
@@ -196,7 +196,7 @@ else {
                if((! $record) || (! count($record))) {
                        logger('authenticate: failed login attempt: ' . trim($_POST['openid_url'])); 
                        notice( t('Login failed.') . EOL );
-                       goaway($a->get_baseurl());
+                       goaway(z_root());
                }
 
                $_SESSION['uid'] = $record['uid'];
index 7040f927d6c31cc252c4033c975948085e31a756..18c3e4b1edbe3aab983a92648199265564a4d2c1 100644 (file)
@@ -1,11 +1,10 @@
 <?php
 
-function hostxrd($baseurl) {
-
+function hostxrd() {
        header('Access-Control-Allow-Origin: *');
        header("Content-type: text/xml");
        $tpl = file_get_contents('view/xrd_host.tpl');
-       echo str_replace('$domain',$baseurl,$tpl);
+       echo str_replace(array('$zroot','$domain'),array(z_root(),z_path()),$tpl);
        session_write_close();
        exit();
 
index e2094b1f31b97eaacb7fc44ef52465cf25cabd96..91333284b724cc0ce370e442d1f048f6af75629c 100644 (file)
@@ -672,7 +672,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
 
        // somebody arrived here by mistake or they are fishing. Send them to the homepage.
 
-       goaway($a->get_baseurl());
+       goaway(z_root());
        // NOTREACHED
 
 }
index 76803ef1b4669f0896d92902352f53dff32acea3..09f198b81465dc33a4cf3a87161b4bfd9734c114 100644 (file)
@@ -61,7 +61,7 @@ function dfrn_poll_init(&$a) {
                                $my_id = '0:' . $dfrn_id;
                                break;
                        default:
-                               goaway($a->get_baseurl());
+                               goaway(z_root());
                                break; // NOTREACHED
                }
 
@@ -100,7 +100,7 @@ function dfrn_poll_init(&$a) {
                        $profile = $r[0]['nickname'];
                        goaway((strlen($destination_url)) ? $destination_url : $a->get_baseurl() . '/profile/' . $profile);
                }
-               goaway($a->get_baseurl());
+               goaway(z_root());
 
        }
 
@@ -297,7 +297,7 @@ function dfrn_poll_post(&$a) {
                        $my_id = '0:' . $dfrn_id;
                        break;
                default:
-                       goaway($a->get_baseurl());
+                       goaway(z_root());
                        break; // NOTREACHED
        }
 
@@ -420,7 +420,7 @@ function dfrn_poll_content(&$a) {
                                $my_id = '0:' . $dfrn_id;
                                break;
                        default:
-                               goaway($a->get_baseurl());
+                               goaway(z_root());
                                break; // NOTREACHED
                }
 
index c9811fa60c46c28d5fd51da27e0ec725954fedea..6b9558b86f4b506e9d32e94cfa6b16b6751482fe 100644 (file)
@@ -48,7 +48,7 @@ function dfrn_request_post(&$a) {
 
 
        if($_POST['cancel']) {
-               goaway($a->get_baseurl());
+               goaway(z_root());
        } 
 
 
@@ -190,7 +190,7 @@ function dfrn_request_post(&$a) {
                // invalid/bogus request
 
                notice( t('Unrecoverable protocol error.') . EOL );
-               goaway($a->get_baseurl());
+               goaway(z_root());
                return; // NOTREACHED
        }
 
@@ -602,7 +602,7 @@ function dfrn_request_content(&$a) {
                                $myaddr = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
                        }
                        else {
-                               $myaddr = $a->user['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3 );
+                               $myaddr = $a->user['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
                        }
                }
                elseif(x($_GET,'addr')) {
index 753a9f478fabcf220b916f58dc6b91decc29ab34..d0e709c753b3cd19ca77e053093aea1e7541bbc4 100644 (file)
@@ -16,7 +16,7 @@ function friendika_init(&$a) {
 
                $data = Array(
                        'version' => FRIENDIKA_VERSION,
-                       'url' => $a->get_baseurl(),
+                       'url' => z_root(),
                        'plugins' => $a->plugins,
                        'register_policy' =>  $register_policy[$a->config['register_policy']],
                        'admin' => $admin,
@@ -40,7 +40,7 @@ function friendika_content(&$a) {
        $o .= '<p></p><p>';
 
        $o .= t('This is Friendika version') . ' ' . FRIENDIKA_VERSION . ' ';
-       $o .= t('running at web location') . ' ' . $a->get_baseurl() . '</p><p>';
+       $o .= t('running at web location') . ' ' . z_root() . '</p><p>';
 
        $o .= t('Shared content within the Friendika network is provided under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 license</a>') . '</p><p>';
 
index 3453a0db4334a8d06957473a20ed82adf8da8aa8..b71398fa4b5b79e7c13619750ec3a6d66e984117 100644 (file)
@@ -5,7 +5,7 @@ function lostpass_post(&$a) {
 
        $email = notags(trim($_POST['login-name']));
        if(! $email)
-               goaway($a->get_baseurl());
+               goaway(z_root());
 
        $r = q("SELECT * FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' ) AND `verified` = 1 AND `blocked` = 0 LIMIT 1",
                dbesc($email),
@@ -14,7 +14,7 @@ function lostpass_post(&$a) {
 
        if(! count($r)) {
                notice( t('No valid account found.') . EOL);
-               goaway($a->get_baseurl());
+               goaway(z_root());
        }
 
        $uid = $r[0]['uid'];
@@ -46,7 +46,7 @@ function lostpass_post(&$a) {
                        . 'Content-transfer-encoding: 8bit' );
 
 
-       goaway($a->get_baseurl());
+       goaway(z_root());
 }
 
 
@@ -62,7 +62,7 @@ function lostpass_content(&$a) {
                );
                if(! count($r)) {
                        notice( t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed.") . EOL);
-                       goaway($a->get_baseurl());
+                       goaway(z_root());
                        return;
                }
                $uid = $r[0]['uid'];
index c6f073058da46eea7ae0d2307f3f968b95e2d30d..244563adc4883192c938cafa4c6ef87ba4ec46d3 100644 (file)
@@ -3,7 +3,7 @@
 function notifications_post(&$a) {
 
        if(! local_user()) {
-               goaway($a->get_baseurl());
+               goaway(z_root());
        }
        
        $request_id = (($a->argc > 1) ? $a->argv[1] : 0);
@@ -60,7 +60,7 @@ function notifications_content(&$a) {
 
        if(! local_user()) {
                notice( t('Permission denied.') . EOL);
-               goaway($a->get_baseurl());
+               return;
        }
 
        $o = '';
index 537d84ce3891d9b283ecc6e1f21cd2af152acdab..6fbd013b8d8756d27091a9f26bd5c450d1c2c154 100644 (file)
@@ -8,7 +8,7 @@ function openid_content(&$a) {
 
        $noid = get_config('system','no_openid');
        if($noid)
-               goaway($a->get_baseurl());
+               goaway(z_root());
 
        if((x($_GET,'openid_mode')) && (x($_SESSION,'openid'))) {
                $openid = new LightOpenID;
@@ -49,7 +49,7 @@ function openid_content(&$a) {
                                if($a->config['register_policy'] != REGISTER_CLOSED)
                                        goaway($a->get_baseurl() . '/register' . $args);
                                else
-                                       goaway($a->get_baseurl());
+                                       goaway(z_root());
 
                                // NOTREACHED
                        } 
@@ -60,7 +60,7 @@ function openid_content(&$a) {
                        );
                        if(! count($r)) {
                                notice( t('Login failed.') . EOL );
-                               goaway($a->get_baseurl());
+                               goaway(z_root());
                        }
                        unset($_SESSION['openid']);
 
@@ -116,10 +116,10 @@ function openid_content(&$a) {
                        if(($a->module !== 'home') && isset($_SESSION['return_url']))
                                goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
                        else
-                               goaway($a->get_baseurl());
+                               goaway(z_root());
                }
        }
        notice( t('Login failed.') . EOL);
-       goaway($a->get_baseurl());
+       goaway(z_root());
        // NOTREACHED
 }
index 8d0c8f4b3a4c0bb3cb590035666e3d2a4f3b1ad5..eb9702b0415a31525b5d0e68f691f68f0c207a1a 100644 (file)
@@ -3,7 +3,7 @@
 function redir_init(&$a) {
 
        if((! local_user()) || (! ($a->argc == 2)) || (! intval($a->argv[1])))
-               goaway($a->get_baseurl());
+               goaway(z_root());
        $cid = $a->argv[1];
        $url = ((x($_GET,'url')) ? $_GET['url'] : '');
 
@@ -13,7 +13,7 @@ function redir_init(&$a) {
        );
 
        if((! count($r)) || ($r[0]['network'] !== 'dfrn'))
-               goaway($a->get_baseurl());
+               goaway(z_root());
 
        $dfrn_id = $orig_id = (($r[0]['issued-id']) ? $r[0]['issued-id'] : $r[0]['dfrn-id']);
 
index 0906395d2d4e8a0c80ac0285b4c5050f042193ab..a8d81f1f6bb1360dfa548bea16cc284fbc648425 100644 (file)
@@ -373,7 +373,7 @@ function register_post(&$a) {
 
                if($res) {
                        info( t('Registration successful. Please check your email for further instructions.') . EOL ) ;
-                       goaway($a->get_baseurl());
+                       goaway(z_root());
                }
                else {
                        notice( t('Failed to send email message. Here is the message that failed.') . $email_tpl . EOL );
@@ -382,7 +382,7 @@ function register_post(&$a) {
        elseif($a->config['register_policy'] == REGISTER_APPROVE) {
                if(! strlen($a->config['admin_email'])) {
                        notice( t('Your registration can not be processed.') . EOL);
-                       goaway($a->get_baseurl());
+                       goaway(z_root());
                }
 
                $hash = random_string();
@@ -428,7 +428,7 @@ function register_post(&$a) {
 
                if($res) {
                        info( t('Your registration is pending approval by the site owner.') . EOL ) ;
-                       goaway($a->get_baseurl());
+                       goaway(z_root());
                }
 
        }
index 6a56963b6c8a8426ca75613b89ab46f976682250..c181ee6ea1091aad140cc0d2c498db6e02c1cbdf 100644 (file)
@@ -29,7 +29,7 @@ function removeme_post(&$a) {
 function removeme_content(&$a) {
 
        if(! local_user())
-               goaway($a->get_baseurl());
+               goaway(z_root());
 
        $hash = random_string();
 
index c6184e306c3359023c5e173ea5d6bf92b9ff58ac..f1d9707d578a245c2c6277b0926d08ff3e11876f 100644 (file)
@@ -2,7 +2,7 @@
 <XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'
      xmlns:hm='http://host-meta.net/xrd/1.0'>
  
-    <hm:Host>$domain</hm:Host>
+    <hm:Host>$zroot</hm:Host>
  
     <Link rel='lrdd' template='$domain/xrd/?uri={uri}' />
     <Link rel='acct-mgmt' href='$domain/amcd' />