$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)));
if($this->cmd === '.well-known/host-meta') {
require_once('include/hostxrd.php');
- hostxrd($this->get_baseurl());
+ hostxrd();
// NOTREACHED
}
$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')
}}
+
+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.
nuke_session();
info( t('Logged out.') . EOL);
- goaway($a->get_baseurl());
+ goaway(z_root());
}
if(x($_SESSION,'visitor_id') && (! x($_SESSION,'uid'))) {
// 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",
if(! count($r)) {
nuke_session();
- goaway($a->get_baseurl());
+ goaway(z_root());
}
// initialise user environment
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
}
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
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'];
<?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();
// somebody arrived here by mistake or they are fishing. Send them to the homepage.
- goaway($a->get_baseurl());
+ goaway(z_root());
// NOTREACHED
}
$my_id = '0:' . $dfrn_id;
break;
default:
- goaway($a->get_baseurl());
+ goaway(z_root());
break; // NOTREACHED
}
$profile = $r[0]['nickname'];
goaway((strlen($destination_url)) ? $destination_url : $a->get_baseurl() . '/profile/' . $profile);
}
- goaway($a->get_baseurl());
+ goaway(z_root());
}
$my_id = '0:' . $dfrn_id;
break;
default:
- goaway($a->get_baseurl());
+ goaway(z_root());
break; // NOTREACHED
}
$my_id = '0:' . $dfrn_id;
break;
default:
- goaway($a->get_baseurl());
+ goaway(z_root());
break; // NOTREACHED
}
if($_POST['cancel']) {
- goaway($a->get_baseurl());
+ goaway(z_root());
}
// invalid/bogus request
notice( t('Unrecoverable protocol error.') . EOL );
- goaway($a->get_baseurl());
+ goaway(z_root());
return; // NOTREACHED
}
$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')) {
$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,
$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>';
$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),
if(! count($r)) {
notice( t('No valid account found.') . EOL);
- goaway($a->get_baseurl());
+ goaway(z_root());
}
$uid = $r[0]['uid'];
. 'Content-transfer-encoding: 8bit' );
- goaway($a->get_baseurl());
+ goaway(z_root());
}
);
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'];
function notifications_post(&$a) {
if(! local_user()) {
- goaway($a->get_baseurl());
+ goaway(z_root());
}
$request_id = (($a->argc > 1) ? $a->argv[1] : 0);
if(! local_user()) {
notice( t('Permission denied.') . EOL);
- goaway($a->get_baseurl());
+ return;
}
$o = '';
$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;
if($a->config['register_policy'] != REGISTER_CLOSED)
goaway($a->get_baseurl() . '/register' . $args);
else
- goaway($a->get_baseurl());
+ goaway(z_root());
// NOTREACHED
}
);
if(! count($r)) {
notice( t('Login failed.') . EOL );
- goaway($a->get_baseurl());
+ goaway(z_root());
}
unset($_SESSION['openid']);
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
}
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'] : '');
);
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']);
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 );
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();
if($res) {
info( t('Your registration is pending approval by the site owner.') . EOL ) ;
- goaway($a->get_baseurl());
+ goaway(z_root());
}
}
function removeme_content(&$a) {
if(! local_user())
- goaway($a->get_baseurl());
+ goaway(z_root());
$hash = random_string();
<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' />