Browse Source

Some rewrites:

- 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>
tags/3.5.1
Roland Häder 2 years ago
parent
commit
293436e5fd

+ 5
- 13
boot.php View File

@@ -1294,10 +1294,6 @@ class App {
1294 1294
 	 */
1295 1295
 	function max_processes_reached() {
1296 1296
 
1297
-		// Is the function called statically?
1298
-		if (!is_object($this))
1299
-			return(self::$a->max_processes_reached());
1300
-
1301 1297
 		if ($this->is_backend()) {
1302 1298
 			$process = "backend";
1303 1299
 			$max_processes = get_config('system', 'max_processes_backend');
@@ -1329,10 +1325,6 @@ class App {
1329 1325
 	 */
1330 1326
 	function maxload_reached() {
1331 1327
 
1332
-		// Is the function called statically?
1333
-		if (!is_object($this))
1334
-			return(self::$a->maxload_reached());
1335
-
1336 1328
 		if ($this->is_backend()) {
1337 1329
 			$process = "backend";
1338 1330
 			$maxsysload = intval(get_config('system', 'maxloadavg'));
@@ -1479,14 +1471,14 @@ function system_unavailable() {
1479 1471
 
1480 1472
 
1481 1473
 function clean_urls() {
1482
-	global $a;
1474
+	$a = get_app();
1483 1475
 	//	if($a->config['system']['clean_urls'])
1484 1476
 	return true;
1485 1477
 	//	return false;
1486 1478
 }
1487 1479
 
1488 1480
 function z_path() {
1489
-	global $a;
1481
+	$a = get_app();
1490 1482
 	$base = $a->get_baseurl();
1491 1483
 	if(! clean_urls())
1492 1484
 		$base .= '/?q=';
@@ -1501,7 +1493,7 @@ function z_path() {
1501 1493
  * @return string
1502 1494
  */
1503 1495
 function z_root() {
1504
-	global $a;
1496
+	$a = get_app();
1505 1497
 	return $a->get_baseurl();
1506 1498
 }
1507 1499
 
@@ -1903,7 +1895,7 @@ function info($s) {
1903 1895
  * @return int
1904 1896
  */
1905 1897
 function get_max_import_size() {
1906
-	global $a;
1898
+	$a = get_app();
1907 1899
 	return ((x($a->config,'max_import_size')) ? $a->config['max_import_size'] : 0 );
1908 1900
 }
1909 1901
 
@@ -2100,7 +2092,7 @@ function current_theme(){
2100 2092
  * @return string
2101 2093
  */
2102 2094
 function current_theme_url() {
2103
-	global $a;
2095
+	$a = get_app();
2104 2096
 
2105 2097
 	$t = current_theme();
2106 2098
 

+ 4
- 4
include/Core/Config.php View File

@@ -30,7 +30,7 @@ class Config {
30 30
 	 * @return void
31 31
 	 */
32 32
 	public static function load($family) {
33
-		global $a;
33
+		$a = get_app();
34 34
 
35 35
 		$r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s' ORDER BY `cat`, `k`, `id`", dbesc($family));
36 36
 		if (count($r)) {
@@ -72,7 +72,7 @@ class Config {
72 72
 	 */
73 73
 	public static function get($family, $key, $default_value = null, $refresh = false) {
74 74
 
75
-		global $a;
75
+		$a = get_app();
76 76
 
77 77
 		if (!$refresh) {
78 78
 			// Looking if the whole family isn't set
@@ -123,7 +123,7 @@ class Config {
123 123
 	 * @return mixed Stored $value or false if the database update failed
124 124
 	 */
125 125
 	public static function set($family, $key, $value) {
126
-		global $a;
126
+		$a = get_app();
127 127
 
128 128
 		$stored = self::get($family, $key);
129 129
 
@@ -171,7 +171,7 @@ class Config {
171 171
 	 */
172 172
 	public static function delete($family, $key) {
173 173
 
174
-		global $a;
174
+		$a = get_app();
175 175
 		if (x($a->config[$family],$key)) {
176 176
 			unset($a->config[$family][$key]);
177 177
 		}

+ 4
- 4
include/Core/PConfig.php View File

@@ -28,7 +28,7 @@ class PConfig {
28 28
 	 * @return void
29 29
 	 */
30 30
 	public static function load($uid, $family) {
31
-		global $a;
31
+		$a = get_app();
32 32
 		$r = q("SELECT `v`,`k` FROM `pconfig` WHERE `cat` = '%s' AND `uid` = %d ORDER BY `cat`, `k`, `id`",
33 33
 			dbesc($family),
34 34
 			intval($uid)
@@ -65,7 +65,7 @@ class PConfig {
65 65
 	 */
66 66
 	public static function get($uid, $family, $key, $default_value = null, $refresh = false) {
67 67
 
68
-		global $a;
68
+		$a = get_app();
69 69
 
70 70
 		if (!$refresh) {
71 71
 			// Looking if the whole family isn't set
@@ -120,7 +120,7 @@ class PConfig {
120 120
 	 */
121 121
 	public static function set($uid, $family, $key, $value) {
122 122
 
123
-		global $a;
123
+		$a = get_app();
124 124
 
125 125
 		$stored = self::get($uid, $family, $key);
126 126
 
@@ -171,7 +171,7 @@ class PConfig {
171 171
 	 */
172 172
 	public static function delete($uid,$family,$key) {
173 173
 
174
-		global $a;
174
+		$a = get_app();
175 175
 
176 176
 		if (x($a->config[$uid][$family], $key)) {
177 177
 			unset($a->config[$uid][$family][$key]);

+ 1
- 1
include/Probe.php View File

@@ -232,7 +232,7 @@ class Probe {
232 232
 		if ($data["photo"] != "")
233 233
 			$data["baseurl"] = matching_url(normalise_link($data["baseurl"]), normalise_link($data["photo"]));
234 234
 		else
235
-			$data["photo"] = App::get_baseurl().'/images/person-175.jpg';
235
+			$data["photo"] = $a->get_baseurl().'/images/person-175.jpg';
236 236
 
237 237
 		if (!isset($data["name"]) OR ($data["name"] == "")) {
238 238
 			if (isset($data["nick"]))

+ 13
- 13
include/api.php View File

@@ -409,12 +409,12 @@
409 409
 		$arr['$user'] = $user_info;
410 410
 		$arr['$rss'] = array(
411 411
 			'alternate' => $user_info['url'],
412
-			'self' => App::get_baseurl(). "/". $a->query_string,
413
-			'base' => App::get_baseurl(),
412
+			'self' => $a->get_baseurl(). "/". $a->query_string,
413
+			'base' => $a->get_baseurl(),
414 414
 			'updated' => api_date(null),
415 415
 			'atom_updated' => datetime_convert('UTC','UTC','now',ATOM_TIME),
416 416
 			'language' => $user_info['language'],
417
-			'logo'	=> App::get_baseurl()."/images/friendica-32.png",
417
+			'logo'	=> $a->get_baseurl()."/images/friendica-32.png",
418 418
 		);
419 419
 
420 420
 		return $arr;
@@ -693,7 +693,7 @@
693 693
 			'follow_request_sent' => false,
694 694
 			'statusnet_blocking' => false,
695 695
 			'notifications' => false,
696
-			//'statusnet_profile_url' => App::get_baseurl()."/contacts/".$uinfo[0]['cid'],
696
+			//'statusnet_profile_url' => $a->get_baseurl()."/contacts/".$uinfo[0]['cid'],
697 697
 			'statusnet_profile_url' => $uinfo[0]['url'],
698 698
 			'uid' => intval($uinfo[0]['uid']),
699 699
 			'cid' => intval($uinfo[0]['cid']),
@@ -1078,8 +1078,8 @@
1078 1078
 			if ($r) {
1079 1079
 				$phototypes = Photo::supportedTypes();
1080 1080
 				$ext = $phototypes[$r[0]['type']];
1081
-				$_REQUEST['body'] .= "\n\n".'[url='.App::get_baseurl().'/photos/'.$r[0]['nickname'].'/image/'.$r[0]['resource-id'].']';
1082
-				$_REQUEST['body'] .= '[img]'.App::get_baseurl()."/photo/".$r[0]['resource-id']."-".$r[0]['scale'].".".$ext."[/img][/url]";
1081
+				$_REQUEST['body'] .= "\n\n".'[url='.$a->get_baseurl().'/photos/'.$r[0]['nickname'].'/image/'.$r[0]['resource-id'].']';
1082
+				$_REQUEST['body'] .= '[img]'.$a->get_baseurl()."/photo/".$r[0]['resource-id']."-".$r[0]['scale'].".".$ext."[/img][/url]";
1083 1083
 			}
1084 1084
 		}
1085 1085
 
@@ -1777,7 +1777,7 @@
1777 1777
 		$start = $page*$count;
1778 1778
 
1779 1779
 		// Ugly code - should be changed
1780
-		$myurl = App::get_baseurl() . '/profile/'. $a->user['nickname'];
1780
+		$myurl = $a->get_baseurl() . '/profile/'. $a->user['nickname'];
1781 1781
 		$myurl = substr($myurl,strpos($myurl,'://')+3);
1782 1782
 		//$myurl = str_replace(array('www.','.'),array('','\\.'),$myurl);
1783 1783
 		$myurl = str_replace('www.','',$myurl);
@@ -2302,7 +2302,7 @@
2302 2302
 		$text = preg_replace_callback(
2303 2303
 				"|data:image/([^;]+)[^=]+=*|m",
2304 2304
 				function($match) use ($item) {
2305
-					return App::get_baseurl()."/display/".$item['guid'];
2305
+					return $a->get_baseurl()."/display/".$item['guid'];
2306 2306
 				},
2307 2307
 				$text);
2308 2308
 		return $text;
@@ -2690,7 +2690,7 @@
2690 2690
 
2691 2691
 		$name = $a->config['sitename'];
2692 2692
 		$server = $a->get_hostname();
2693
-		$logo = App::get_baseurl() . '/images/friendica-64.png';
2693
+		$logo = $a->get_baseurl() . '/images/friendica-64.png';
2694 2694
 		$email = $a->config['admin_email'];
2695 2695
 		$closed = (($a->config['register_policy'] == REGISTER_CLOSED) ? 'true' : 'false');
2696 2696
 		$private = (($a->config['system']['block_public']) ? 'true' : 'false');
@@ -2698,7 +2698,7 @@
2698 2698
 		if($a->config['api_import_size'])
2699 2699
 			$texlimit = string($a->config['api_import_size']);
2700 2700
 		$ssl = (($a->config['system']['have_ssl']) ? 'true' : 'false');
2701
-		$sslserver = (($ssl === 'true') ? str_replace('http:','https:',App::get_baseurl()) : '');
2701
+		$sslserver = (($ssl === 'true') ? str_replace('http:','https:',$a->get_baseurl()) : '');
2702 2702
 
2703 2703
 		$config = array(
2704 2704
 			'site' => array('name' => $name,'server' => $server, 'theme' => 'default', 'path' => '',
@@ -3075,7 +3075,7 @@
3075 3075
 				$photo['album'] = $rr['album'];
3076 3076
 				$photo['filename'] = $rr['filename'];
3077 3077
 				$photo['type'] = $rr['type'];
3078
-				$thumb = App::get_baseurl()."/photo/".$rr['resource-id']."-".$rr['scale'].".".$typetoext[$rr['type']];
3078
+				$thumb = $a->get_baseurl()."/photo/".$rr['resource-id']."-".$rr['scale'].".".$typetoext[$rr['type']];
3079 3079
 
3080 3080
 				if ($type == "xml")
3081 3081
 					$data['photo'][] = array("@attributes" => $photo, "1" => $thumb);
@@ -3124,11 +3124,11 @@
3124 3124
 				for ($k=intval($data['photo']['minscale']); $k<=intval($data['photo']['maxscale']); $k++)
3125 3125
 					$data['photo']['links'][$k.":link"]["@attributes"] = array("type" => $data['photo']['type'],
3126 3126
 											"scale" => $k,
3127
-											"href" => App::get_baseurl()."/photo/".$data['photo']['resource-id']."-".$k.".".$typetoext[$data['photo']['type']]);
3127
+											"href" => $a->get_baseurl()."/photo/".$data['photo']['resource-id']."-".$k.".".$typetoext[$data['photo']['type']]);
3128 3128
 			} else {
3129 3129
 				$data['photo']['link'] = array();
3130 3130
 				for ($k=intval($data['photo']['minscale']); $k<=intval($data['photo']['maxscale']); $k++) {
3131
-					$data['photo']['link'][$k] = App::get_baseurl()."/photo/".$data['photo']['resource-id']."-".$k.".".$typetoext[$data['photo']['type']];
3131
+					$data['photo']['link'][$k] = $a->get_baseurl()."/photo/".$data['photo']['resource-id']."-".$k.".".$typetoext[$data['photo']['type']];
3132 3132
 				}
3133 3133
 			}
3134 3134
 			unset($data['photo']['resource-id']);

+ 2
- 2
include/auth_ejabberd.php View File

@@ -146,7 +146,7 @@ class exAuth {
146 146
 	 * @param array $aCommand The command array
147 147
 	 */
148 148
 	private function isuser($aCommand) {
149
-		global $a;
149
+		$a = get_app();
150 150
 
151 151
 		// Check if there is a username
152 152
 		if (!isset($aCommand[1])) {
@@ -214,7 +214,7 @@ class exAuth {
214 214
 	 * @param array $aCommand The command array
215 215
 	 */
216 216
 	private function auth($aCommand) {
217
-		global $a;
217
+		$a = get_app();
218 218
 
219 219
 		// check user authentication
220 220
 		if (sizeof($aCommand) != 4) {

+ 1
- 1
include/cron.php View File

@@ -42,7 +42,7 @@ function cron_run(&$argv, &$argc){
42 42
 
43 43
 	// Don't check this stuff if the function is called by the poller
44 44
 	if (App::callstack() != "poller_run") {
45
-		if (App::maxload_reached())
45
+		if ($a->maxload_reached())
46 46
 			return;
47 47
 		if (App::is_already_running('cron', 'include/cron.php', 540))
48 48
 			return;

+ 1
- 1
include/cronhooks.php View File

@@ -25,7 +25,7 @@ function cronhooks_run(&$argv, &$argc){
25 25
 
26 26
 	// Don't check this stuff if the function is called by the poller
27 27
 	if (App::callstack() != "poller_run") {
28
-		if (App::maxload_reached())
28
+		if ($a->maxload_reached())
29 29
 			return;
30 30
 		if (App::is_already_running('cronhooks', 'include/cronhooks.php', 1140))
31 31
 			return;

+ 2
- 2
include/dba.php View File

@@ -35,7 +35,7 @@ class dba {
35 35
 	public  $error = false;
36 36
 
37 37
 	function __construct($server, $user, $pass, $db, $install = false) {
38
-		global $a;
38
+		$a = get_app();
39 39
 
40 40
 		$stamp1 = microtime(true);
41 41
 
@@ -139,7 +139,7 @@ class dba {
139 139
 	}
140 140
 
141 141
 	public function q($sql, $onlyquery = false) {
142
-		global $a;
142
+		$a = get_app();
143 143
 
144 144
 		if (!$this->db || !$this->connected) {
145 145
 			return false;

+ 2
- 2
include/dba_pdo.php View File

@@ -44,7 +44,7 @@ class dba {
44 44
 	public  $error = false;
45 45
 
46 46
 	function __construct($server,$user,$pass,$db,$install = false) {
47
-		global $a;
47
+		$a = get_app();
48 48
     
49 49
     # work around, to store the database - configuration in DDDBL
50 50
     $objDataObjectPool = new \DDDBL\DataObjectPool('Database-Definition');
@@ -99,7 +99,7 @@ class dba {
99 99
 	}
100 100
 
101 101
 	public function q($sql, $onlyquery = false) {
102
-		global $a;
102
+		$a = get_app();
103 103
 
104 104
     $strHandler = (true === $onlyquery) ? 'PDOStatement' : 'MULTI';
105 105
     

+ 1
- 1
include/delivery.php View File

@@ -57,7 +57,7 @@ function delivery_run(&$argv, &$argc){
57 57
 			continue;
58 58
 		}
59 59
 
60
-		if (App::maxload_reached())
60
+		if ($a->maxload_reached())
61 61
 			return;
62 62
 
63 63
 		// It's ours to deliver. Remove it from the queue.

+ 6
- 3
include/dfrn.php View File

@@ -1443,6 +1443,7 @@ class dfrn {
1443 1443
 	 * @param array $importer Record of the importer user mixed with contact of the content
1444 1444
 	 */
1445 1445
 	private function process_suggestion($xpath, $suggestion, $importer) {
1446
+		$a = get_app();
1446 1447
 
1447 1448
 		logger("Processing suggestions");
1448 1449
 
@@ -1524,7 +1525,7 @@ class dfrn {
1524 1525
 			"to_email"     => $importer["email"],
1525 1526
 			"uid"          => $importer["importer_uid"],
1526 1527
 			"item"         => $suggest,
1527
-			"link"         => App::get_baseurl()."/notifications/intros",
1528
+			"link"         => $a->get_baseurl()."/notifications/intros",
1528 1529
 			"source_name"  => $importer["name"],
1529 1530
 			"source_link"  => $importer["url"],
1530 1531
 			"source_photo" => $importer["photo"],
@@ -1791,6 +1792,8 @@ class dfrn {
1791 1792
 	 * @param int $posted_id The record number of item record that was just posted
1792 1793
 	 */
1793 1794
 	private function do_poke($item, $importer, $posted_id) {
1795
+		$a = get_app();
1796
+
1794 1797
 		$verb = urldecode(substr($item["verb"],strpos($item["verb"], "#")+1));
1795 1798
 		if(!$verb)
1796 1799
 			return;
@@ -1810,7 +1813,7 @@ class dfrn {
1810 1813
 				}
1811 1814
 			}
1812 1815
 
1813
-			if($Blink && link_compare($Blink,App::get_baseurl()."/profile/".$importer["nickname"])) {
1816
+			if($Blink && link_compare($Blink,$a->get_baseurl()."/profile/".$importer["nickname"])) {
1814 1817
 
1815 1818
 				// send a notification
1816 1819
 				notification(array(
@@ -1821,7 +1824,7 @@ class dfrn {
1821 1824
 					"to_email"     => $importer["email"],
1822 1825
 					"uid"          => $importer["importer_uid"],
1823 1826
 					"item"         => $item,
1824
-					"link"         => App::get_baseurl()."/display/".urlencode(get_item_guid($posted_id)),
1827
+					"link"         => $a->get_baseurl()."/display/".urlencode(get_item_guid($posted_id)),
1825 1828
 					"source_name"  => stripslashes($item["author-name"]),
1826 1829
 					"source_link"  => $item["author-link"],
1827 1830
 					"source_photo" => ((link_compare($item["author-link"],$importer["url"]))

+ 1
- 1
include/discover_poco.php View File

@@ -26,7 +26,7 @@ function discover_poco_run(&$argv, &$argc){
26 26
 
27 27
 	// Don't check this stuff if the function is called by the poller
28 28
 	if (App::callstack() != "poller_run")
29
-		if (App::maxload_reached())
29
+		if ($a->maxload_reached())
30 30
 			return;
31 31
 
32 32
 	if(($argc > 2) && ($argv[1] == "dirsearch")) {

+ 3
- 2
include/enotify.php View File

@@ -648,6 +648,7 @@ function notification($params) {
648 648
  * @param str $defaulttype (Optional) Forces a notification with this type.
649 649
  */
650 650
 function check_item_notification($itemid, $uid, $defaulttype = "") {
651
+	$a = get_app();
651 652
 
652 653
 	$notification_data = array("uid" => $uid, "profiles" => array());
653 654
 	call_hooks('check_item_notification', $notification_data);
@@ -666,7 +667,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
666 667
 	$profiles[] = $owner[0]["url"];
667 668
 
668 669
 	// Notifications from Diaspora are often with an URL in the Diaspora format
669
-	$profiles[] = App::get_baseurl()."/u/".$user[0]["nickname"];
670
+	$profiles[] = $a->get_baseurl()."/u/".$user[0]["nickname"];
670 671
 
671 672
 	$profiles2 = array();
672 673
 
@@ -720,7 +721,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
720 721
 	$params["to_email"] = $user[0]["email"];
721 722
 	$params["item"] = $item[0];
722 723
 	$params["parent"] = $item[0]["parent"];
723
-	$params["link"] = App::get_baseurl().'/display/'.urlencode($item[0]["guid"]);
724
+	$params["link"] = $a->get_baseurl().'/display/'.urlencode($item[0]["guid"]);
724 725
 	$params["otype"] = 'item';
725 726
 	$params["source_name"] = $item[0]["author-name"];
726 727
 	$params["source_link"] = $item[0]["author-link"];

+ 1
- 1
include/event.php View File

@@ -590,7 +590,7 @@ function process_events ($arr) {
590 590
 			$is_first = ($d !== $last_date);
591 591
 
592 592
 			$last_date = $d;
593
-			$edit = ((! $rr['cid']) ? array(App::get_baseurl().'/events/event/'.$rr['id'],t('Edit event'),'','') : null);
593
+			$edit = ((! $rr['cid']) ? array($a->get_baseurl().'/events/event/'.$rr['id'],t('Edit event'),'','') : null);
594 594
 			$title = strip_tags(html_entity_decode(bbcode($rr['summary']),ENT_QUOTES,'UTF-8'));
595 595
 			if(! $title) {
596 596
 				list($title, $_trash) = explode("<br",bbcode($rr['desc']),2);

+ 1
- 1
include/files.php View File

@@ -1,6 +1,6 @@
1 1
 <?php
2 2
 function create_files_from_item($itemid) {
3
-	global $a;
3
+	$a = get_app();
4 4
 
5 5
 	$messages = q("SELECT `guid`, `uid`, `id`, `edited`, `deleted`, `file`, `parent` FROM `item` WHERE `id` = %d LIMIT 1", intval($itemid));
6 6
 

+ 6
- 2
include/oembed.php View File

@@ -149,6 +149,8 @@ function oembed_fetch_url($embedurl, $no_rich_type = false){
149 149
 }
150 150
 
151 151
 function oembed_format_object($j){
152
+	$a = get_app();
153
+
152 154
 	require_once("mod/proxy.php");
153 155
 
154 156
 	$embedurl = $j->embedurl;
@@ -165,7 +167,7 @@ function oembed_format_object($j){
165 167
 				$th=120; $tw = $th*$tr;
166 168
 				$tpl=get_markup_template('oembed_video.tpl');
167 169
 				$ret.=replace_macros($tpl, array(
168
-					'$baseurl' => App::get_baseurl(),
170
+					'$baseurl' => $a->get_baseurl(),
169 171
 					'$embedurl'=>$embedurl,
170 172
 					'$escapedhtml'=>base64_encode($jhtml),
171 173
 					'$tw'=>$tw,
@@ -255,12 +257,14 @@ function oembed_format_object($j){
255 257
  * @see oembed_format_object()
256 258
  */
257 259
 function oembed_iframe($src, $width, $height) {
260
+	$a = get_app();
261
+
258 262
 	if (!$height || strstr($height,'%')) {
259 263
 		$height = '200';
260 264
 	}
261 265
 	$width = '100%';
262 266
 
263
-	$s = App::get_baseurl() . '/oembed/'.base64url_encode($src);
267
+	$s = $a->get_baseurl() . '/oembed/'.base64url_encode($src);
264 268
 	return '<iframe onload="resizeIframe(this);" class="embed_rich" height="' . $height . '" width="' . $width . '" src="' . $s . '" allowfullscreen scrolling="no" frameborder="no">' . t('Embedded content') . '</iframe>';
265 269
 }
266 270
 

+ 1
- 1
include/pgettext.php View File

@@ -98,7 +98,7 @@ if(! function_exists('load_translation_table')) {
98 98
  * @param string $lang language code to load
99 99
  */
100 100
 function load_translation_table($lang) {
101
-	global $a;
101
+	$a = get_app();
102 102
 
103 103
 	$a->strings = array();
104 104
 	// load enabled plugins strings

+ 1
- 1
include/poller.php View File

@@ -39,7 +39,7 @@ function poller_run($argv, $argc){
39 39
 		return;
40 40
 	}
41 41
 
42
-	if (App::maxload_reached()) {
42
+	if ($a->maxload_reached()) {
43 43
 		return;
44 44
 	}
45 45
 

+ 4
- 2
include/socgraph.php View File

@@ -1728,6 +1728,8 @@ function update_gcontact_from_probe($url) {
1728 1728
  * @param int $uid User ID
1729 1729
  */
1730 1730
 function update_gcontact_for_user($uid) {
1731
+	$a = get_app();
1732
+
1731 1733
 	$r = q("SELECT `profile`.`locality`, `profile`.`region`, `profile`.`country-name`,
1732 1734
 			`profile`.`name`, `profile`.`about`, `profile`.`gender`,
1733 1735
 			`profile`.`pub_keywords`, `profile`.`dob`, `profile`.`photo`,
@@ -1744,7 +1746,7 @@ function update_gcontact_for_user($uid) {
1744 1746
 
1745 1747
 	// The "addr" field was added in 3.4.3 so it can be empty for older users
1746 1748
 	if ($r[0]["addr"] != "")
1747
-		$addr = $r[0]["nickname"].'@'.str_replace(array("http://", "https://"), "", App::get_baseurl());
1749
+		$addr = $r[0]["nickname"].'@'.str_replace(array("http://", "https://"), "", $a->get_baseurl());
1748 1750
 	else
1749 1751
 		$addr = $r[0]["addr"];
1750 1752
 
@@ -1754,7 +1756,7 @@ function update_gcontact_for_user($uid) {
1754 1756
 			"notify" => $r[0]["notify"], "url" => $r[0]["url"],
1755 1757
 			"hide" => ($r[0]["hidewall"] OR !$r[0]["net-publish"]),
1756 1758
 			"nick" => $r[0]["nickname"], "addr" => $addr,
1757
-			"connect" => $addr, "server_url" => App::get_baseurl(),
1759
+			"connect" => $addr, "server_url" => $a->get_baseurl(),
1758 1760
 			"generation" => 1, "network" => NETWORK_DFRN);
1759 1761
 
1760 1762
 	update_gcontact($gcontact);

+ 1
- 1
include/tags.php View File

@@ -1,6 +1,6 @@
1 1
 <?php
2 2
 function create_tags_from_item($itemid) {
3
-	global $a;
3
+	$a = get_app();
4 4
 
5 5
 	$profile_base = $a->get_baseurl();
6 6
 	$profile_data = parse_url($profile_base);

+ 1
- 1
include/text.php View File

@@ -699,7 +699,7 @@ $LOGGER_LEVELS = array();
699 699
  * @param int $level
700 700
  */
701 701
 function logger($msg, $level = 0) {
702
-	global $a;
702
+	$a = get_app();
703 703
 	global $db;
704 704
 	global $LOGGER_LEVELS;
705 705
 

+ 3
- 2
mod/fbrowser.php View File

@@ -63,7 +63,7 @@ function fbrowser_content($a){
63 63
 			);
64 64
 
65 65
 			function _map_files1($rr){
66
-				global $a;
66
+				$a = get_app();
67 67
 				$types = Photo::supportedTypes();
68 68
 				$ext = $types[$rr['type']];
69 69
 
@@ -110,7 +110,8 @@ function fbrowser_content($a){
110 110
 					intval(local_user())
111 111
 				);
112 112
 
113
-				function _map_files2($rr){ global $a;
113
+				function _map_files2($rr){
114
+					$a = get_app();
114 115
 					list($m1,$m2) = explode("/",$rr['filetype']);
115 116
 					$filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip");
116 117
 

+ 1
- 1
mod/fetch.php View File

@@ -27,7 +27,7 @@ function fetch_init($a){
27 27
 			$parts = parse_url($r[0]["author-link"]);
28 28
 			$host = $parts["scheme"]."://".$parts["host"];
29 29
 
30
-			if (normalise_link($host) != normalise_link(App::get_baseurl())) {
30
+			if (normalise_link($host) != normalise_link($a->get_baseurl())) {
31 31
 				$location = $host."/fetch/".$a->argv[1]."/".urlencode($guid);
32 32
 
33 33
 				header("HTTP/1.1 301 Moved Permanently");

+ 1
- 1
mod/p.php View File

@@ -31,7 +31,7 @@ function p_init($a){
31 31
 			$parts = parse_url($r[0]["author-link"]);
32 32
 			$host = $parts["scheme"]."://".$parts["host"];
33 33
 
34
-			if (normalise_link($host) != normalise_link(App::get_baseurl())) {
34
+			if (normalise_link($host) != normalise_link($a->get_baseurl())) {
35 35
 				$location = $host."/p/".urlencode($guid).".xml";
36 36
 
37 37
 				header("HTTP/1.1 301 Moved Permanently");

+ 1
- 2
object/BaseObject.php View File

@@ -21,8 +21,7 @@ class BaseObject {
21 21
 		if(self::$app)
22 22
 			return self::$app;
23 23
 
24
-		global $a;
25
-		self::$app = $a;
24
+		self::$app = get_app();
26 25
 
27 26
 		return self::$app;
28 27
 	}

+ 1
- 1
object/Conversation.php View File

@@ -127,7 +127,7 @@ class Conversation extends BaseObject {
127 127
 	 *      _ false on failure
128 128
 	 */
129 129
 	public function get_template_data($conv_responses) {
130
-		global $a;
130
+		$a = get_app();
131 131
 		$result = array();
132 132
 
133 133
 		$i = 0;

Loading…
Cancel
Save