diff --git a/boot.php b/boot.php index 358e88494..ac6cbc955 100644 --- a/boot.php +++ b/boot.php @@ -21,6 +21,7 @@ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'); use Friendica\App; +use Friendica\Core\System; use Friendica\Core\Config; use Friendica\Util\Lock; @@ -551,31 +552,16 @@ function system_unavailable() { killme(); } -function clean_urls() { - $a = get_app(); - return true; -} - -function z_path() { - $base = App::get_baseurl(); - - if (!clean_urls()) { - $base .= '/?q='; - } - - return $base; -} - /** * @brief Returns the baseurl. * - * @see App::get_baseurl() + * @see System::baseUrl() * * @return string - * @TODO Maybe super-flous and deprecated? Seems to only wrap App::get_baseurl() + * @TODO Function is deprecated and only used in some addons */ function z_root() { - return App::get_baseurl(); + return System::baseUrl(); } /** @@ -628,10 +614,10 @@ function check_url(App $a) { // We will only change the url to an ip address if there is no existing setting if (!x($url)) { - $url = set_config('system', 'url', App::get_baseurl()); + $url = set_config('system', 'url', System::baseUrl()); } - if ((!link_compare($url, App::get_baseurl())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $a->get_hostname))) { - $url = set_config('system', 'url', App::get_baseurl()); + if ((!link_compare($url, System::baseUrl())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $a->get_hostname))) { + $url = set_config('system', 'url', System::baseUrl()); } return; @@ -913,7 +899,7 @@ function killme() { */ function goaway($s) { if (!strstr(normalise_link($s), "http://")) { - $s = App::get_baseurl() . "/" . $s; + $s = System::baseUrl() . "/" . $s; } header("Location: $s"); diff --git a/include/Contact.php b/include/Contact.php index f69454e39..95c7979aa 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -1,6 +1,7 @@ $contact['name'], 'cid' => $contact['id'], 'selected' => $selected, - 'micro' => App::remove_baseurl(proxy_url($contact['micro'], false, PROXY_SIZE_MICRO)), + 'micro' => System::removedBaseUrl(proxy_url($contact['micro'], false, PROXY_SIZE_MICRO)), 'id' => ++$id, ); $entries[] = $entry; diff --git a/include/NotificationsManager.php b/include/NotificationsManager.php index 57c315c9d..802d541d3 100644 --- a/include/NotificationsManager.php +++ b/include/NotificationsManager.php @@ -5,6 +5,8 @@ * or for formatting notifications */ +use Friendica\Core\System; + require_once 'include/html2plain.php'; require_once 'include/probe.php'; require_once 'include/datetime.php'; @@ -225,7 +227,7 @@ class NotificationsManager { switch ($ident) { case 'system': $default_item_label = 'notify'; - $default_item_link = $this->a->get_baseurl(true).'/notify/view/'. $it['id']; + $default_item_link = System::baseUrl(true).'/notify/view/'. $it['id']; $default_item_image = proxy_url($it['photo'], false, PROXY_SIZE_MICRO); $default_item_url = $it['url']; $default_item_text = strip_tags(bbcode($it['msg'])); @@ -235,7 +237,7 @@ class NotificationsManager { case 'home': $default_item_label = 'comment'; - $default_item_link = $this->a->get_baseurl(true).'/display/'.$it['pguid']; + $default_item_link = System::baseUrl(true).'/display/'.$it['pguid']; $default_item_image = proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO); $default_item_url = $it['author-link']; $default_item_text = sprintf(t("%s commented on %s's post"), $it['author-name'], $it['pname']); @@ -245,7 +247,7 @@ class NotificationsManager { default: $default_item_label = (($it['id'] == $it['parent']) ? 'post' : 'comment'); - $default_item_link = $this->a->get_baseurl(true).'/display/'.$it['pguid']; + $default_item_link = System::baseUrl(true).'/display/'.$it['pguid']; $default_item_image = proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO); $default_item_url = $it['author-link']; $default_item_text = (($it['id'] == $it['parent']) @@ -261,7 +263,7 @@ class NotificationsManager { case ACTIVITY_LIKE: $notif = array( 'label' => 'like', - 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], + 'link' => System::baseUrl(true).'/display/'.$it['pguid'], 'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), 'url' => $it['author-link'], 'text' => sprintf(t("%s liked %s's post"), $it['author-name'], $it['pname']), @@ -274,7 +276,7 @@ class NotificationsManager { case ACTIVITY_DISLIKE: $notif = array( 'label' => 'dislike', - 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], + 'link' => System::baseUrl(true).'/display/'.$it['pguid'], 'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), 'url' => $it['author-link'], 'text' => sprintf(t("%s disliked %s's post"), $it['author-name'], $it['pname']), @@ -287,7 +289,7 @@ class NotificationsManager { case ACTIVITY_ATTEND: $notif = array( 'label' => 'attend', - 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], + 'link' => System::baseUrl(true).'/display/'.$it['pguid'], 'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), 'url' => $it['author-link'], 'text' => sprintf(t("%s is attending %s's event"), $it['author-name'], $it['pname']), @@ -300,7 +302,7 @@ class NotificationsManager { case ACTIVITY_ATTENDNO: $notif = array( 'label' => 'attendno', - 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], + 'link' => System::baseUrl(true).'/display/'.$it['pguid'], 'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), 'url' => $it['author-link'], 'text' => sprintf( t("%s is not attending %s's event"), $it['author-name'], $it['pname']), @@ -313,7 +315,7 @@ class NotificationsManager { case ACTIVITY_ATTENDMAYBE: $notif = array( 'label' => 'attendmaybe', - 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], + 'link' => System::baseUrl(true).'/display/'.$it['pguid'], 'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), 'url' => $it['author-link'], 'text' => sprintf(t("%s may attend %s's event"), $it['author-name'], $it['pname']), @@ -330,7 +332,7 @@ class NotificationsManager { $notif = array( 'label' => 'friend', - 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], + 'link' => System::baseUrl(true).'/display/'.$it['pguid'], 'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), 'url' => $it['author-link'], 'text' => sprintf(t("%s is now friends with %s"), $it['author-name'], $it['fname']), @@ -508,7 +510,7 @@ class NotificationsManager { * @return string The additional sql query */ private function _personal_sql_extra() { - $myurl = $this->a->get_baseurl(true) . '/profile/'. $this->a->user['nickname']; + $myurl = System::baseUrl(true) . '/profile/'. $this->a->user['nickname']; $myurl = substr($myurl,strpos($myurl,'://')+3); $myurl = str_replace(array('www.','.'),array('','\\.'),$myurl); $diasp_url = str_replace('/profile/','/u/',$myurl); diff --git a/include/Photo.php b/include/Photo.php index 5c3a52ffd..f02ee130a 100644 --- a/include/Photo.php +++ b/include/Photo.php @@ -5,6 +5,7 @@ */ use Friendica\App; +use Friendica\Core\System; require_once("include/photos.php"); @@ -857,9 +858,9 @@ function import_profile_photo($photo, $uid, $cid, $quit_on_error = false) { $suffix = '?ts='.time(); - $photo = App::get_baseurl() . '/photo/' . $hash . '-4.' . $img->getExt() . $suffix; - $thumb = App::get_baseurl() . '/photo/' . $hash . '-5.' . $img->getExt() . $suffix; - $micro = App::get_baseurl() . '/photo/' . $hash . '-6.' . $img->getExt() . $suffix; + $photo = System::baseUrl() . '/photo/' . $hash . '-4.' . $img->getExt() . $suffix; + $thumb = System::baseUrl() . '/photo/' . $hash . '-5.' . $img->getExt() . $suffix; + $micro = System::baseUrl() . '/photo/' . $hash . '-6.' . $img->getExt() . $suffix; // Remove the cached photo $a = get_app(); @@ -888,9 +889,9 @@ function import_profile_photo($photo, $uid, $cid, $quit_on_error = false) { } if ($photo_failure) { - $photo = App::get_baseurl() . '/images/person-175.jpg'; - $thumb = App::get_baseurl() . '/images/person-80.jpg'; - $micro = App::get_baseurl() . '/images/person-48.jpg'; + $photo = System::baseUrl() . '/images/person-175.jpg'; + $thumb = System::baseUrl() . '/images/person-80.jpg'; + $micro = System::baseUrl() . '/images/person-48.jpg'; } return(array($photo,$thumb,$micro)); @@ -1079,18 +1080,18 @@ function store_photo(App $a, $uid, $imagedata = "", $url = "") { return(array()); } - $image = array("page" => App::get_baseurl().'/photos/'.$page_owner_nick.'/image/'.$hash, - "full" => App::get_baseurl()."/photo/{$hash}-0.".$ph->getExt()); + $image = array("page" => System::baseUrl().'/photos/'.$page_owner_nick.'/image/'.$hash, + "full" => System::baseUrl()."/photo/{$hash}-0.".$ph->getExt()); if ($width > 800 || $height > 800) { - $image["large"] = App::get_baseurl()."/photo/{$hash}-0.".$ph->getExt(); + $image["large"] = System::baseUrl()."/photo/{$hash}-0.".$ph->getExt(); } if ($width > 640 || $height > 640) { $ph->scaleImage(640); $r = $ph->store($uid, $visitor, $hash, $tempfile, t('Wall Photos'), 1, 0, $defperm); if ($r) { - $image["medium"] = App::get_baseurl()."/photo/{$hash}-1.".$ph->getExt(); + $image["medium"] = System::baseUrl()."/photo/{$hash}-1.".$ph->getExt(); } } @@ -1098,7 +1099,7 @@ function store_photo(App $a, $uid, $imagedata = "", $url = "") { $ph->scaleImage(320); $r = $ph->store($uid, $visitor, $hash, $tempfile, t('Wall Photos'), 2, 0, $defperm); if ($r) { - $image["small"] = App::get_baseurl()."/photo/{$hash}-2.".$ph->getExt(); + $image["small"] = System::baseUrl()."/photo/{$hash}-2.".$ph->getExt(); } } @@ -1123,7 +1124,7 @@ function store_photo(App $a, $uid, $imagedata = "", $url = "") { $r = $ph->store($uid, $visitor, $hash, $tempfile, t('Wall Photos'), 3, 0, $defperm); if ($r) { - $image["thumb"] = App::get_baseurl()."/photo/{$hash}-3.".$ph->getExt(); + $image["thumb"] = System::baseUrl()."/photo/{$hash}-3.".$ph->getExt(); } } diff --git a/include/Smilies.php b/include/Smilies.php index 9264a09d8..d63511cd1 100644 --- a/include/Smilies.php +++ b/include/Smilies.php @@ -6,6 +6,7 @@ */ use Friendica\App; +use Friendica\Core\System; /** * This class contains functions to handle smiles @@ -86,41 +87,41 @@ class Smilies { ); $icons = array( - '<3', - '</3', - '<\\3', - ':-)', - ';-)', - ':-(', - ':-P', - ':-p', - ':-\', - ':-\', - ':-x', - ':-X', - ':-D', - '8-|', - '8-O', - ':-O', - '\\o/', - 'o.O', - 'O.o', - 'o_O', - 'O_o', - ':\'(', - ':-!', - ':-/', - ':-[', - '8-)', - ':beer', - ':homebrew', - ':coffee', - ':facepalm', - ':like', - ':dislike', - '~friendica ~friendica', - 'redred#matrix', - 'redred#matrixmatrix' + '<3', + '</3', + '<\\3', + ':-)', + ';-)', + ':-(', + ':-P', + ':-p', + ':-\', + ':-\', + ':-x', + ':-X', + ':-D', + '8-|', + '8-O', + ':-O', + '\\o/', + 'o.O', + 'O.o', + 'o_O', + 'O_o', + ':\'(', + ':-!', + ':-/', + ':-[', + '8-)', + ':beer', + ':homebrew', + ':coffee', + ':facepalm', + ':like', + ':dislike', + '~friendica ~friendica', + 'redred#matrix', + 'redred#matrixmatrix' ); $params = array('texts' => $texts, 'icons' => $icons); @@ -209,7 +210,7 @@ class Smilies { return $x[0]; $t = ''; for($cnt = 0; $cnt < strlen($x[1]); $cnt ++) - $t .= '<3'; + $t .= '<3'; $r = str_replace($x[0],$t,$x[0]); return $r; } diff --git a/include/api.php b/include/api.php index 16ff0f4a0..62e874145 100644 --- a/include/api.php +++ b/include/api.php @@ -7,6 +7,7 @@ */ use Friendica\App; +use Friendica\Core\System; use Friendica\Core\Config; require_once 'include/HTTPExceptions.php'; @@ -96,7 +97,7 @@ $called_api = null; * * Register a function to be the endpont for defined API path. * - * @param string $path API URL path, relative to App::get_baseurl() + * @param string $path API URL path, relative to System::baseUrl() * @param string $func Function name to call on path request * @param bool $auth API need logged user * @param string $method HTTP method reqiured to call this endpoint. @@ -436,12 +437,12 @@ $called_api = null; $arr['$user'] = $user_info; $arr['$rss'] = array( 'alternate' => $user_info['url'], - 'self' => App::get_baseurl() . "/" . $a->query_string, - 'base' => App::get_baseurl(), + 'self' => System::baseUrl() . "/" . $a->query_string, + 'base' => System::baseUrl(), 'updated' => api_date(null), 'atom_updated' => datetime_convert('UTC', 'UTC', 'now', ATOM_TIME), 'language' => $user_info['language'], - 'logo' => App::get_baseurl() . "/images/friendica-32.png", + 'logo' => System::baseUrl() . "/images/friendica-32.png", ); return $arr; @@ -754,7 +755,7 @@ $called_api = null; 'statusnet_blocking' => false, 'notifications' => false, /// @TODO old way? - //'statusnet_profile_url' => App::get_baseurl()."/contacts/".$uinfo[0]['cid'], + //'statusnet_profile_url' => System::baseUrl()."/contacts/".$uinfo[0]['cid'], 'statusnet_profile_url' => $uinfo[0]['url'], 'uid' => intval($uinfo[0]['uid']), 'cid' => intval($uinfo[0]['cid']), @@ -1164,8 +1165,8 @@ $called_api = null; if (dbm::is_result($r)) { $phototypes = Photo::supportedTypes(); $ext = $phototypes[$r[0]['type']]; - $_REQUEST['body'] .= "\n\n" . '[url=' . App::get_baseurl() . '/photos/' . $r[0]['nickname'] . '/image/' . $r[0]['resource-id'] . ']'; - $_REQUEST['body'] .= '[img]' . App::get_baseurl() . '/photo/' . $r[0]['resource-id'] . '-' . $r[0]['scale'] . '.' . $ext . '[/img][/url]'; + $_REQUEST['body'] .= "\n\n" . '[url=' . System::baseUrl() . '/photos/' . $r[0]['nickname'] . '/image/' . $r[0]['resource-id'] . ']'; + $_REQUEST['body'] .= '[img]' . System::baseUrl() . '/photo/' . $r[0]['resource-id'] . '-' . $r[0]['scale'] . '.' . $ext . '[/img][/url]'; } } @@ -1929,7 +1930,7 @@ $called_api = null; $start = $page * $count; // Ugly code - should be changed - $myurl = App::get_baseurl() . '/profile/'. $a->user['nickname']; + $myurl = System::baseUrl() . '/profile/'. $a->user['nickname']; $myurl = substr($myurl,strpos($myurl, '://') + 3); //$myurl = str_replace(array('www.','.'),array('','\\.'),$myurl); $myurl = str_replace('www.', '', $myurl); @@ -2494,7 +2495,7 @@ $called_api = null; $text = preg_replace_callback( "|data:image/([^;]+)[^=]+=*|m", function($match) use ($item) { - return App::get_baseurl()."/display/".$item['guid']; + return System::baseUrl()."/display/".$item['guid']; }, $text); return $text; @@ -2911,7 +2912,7 @@ $called_api = null; $name = $a->config['sitename']; $server = $a->get_hostname(); - $logo = App::get_baseurl() . '/images/friendica-64.png'; + $logo = System::baseUrl() . '/images/friendica-64.png'; $email = $a->config['admin_email']; $closed = (($a->config['register_policy'] == REGISTER_CLOSED) ? 'true' : 'false'); $private = ((Config::get('system', 'block_public')) ? 'true' : 'false'); @@ -2920,7 +2921,7 @@ $called_api = null; $texlimit = string($a->config['api_import_size']); } $ssl = ((Config::get('system', 'have_ssl')) ? 'true' : 'false'); - $sslserver = (($ssl === 'true') ? str_replace('http:','https:',App::get_baseurl()) : ''); + $sslserver = (($ssl === 'true') ? str_replace('http:','https:',System::baseUrl()) : ''); $config = array( 'site' => array('name' => $name,'server' => $server, 'theme' => 'default', 'path' => '', @@ -3422,7 +3423,7 @@ $called_api = null; $photo['album'] = $rr['album']; $photo['filename'] = $rr['filename']; $photo['type'] = $rr['type']; - $thumb = App::get_baseurl() . "/photo/" . $rr['resource-id'] . "-" . $rr['scale'] . "." . $typetoext[$rr['type']]; + $thumb = System::baseUrl() . "/photo/" . $rr['resource-id'] . "-" . $rr['scale'] . "." . $typetoext[$rr['type']]; $photo['created'] = $rr['created']; $photo['edited'] = $rr['edited']; $photo['desc'] = $rr['desc']; @@ -3720,15 +3721,15 @@ $called_api = null; ); $r = q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `self` AND `uid` = %d", - dbesc(App::get_baseurl() . '/photo/' . $data['photo']['id'] . '-4.' . $fileext), - dbesc(App::get_baseurl() . '/photo/' . $data['photo']['id'] . '-5.' . $fileext), - dbesc(App::get_baseurl() . '/photo/' . $data['photo']['id'] . '-6.' . $fileext), + dbesc(System::baseUrl() . '/photo/' . $data['photo']['id'] . '-4.' . $fileext), + dbesc(System::baseUrl() . '/photo/' . $data['photo']['id'] . '-5.' . $fileext), + dbesc(System::baseUrl() . '/photo/' . $data['photo']['id'] . '-6.' . $fileext), intval(local_user()) ); } else { $r = q("UPDATE `profile` SET `photo` = '%s', `thumb` = '%s' WHERE `id` = %d AND `uid` = %d", - dbesc(App::get_baseurl() . '/photo/' . $data['photo']['id'] . '-4.' . $filetype), - dbesc(App::get_baseurl() . '/photo/' . $data['photo']['id'] . '-5.' . $filetype), + dbesc(System::baseUrl() . '/photo/' . $data['photo']['id'] . '-4.' . $filetype), + dbesc(System::baseUrl() . '/photo/' . $data['photo']['id'] . '-5.' . $filetype), intval($_REQUEST['profile']), intval(local_user()) ); @@ -3744,7 +3745,7 @@ $called_api = null; // Update global directory in background //$user = api_get_user(get_app()); - $url = App::get_baseurl() . '/profile/' . get_app()->user['nickname']; + $url = System::baseUrl() . '/profile/' . get_app()->user['nickname']; if ($url && strlen(get_config('system', 'directory'))) { proc_run(PRIORITY_LOW, "include/directory.php", $url); } @@ -3973,8 +3974,8 @@ $called_api = null; ); // adds link to the thumbnail scale photo - $arr['body'] = '[url=' . App::get_baseurl() . '/photos/' . $owner_record[0]['name'] . '/image/' . $hash . ']' - . '[img]' . App::get_baseurl() . '/photo/' . $hash . '-' . "2" . '.'. $typetoext[$filetype] . '[/img]' + $arr['body'] = '[url=' . System::baseUrl() . '/photos/' . $owner_record[0]['name'] . '/image/' . $hash . ']' + . '[img]' . System::baseUrl() . '/photo/' . $hash . '-' . "2" . '.'. $typetoext[$filetype] . '[/img]' . '[/url]'; // do the magic for storing the item in the database and trigger the federation to other contacts @@ -4017,14 +4018,14 @@ $called_api = null; for ($k = intval($data['photo']['minscale']); $k <= intval($data['photo']['maxscale']); $k++) { $data['photo']['links'][$k . ":link"]["@attributes"] = array("type" => $data['photo']['type'], "scale" => $k, - "href" => App::get_baseurl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . "." . $typetoext[$data['photo']['type']]); + "href" => System::baseUrl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . "." . $typetoext[$data['photo']['type']]); } } else { $data['photo']['link'] = array(); // when we have profile images we could have only scales from 4 to 6, but index of array always needs to start with 0 $i = 0; for ($k = intval($data['photo']['minscale']); $k <= intval($data['photo']['maxscale']); $k++) { - $data['photo']['link'][$i] = App::get_baseurl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . "." . $typetoext[$data['photo']['type']]; + $data['photo']['link'][$i] = System::baseUrl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . "." . $typetoext[$data['photo']['type']]; $i++; } } diff --git a/include/auth.php b/include/auth.php index d301f8705..f220e1685 100644 --- a/include/auth.php +++ b/include/auth.php @@ -1,6 +1,7 @@ hash != cookie_hash($r[0])) { logger("Hash for user ".$data->uid." doesn't fit."); nuke_session(); - goaway(z_root()); + goaway(System::baseUrl()); } // Renew the cookie @@ -50,7 +51,7 @@ if (isset($_SESSION) && x($_SESSION,'authenticated') && (!x($_POST,'auth-params' call_hooks("logging_out"); nuke_session(); info(t('Logged out.').EOL); - goaway(z_root()); + goaway(System::baseUrl()); } if (x($_SESSION,'visitor_id') && !x($_SESSION,'uid')) { @@ -72,7 +73,7 @@ if (isset($_SESSION) && x($_SESSION,'authenticated') && (!x($_POST,'auth-params' logger('Session address changed. Paranoid setting in effect, blocking session. '. $_SESSION['addr'].' != '.$_SERVER['REMOTE_ADDR']); nuke_session(); - goaway(z_root()); + goaway(System::baseUrl()); } $r = q("SELECT `user`.*, `user`.`pubkey` as `upubkey`, `user`.`prvkey` as `uprvkey` @@ -82,7 +83,7 @@ if (isset($_SESSION) && x($_SESSION,'authenticated') && (!x($_POST,'auth-params' if (!dbm::is_result($r)) { nuke_session(); - goaway(z_root()); + goaway(System::baseUrl()); } // Make sure to refresh the last login time for the user if the user @@ -121,7 +122,7 @@ if (isset($_SESSION) && x($_SESSION,'authenticated') && (!x($_POST,'auth-params' if ($noid || strpos($temp_string,'@') || !validate_url($temp_string)) { $a = get_app(); notice(t('Login failed.').EOL); - goaway(z_root()); + goaway(System::baseUrl()); // NOTREACHED } @@ -133,7 +134,7 @@ if (isset($_SESSION) && x($_SESSION,'authenticated') && (!x($_POST,'auth-params' $openid->identity = $openid_url; $_SESSION['openid'] = $openid_url; $_SESSION['remember'] = $_POST['remember']; - $openid->returnUrl = App::get_baseurl(true).'/openid'; + $openid->returnUrl = System::baseUrl(true).'/openid'; goaway($openid->authUrl()); } catch (Exception $e) { notice(t('We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID.').'

'.t('The error message was:').' '.$e->getMessage()); @@ -183,7 +184,7 @@ if (isset($_SESSION) && x($_SESSION,'authenticated') && (!x($_POST,'auth-params' if (!$record || !count($record)) { logger('authenticate: failed login attempt: '.notags(trim($_POST['username'])).' from IP '.$_SERVER['REMOTE_ADDR']); notice(t('Login failed.').EOL); - goaway(z_root()); + goaway(System::baseUrl()); } if (! $_POST['remember']) { diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 832dab7e8..20309b9d2 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -1,6 +1,7 @@ acct:$1@$2', $Text); + $Text = preg_replace('/acct:([^@]+)@((?!\-)(?:[a-zA-Z\d\-]{0,62}[a-zA-Z\d]\.){1,126}(?!\d+)[a-zA-Z\d]{1,63})/', 'acct:$1@$2', $Text); // Perform MAIL Search $Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '$1', $Text); @@ -1192,9 +1193,9 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa return bb_ShareAttributes($match, $simplehtml); }, $Text); - $Text = preg_replace("/\[crypt\](.*?)\[\/crypt\]/ism", '
' . t('Encrypted content') . '
', $Text); - $Text = preg_replace("/\[crypt(.*?)\](.*?)\[\/crypt\]/ism", '
' . t('Encrypted content') . '
', $Text); - //$Text = preg_replace("/\[crypt=(.*?)\](.*?)\[\/crypt\]/ism", '
' . t('Encrypted content') . '
', $Text); + $Text = preg_replace("/\[crypt\](.*?)\[\/crypt\]/ism", '
' . t('Encrypted content') . '
', $Text); + $Text = preg_replace("/\[crypt(.*?)\](.*?)\[\/crypt\]/ism", '
' . t('Encrypted content') . '
', $Text); + //$Text = preg_replace("/\[crypt=(.*?)\](.*?)\[\/crypt\]/ism", '
' . t('Encrypted content') . '
', $Text); // Try to Oembed if ($tryoembed) { diff --git a/include/contact_widgets.php b/include/contact_widgets.php index 2bc1e89f5..b359781ff 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -1,6 +1,7 @@ sprintf( tt("%d contact in common", "%d contacts in common", $t), $t), - '$base' => App::get_baseurl(), + '$base' => System::baseUrl(), '$uid' => $profile_uid, '$cid' => (($cid) ? $cid : '0'), '$linkmore' => (($t > 5) ? 'true' : ''), diff --git a/include/conversation.php b/include/conversation.php index 4f40bc288..8d3ee98a2 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1,6 +1,7 @@ $profile_name_e, 'sparkle' => $sparkle, 'lock' => $lock, - 'thumb' => App::remove_baseurl(proxy_url($item['author-thumb'], false, PROXY_SIZE_THUMB)), + 'thumb' => System::removedBaseUrl(proxy_url($item['author-thumb'], false, PROXY_SIZE_THUMB)), 'title' => $item['title_e'], 'body' => $body_e, 'tags' => $tags_e, @@ -818,7 +819,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { 'indent' => '', 'owner_name' => $owner_name_e, 'owner_url' => $owner_url, - 'owner_photo' => App::remove_baseurl(proxy_url($item['owner-thumb'], false, PROXY_SIZE_THUMB)), + 'owner_photo' => System::removedBaseUrl(proxy_url($item['owner-thumb'], false, PROXY_SIZE_THUMB)), 'plink' => get_plink($item), 'edpost' => false, 'isstarred' => $isstarred, @@ -905,7 +906,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { } $o = replace_macros($page_template, array( - '$baseurl' => App::get_baseurl($ssl_state), + '$baseurl' => System::baseUrl($ssl_state), '$return_path' => $a->query_string, '$live_update' => $live_update_div, '$remove' => t('remove'), @@ -1225,7 +1226,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) { $tpl = get_markup_template('jot-header.tpl'); $a->page['htmlhead'] .= replace_macros($tpl, array( '$newpost' => 'true', - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), '$geotag' => $geotag, '$nickname' => $x['nickname'], '$ispublic' => t('Visible to everybody'), @@ -1241,7 +1242,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) { $tpl = get_markup_template('jot-end.tpl'); $a->page['end'] .= replace_macros($tpl, array( '$newpost' => 'true', - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), '$geotag' => $geotag, '$nickname' => $x['nickname'], '$ispublic' => t('Visible to everybody'), @@ -1309,7 +1310,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) { '$ptyp' => (($notes_cid) ? 'note' : 'wall'), '$content' => $x['content'], '$post_id' => $x['post_id'], - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), '$defloc' => $x['default_location'], '$visitor' => $x['visitor'], '$pvisit' => (($notes_cid) ? 'none' : $x['visitor']), diff --git a/include/dbstructure.php b/include/dbstructure.php index fea88c9d3..a2599fc39 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -1,6 +1,7 @@ $a->config['sitename'], - '$siteurl' => App::get_baseurl(), + '$siteurl' => System::baseUrl(), '$update' => DB_UPDATE_VERSION, '$error' => sprintf(t('Update %s failed. See error logs.'), DB_UPDATE_VERSION) )); - $subject=sprintf(t('Update Error at %s'), App::get_baseurl()); + $subject=sprintf(t('Update Error at %s'), System::baseUrl()); require_once('include/email.php'); $subject = email_header_encode($subject,'UTF-8'); mail($a->config['admin_email'], $subject, $email_msg, diff --git a/include/delivery.php b/include/delivery.php index 05fba7985..f95caed29 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -1,6 +1,7 @@ setAttribute("xmlns:ostatus", NAMESPACE_OSTATUS); $root->setAttribute("xmlns:statusnet", NAMESPACE_STATUSNET); - xml::add_element($doc, $root, "id", App::get_baseurl()."/profile/".$owner["nick"]); + xml::add_element($doc, $root, "id", System::baseUrl()."/profile/".$owner["nick"]); xml::add_element($doc, $root, "title", $owner["name"]); $attributes = array("uri" => "https://friendi.ca", "version" => FRIENDICA_VERSION."-".DB_UPDATE_VERSION); @@ -506,13 +507,13 @@ class dfrn { // DFRN itself doesn't uses this. But maybe someone else wants to subscribe to the public feed. ostatus::hublinks($doc, $root, $owner["nick"]); - $attributes = array("rel" => "salmon", "href" => App::get_baseurl()."/salmon/".$owner["nick"]); + $attributes = array("rel" => "salmon", "href" => System::baseUrl()."/salmon/".$owner["nick"]); xml::add_element($doc, $root, "link", "", $attributes); - $attributes = array("rel" => "http://salmon-protocol.org/ns/salmon-replies", "href" => App::get_baseurl()."/salmon/".$owner["nick"]); + $attributes = array("rel" => "http://salmon-protocol.org/ns/salmon-replies", "href" => System::baseUrl()."/salmon/".$owner["nick"]); xml::add_element($doc, $root, "link", "", $attributes); - $attributes = array("rel" => "http://salmon-protocol.org/ns/salmon-mention", "href" => App::get_baseurl()."/salmon/".$owner["nick"]); + $attributes = array("rel" => "http://salmon-protocol.org/ns/salmon-mention", "href" => System::baseUrl()."/salmon/".$owner["nick"]); xml::add_element($doc, $root, "link", "", $attributes); } @@ -569,7 +570,7 @@ class dfrn { } xml::add_element($doc, $author, "name", $owner["name"], $attributes); - xml::add_element($doc, $author, "uri", App::get_baseurl().'/profile/'.$owner["nickname"], $attributes); + xml::add_element($doc, $author, "uri", System::baseUrl().'/profile/'.$owner["nickname"], $attributes); xml::add_element($doc, $author, "dfrn:handle", $owner["addr"], $attributes); $attributes = array("rel" => "photo", "type" => "image/jpeg", @@ -870,13 +871,13 @@ class dfrn { $parent = q("SELECT `guid` FROM `item` WHERE `id` = %d", intval($item["parent"])); $parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']); $attributes = array("ref" => $parent_item, "type" => "text/html", - "href" => App::get_baseurl().'/display/'.$parent[0]['guid'], + "href" => System::baseUrl().'/display/'.$parent[0]['guid'], "dfrn:diaspora_guid" => $parent[0]['guid']); xml::add_element($doc, $entry, "thr:in-reply-to", "", $attributes); } // Add conversation data. This is used for OStatus - $conversation_href = App::get_baseurl()."/display/".$owner["nick"]."/".$item["parent"]; + $conversation_href = System::baseUrl()."/display/".$owner["nick"]."/".$item["parent"]; $conversation_uri = $conversation_href; if (isset($parent_item)) { @@ -912,7 +913,7 @@ class dfrn { // We save this value in "plink". Maybe we should read it from there as well? xml::add_element($doc, $entry, "link", "", array("rel" => "alternate", "type" => "text/html", - "href" => App::get_baseurl()."/display/".$item["guid"])); + "href" => System::baseUrl()."/display/".$item["guid"])); // "comment-allow" is some old fashioned stuff for old Friendica versions. // It is included in the rewritten code for completeness @@ -1797,7 +1798,7 @@ class dfrn { "to_email" => $importer["email"], "uid" => $importer["importer_uid"], "item" => $suggest, - "link" => App::get_baseurl()."/notifications/intros", + "link" => System::baseUrl()."/notifications/intros", "source_name" => $importer["name"], "source_link" => $importer["url"], "source_photo" => $importer["photo"], @@ -2103,7 +2104,7 @@ class dfrn { } } - if ($Blink && link_compare($Blink, App::get_baseurl() . "/profile/" . $importer["nickname"])) { + if ($Blink && link_compare($Blink, System::baseUrl() . "/profile/" . $importer["nickname"])) { // send a notification notification(array( @@ -2114,7 +2115,7 @@ class dfrn { "to_email" => $importer["email"], "uid" => $importer["importer_uid"], "item" => $item, - "link" => App::get_baseurl()."/display/".urlencode(get_item_guid($posted_id)), + "link" => System::baseUrl()."/display/".urlencode(get_item_guid($posted_id)), "source_name" => stripslashes($item["author-name"]), "source_link" => $item["author-link"], "source_photo" => ((link_compare($item["author-link"],$importer["url"])) diff --git a/include/diaspora.php b/include/diaspora.php index 3d0726832..4cc177a15 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -9,6 +9,7 @@ */ use Friendica\App; +use Friendica\Core\System; use Friendica\Core\Config; require_once 'include/items.php'; @@ -1654,7 +1655,7 @@ class Diaspora { $ulink = "[url=".$contact["url"]."]".$contact["name"]."[/url]"; $alink = "[url=".$parent_item["author-link"]."]".$parent_item["author-name"]."[/url]"; - $plink = "[url=".App::get_baseurl()."/display/".urlencode($guid)."]".t("status")."[/url]"; + $plink = "[url=".System::baseUrl()."/display/".urlencode($guid)."]".t("status")."[/url]"; return sprintf($bodyverb, $ulink, $alink, $plink); } @@ -1669,7 +1670,7 @@ class Diaspora { */ private static function construct_like_object($importer, $parent_item) { $objtype = ACTIVITY_OBJ_NOTE; - $link = ''; + $link = ''; $parent_body = $parent_item["body"]; $xmldata = array("object" => array("type" => $objtype, @@ -2363,7 +2364,7 @@ class Diaspora { return false; } - $orig_url = App::get_baseurl()."/display/".$original_item["guid"]; + $orig_url = System::baseUrl()."/display/".$original_item["guid"]; $datarray = array(); @@ -2653,7 +2654,7 @@ class Diaspora { $nick = $contact["nick"]; } - return $nick."@".substr(App::get_baseurl(), strpos(App::get_baseurl(),"://") + 3); + return $nick."@".substr(System::baseUrl(), strpos(System::baseUrl(),"://") + 3); } @@ -3620,9 +3621,9 @@ class Diaspora { $first = ((strpos($profile['name'],' ') ? trim(substr($profile['name'],0,strpos($profile['name'],' '))) : $profile['name'])); $last = (($first === $profile['name']) ? '' : trim(substr($profile['name'], strlen($first)))); - $large = App::get_baseurl().'/photo/custom/300/'.$profile['uid'].'.jpg'; - $medium = App::get_baseurl().'/photo/custom/100/'.$profile['uid'].'.jpg'; - $small = App::get_baseurl().'/photo/custom/50/' .$profile['uid'].'.jpg'; + $large = System::baseUrl().'/photo/custom/300/'.$profile['uid'].'.jpg'; + $medium = System::baseUrl().'/photo/custom/100/'.$profile['uid'].'.jpg'; + $small = System::baseUrl().'/photo/custom/50/' .$profile['uid'].'.jpg'; $searchable = (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false'); if ($searchable === 'true') { diff --git a/include/enotify.php b/include/enotify.php index 3b5672dcd..62328c01f 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -1,6 +1,7 @@ config['sitename']; if (!x($a->config['admin_name'])) @@ -66,7 +67,7 @@ function notification($params) { $additional_mail_header .= "X-Friendica-Platform: ".FRIENDICA_PLATFORM."\n"; $additional_mail_header .= "X-Friendica-Version: ".FRIENDICA_VERSION."\n"; $additional_mail_header .= "List-ID: \n"; - $additional_mail_header .= "List-Archive: <".App::get_baseurl()."/notifications/system>\n"; + $additional_mail_header .= "List-Archive: <".System::baseUrl()."/notifications/system>\n"; if (array_key_exists('item', $params)) { $title = $params['item']['title']; @@ -502,7 +503,7 @@ function notification($params) { } - $itemlink = App::get_baseurl().'/notify/view/'.$notify_id; + $itemlink = System::baseUrl().'/notify/view/'.$notify_id; $msg = replace_macros($epreamble, array('$itemlink' => $itemlink)); $msg_cache = format_notification_message($datarray['name_cache'], strip_tags(bbcode($msg))); $r = q("UPDATE `notify` SET `msg` = '%s', `msg_cache` = '%s' WHERE `id` = %d AND `uid` = %d", @@ -673,7 +674,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") { $profiles[] = $owner[0]["url"]; // Notifications from Diaspora are often with an URL in the Diaspora format - $profiles[] = App::get_baseurl()."/u/".$user[0]["nickname"]; + $profiles[] = System::baseUrl()."/u/".$user[0]["nickname"]; $profiles2 = array(); @@ -727,7 +728,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") { $params["to_email"] = $user[0]["email"]; $params["item"] = $item[0]; $params["parent"] = $item[0]["parent"]; - $params["link"] = App::get_baseurl().'/display/'.urlencode($item[0]["guid"]); + $params["link"] = System::baseUrl().'/display/'.urlencode($item[0]["guid"]); $params["otype"] = 'item'; $params["source_name"] = $item[0]["author-name"]; $params["source_link"] = $item[0]["author-link"]; diff --git a/include/event.php b/include/event.php index e5f19deda..7840032c7 100644 --- a/include/event.php +++ b/include/event.php @@ -5,6 +5,7 @@ */ use Friendica\App; +use Friendica\Core\System; require_once 'include/bbcode.php'; require_once 'include/map.php'; @@ -372,7 +373,7 @@ function event_store($arr) { intval($arr['uid']) ); //if (dbm::is_result($r)) - // $plink = App::get_baseurl() . '/display/' . $r[0]['nickname'] . '/' . $item_id; + // $plink = System::baseUrl() . '/display/' . $r[0]['nickname'] . '/' . $item_id; if ($item_id) { @@ -589,8 +590,8 @@ function process_events($arr) { // Show edit and drop actions only if the user is the owner of the event and the event // is a real event (no bithdays) if (local_user() && local_user() == $rr['uid'] && $rr['type'] == 'event') { - $edit = ((! $rr['cid']) ? array(App::get_baseurl() . '/events/event/' . $rr['id'], t('Edit event'), '', '') : null); - $drop = array(App::get_baseurl() . '/events/drop/' . $rr['id'], t('Delete event'), '', ''); + $edit = ((! $rr['cid']) ? array(System::baseUrl() . '/events/event/' . $rr['id'], t('Edit event'), '', '') : null); + $drop = array(System::baseUrl() . '/events/drop/' . $rr['id'], t('Delete event'), '', ''); } $title = strip_tags(html_entity_decode(bbcode($rr['summary']), ENT_QUOTES, 'UTF-8')); diff --git a/include/follow.php b/include/follow.php index 711579ff5..48e23bff6 100644 --- a/include/follow.php +++ b/include/follow.php @@ -1,6 +1,7 @@ path)) { - $myaddr = bin2hex(App::get_baseurl() . '/profile/' . $a->user['nickname']); + $myaddr = bin2hex(System::baseUrl() . '/profile/' . $a->user['nickname']); } else { $myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname()); } diff --git a/include/identity.php b/include/identity.php index bc18319b2..3686b23d2 100644 --- a/include/identity.php +++ b/include/identity.php @@ -4,6 +4,7 @@ */ use Friendica\App; +use Friendica\Core\System; require_once 'include/ForumManager.php'; require_once 'include/bbcode.php'; @@ -242,7 +243,7 @@ function profile_sidebar($profile, $block = 0) { if (isset($profile["url"])) { $profile_url = normalise_link($profile["url"]); } else { - $profile_url = normalise_link(App::get_baseurl()."/profile/".$profile["nickname"]); + $profile_url = normalise_link(System::baseUrl()."/profile/".$profile["nickname"]); } if (dba::exists('contact', array('pending' => false, 'uid' => local_user(), 'nurl' => $profile_url))) { @@ -289,7 +290,7 @@ function profile_sidebar($profile, $block = 0) { // show edit profile to yourself if (!$is_contact && $profile['uid'] == local_user() && feature_enabled(local_user(),'multi_profiles')) { - $profile['edit'] = array(App::get_baseurl(). '/profiles', t('Profiles'),"", t('Manage/edit profiles')); + $profile['edit'] = array(System::baseUrl(). '/profiles', t('Profiles'),"", t('Manage/edit profiles')); $r = q("SELECT * FROM `profile` WHERE `uid` = %d", local_user()); @@ -318,7 +319,7 @@ function profile_sidebar($profile, $block = 0) { } } if (!$is_contact && $profile['uid'] == local_user() && !feature_enabled(local_user(),'multi_profiles')) { - $profile['edit'] = array(App::get_baseurl(). '/profiles/'.$profile['id'], t('Edit profile'),"", t('Edit profile')); + $profile['edit'] = array(System::baseUrl(). '/profiles/'.$profile['id'], t('Edit profile'),"", t('Edit profile')); $profile['menu'] = array( 'chg_photo' => t('Change profile photo'), 'cr_new' => null, @@ -359,7 +360,7 @@ function profile_sidebar($profile, $block = 0) { if ($profile['guid'] != "") $diaspora = array( 'guid' => $profile['guid'], - 'podloc' => App::get_baseurl(), + 'podloc' => System::baseUrl(), 'searchable' => (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' ), 'nickname' => $profile['nickname'], 'fullname' => $profile['name'], @@ -509,7 +510,7 @@ function get_birthdays() { $url = $rr['url']; if ($rr['network'] === NETWORK_DFRN) { $sparkle = " sparkle"; - $url = App::get_baseurl() . '/redir/' . $rr['cid']; + $url = System::baseUrl() . '/redir/' . $rr['cid']; } $rr['link'] = $url; @@ -523,7 +524,7 @@ function get_birthdays() { } $tpl = get_markup_template("birthdays_reminder.tpl"); return replace_macros($tpl, array( - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), '$classtoday' => $classtoday, '$count' => $total, '$event_reminders' => t('Birthday Reminders'), @@ -611,7 +612,7 @@ function get_events() { } $tpl = get_markup_template("events_reminder.tpl"); return replace_macros($tpl, array( - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), '$classtoday' => $classtoday, '$count' => count($r), '$event_reminders' => t('Event Reminders'), @@ -751,7 +752,7 @@ function advanced_profile(App $a) { } if ($a->profile['uid'] == local_user()) { - $profile['edit'] = array(App::get_baseurl(). '/profiles/'.$a->profile['id'], t('Edit profile'),"", t('Edit profile')); + $profile['edit'] = array(System::baseUrl(). '/profiles/'.$a->profile['id'], t('Edit profile'),"", t('Edit profile')); } return replace_macros($tpl, array( @@ -776,7 +777,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null) { $tab = notags(trim($_GET['tab'])); } - $url = App::get_baseurl() . '/profile/' . $nickname; + $url = System::baseUrl() . '/profile/' . $nickname; $tabs = array( array( @@ -797,7 +798,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null) { ), array( 'label' => t('Photos'), - 'url' => App::get_baseurl() . '/photos/' . $nickname, + 'url' => System::baseUrl() . '/photos/' . $nickname, 'sel' => ((!isset($tab) && $a->argv[0]=='photos') ? 'active' : ''), 'title' => t('Photo Albums'), 'id' => 'photo-tab', @@ -805,7 +806,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null) { ), array( 'label' => t('Videos'), - 'url' => App::get_baseurl() . '/videos/' . $nickname, + 'url' => System::baseUrl() . '/videos/' . $nickname, 'sel' => ((!isset($tab) && $a->argv[0]=='videos') ? 'active' : ''), 'title' => t('Videos'), 'id' => 'video-tab', @@ -817,7 +818,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null) { if ($is_owner && $a->theme_events_in_profile) { $tabs[] = array( 'label' => t('Events'), - 'url' => App::get_baseurl() . '/events', + 'url' => System::baseUrl() . '/events', 'sel' =>((!isset($tab) && $a->argv[0]=='events') ? 'active' : ''), 'title' => t('Events and Calendar'), 'id' => 'events-tab', @@ -828,7 +829,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null) { } elseif (! $is_owner) { $tabs[] = array( 'label' => t('Events'), - 'url' => App::get_baseurl() . '/cal/' . $nickname, + 'url' => System::baseUrl() . '/cal/' . $nickname, 'sel' =>((!isset($tab) && $a->argv[0]=='cal') ? 'active' : ''), 'title' => t('Events and Calendar'), 'id' => 'events-tab', @@ -839,7 +840,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null) { if ($is_owner) { $tabs[] = array( 'label' => t('Personal Notes'), - 'url' => App::get_baseurl() . '/notes', + 'url' => System::baseUrl() . '/notes', 'sel' =>((!isset($tab) && $a->argv[0]=='notes') ? 'active' : ''), 'title' => t('Only You Can See This'), 'id' => 'notes-tab', @@ -850,7 +851,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null) { if ((! $is_owner) && ((count($a->profile)) || (! $a->profile['hide-friends']))) { $tabs[] = array( 'label' => t('Contacts'), - 'url' => App::get_baseurl() . '/viewcontacts/' . $nickname, + 'url' => System::baseUrl() . '/viewcontacts/' . $nickname, 'sel' => ((!isset($tab) && $a->argv[0]=='viewcontacts') ? 'active' : ''), 'title' => t('Contacts'), 'id' => 'viewcontacts-tab', diff --git a/include/items.php b/include/items.php index d8f615a2c..e8ec81277 100644 --- a/include/items.php +++ b/include/items.php @@ -5,6 +5,7 @@ */ use Friendica\App; +use Friendica\Core\System; use Friendica\ParseUrl; use Friendica\Util\Lock; use Friendica\Core\Config; @@ -222,7 +223,7 @@ function add_page_info_data($data) { /// @todo make a positive list of allowed characters $hashtag = str_replace(array(" ", "+", "/", ".", "#", "'", "’", "`", "(", ")", "„", "“"), array("", "", "", "", "", "", "", "", "", "", "", ""), $keyword); - $hashtags .= "#[url=" . App::get_baseurl() . "/search?tag=" . rawurlencode($hashtag) . "]" . $hashtag . "[/url] "; + $hashtags .= "#[url=" . System::baseUrl() . "/search?tag=" . rawurlencode($hashtag) . "]" . $hashtag . "[/url] "; } } @@ -270,7 +271,7 @@ function add_page_keywords($url, $no_photos = false, $photo = "", $keywords = fa $tags .= ", "; } - $tags .= "#[url=" . App::get_baseurl() . "/search?tag=" . rawurlencode($hashtag) . "]" . $hashtag . "[/url]"; + $tags .= "#[url=" . System::baseUrl() . "/search?tag=" . rawurlencode($hashtag) . "]" . $hashtag . "[/url]"; } } @@ -669,7 +670,7 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f } if ($arr['plink'] == "") { - $arr['plink'] = App::get_baseurl() . '/display/' . urlencode($arr['guid']); + $arr['plink'] = System::baseUrl() . '/display/' . urlencode($arr['guid']); } if ($arr['network'] == "") { @@ -841,7 +842,7 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f $u = q("SELECT `nickname` FROM `user` WHERE `uid` = %d", intval($arr['uid'])); if (dbm::is_result($u)) { $a = get_app(); - $self = normalise_link(App::get_baseurl() . '/profile/' . $u[0]['nickname']); + $self = normalise_link(System::baseUrl() . '/profile/' . $u[0]['nickname']); logger("item_store: 'myself' is ".$self." for parent ".$parent_id." checking against ".$arr['author-link']." and ".$arr['owner-link'], LOGGER_DEBUG); if ((normalise_link($arr['author-link']) == $self) || (normalise_link($arr['owner-link']) == $self)) { dba::update('thread', array('mention' => true), array('iid' => $parent_id)); @@ -1181,10 +1182,10 @@ function item_body_set_hashtags(&$item) { // All hashtags should point to the home server if "local_tags" is activated if (Config::get('system', 'local_tags')) { $item["body"] = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", - "#[url=".App::get_baseurl()."/search?tag=$2]$2[/url]", $item["body"]); + "#[url=".System::baseUrl()."/search?tag=$2]$2[/url]", $item["body"]); $item["tag"] = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", - "#[url=".App::get_baseurl()."/search?tag=$2]$2[/url]", $item["tag"]); + "#[url=".System::baseUrl()."/search?tag=$2]$2[/url]", $item["tag"]); } // mask hashtags inside of url, bookmarks and attachments to avoid urls in urls @@ -1214,7 +1215,7 @@ function item_body_set_hashtags(&$item) { $basetag = str_replace('_',' ',substr($tag,1)); - $newtag = '#[url=' . App::get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]'; + $newtag = '#[url=' . System::baseUrl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]'; $item["body"] = str_replace($tag, $newtag, $item["body"]); @@ -1324,13 +1325,13 @@ function tag_deliver($uid, $item_id) { $item = $i[0]; - $link = normalise_link(App::get_baseurl() . '/profile/' . $u[0]['nickname']); + $link = normalise_link(System::baseUrl() . '/profile/' . $u[0]['nickname']); /* * Diaspora uses their own hardwired link URL in @-tags * instead of the one we supply with webfinger */ - $dlink = normalise_link(App::get_baseurl() . '/u/' . $u[0]['nickname']); + $dlink = normalise_link(System::baseUrl() . '/u/' . $u[0]['nickname']); $cnt = preg_match_all('/[\@\!]\[url\=(.*?)\](.*?)\[\/url\]/ism', $item['body'], $matches, PREG_SET_ORDER); if ($cnt) { @@ -1427,13 +1428,13 @@ function tgroup_check($uid, $item) { $community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false); $prvgroup = (($u[0]['page-flags'] == PAGE_PRVGROUP) ? true : false); - $link = normalise_link(App::get_baseurl() . '/profile/' . $u[0]['nickname']); + $link = normalise_link(System::baseUrl() . '/profile/' . $u[0]['nickname']); /* * Diaspora uses their own hardwired link URL in @-tags * instead of the one we supply with webfinger */ - $dlink = normalise_link(App::get_baseurl() . '/u/' . $u[0]['nickname']); + $dlink = normalise_link(System::baseUrl() . '/u/' . $u[0]['nickname']); $cnt = preg_match_all('/[\@\!]\[url\=(.*?)\](.*?)\[\/url\]/ism', $item['body'], $matches, PREG_SET_ORDER); if ($cnt) { @@ -1698,7 +1699,7 @@ function new_follower($importer, $contact, $datarray, $item, $sharing = false) { 'to_name' => $r[0]['username'], 'to_email' => $r[0]['email'], 'uid' => $r[0]['uid'], - 'link' => App::get_baseurl() . '/notifications/intro', + 'link' => System::baseUrl() . '/notifications/intro', 'source_name' => ((strlen(stripslashes($contact_record['name']))) ? stripslashes($contact_record['name']) : t('[Name Withheld]')), 'source_link' => $contact_record['url'], 'source_photo' => $contact_record['photo'], @@ -1784,7 +1785,7 @@ function fix_private_photos($s, $uid, $item = null, $cid = 0) { $a = get_app(); logger('fix_private_photos: check for photos', LOGGER_DEBUG); - $site = substr(App::get_baseurl(),strpos(App::get_baseurl(),'://')); + $site = substr(System::baseUrl(),strpos(System::baseUrl(),'://')); $orig_body = $s; $new_body = ''; @@ -2076,7 +2077,7 @@ function drop_item($id, $interactive = true) { return 0; } notice( t('Item not found.') . EOL); - goaway(App::get_baseurl() . '/' . $_SESSION['return_url']); + goaway(System::baseUrl() . '/' . $_SESSION['return_url']); } $item = $r[0]; @@ -2128,7 +2129,7 @@ function drop_item($id, $interactive = true) { } // Now check how the user responded to the confirmation query if ($_REQUEST['canceled']) { - goaway(App::get_baseurl() . '/' . $_SESSION['return_url']); + goaway(System::baseUrl() . '/' . $_SESSION['return_url']); } logger('delete item: ' . $item['id'], LOGGER_DEBUG); @@ -2253,14 +2254,14 @@ function drop_item($id, $interactive = true) { if (! $interactive) { return $owner; } - goaway(App::get_baseurl() . '/' . $_SESSION['return_url']); + goaway(System::baseUrl() . '/' . $_SESSION['return_url']); //NOTREACHED } else { if (! $interactive) { return 0; } notice( t('Permission denied.') . EOL); - goaway(App::get_baseurl() . '/' . $_SESSION['return_url']); + goaway(System::baseUrl() . '/' . $_SESSION['return_url']); //NOTREACHED } diff --git a/include/like.php b/include/like.php index 4f2600271..bce1c776f 100644 --- a/include/like.php +++ b/include/like.php @@ -1,6 +1,7 @@ ' . "\n") ; + $link = xmlify('' . "\n") ; $body = $item['body']; $obj = <<< EOT @@ -200,7 +201,7 @@ EOT; $ulink = '[url=' . $author_contact['url'] . ']' . $author_contact['name'] . '[/url]'; $alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]'; - $plink = '[url=' . App::get_baseurl() . '/display/' . $owner_self_contact['nick'] . '/' . $item['id'] . ']' . $post_type . '[/url]'; + $plink = '[url=' . System::baseUrl() . '/display/' . $owner_self_contact['nick'] . '/' . $item['id'] . ']' . $post_type . '[/url]'; $new_item = array( 'guid' => get_guid(32), diff --git a/include/message.php b/include/message.php index 0c1ffff7c..6800663b5 100644 --- a/include/message.php +++ b/include/message.php @@ -3,6 +3,7 @@ // send a private message use Friendica\App; +use Friendica\Core\System; function send_message($recipient=0, $body='', $subject='', $replyto=''){ @@ -26,7 +27,7 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){ } $guid = get_guid(32); - $uri = 'urn:X-dfrn:' . App::get_baseurl() . ':' . local_user() . ':' . $guid; + $uri = 'urn:X-dfrn:' . System::baseUrl() . ':' . local_user() . ':' . $guid; $convid = 0; $reply = false; @@ -52,7 +53,7 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){ $recip_host = substr($recip_host,0,strpos($recip_host,'/')); $recip_handle = (($contact[0]['addr']) ? $contact[0]['addr'] : $contact[0]['nick'] . '@' . $recip_host); - $sender_handle = $a->user['nickname'] . '@' . substr(App::get_baseurl(), strpos(App::get_baseurl(),'://') + 3); + $sender_handle = $a->user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(),'://') + 3); $conv_guid = get_guid(32); $convuri = $recip_handle.':'.$conv_guid; @@ -133,7 +134,7 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){ $images = $match[1]; if (count($images)) { foreach ($images as $image) { - if (! stristr($image,App::get_baseurl() . '/photo/')) { + if (! stristr($image,System::baseUrl() . '/photo/')) { continue; } $image_uri = substr($image,strrpos($image,'/') + 1); @@ -169,7 +170,7 @@ function send_wallmessage($recipient='', $body='', $subject='', $replyto=''){ } $guid = get_guid(32); - $uri = 'urn:X-dfrn:' . App::get_baseurl() . ':' . local_user() . ':' . $guid; + $uri = 'urn:X-dfrn:' . System::baseUrl() . ':' . local_user() . ':' . $guid; $convid = 0; $reply = false; @@ -184,7 +185,7 @@ function send_wallmessage($recipient='', $body='', $subject='', $replyto=''){ $conv_guid = get_guid(32); - $recip_handle = $recipient['nickname'] . '@' . substr(App::get_baseurl(), strpos(App::get_baseurl(),'://') + 3); + $recip_handle = $recipient['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(),'://') + 3); $sender_nick = basename($replyto); $sender_host = substr($replyto,strpos($replyto,'://')+3); diff --git a/include/nav.php b/include/nav.php index 435e892d9..382b89cfe 100644 --- a/include/nav.php +++ b/include/nav.php @@ -1,6 +1,7 @@ page['nav'] .= replace_macros($tpl, array( - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), '$sitelocation' => $nav_info['sitelocation'], '$nav' => $nav_info['nav'], '$banner' => $nav_info['banner'], @@ -67,7 +68,7 @@ function nav_info(App $a) $myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : ''); - $sitelocation = $myident . substr(App::get_baseurl($ssl_state), strpos(App::get_baseurl($ssl_state), '//') + 2 ); + $sitelocation = $myident . substr(System::baseUrl($ssl_state), strpos(System::baseUrl($ssl_state), '//') + 2 ); // nav links: array of array('href', 'text', 'extra css classes', 'title') $nav = array(); diff --git a/include/network.php b/include/network.php index 5f2c120bc..4b1ddab03 100644 --- a/include/network.php +++ b/include/network.php @@ -5,6 +5,7 @@ */ use Friendica\App; +use Friendica\Core\System; use Friendica\Core\Config; use Friendica\Network\Probe; @@ -611,7 +612,7 @@ function avatar_img($email) { call_hooks('avatar_lookup', $avatar); if (! $avatar['success']) { - $avatar['url'] = App::get_baseurl() . '/images/person-175.jpg'; + $avatar['url'] = System::baseUrl() . '/images/person-175.jpg'; } logger('Avatar: ' . $avatar['email'] . ' ' . $avatar['url'], LOGGER_DEBUG); @@ -660,7 +661,7 @@ function scale_external_images($srctext, $include_link = true, $scale_replace = foreach ($matches as $mtch) { logger('scale_external_image: ' . $mtch[1]); - $hostname = str_replace('www.','',substr(App::get_baseurl(),strpos(App::get_baseurl(),'://')+3)); + $hostname = str_replace('www.','',substr(System::baseUrl(),strpos(System::baseUrl(),'://')+3)); if (stristr($mtch[1],$hostname)) { continue; } diff --git a/include/oauth.php b/include/oauth.php index 9e2be68c7..ce22086d1 100644 --- a/include/oauth.php +++ b/include/oauth.php @@ -6,6 +6,7 @@ */ use Friendica\App; +use Friendica\Core\System; define('REQUEST_TOKEN_DURATION', 300); define('ACCESS_TOKEN_DURATION', 31536000); @@ -150,7 +151,7 @@ class FKOAuth1 extends OAuthServer { $_SESSION['mobile-theme'] = get_pconfig($record['uid'], 'system', 'mobile_theme'); $_SESSION['authenticated'] = 1; $_SESSION['page_flags'] = $record['page-flags']; - $_SESSION['my_url'] = App::get_baseurl() . '/profile/' . $record['nickname']; + $_SESSION['my_url'] = System::baseUrl() . '/profile/' . $record['nickname']; $_SESSION['addr'] = $_SERVER['REMOTE_ADDR']; $_SESSION["allow_api"] = true; diff --git a/include/oembed.php b/include/oembed.php index cb23517cd..715a0ba5b 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -5,6 +5,7 @@ */ use Friendica\App; +use Friendica\Core\System; use Friendica\ParseUrl; use Friendica\Core\Config; @@ -152,7 +153,7 @@ function oembed_format_object($j){ $th=120; $tw = $th*$tr; $tpl=get_markup_template('oembed_video.tpl'); $ret.=replace_macros($tpl, array( - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), '$embedurl' => $embedurl, '$escapedhtml' => base64_encode($jhtml), '$tw' => $tw, @@ -249,7 +250,7 @@ function oembed_iframe($src, $width, $height) { } $width = '100%'; - $s = App::get_baseurl() . '/oembed/' . base64url_encode($src); + $s = System::baseUrl() . '/oembed/' . base64url_encode($src); return ''; } diff --git a/include/ostatus.php b/include/ostatus.php index e3724f3bf..cd626201f 100644 --- a/include/ostatus.php +++ b/include/ostatus.php @@ -4,6 +4,7 @@ */ use Friendica\App; +use Friendica\Core\System; use Friendica\Core\Config; use Friendica\Network\Probe; @@ -456,7 +457,7 @@ class ostatus { if (strlen($item["tag"])) { $item["tag"] .= ','; } - $item["tag"] .= "#[url=".App::get_baseurl()."/search?tag=".$term."]".$term."[/url]"; + $item["tag"] .= "#[url=".System::baseUrl()."/search?tag=".$term."]".$term."[/url]"; } } } @@ -1452,7 +1453,7 @@ class ostatus { $attributes = array("uri" => "https://friendi.ca", "version" => FRIENDICA_VERSION."-".DB_UPDATE_VERSION); xml::add_element($doc, $root, "generator", FRIENDICA_PLATFORM, $attributes); - xml::add_element($doc, $root, "id", App::get_baseurl()."/profile/".$owner["nick"]); + xml::add_element($doc, $root, "id", System::baseUrl()."/profile/".$owner["nick"]); xml::add_element($doc, $root, "title", sprintf("%s timeline", $owner["name"])); xml::add_element($doc, $root, "subtitle", sprintf("Updates from %s on %s", $owner["name"], $a->config["sitename"])); xml::add_element($doc, $root, "logo", $owner["photo"]); @@ -1465,23 +1466,23 @@ class ostatus { xml::add_element($doc, $root, "link", "", $attributes); /// @TODO We have to find out what this is - /// $attributes = array("href" => App::get_baseurl()."/sup", + /// $attributes = array("href" => System::baseUrl()."/sup", /// "rel" => "http://api.friendfeed.com/2008/03#sup", /// "type" => "application/json"); /// xml::add_element($doc, $root, "link", "", $attributes); self::hublinks($doc, $root, $owner["nick"]); - $attributes = array("href" => App::get_baseurl()."/salmon/".$owner["nick"], "rel" => "salmon"); + $attributes = array("href" => System::baseUrl()."/salmon/".$owner["nick"], "rel" => "salmon"); xml::add_element($doc, $root, "link", "", $attributes); - $attributes = array("href" => App::get_baseurl()."/salmon/".$owner["nick"], "rel" => "http://salmon-protocol.org/ns/salmon-replies"); + $attributes = array("href" => System::baseUrl()."/salmon/".$owner["nick"], "rel" => "http://salmon-protocol.org/ns/salmon-replies"); xml::add_element($doc, $root, "link", "", $attributes); - $attributes = array("href" => App::get_baseurl()."/salmon/".$owner["nick"], "rel" => "http://salmon-protocol.org/ns/salmon-mention"); + $attributes = array("href" => System::baseUrl()."/salmon/".$owner["nick"], "rel" => "http://salmon-protocol.org/ns/salmon-mention"); xml::add_element($doc, $root, "link", "", $attributes); - $attributes = array("href" => App::get_baseurl()."/api/statuses/user_timeline/".$owner["nick"].".atom", + $attributes = array("href" => System::baseUrl()."/api/statuses/user_timeline/".$owner["nick"].".atom", "rel" => "self", "type" => "application/atom+xml"); xml::add_element($doc, $root, "link", "", $attributes); @@ -1495,7 +1496,7 @@ class ostatus { * @param object $root XML root element where the hub links are added */ public static function hublinks($doc, $root, $nick) { - $h = App::get_baseurl() . '/pubsubhubbub/'.$nick; + $h = System::baseUrl() . '/pubsubhubbub/'.$nick; xml::add_element($doc, $root, "link", "", array("href" => $h, "rel" => "hub")); } @@ -1625,7 +1626,7 @@ class ostatus { } if (count($profile)) { - xml::add_element($doc, $author, "followers", "", array("url" => App::get_baseurl()."/viewcontacts/".$owner["nick"])); + xml::add_element($doc, $author, "followers", "", array("url" => System::baseUrl()."/viewcontacts/".$owner["nick"])); xml::add_element($doc, $author, "statusnet:profile_info", "", array("local_id" => $owner["uid"])); } @@ -2066,7 +2067,7 @@ class ostatus { xml::add_element($doc, $entry, "content", $body, array("type" => "html")); xml::add_element($doc, $entry, "link", "", array("rel" => "alternate", "type" => "text/html", - "href" => App::get_baseurl()."/display/".$item["guid"])); + "href" => System::baseUrl()."/display/".$item["guid"])); if ($complete && ($item["id"] > 0)) xml::add_element($doc, $entry, "status_net", "", array("notice_id" => $item["id"])); @@ -2104,7 +2105,7 @@ class ostatus { } else { $mentioned[$parent[0]["author-link"]] = $parent[0]["author-link"]; $mentioned[$parent[0]["owner-link"]] = $parent[0]["owner-link"]; - $parent_plink = App::get_baseurl()."/display/".$parent[0]["guid"]; + $parent_plink = System::baseUrl()."/display/".$parent[0]["guid"]; } $attributes = array( @@ -2119,7 +2120,7 @@ class ostatus { } if (intval($item["parent"]) > 0) { - $conversation_href = App::get_baseurl()."/display/".$owner["nick"]."/".$item["parent"]; + $conversation_href = System::baseUrl()."/display/".$owner["nick"]."/".$item["parent"]; $conversation_uri = $conversation_href; if (isset($parent_item)) { diff --git a/include/plugin.php b/include/plugin.php index 4dd79b521..d5bceafde 100644 --- a/include/plugin.php +++ b/include/plugin.php @@ -6,6 +6,7 @@ */ use Friendica\App; +use Friendica\Core\System; /** * @brief uninstalls an addon. @@ -401,10 +402,10 @@ function get_theme_screenshot($theme) { $exts = array('.png','.jpg'); foreach ($exts as $ext) { if (file_exists('view/theme/' . $theme . '/screenshot' . $ext)) { - return(App::get_baseurl() . '/view/theme/' . $theme . '/screenshot' . $ext); + return(System::baseUrl() . '/view/theme/' . $theme . '/screenshot' . $ext); } } - return(App::get_baseurl() . '/images/blank.png'); + return(System::baseUrl() . '/images/blank.png'); } // install and uninstall theme diff --git a/include/poller.php b/include/poller.php index 8c30d1628..9758ab946 100644 --- a/include/poller.php +++ b/include/poller.php @@ -1,6 +1,7 @@ ;rel=hub,<%s>;rel=self", - App::get_baseurl().'/pubsubhubbub/'.$rr['nickname'], + System::baseUrl().'/pubsubhubbub/'.$rr['nickname'], $rr['topic']), "X-Hub-Signature: sha1=".$hmac_sig); diff --git a/include/redir.php b/include/redir.php index d6b8285cf..8c04d711e 100644 --- a/include/redir.php +++ b/include/redir.php @@ -1,6 +1,7 @@ user = $user_record; @@ -147,7 +148,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive call_hooks('logged_in', $a->user); if (($a->module !== 'home') && isset($_SESSION['return_url'])) { - goaway(App::get_baseurl() . '/' . $_SESSION['return_url']); + goaway(System::baseUrl() . '/' . $_SESSION['return_url']); } } } @@ -428,7 +429,7 @@ function check_form_security_token_redirectOnErr($err_redirect, $typename = '', logger('check_form_security_token failed: user ' . $a->user['guid'] . ' - form element ' . $typename); logger('check_form_security_token failed: _REQUEST data: ' . print_r($_REQUEST, true), LOGGER_DATA); notice( check_form_security_std_err_msg() ); - goaway(App::get_baseurl() . $err_redirect ); + goaway(System::baseUrl() . $err_redirect ); } } function check_form_security_token_ForbiddenOnErr($typename = '', $formname = 'form_security_token') { diff --git a/include/socgraph.php b/include/socgraph.php index ace1b916e..0a28a177f 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -8,6 +8,7 @@ */ use Friendica\App; +use Friendica\Core\System; use Friendica\Core\Config; use Friendica\Network\Probe; @@ -243,7 +244,7 @@ function sanitize_gcontact($gcontact) { $alternate = poco_alternate_ostatus_url($gcontact['url']); // The global contacts should contain the original picture, not the cached one - if (($gcontact['generation'] != 1) && stristr(normalise_link($gcontact['photo']), normalise_link(App::get_baseurl()."/photo/"))) { + if (($gcontact['generation'] != 1) && stristr(normalise_link($gcontact['photo']), normalise_link(System::baseUrl()."/photo/"))) { $gcontact['photo'] = ""; } @@ -1633,9 +1634,9 @@ function update_suggestions() { $done = array(); /// @TODO Check if it is really neccessary to poll the own server - poco_load(0, 0, 0, App::get_baseurl() . '/poco'); + poco_load(0, 0, 0, System::baseUrl() . '/poco'); - $done[] = App::get_baseurl() . '/poco'; + $done[] = System::baseUrl() . '/poco'; if (strlen(get_config('system','directory'))) { $x = fetch_url(get_server()."/pubsites"); @@ -2320,7 +2321,7 @@ function update_gcontact_for_user($uid) { // The "addr" field was added in 3.4.3 so it can be empty for older users if ($r[0]["addr"] != "") { - $addr = $r[0]["nickname"].'@'.str_replace(array("http://", "https://"), "", App::get_baseurl()); + $addr = $r[0]["nickname"].'@'.str_replace(array("http://", "https://"), "", System::baseUrl()); } else { $addr = $r[0]["addr"]; } @@ -2331,7 +2332,7 @@ function update_gcontact_for_user($uid) { "notify" => $r[0]["notify"], "url" => $r[0]["url"], "hide" => ($r[0]["hidewall"] || !$r[0]["net-publish"]), "nick" => $r[0]["nickname"], "addr" => $addr, - "connect" => $addr, "server_url" => App::get_baseurl(), + "connect" => $addr, "server_url" => System::baseUrl(), "generation" => 1, "network" => NETWORK_DFRN); update_gcontact($gcontact); @@ -2390,7 +2391,7 @@ function gs_fetch_users($server) { "nick" => $user->nickname, "about" => $user->bio, "network" => NETWORK_OSTATUS, - "photo" => App::get_baseurl()."/images/person-175.jpg"); + "photo" => System::baseUrl()."/images/person-175.jpg"); get_gcontact_id($contact); } } diff --git a/include/tags.php b/include/tags.php index de716edef..8720367fa 100644 --- a/include/tags.php +++ b/include/tags.php @@ -1,9 +1,10 @@ template_engine(); try { @@ -1311,7 +1312,7 @@ function prepare_body(&$item, $attach = false, $preview = false) { $a = get_app(); call_hooks('prepare_body_init', $item); - $searchpath = z_root() . "/search?tag="; + $searchpath = System::baseUrl() . "/search?tag="; $tags = array(); $hashtags = array(); @@ -1394,10 +1395,10 @@ function prepare_body(&$item, $attach = false, $preview = false) { if (!$vhead) { $vhead = true; $a->page['htmlhead'] .= replace_macros(get_markup_template('videos_head.tpl'), array( - '$baseurl' => z_root(), + '$baseurl' => System::baseUrl(), )); $a->page['end'] .= replace_macros(get_markup_template('videos_end.tpl'), array( - '$baseurl' => z_root(), + '$baseurl' => System::baseUrl(), )); } diff --git a/include/threads.php b/include/threads.php index c1277778e..4cb881569 100644 --- a/include/threads.php +++ b/include/threads.php @@ -1,6 +1,7 @@ identity = $openid_url; - $openid->returnUrl = z_root() . '/openid'; + $openid->returnUrl = System::baseUrl() . '/openid'; $openid->required = array('namePerson/friendly', 'contact/email', 'namePerson'); $openid->optional = array('namePerson/first','media/image/aspect11','media/image/default'); try { @@ -237,8 +239,8 @@ function create_user($arr) { t('default'), 1, dbesc($username), - dbesc(z_root() . "/photo/profile/{$newuid}.jpg"), - dbesc(z_root() . "/photo/avatar/{$newuid}.jpg"), + dbesc(System::baseUrl() . "/photo/profile/{$newuid}.jpg"), + dbesc(System::baseUrl() . "/photo/avatar/{$newuid}.jpg"), intval($publish), intval($netpublish) @@ -368,17 +370,17 @@ function user_create_self_contact($uid) { datetime_convert(), dbesc($user['username']), dbesc($user['nickname']), - dbesc(z_root()."/photo/profile/".$user['uid'].".jpg"), - dbesc(z_root()."/photo/avatar/".$user['uid'].".jpg"), - dbesc(z_root()."/photo/micro/".$user['uid'].".jpg"), - dbesc(z_root()."/profile/".$user['nickname']), - dbesc(normalise_link(z_root()."/profile/".$user['nickname'])), - dbesc($user['nickname'].'@'.substr(z_root(), strpos(z_root(),'://') + 3)), - dbesc(z_root()."/dfrn_request/".$user['nickname']), - dbesc(z_root()."/dfrn_notify/".$user['nickname']), - dbesc(z_root()."/dfrn_poll/".$user['nickname']), - dbesc(z_root()."/dfrn_confirm/".$user['nickname']), - dbesc(z_root()."/poco/".$user['nickname']), + dbesc(System::baseUrl()."/photo/profile/".$user['uid'].".jpg"), + dbesc(System::baseUrl()."/photo/avatar/".$user['uid'].".jpg"), + dbesc(System::baseUrl()."/photo/micro/".$user['uid'].".jpg"), + dbesc(System::baseUrl()."/profile/".$user['nickname']), + dbesc(normalise_link(System::baseUrl()."/profile/".$user['nickname'])), + dbesc($user['nickname'].'@'.substr(System::baseUrl(), strpos(System::baseUrl(),'://') + 3)), + dbesc(System::baseUrl()."/dfrn_request/".$user['nickname']), + dbesc(System::baseUrl()."/dfrn_notify/".$user['nickname']), + dbesc(System::baseUrl()."/dfrn_poll/".$user['nickname']), + dbesc(System::baseUrl()."/dfrn_confirm/".$user['nickname']), + dbesc(System::baseUrl()."/poco/".$user['nickname']), dbesc(datetime_convert()), dbesc(datetime_convert()), dbesc(datetime_convert()) diff --git a/index.php b/index.php index e67ace132..5b4cea756 100644 --- a/index.php +++ b/index.php @@ -14,6 +14,7 @@ */ use Friendica\App; +use Friendica\Core\System; use Friendica\Core\Config; require_once 'boot.php'; @@ -62,15 +63,15 @@ if (!$install) { if ($a->max_processes_reached() || $a->maxload_reached()) { header($_SERVER["SERVER_PROTOCOL"] . ' 503 Service Temporarily Unavailable'); header('Retry-After: 120'); - header('Refresh: 120; url=' . App::get_baseurl() . "/" . $a->query_string); + header('Refresh: 120; url=' . System::baseUrl() . "/" . $a->query_string); die("System is currently unavailable. Please try again later"); } if (get_config('system', 'force_ssl') && ($a->get_scheme() == "http") && (intval(get_config('system', 'ssl_policy')) == SSL_POLICY_FULL) && - (substr(App::get_baseurl(), 0, 8) == "https://")) { + (substr(System::baseUrl(), 0, 8) == "https://")) { header("HTTP/1.1 302 Moved Temporarily"); - header("Location: " . App::get_baseurl() . "/" . $a->query_string); + header("Location: " . System::baseUrl() . "/" . $a->query_string); exit(); } @@ -154,7 +155,7 @@ if ((x($_GET,'zrl')) && (!$install && !$maintenance)) { * */ -// header('Link: <' . App::get_baseurl() . '/amcd>; rel="acct-mgmt";'); +// header('Link: <' . System::baseUrl() . '/amcd>; rel="acct-mgmt";'); if (x($_COOKIE["Friendica"]) || (x($_SESSION,'authenticated')) || (x($_POST,'auth-params')) || ($a->module === 'login')) { require("include/auth.php"); @@ -294,7 +295,7 @@ if (strlen($a->module)) { if ((x($_SERVER,'QUERY_STRING')) && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') && isset($dreamhost_error_hack)) { logger('index.php: dreamhost_error_hack invoked. Original URI =' . $_SERVER['REQUEST_URI']); - goaway(App::get_baseurl() . $_SERVER['REQUEST_URI']); + goaway(System::baseUrl() . $_SERVER['REQUEST_URI']); } logger('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], LOGGER_DEBUG); diff --git a/mod/admin.php b/mod/admin.php index fbc096800..291907667 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -7,6 +7,7 @@ */ use Friendica\App; +use Friendica\Core\System; use Friendica\Core\Config; require_once("include/enotify.php"); @@ -307,7 +308,7 @@ function admin_page_blocklist(App $a) { '$threason' => t('Reason for the block'), '$delentry' => t('Delete entry from blocklist'), '$entries' => $blocklistform, - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), '$confirm_delete' => t('Delete entry from blocklist?'), '$form_security_token' => get_form_security_token("admin_blocklist") )); @@ -376,7 +377,7 @@ function admin_page_deleteitem(App $a) { '$intro1' => t('On this page you can delete an item from your node. If the item is a top level posting, the entire thread will be deleted.'), '$intro2' => t('You need to know the GUID of the item. You can find it e.g. by looking at the display URL. The last part of http://example.com/display/123456 is the GUID, here 123456.'), '$deleteitemguid' => array('deleteitemguid', t("GUID"), '', t("The GUID of the item you want to delete."), 'required', 'autofocus'), - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), '$form_security_token' => get_form_security_token("admin_deleteitem") )); } @@ -552,7 +553,7 @@ function admin_page_federation(App $a) { '$counts' => $counts, '$version' => FRIENDICA_VERSION, '$legendtext' => sprintf(t('Currently this node is aware of %d nodes from the following platforms:'), $total), - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), )); } @@ -665,7 +666,7 @@ function admin_page_summary(App $a) { '$accounts' => $accounts, '$pending' => array(t('Pending registrations'), $pending), '$version' => array(t('Version'), FRIENDICA_VERSION), - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), '$platform' => FRIENDICA_PLATFORM, '$codename' => FRIENDICA_CODENAME, '$build' => get_config('system','build'), @@ -703,7 +704,7 @@ function admin_page_site_post(App $a) { * send relocate for every local user * */ - $old_url = App::get_baseurl(true); + $old_url = System::baseUrl(true); // Generate host names for relocation the addresses in the format user@address.tld $new_host = str_replace("http://", "@", normalise_link($new_url)); @@ -1151,7 +1152,7 @@ function admin_page_site(App $a) { '$performance' => t('Performance'), '$worker_title' => t('Worker'), '$relocate'=> t('Relocate - WARNING: advanced function. Could make this server unreachable.'), - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), // name, label, value, help string, extra data... '$sitename' => array('sitename', t("Site name"), $a->config['sitename'],''), '$hostname' => array('hostname', t("Host name"), $a->config['hostname'], ""), @@ -1226,14 +1227,14 @@ function admin_page_site(App $a) { '$proxy_disabled' => array('proxy_disabled', t("Disable picture proxy"), get_config('system','proxy_disabled'), t("The picture proxy increases performance and privacy. It shouldn't be used on systems with very low bandwith.")), '$only_tag_search' => array('only_tag_search', t("Only search in tags"), get_config('system','only_tag_search'), t("On large systems the text search can slow down the system extremely.")), - '$relocate_url' => array('relocate_url', t("New base url"), App::get_baseurl(), t("Change base url for this server. Sends relocate message to all DFRN contacts of all users.")), + '$relocate_url' => array('relocate_url', t("New base url"), System::baseUrl(), t("Change base url for this server. Sends relocate message to all DFRN contacts of all users.")), '$rino' => array('rino', t("RINO Encryption"), intval(get_config('system','rino_encrypt')), t("Encryption layer between nodes."), array("Disabled", "RINO1 (deprecated)", "RINO2")), '$worker_queues' => array('worker_queues', t("Maximum number of parallel workers"), get_config('system','worker_queues'), t("On shared hosters set this to 2. On larger systems, values of 10 are great. Default value is 4.")), '$worker_dont_fork' => array('worker_dont_fork', t("Don't use 'proc_open' with the worker"), get_config('system','worker_dont_fork'), t("Enable this if your system doesn't allow the use of 'proc_open'. This can happen on shared hosters. If this is enabled you should increase the frequency of poller calls in your crontab.")), '$worker_fastlane' => array('worker_fastlane', t("Enable fastlane"), get_config('system','worker_fastlane'), t("When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.")), - '$worker_frontend' => array('worker_frontend', t('Enable frontend worker'), get_config('system','frontend_worker'), sprintf(t('When enabled the Worker process is triggered when backend access is performed (e.g. messages being delivered). On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.'), App::get_baseurl())), + '$worker_frontend' => array('worker_frontend', t('Enable frontend worker'), get_config('system','frontend_worker'), sprintf(t('When enabled the Worker process is triggered when backend access is performed (e.g. messages being delivered). On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.'), System::baseUrl())), '$form_security_token' => get_form_security_token("admin_site") @@ -1316,13 +1317,13 @@ function admin_page_dbsync(App $a) { } if (! count($failed)) { $o = replace_macros(get_markup_template('structure_check.tpl'),array( - '$base' => App::get_baseurl(true), + '$base' => System::baseUrl(true), '$banner' => t('No failed updates.'), '$check' => t('Check database structure'), )); } else { $o = replace_macros(get_markup_template('failed_updates.tpl'),array( - '$base' => App::get_baseurl(true), + '$base' => System::baseUrl(true), '$banner' => t('Failed Updates'), '$desc' => t('This does not include updates prior to 1139, which did not return a status.'), '$mark' => t('Mark success (if update was manually applied)'), @@ -1390,7 +1391,7 @@ function admin_page_users_post(App $a) { Thank you and welcome to %4$s.')); $preamble = sprintf($preamble, $nu['username'], $a->config['sitename']); - $body = sprintf($body, App::get_baseurl(), $nu['email'], $result['password'], $a->config['sitename']); + $body = sprintf($body, System::baseUrl(), $nu['email'], $result['password'], $a->config['sitename']); notification(array( 'type' => "SYSTEM_EMAIL", @@ -1614,7 +1615,7 @@ function admin_page_users(App $a) { '$form_security_token' => get_form_security_token("admin_users"), // values // - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), '$pending' => $pending, 'deleted' => $deleted, @@ -1706,7 +1707,7 @@ function admin_page_plugins(App $a) { '$page' => t('Plugins'), '$toggle' => t('Toggle'), '$settings' => t('Settings'), - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), '$plugin' => $plugin, '$status' => $status, @@ -1731,10 +1732,10 @@ function admin_page_plugins(App $a) { */ if (x($_GET,"a") && $_GET['a']=="r") { - check_form_security_token_redirectOnErr(App::get_baseurl().'/admin/plugins', 'admin_themes', 't'); + check_form_security_token_redirectOnErr(System::baseUrl().'/admin/plugins', 'admin_themes', 't'); reload_plugins(); info("Plugins reloaded"); - goaway(App::get_baseurl().'/admin/plugins'); + goaway(System::baseUrl().'/admin/plugins'); } $plugins = array(); @@ -1769,7 +1770,7 @@ function admin_page_plugins(App $a) { '$page' => t('Plugins'), '$submit' => t('Save Settings'), '$reload' => t('Reload active plugins'), - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), '$function' => 'plugins', '$plugins' => $plugins, '$pcount' => count($plugins), @@ -1982,7 +1983,7 @@ function admin_page_themes(App $a) { '$page' => t('Themes'), '$toggle' => t('Toggle'), '$settings' => t('Settings'), - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), '$plugin' => $theme, '$status' => $status, '$action' => $action, @@ -2001,7 +2002,7 @@ function admin_page_themes(App $a) { // reload active themes if (x($_GET,"a") && $_GET['a']=="r") { - check_form_security_token_redirectOnErr(App::get_baseurl().'/admin/themes', 'admin_themes', 't'); + check_form_security_token_redirectOnErr(System::baseUrl().'/admin/themes', 'admin_themes', 't'); if ($themes) { foreach ($themes as $th) { if ($th['allowed']) { @@ -2011,7 +2012,7 @@ function admin_page_themes(App $a) { } } info("Themes reloaded"); - goaway(App::get_baseurl().'/admin/themes'); + goaway(System::baseUrl().'/admin/themes'); } /* @@ -2032,7 +2033,7 @@ function admin_page_themes(App $a) { '$page' => t('Themes'), '$submit' => t('Save Settings'), '$reload' => t('Reload active themes'), - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), '$function' => 'themes', '$plugins' => $xthemes, '$pcount' => count($themes), @@ -2106,7 +2107,7 @@ function admin_page_logs(App $a) { '$page' => t('Logs'), '$submit' => t('Save Settings'), '$clear' => t('Clear'), - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), '$logname' => get_config('system','logfile'), // name, label, value, help string, extra data... diff --git a/mod/allfriends.php b/mod/allfriends.php index fe3013a7c..8d849d375 100644 --- a/mod/allfriends.php +++ b/mod/allfriends.php @@ -1,6 +1,7 @@ array(t("View Profile"), zrl($rr['url'])), 'follow' => array(t("Connect/Follow"), $connlnk) diff --git a/mod/bookmarklet.php b/mod/bookmarklet.php index f7dd25677..785a2fbea 100644 --- a/mod/bookmarklet.php +++ b/mod/bookmarklet.php @@ -1,6 +1,7 @@ page['htmlhead'] .= replace_macros($htpl,array( - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), '$module_url' => '/cal/' . $a->data['user']['nickname'], '$modparams' => 2, '$i18n' => $i18n, @@ -86,7 +87,7 @@ function cal_content(App $a) { $etpl = get_markup_template('event_end.tpl'); $a->page['end'] .= replace_macros($etpl,array( - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), )); $o =""; @@ -228,7 +229,7 @@ function cal_content(App $a) { foreach ($r as $rr) { $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); if (! x($links,$j)) { - $links[$j] = App::get_baseurl() . '/' . $a->cmd . '#link-' . $j; + $links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j; } } } @@ -267,12 +268,12 @@ function cal_content(App $a) { } $o = replace_macros($tpl, array( - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), '$tabs' => $tabs, '$title' => t('Events'), '$view' => t('View'), - '$previous' => array(App::get_baseurl()."/events/$prevyear/$prevmonth", t('Previous'),'',''), - '$next' => array(App::get_baseurl()."/events/$nextyear/$nextmonth", t('Next'),'',''), + '$previous' => array(System::baseUrl()."/events/$prevyear/$prevmonth", t('Previous'),'',''), + '$next' => array(System::baseUrl()."/events/$nextyear/$nextmonth", t('Next'),'',''), '$calendar' => cal($y,$m,$links, ' eventcal'), '$events' => $events, diff --git a/mod/contacts.php b/mod/contacts.php index 6b40f0455..bbbd088cd 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -1,6 +1,7 @@ $networks_widget )); - $base = z_root(); + $base = System::baseUrl(); $tpl = get_markup_template("contacts-head.tpl"); $a->page['htmlhead'] .= replace_macros($tpl,array( - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), '$base' => $base )); $tpl = get_markup_template("contacts-end.tpl"); $a->page['end'] .= replace_macros($tpl,array( - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), '$base' => $base )); @@ -493,10 +494,10 @@ function contacts_content(App $a) { $contact = $a->data['contact']; $a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), array( - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), )); $a->page['end'] .= replace_macros(get_markup_template('contact_end.tpl'), array( - '$baseurl' => App::get_baseurl(true), + '$baseurl' => System::baseUrl(true), )); require_once 'include/contact_selectors.php'; @@ -575,7 +576,7 @@ function contacts_content(App $a) { if (in_array($contact['network'], array(NETWORK_DIASPORA, NETWORK_OSTATUS)) && ($contact['rel'] == CONTACT_IS_FOLLOWER)) - $follow = App::get_baseurl(true)."/follow?url=".urlencode($contact["url"]); + $follow = System::baseUrl(true)."/follow?url=".urlencode($contact["url"]); // Load contactact related actions like hide, suggest, delete and others $contact_actions = contact_actions($contact); @@ -801,7 +802,7 @@ function contacts_content(App $a) { $tpl = get_markup_template("contacts-template.tpl"); $o .= replace_macros($tpl, array( - '$baseurl' => z_root(), + '$baseurl' => System::baseUrl(), '$header' => t('Contacts') . (($nets) ? ' - ' . network_to_name($nets) : ''), '$tabs' => $t, '$total' => $total, diff --git a/mod/content.php b/mod/content.php index a8c313033..b6fad9e22 100644 --- a/mod/content.php +++ b/mod/content.php @@ -16,6 +16,7 @@ // and 10-20 milliseconds to fetch all the child items. use Friendica\App; +use Friendica\Core\System; function content_content(App $a, $update = 0) { @@ -118,7 +119,7 @@ function content_content(App $a, $update = 0) { if($update) killme(); notice( t('No such group') . EOL ); - goaway(App::get_baseurl(true) . '/network'); + goaway(System::baseUrl(true) . '/network'); // NOTREACHED } @@ -198,7 +199,7 @@ function content_content(App $a, $update = 0) { } if($conv) { - $myurl = App::get_baseurl() . '/profile/'. $a->user['nickname']; + $myurl = System::baseUrl() . '/profile/'. $a->user['nickname']; $myurl = substr($myurl,strpos($myurl,'://')+3); $myurl = str_replace('www.','',$myurl); $diasp_url = str_replace('/profile/','/u/',$myurl); @@ -510,8 +511,8 @@ function render_content(App $a, $items, $mode, $update, $preview = false) { 'like' => '', 'dislike' => '', 'comment' => '', - //'conv' => (($preview) ? '' : array('href'=> App::get_baseurl($ssl_state) . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))), - 'conv' => (($preview) ? '' : array('href'=> App::get_baseurl($ssl_state).'/display/'.$item['guid'], 'title'=> t('View in context'))), + //'conv' => (($preview) ? '' : array('href'=> System::baseUrl($ssl_state) . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))), + 'conv' => (($preview) ? '' : array('href'=> System::baseUrl($ssl_state).'/display/'.$item['guid'], 'title'=> t('View in context'))), 'previewing' => $previewing, 'wait' => t('Please wait'), ); @@ -744,7 +745,7 @@ function render_content(App $a, $items, $mode, $update, $preview = false) { } if (local_user() && link_compare($a->contact['url'],$item['author-link'])) { - $edpost = array(App::get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit")); + $edpost = array(System::baseUrl($ssl_state)."/editpost/".$item['id'], t("Edit")); } else { $edpost = false; } diff --git a/mod/delegate.php b/mod/delegate.php index e99734a33..4d35d46c7 100644 --- a/mod/delegate.php +++ b/mod/delegate.php @@ -1,6 +1,7 @@ argv[2]; @@ -31,7 +32,7 @@ function delegate_content(App $a) { if (dbm::is_result($r)) { $r = q("select id from contact where uid = %d and nurl = '%s' limit 1", intval(local_user()), - dbesc(normalise_link(App::get_baseurl() . '/profile/' . $r[0]['nickname'])) + dbesc(normalise_link(System::baseUrl() . '/profile/' . $r[0]['nickname'])) ); if (dbm::is_result($r)) { q("insert into manage ( uid, mid ) values ( %d , %d ) ", @@ -40,21 +41,21 @@ function delegate_content(App $a) { ); } } - goaway(App::get_baseurl() . '/delegate'); + goaway(System::baseUrl() . '/delegate'); } if ($a->argc > 2 && $a->argv[1] === 'remove' && intval($a->argv[2])) { // delegated admins can view but not change delegation permissions if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) { - goaway(App::get_baseurl() . '/delegate'); + goaway(System::baseUrl() . '/delegate'); } q("DELETE FROM `manage` WHERE `uid` = %d AND `mid` = %d LIMIT 1", intval($a->argv[2]), intval(local_user()) ); - goaway(App::get_baseurl() . '/delegate'); + goaway(System::baseUrl() . '/delegate'); } @@ -94,7 +95,7 @@ function delegate_content(App $a) { $r = q("select nurl from contact where substring_index(contact.nurl,'/',3) = '%s' and contact.uid = %d and contact.self = 0 and network = '%s' ", - dbesc(normalise_link(App::get_baseurl())), + dbesc(normalise_link(System::baseUrl())), intval(local_user()), dbesc(NETWORK_DFRN) ); @@ -130,7 +131,7 @@ function delegate_content(App $a) { $o = replace_macros(get_markup_template('delegate.tpl'),array( '$header' => t('Delegate Page Management'), - '$base' => App::get_baseurl(), + '$base' => System::baseUrl(), '$desc' => t('Delegates are able to manage all aspects of this account/page except for basic account settings. Please do not delegate your personal account to anybody that you do not trust completely.'), '$head_managers' => t('Existing Page Managers'), '$managers' => $full_managers, diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 897e85ecb..9c64c8c88 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -19,6 +19,7 @@ */ use Friendica\App; +use Friendica\Core\System; use Friendica\Network\Probe; require_once 'include/enotify.php'; @@ -196,7 +197,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { $params['public_key'] = $public_key; - $my_url = App::get_baseurl() . '/profile/' . $user[0]['nickname']; + $my_url = System::baseUrl() . '/profile/' . $user[0]['nickname']; openssl_public_encrypt($my_url, $params['source_url'], $site_pubkey); $params['source_url'] = bin2hex($params['source_url']); @@ -507,7 +508,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { // do anything special with this new friend. if ($handsfree === null) { - goaway(App::get_baseurl() . '/contacts/' . intval($contact_id)); + goaway(System::baseUrl() . '/contacts/' . intval($contact_id)); } else { return; } @@ -669,7 +670,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { if (dbm::is_result($r)) { $photo = $r[0]['photo']; } else { - $photo = App::get_baseurl() . '/images/person-175.jpg'; + $photo = System::baseUrl() . '/images/person-175.jpg'; } require_once 'include/Photo.php'; @@ -734,7 +735,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { 'to_name' => $r[0]['username'], 'to_email' => $r[0]['email'], 'uid' => $r[0]['uid'], - 'link' => App::get_baseurl() . '/contacts/' . $dfrn_record, + 'link' => System::baseUrl() . '/contacts/' . $dfrn_record, 'source_name' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : t('[Name Withheld]')), 'source_link' => $r[0]['url'], 'source_photo' => $r[0]['photo'], @@ -809,7 +810,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) { // somebody arrived here by mistake or they are fishing. Send them to the homepage. - goaway(z_root()); + goaway(System::baseUrl()); // NOTREACHED } diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index e6196accc..d87d97a31 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -1,6 +1,7 @@ cmd); + goaway(System::baseUrl() . '/' . $a->cmd); return; // NOTREACHED } if (! allowed_url($url)) { notice( t('Disallowed profile URL.') . EOL); - goaway(App::get_baseurl() . '/' . $a->cmd); + goaway(System::baseUrl() . '/' . $a->cmd); return; // NOTREACHED } if (blocked_url($url)) { notice( t('Blocked domain') . EOL); - goaway(App::get_baseurl() . '/' . $a->cmd); + goaway(System::baseUrl() . '/' . $a->cmd); return; // NOTREACHED } @@ -526,7 +527,7 @@ function dfrn_request_post(App $a) { if (! count($parms)) { notice( t('Profile location is not valid or does not contain profile information.') . EOL ); - goaway(App::get_baseurl() . '/' . $a->cmd); + goaway(System::baseUrl() . '/' . $a->cmd); } else { if (! x($parms,'fn')) { @@ -616,7 +617,7 @@ function dfrn_request_post(App $a) { // "Homecoming" - send the requestor back to their site to record the introduction. - $dfrn_url = bin2hex(App::get_baseurl() . '/profile/' . $nickname); + $dfrn_url = bin2hex(System::baseUrl() . '/profile/' . $nickname); $aes_allow = ((function_exists('openssl_encrypt')) ? 1 : 0); goaway($parms['dfrn-request'] . "?dfrn_url=$dfrn_url" @@ -645,7 +646,7 @@ function dfrn_request_post(App $a) { $uri = urlencode($uri); } else { - $uri = App::get_baseurl().'/profile/'.$nickname; + $uri = System::baseUrl().'/profile/'.$nickname; } $url = str_replace('{uri}', $uri, $url); @@ -755,7 +756,7 @@ function dfrn_request_content(App $a) { 'to_name' => $r[0]['username'], 'to_email' => $r[0]['email'], 'uid' => $r[0]['uid'], - 'link' => App::get_baseurl() . '/notifications/intros', + 'link' => System::baseUrl() . '/notifications/intros', 'source_name' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : t('[Name Withheld]')), 'source_link' => $r[0]['url'], 'source_photo' => $r[0]['photo'], @@ -819,16 +820,16 @@ function dfrn_request_content(App $a) { $myaddr = $_GET['address']; } elseif (local_user()) { if (strlen($a->path)) { - $myaddr = App::get_baseurl() . '/profile/' . $a->user['nickname']; + $myaddr = System::baseUrl() . '/profile/' . $a->user['nickname']; } else { - $myaddr = $a->user['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 ); + $myaddr = $a->user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(),'://') + 3 ); } } else { // last, try a zrl $myaddr = get_my_url(); } - $target_addr = $a->profile['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 ); + $target_addr = $a->profile['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(),'://') + 3 ); /* diff --git a/mod/dirfind.php b/mod/dirfind.php index 884eca9a6..7d167494e 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -1,6 +1,7 @@ connect) ? $jj->connect : $jj->url); + $connlnk = System::baseUrl().'/follow/?url='.(($jj->connect) ? $jj->connect : $jj->url); $conntxt = t('Connect'); $photo_menu = array( 'profile' => array(t("View Profile"), zrl($jj->url)), diff --git a/mod/display.php b/mod/display.php index 4adb860f3..b76fe1d48 100644 --- a/mod/display.php +++ b/mod/display.php @@ -1,6 +1,7 @@ user["nickname"])) { $r = dba::fetch_first("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile` @@ -197,11 +198,11 @@ function display_fetchauthor($a, $item) { $profiledata = get_contact_details_by_url($profiledata["url"], local_user(), $profiledata); - $profiledata["photo"] = App::remove_baseurl($profiledata["photo"]); + $profiledata["photo"] = System::removedBaseUrl($profiledata["photo"]); if (local_user()) { if (in_array($profiledata["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) { - $profiledata["remoteconnect"] = App::get_baseurl()."/follow?url=".urlencode($profiledata["url"]); + $profiledata["remoteconnect"] = System::baseUrl()."/follow?url=".urlencode($profiledata["url"]); } } elseif ($profiledata["network"] == NETWORK_DFRN) { $connect = str_replace("/profile/", "/dfrn_request/", $profiledata["url"]); @@ -294,7 +295,7 @@ function display_content(App $a, $update = 0) { // We are displaying an "alternate" link if that post was public. See issue 2864 $is_public = dba::exists('item', array('id' => $item_id, 'private' => false, 'wall' => true)); if ($is_public) { - $alternate = App::get_baseurl().'/display/'.$nick.'/'.$item_id.'.atom'; + $alternate = System::baseUrl().'/display/'.$nick.'/'.$item_id.'.atom'; } else { $alternate = ''; } diff --git a/mod/editpost.php b/mod/editpost.php index c0d903d0c..149e432e1 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -1,6 +1,7 @@ page['htmlhead'] .= replace_macros($tpl, array( - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), '$ispublic' => ' ', // t('Visible to everybody'), '$geotag' => $geotag, '$nickname' => $a->user['nickname'] @@ -44,7 +45,7 @@ function editpost_content(App $a) { $tpl = get_markup_template('jot-end.tpl'); $a->page['end'] .= replace_macros($tpl, array( - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), '$ispublic' => ' ', // t('Visible to everybody'), '$geotag' => $geotag, '$nickname' => $a->user['nickname'] @@ -118,7 +119,7 @@ function editpost_content(App $a) { '$ptyp' => $itm[0]['type'], '$content' => undo_post_tagging($itm[0]['body']), '$post_id' => $post_id, - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), '$defloc' => $a->user['default-location'], '$visitor' => 'none', '$pvisit' => 'none', diff --git a/mod/events.php b/mod/events.php index 0fdec5cbe..4e70c0056 100644 --- a/mod/events.php +++ b/mod/events.php @@ -5,6 +5,7 @@ */ use Friendica\App; +use Friendica\Core\System; require_once 'include/bbcode.php'; require_once 'include/datetime.php'; @@ -90,7 +91,7 @@ function events_post(App $a) { $type = 'event'; $action = ($event_id == '') ? 'new' : "event/" . $event_id; - $onerror_url = App::get_baseurl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish"; + $onerror_url = System::baseUrl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish"; if (strcmp($finish, $start) < 0 && !$nofinish) { notice(t('Event can not end before it has started.') . EOL); @@ -190,7 +191,7 @@ function events_content(App $a) { } if ($a->argc == 1) { - $_SESSION['return_url'] = App::get_baseurl() . '/' . $a->cmd; + $_SESSION['return_url'] = System::baseUrl() . '/' . $a->cmd; } if (($a->argc > 2) && ($a->argv[1] === 'ignore') && intval($a->argv[2])) { @@ -218,7 +219,7 @@ function events_content(App $a) { $htpl = get_markup_template('event_head.tpl'); $a->page['htmlhead'] .= replace_macros($htpl, array( - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), '$module_url' => '/events', '$modparams' => 1, '$i18n' => $i18n, @@ -226,7 +227,7 @@ function events_content(App $a) { $etpl = get_markup_template('event_end.tpl'); $a->page['end'] .= replace_macros($etpl, array( - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), )); $o = ''; @@ -337,7 +338,7 @@ function events_content(App $a) { foreach ($r as $rr) { $j = (($rr['adjust']) ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j')); if (! x($links,$j)) { - $links[$j] = App::get_baseurl() . '/' . $a->cmd . '#link-' . $j; + $links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j; } } } @@ -372,13 +373,13 @@ function events_content(App $a) { } $o = replace_macros($tpl, array( - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), '$tabs' => $tabs, '$title' => t('Events'), '$view' => t('View'), - '$new_event' => array(App::get_baseurl() . '/events/new', t('Create New Event'), '', ''), - '$previous' => array(App::get_baseurl() . '/events/$prevyear/$prevmonth', t('Previous'), '', ''), - '$next' => array(App::get_baseurl() . '/events/$nextyear/$nextmonth', t('Next'), '', ''), + '$new_event' => array(System::baseUrl() . '/events/new', t('Create New Event'), '', ''), + '$previous' => array(System::baseUrl() . '/events/$prevyear/$prevmonth', t('Previous'), '', ''), + '$next' => array(System::baseUrl() . '/events/$nextyear/$nextmonth', t('Next'), '', ''), '$calendar' => cal($y, $m, $links, ' eventcal'), '$events' => $events, @@ -476,7 +477,7 @@ function events_content(App $a) { $tpl = get_markup_template('event_form.tpl'); $o .= replace_macros($tpl,array( - '$post' => App::get_baseurl() . '/events', + '$post' => System::baseUrl() . '/events', '$eid' => $eid, '$cid' => $cid, '$uri' => $uri, @@ -533,6 +534,6 @@ function events_content(App $a) { info(t('Event removed') . EOL); } - goaway(App::get_baseurl() . '/events'); + goaway(System::baseUrl() . '/events'); } } diff --git a/mod/fbrowser.php b/mod/fbrowser.php index 21b9b2e7b..d1448b81d 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -6,6 +6,7 @@ */ use Friendica\App; +use Friendica\Core\System; require_once('include/Photo.php'); @@ -84,9 +85,9 @@ function fbrowser_content(App $a) { $scale = $rr['loq']; return array( - App::get_baseurl() . '/photos/' . $a->user['nickname'] . '/image/' . $rr['resource-id'], + System::baseUrl() . '/photos/' . $a->user['nickname'] . '/image/' . $rr['resource-id'], $filename_e, - App::get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $scale . '.'. $ext + System::baseUrl() . '/photo/' . $rr['resource-id'] . '-' . $scale . '.'. $ext ); } $files = array_map("_map_files1", $r); @@ -95,7 +96,7 @@ function fbrowser_content(App $a) { $o = replace_macros($tpl, array( '$type' => 'image', - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), '$path' => $path, '$folders' => $albums, '$files' => $files, @@ -122,7 +123,7 @@ function fbrowser_content(App $a) { $filename_e = $rr['filename']; } - return array( App::get_baseurl() . '/attach/' . $rr['id'], $filename_e, App::get_baseurl() . '/images/icons/16/' . $filetype . '.png'); + return array( System::baseUrl() . '/attach/' . $rr['id'], $filename_e, System::baseUrl() . '/images/icons/16/' . $filetype . '.png'); } $files = array_map("_map_files2", $files); @@ -130,7 +131,7 @@ function fbrowser_content(App $a) { $tpl = get_markup_template($template_file); $o = replace_macros($tpl, array( '$type' => 'file', - '$baseurl' => App::get_baseurl(), + '$baseurl' => System::baseUrl(), '$path' => array( array( "", t("Files")) ), '$folders' => false, '$files' =>$files, diff --git a/mod/fetch.php b/mod/fetch.php index 6dd6966d9..30c38bf54 100644 --- a/mod/fetch.php +++ b/mod/fetch.php @@ -4,6 +4,7 @@ This file is part of the Diaspora protocol. It is used for fetching single publi */ use Friendica\App; +use Friendica\Core\System; require_once("include/crypto.php"); require_once("include/diaspora.php"); @@ -30,7 +31,7 @@ function fetch_init(App $a) { $parts = parse_url($r[0]["author-link"]); $host = $parts["scheme"]."://".$parts["host"]; - if (normalise_link($host) != normalise_link(App::get_baseurl())) { + if (normalise_link($host) != normalise_link(System::baseUrl())) { $location = $host."/fetch/".$a->argv[1]."/".urlencode($guid); header("HTTP/1.1 301 Moved Permanently"); diff --git a/mod/filerm.php b/mod/filerm.php index 71e0af08d..bd46a8bfe 100644 --- a/mod/filerm.php +++ b/mod/filerm.php @@ -1,6 +1,7 @@ $r[0]['username'], - 'profile'=> App::get_baseurl() . '/profile/' . $r[0]['nickname'], + 'profile'=> System::baseUrl() . '/profile/' . $r[0]['nickname'], ); } else { $admin = false; @@ -47,7 +48,7 @@ function friendica_init(App $a) { $data = Array( 'version' => FRIENDICA_VERSION, - 'url' => z_root(), + 'url' => System::baseUrl(), 'plugins' => $visible_plugins, 'locked_features' => $locked_features, 'register_policy' => $register_policy[$a->config['register_policy']], @@ -55,7 +56,7 @@ function friendica_init(App $a) { 'site_name' => $a->config['sitename'], 'platform' => FRIENDICA_PLATFORM, 'info' => ((x($a->config,'info')) ? $a->config['info'] : ''), - 'no_scrape_url' => App::get_baseurl().'/noscrape' + 'no_scrape_url' => System::baseUrl().'/noscrape' ); echo json_encode($data); @@ -67,7 +68,7 @@ function friendica_content(App $a) { $o = '

Friendica

' . PHP_EOL; $o .= '

'; $o .= t('This is Friendica, version') . ' ' . FRIENDICA_VERSION . ' '; - $o .= t('running at web location') . ' ' . z_root(); + $o .= t('running at web location') . ' ' . System::baseUrl(); $o .= '

' . PHP_EOL; $o .= '

'; diff --git a/mod/group.php b/mod/group.php index c01d1cf55..71fca276a 100644 --- a/mod/group.php +++ b/mod/group.php @@ -6,6 +6,7 @@ */ use Friendica\App; +use Friendica\Core\System; function group_init(App $a) { if (local_user()) { @@ -30,12 +31,12 @@ function group_post(App $a) { info(t('Group created.') . EOL); $r = group_byname(local_user(), $name); if ($r) { - goaway(App::get_baseurl() . '/group/' . $r); + goaway(System::baseUrl() . '/group/' . $r); } } else { notice(t('Could not create group.') . EOL); } - goaway(App::get_baseurl() . '/group'); + goaway(System::baseUrl() . '/group'); return; // NOTREACHED } @@ -48,7 +49,7 @@ function group_post(App $a) { ); if (! dbm::is_result($r)) { notice(t('Group not found.') . EOL); - goaway(App::get_baseurl() . '/contacts'); + goaway(System::baseUrl() . '/contacts'); return; // NOTREACHED } $group = $r[0]; @@ -126,7 +127,7 @@ function group_content(App $a) { notice(t('Unable to remove group.') . EOL); } } - goaway(App::get_baseurl() . '/group'); + goaway(System::baseUrl() . '/group'); // NOTREACHED } @@ -153,7 +154,7 @@ function group_content(App $a) { if (! dbm::is_result($r)) { notice(t('Group not found.') . EOL); - goaway(App::get_baseurl() . '/contacts'); + goaway(System::baseUrl() . '/contacts'); } $group = $r[0]; diff --git a/mod/hcard.php b/mod/hcard.php index 229939a4a..d31ea1b27 100644 --- a/mod/hcard.php +++ b/mod/hcard.php @@ -1,6 +1,7 @@ page['htmlhead'] .= '' . "\r\n" ; - $a->page['htmlhead'] .= '' . "\r\n" ; + $a->page['htmlhead'] .= '' . "\r\n" ; $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : '')); - $a->page['htmlhead'] .= '' . "\r\n"; - header('Link: <' . App::get_baseurl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false); + $a->page['htmlhead'] .= '' . "\r\n"; + header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false); $dfrn_pages = array('request', 'confirm', 'notify', 'poll'); foreach ($dfrn_pages as $dfrn) { - $a->page['htmlhead'] .= "\r\n"; + $a->page['htmlhead'] .= "\r\n"; } } diff --git a/mod/help.php b/mod/help.php index 95fe91c38..9a4b275f9 100644 --- a/mod/help.php +++ b/mod/help.php @@ -1,6 +1,7 @@ $lastlevel) $toc.="