]> git.mxchange.org Git - friendica.git/commitdiff
Some rewrites:
authorRoland Häder <roland@mxchange.org>
Tue, 13 Dec 2016 09:16:36 +0000 (10:16 +0100)
committerRoland Häder <roland@mxchange.org>
Tue, 13 Dec 2016 09:16:36 +0000 (10:16 +0100)
- max_proccesses_reach() and maxload_reached() (why no _ behind max?) are called
  both way, static and with object reference.
- this is strongly discouraged and should be avoided as its support (in PHP) may
  be dropped in future releases.
- used $a = get_app(); to encapsulate code (even when the function does
  currently the same, it may be changed later)

Signed-off-by: Roland Häder <roland@mxchange.org>
27 files changed:
boot.php
include/Core/Config.php
include/Core/PConfig.php
include/Probe.php
include/api.php
include/auth_ejabberd.php
include/cron.php
include/cronhooks.php
include/dba.php
include/dba_pdo.php
include/delivery.php
include/dfrn.php
include/discover_poco.php
include/enotify.php
include/event.php
include/files.php
include/oembed.php
include/pgettext.php
include/poller.php
include/socgraph.php
include/tags.php
include/text.php
mod/fbrowser.php
mod/fetch.php
mod/p.php
object/BaseObject.php
object/Conversation.php

index 49745122481b4c51e0dfb7e124bf7a479d4719ce..5b497632ebea9136af059c0450a081a2b6c9c8e9 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1294,10 +1294,6 @@ class App {
         */
        function max_processes_reached() {
 
-               // Is the function called statically?
-               if (!is_object($this))
-                       return(self::$a->max_processes_reached());
-
                if ($this->is_backend()) {
                        $process = "backend";
                        $max_processes = get_config('system', 'max_processes_backend');
@@ -1329,10 +1325,6 @@ class App {
         */
        function maxload_reached() {
 
-               // Is the function called statically?
-               if (!is_object($this))
-                       return(self::$a->maxload_reached());
-
                if ($this->is_backend()) {
                        $process = "backend";
                        $maxsysload = intval(get_config('system', 'maxloadavg'));
@@ -1479,14 +1471,14 @@ function system_unavailable() {
 
 
 function clean_urls() {
-       global $a;
+       $a = get_app();
        //      if($a->config['system']['clean_urls'])
        return true;
        //      return false;
 }
 
 function z_path() {
-       global $a;
+       $a = get_app();
        $base = $a->get_baseurl();
        if(! clean_urls())
                $base .= '/?q=';
@@ -1501,7 +1493,7 @@ function z_path() {
  * @return string
  */
 function z_root() {
-       global $a;
+       $a = get_app();
        return $a->get_baseurl();
 }
 
@@ -1903,7 +1895,7 @@ function info($s) {
  * @return int
  */
 function get_max_import_size() {
-       global $a;
+       $a = get_app();
        return ((x($a->config,'max_import_size')) ? $a->config['max_import_size'] : 0 );
 }
 
@@ -2100,7 +2092,7 @@ function current_theme(){
  * @return string
  */
 function current_theme_url() {
-       global $a;
+       $a = get_app();
 
        $t = current_theme();
 
index a5eca0570a56efc86f1ecf26ed4dae91f71e07df..0d29c99561cfa1b5ba4a9555979e1d3402ecf5b4 100644 (file)
@@ -30,7 +30,7 @@ class Config {
         * @return void
         */
        public static function load($family) {
-               global $a;
+               $a = get_app();
 
                $r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s' ORDER BY `cat`, `k`, `id`", dbesc($family));
                if (count($r)) {
@@ -72,7 +72,7 @@ class Config {
         */
        public static function get($family, $key, $default_value = null, $refresh = false) {
 
-               global $a;
+               $a = get_app();
 
                if (!$refresh) {
                        // Looking if the whole family isn't set
@@ -123,7 +123,7 @@ class Config {
         * @return mixed Stored $value or false if the database update failed
         */
        public static function set($family, $key, $value) {
-               global $a;
+               $a = get_app();
 
                $stored = self::get($family, $key);
 
@@ -171,7 +171,7 @@ class Config {
         */
        public static function delete($family, $key) {
 
-               global $a;
+               $a = get_app();
                if (x($a->config[$family],$key)) {
                        unset($a->config[$family][$key]);
                }
index 63d204b3a2cd01ff63c1b88842ed65d83c1866bf..351f63e0043b1f5daf286c2187d9857e3a72d178 100644 (file)
@@ -28,7 +28,7 @@ class PConfig {
         * @return void
         */
        public static function load($uid, $family) {
-               global $a;
+               $a = get_app();
                $r = q("SELECT `v`,`k` FROM `pconfig` WHERE `cat` = '%s' AND `uid` = %d ORDER BY `cat`, `k`, `id`",
                        dbesc($family),
                        intval($uid)
@@ -65,7 +65,7 @@ class PConfig {
         */
        public static function get($uid, $family, $key, $default_value = null, $refresh = false) {
 
-               global $a;
+               $a = get_app();
 
                if (!$refresh) {
                        // Looking if the whole family isn't set
@@ -120,7 +120,7 @@ class PConfig {
         */
        public static function set($uid, $family, $key, $value) {
 
-               global $a;
+               $a = get_app();
 
                $stored = self::get($uid, $family, $key);
 
@@ -171,7 +171,7 @@ class PConfig {
         */
        public static function delete($uid,$family,$key) {
 
-               global $a;
+               $a = get_app();
 
                if (x($a->config[$uid][$family], $key)) {
                        unset($a->config[$uid][$family][$key]);
index 14e8d5bcad8ab2593547a100bb12c3fa09a365bf..4e69cc8efd78b2009ac762c202f69e92024f10b0 100644 (file)
@@ -232,7 +232,7 @@ class Probe {
                if ($data["photo"] != "")
                        $data["baseurl"] = matching_url(normalise_link($data["baseurl"]), normalise_link($data["photo"]));
                else
-                       $data["photo"] = App::get_baseurl().'/images/person-175.jpg';
+                       $data["photo"] = $a->get_baseurl().'/images/person-175.jpg';
 
                if (!isset($data["name"]) OR ($data["name"] == "")) {
                        if (isset($data["nick"]))
index 1f3c762989f3f2c5850fdfd4327768307b545060..04d614d02966e21e5935534d64502ed7df605d1c 100644 (file)
                $arr['$user'] = $user_info;
                $arr['$rss'] = array(
                        'alternate' => $user_info['url'],
-                       'self' => App::get_baseurl(). "/". $a->query_string,
-                       'base' => App::get_baseurl(),
+                       'self' => $a->get_baseurl(). "/". $a->query_string,
+                       'base' => $a->get_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'  => $a->get_baseurl()."/images/friendica-32.png",
                );
 
                return $arr;
                        'follow_request_sent' => false,
                        'statusnet_blocking' => false,
                        'notifications' => false,
-                       //'statusnet_profile_url' => App::get_baseurl()."/contacts/".$uinfo[0]['cid'],
+                       //'statusnet_profile_url' => $a->get_baseurl()."/contacts/".$uinfo[0]['cid'],
                        'statusnet_profile_url' => $uinfo[0]['url'],
                        'uid' => intval($uinfo[0]['uid']),
                        'cid' => intval($uinfo[0]['cid']),
                        if ($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='.$a->get_baseurl().'/photos/'.$r[0]['nickname'].'/image/'.$r[0]['resource-id'].']';
+                               $_REQUEST['body'] .= '[img]'.$a->get_baseurl()."/photo/".$r[0]['resource-id']."-".$r[0]['scale'].".".$ext."[/img][/url]";
                        }
                }
 
                $start = $page*$count;
 
                // Ugly code - should be changed
-               $myurl = App::get_baseurl() . '/profile/'. $a->user['nickname'];
+               $myurl = $a->get_baseurl() . '/profile/'. $a->user['nickname'];
                $myurl = substr($myurl,strpos($myurl,'://')+3);
                //$myurl = str_replace(array('www.','.'),array('','\\.'),$myurl);
                $myurl = str_replace('www.','',$myurl);
                $text = preg_replace_callback(
                                "|data:image/([^;]+)[^=]+=*|m",
                                function($match) use ($item) {
-                                       return App::get_baseurl()."/display/".$item['guid'];
+                                       return $a->get_baseurl()."/display/".$item['guid'];
                                },
                                $text);
                return $text;
 
                $name = $a->config['sitename'];
                $server = $a->get_hostname();
-               $logo = App::get_baseurl() . '/images/friendica-64.png';
+               $logo = $a->get_baseurl() . '/images/friendica-64.png';
                $email = $a->config['admin_email'];
                $closed = (($a->config['register_policy'] == REGISTER_CLOSED) ? 'true' : 'false');
                $private = (($a->config['system']['block_public']) ? 'true' : 'false');
                if($a->config['api_import_size'])
                        $texlimit = string($a->config['api_import_size']);
                $ssl = (($a->config['system']['have_ssl']) ? 'true' : 'false');
-               $sslserver = (($ssl === 'true') ? str_replace('http:','https:',App::get_baseurl()) : '');
+               $sslserver = (($ssl === 'true') ? str_replace('http:','https:',$a->get_baseurl()) : '');
 
                $config = array(
                        'site' => array('name' => $name,'server' => $server, 'theme' => 'default', 'path' => '',
                                $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 = $a->get_baseurl()."/photo/".$rr['resource-id']."-".$rr['scale'].".".$typetoext[$rr['type']];
 
                                if ($type == "xml")
                                        $data['photo'][] = array("@attributes" => $photo, "1" => $thumb);
                                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" => $a->get_baseurl()."/photo/".$data['photo']['resource-id']."-".$k.".".$typetoext[$data['photo']['type']]);
                        } else {
                                $data['photo']['link'] = array();
                                for ($k=intval($data['photo']['minscale']); $k<=intval($data['photo']['maxscale']); $k++) {
-                                       $data['photo']['link'][$k] = App::get_baseurl()."/photo/".$data['photo']['resource-id']."-".$k.".".$typetoext[$data['photo']['type']];
+                                       $data['photo']['link'][$k] = $a->get_baseurl()."/photo/".$data['photo']['resource-id']."-".$k.".".$typetoext[$data['photo']['type']];
                                }
                        }
                        unset($data['photo']['resource-id']);
index e1900dc7304df8501794b5f9537fc050d59f3e85..e12da35ef1755057b37e78e26e2069ba50fa7035 100755 (executable)
@@ -146,7 +146,7 @@ class exAuth {
         * @param array $aCommand The command array
         */
        private function isuser($aCommand) {
-               global $a;
+               $a = get_app();
 
                // Check if there is a username
                if (!isset($aCommand[1])) {
@@ -214,7 +214,7 @@ class exAuth {
         * @param array $aCommand The command array
         */
        private function auth($aCommand) {
-               global $a;
+               $a = get_app();
 
                // check user authentication
                if (sizeof($aCommand) != 4) {
index c92396dc7a446ce256e66f7e46d5d38d924c7a77..9807043b155c72b3a70230e410bfe05bf93fabef 100644 (file)
@@ -42,7 +42,7 @@ function cron_run(&$argv, &$argc){
 
        // Don't check this stuff if the function is called by the poller
        if (App::callstack() != "poller_run") {
-               if (App::maxload_reached())
+               if ($a->maxload_reached())
                        return;
                if (App::is_already_running('cron', 'include/cron.php', 540))
                        return;
index 4bb1e5f65960b3b3c1bbad1077d34628388040b0..7524a0c3a8883c80b4a914e54093d7cfa9351508 100644 (file)
@@ -25,7 +25,7 @@ function cronhooks_run(&$argv, &$argc){
 
        // Don't check this stuff if the function is called by the poller
        if (App::callstack() != "poller_run") {
-               if (App::maxload_reached())
+               if ($a->maxload_reached())
                        return;
                if (App::is_already_running('cronhooks', 'include/cronhooks.php', 1140))
                        return;
index 16d2dc54d9cc1a362028699c974f41a8299174fb..920027cbcfaeef721a02f2ec3214efed0fcf459b 100644 (file)
@@ -35,7 +35,7 @@ class dba {
        public  $error = false;
 
        function __construct($server, $user, $pass, $db, $install = false) {
-               global $a;
+               $a = get_app();
 
                $stamp1 = microtime(true);
 
@@ -139,7 +139,7 @@ class dba {
        }
 
        public function q($sql, $onlyquery = false) {
-               global $a;
+               $a = get_app();
 
                if (!$this->db || !$this->connected) {
                        return false;
index 7b720fb6c1217e31be5ae0368ea9facbdfcf229e..a44c447af20fa568d8ed15bb6e6082fc5330b182 100644 (file)
@@ -44,7 +44,7 @@ class dba {
        public  $error = false;
 
        function __construct($server,$user,$pass,$db,$install = false) {
-               global $a;
+               $a = get_app();
     
     # work around, to store the database - configuration in DDDBL
     $objDataObjectPool = new \DDDBL\DataObjectPool('Database-Definition');
@@ -99,7 +99,7 @@ class dba {
        }
 
        public function q($sql, $onlyquery = false) {
-               global $a;
+               $a = get_app();
 
     $strHandler = (true === $onlyquery) ? 'PDOStatement' : 'MULTI';
     
index 8fce98774250cdaeeaccda7bd841671cbda1a7ed..094d0497b29fca43ab21a472570832b52060b73d 100644 (file)
@@ -57,7 +57,7 @@ function delivery_run(&$argv, &$argc){
                        continue;
                }
 
-               if (App::maxload_reached())
+               if ($a->maxload_reached())
                        return;
 
                // It's ours to deliver. Remove it from the queue.
index 272105128fe07a2ea4c9711a54cdf4d52deb6c67..ce7bdc719f56a57b80925c01160d84b7bb0bdb9d 100644 (file)
@@ -1443,6 +1443,7 @@ class dfrn {
         * @param array $importer Record of the importer user mixed with contact of the content
         */
        private function process_suggestion($xpath, $suggestion, $importer) {
+               $a = get_app();
 
                logger("Processing suggestions");
 
@@ -1524,7 +1525,7 @@ class dfrn {
                        "to_email"     => $importer["email"],
                        "uid"          => $importer["importer_uid"],
                        "item"         => $suggest,
-                       "link"         => App::get_baseurl()."/notifications/intros",
+                       "link"         => $a->get_baseurl()."/notifications/intros",
                        "source_name"  => $importer["name"],
                        "source_link"  => $importer["url"],
                        "source_photo" => $importer["photo"],
@@ -1791,6 +1792,8 @@ class dfrn {
         * @param int $posted_id The record number of item record that was just posted
         */
        private function do_poke($item, $importer, $posted_id) {
+               $a = get_app();
+
                $verb = urldecode(substr($item["verb"],strpos($item["verb"], "#")+1));
                if(!$verb)
                        return;
@@ -1810,7 +1813,7 @@ class dfrn {
                                }
                        }
 
-                       if($Blink && link_compare($Blink,App::get_baseurl()."/profile/".$importer["nickname"])) {
+                       if($Blink && link_compare($Blink,$a->get_baseurl()."/profile/".$importer["nickname"])) {
 
                                // send a notification
                                notification(array(
@@ -1821,7 +1824,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"         => $a->get_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"]))
index 0b468faea189e522505ed5c686facd22be905406..bf3e47edd9a514acde02b4dcb5cdcb8d00a676be 100644 (file)
@@ -26,7 +26,7 @@ function discover_poco_run(&$argv, &$argc){
 
        // Don't check this stuff if the function is called by the poller
        if (App::callstack() != "poller_run")
-               if (App::maxload_reached())
+               if ($a->maxload_reached())
                        return;
 
        if(($argc > 2) && ($argv[1] == "dirsearch")) {
index 5b2bea2977b070fdb908eeb720ca1a699ba15173..99258c64c8761509c452e99ca304e700ecc5f37f 100644 (file)
@@ -648,6 +648,7 @@ function notification($params) {
  * @param str $defaulttype (Optional) Forces a notification with this type.
  */
 function check_item_notification($itemid, $uid, $defaulttype = "") {
+       $a = get_app();
 
        $notification_data = array("uid" => $uid, "profiles" => array());
        call_hooks('check_item_notification', $notification_data);
@@ -666,7 +667,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[] = $a->get_baseurl()."/u/".$user[0]["nickname"];
 
        $profiles2 = array();
 
@@ -720,7 +721,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"] = $a->get_baseurl().'/display/'.urlencode($item[0]["guid"]);
        $params["otype"] = 'item';
        $params["source_name"] = $item[0]["author-name"];
        $params["source_link"] = $item[0]["author-link"];
index 6c0e2bdec6e68608a5d8267200cb75ea6289f8e6..3a66a4a6de0ebc01bff56502bb80a3d6f5889e5c 100644 (file)
@@ -590,7 +590,7 @@ function process_events ($arr) {
                        $is_first = ($d !== $last_date);
 
                        $last_date = $d;
-                       $edit = ((! $rr['cid']) ? array(App::get_baseurl().'/events/event/'.$rr['id'],t('Edit event'),'','') : null);
+                       $edit = ((! $rr['cid']) ? array($a->get_baseurl().'/events/event/'.$rr['id'],t('Edit event'),'','') : null);
                        $title = strip_tags(html_entity_decode(bbcode($rr['summary']),ENT_QUOTES,'UTF-8'));
                        if(! $title) {
                                list($title, $_trash) = explode("<br",bbcode($rr['desc']),2);
index b3bd7690fe7194a9403fc4b386343f17e1210e56..7bff0e3468bd7d0331e0549ce2dd9c3616aa574a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 function create_files_from_item($itemid) {
-       global $a;
+       $a = get_app();
 
        $messages = q("SELECT `guid`, `uid`, `id`, `edited`, `deleted`, `file`, `parent` FROM `item` WHERE `id` = %d LIMIT 1", intval($itemid));
 
index 5abd03b61769587180e292d9ebdb825e12ddf757..dbe934ff6de3c980f91d71ad8d7d8b6460e6b4f7 100755 (executable)
@@ -149,6 +149,8 @@ function oembed_fetch_url($embedurl, $no_rich_type = false){
 }
 
 function oembed_format_object($j){
+       $a = get_app();
+
        require_once("mod/proxy.php");
 
        $embedurl = $j->embedurl;
@@ -165,7 +167,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' => $a->get_baseurl(),
                                        '$embedurl'=>$embedurl,
                                        '$escapedhtml'=>base64_encode($jhtml),
                                        '$tw'=>$tw,
@@ -255,12 +257,14 @@ function oembed_format_object($j){
  * @see oembed_format_object()
  */
 function oembed_iframe($src, $width, $height) {
+       $a = get_app();
+
        if (!$height || strstr($height,'%')) {
                $height = '200';
        }
        $width = '100%';
 
-       $s = App::get_baseurl() . '/oembed/'.base64url_encode($src);
+       $s = $a->get_baseurl() . '/oembed/'.base64url_encode($src);
        return '<iframe onload="resizeIframe(this);" class="embed_rich" height="' . $height . '" width="' . $width . '" src="' . $s . '" allowfullscreen scrolling="no" frameborder="no">' . t('Embedded content') . '</iframe>';
 }
 
index de7cdda9e8575cfa41a3d117062225666e8e2ca2..fb87798ff72712b74acccc8f2d4a93bf6b5ba1f4 100644 (file)
@@ -98,7 +98,7 @@ if(! function_exists('load_translation_table')) {
  * @param string $lang language code to load
  */
 function load_translation_table($lang) {
-       global $a;
+       $a = get_app();
 
        $a->strings = array();
        // load enabled plugins strings
index 925de3fe5b04994cb6102b425850e5d9d6c3e810..44f4895cdbda1991d9d12d1c0e59dee33b055eab 100644 (file)
@@ -39,7 +39,7 @@ function poller_run($argv, $argc){
                return;
        }
 
-       if (App::maxload_reached()) {
+       if ($a->maxload_reached()) {
                return;
        }
 
index 765ed5d8912b5fb30d513d6430a07a47bed86fd6..d87be91b7c1624ebc870bc7249083c20b9ac07ff 100644 (file)
@@ -1728,6 +1728,8 @@ function update_gcontact_from_probe($url) {
  * @param int $uid User ID
  */
 function update_gcontact_for_user($uid) {
+       $a = get_app();
+
        $r = q("SELECT `profile`.`locality`, `profile`.`region`, `profile`.`country-name`,
                        `profile`.`name`, `profile`.`about`, `profile`.`gender`,
                        `profile`.`pub_keywords`, `profile`.`dob`, `profile`.`photo`,
@@ -1744,7 +1746,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://"), "", $a->get_baseurl());
        else
                $addr = $r[0]["addr"];
 
@@ -1754,7 +1756,7 @@ function update_gcontact_for_user($uid) {
                        "notify" => $r[0]["notify"], "url" => $r[0]["url"],
                        "hide" => ($r[0]["hidewall"] OR !$r[0]["net-publish"]),
                        "nick" => $r[0]["nickname"], "addr" => $addr,
-                       "connect" => $addr, "server_url" => App::get_baseurl(),
+                       "connect" => $addr, "server_url" => $a->get_baseurl(),
                        "generation" => 1, "network" => NETWORK_DFRN);
 
        update_gcontact($gcontact);
index a8bcae86dcc3783c13bbbc8ab6466517db431f1e..6c1d01d74da5063e6b167d3388b1a03b4b913813 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 function create_tags_from_item($itemid) {
-       global $a;
+       $a = get_app();
 
        $profile_base = $a->get_baseurl();
        $profile_data = parse_url($profile_base);
index 1197f24ee169421e9ab45336b454ad79ae8e18db..61abc359cd302c16bdbef758a0e87c05bfa15ba4 100644 (file)
@@ -699,7 +699,7 @@ $LOGGER_LEVELS = array();
  * @param int $level
  */
 function logger($msg, $level = 0) {
-       global $a;
+       $a = get_app();
        global $db;
        global $LOGGER_LEVELS;
 
index 110ca9585c9d2e5ff0e346aaf4ad4328afffadd7..11ac2d82531bf76c5ba3969ac82b3a8bc5514f23 100644 (file)
@@ -63,7 +63,7 @@ function fbrowser_content($a){
                        );
 
                        function _map_files1($rr){
-                               global $a;
+                               $a = get_app();
                                $types = Photo::supportedTypes();
                                $ext = $types[$rr['type']];
 
@@ -110,7 +110,8 @@ function fbrowser_content($a){
                                        intval(local_user())
                                );
 
-                               function _map_files2($rr){ global $a;
+                               function _map_files2($rr){
+                                       $a = get_app();
                                        list($m1,$m2) = explode("/",$rr['filetype']);
                                        $filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip");
 
index 1c73ad37185234328952834fa042bc0f237a8aa3..6e4c7bb16e8249d7c434245711eafdc51e61dc4f 100644 (file)
@@ -27,7 +27,7 @@ function fetch_init($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($a->get_baseurl())) {
                                $location = $host."/fetch/".$a->argv[1]."/".urlencode($guid);
 
                                header("HTTP/1.1 301 Moved Permanently");
index 8da044e9323916e742b2b1bb24404fefe854acdf..6928bb0b997779086f920639e4a0813ef212f60e 100644 (file)
--- a/mod/p.php
+++ b/mod/p.php
@@ -31,7 +31,7 @@ function p_init($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($a->get_baseurl())) {
                                $location = $host."/p/".urlencode($guid).".xml";
 
                                header("HTTP/1.1 301 Moved Permanently");
index 14f0d8fd083a398c6a7af1953d2551c9cd1b782b..2666dc1de572816a01ec53d4522288392e8c5424 100644 (file)
@@ -21,8 +21,7 @@ class BaseObject {
                if(self::$app)
                        return self::$app;
 
-               global $a;
-               self::$app = $a;
+               self::$app = get_app();
 
                return self::$app;
        }
index 36c06c6d62d2c3014f880c8017b1a4f8814c4e9b..eb5b3b9b486985fe67bc0c8958cb3f33912293c8 100644 (file)
@@ -127,7 +127,7 @@ class Conversation extends BaseObject {
         *      _ false on failure
         */
        public function get_template_data($conv_responses) {
-               global $a;
+               $a = get_app();
                $result = array();
 
                $i = 0;