From 40bdc5d33c740ed5c73f56056457a0e7b2d82117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Tue, 20 Dec 2016 11:14:30 +0100 Subject: [PATCH 01/13] added curly braces + space between "if" and brace + added TODO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- mod/home.php | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/mod/home.php b/mod/home.php index 7289a0fb6d..8bee1aef00 100644 --- a/mod/home.php +++ b/mod/home.php @@ -6,12 +6,13 @@ function home_init(App &$a) { $ret = array(); call_hooks('home_init',$ret); - if(local_user() && ($a->user['nickname'])) + if (local_user() && ($a->user['nickname'])) { goaway(App::get_baseurl()."/network"); - //goaway(App::get_baseurl()."/profile/".$a->user['nickname']); + } - if(strlen(get_config('system','singleuser'))) + if (strlen(get_config('system','singleuser'))) { goaway(App::get_baseurl()."/profile/" . get_config('system','singleuser')); + } }} @@ -21,18 +22,24 @@ function home_content(App &$a) { $o = ''; - if(x($_SESSION,'theme')) + if (x($_SESSION,'theme')) { unset($_SESSION['theme']); - if(x($_SESSION,'mobile-theme')) + } + if (x($_SESSION,'mobile-theme')) { unset($_SESSION['mobile-theme']); + } - if(file_exists('home.html')){ - if(file_exists('home.css')){ - $a->page['htmlhead'] .= '';} + /// @TODO No absolute path used, maybe risky (security) + if (file_exists('home.html')) { + if (file_exists('home.css')) { + $a->page['htmlhead'] .= ''; + } - $o .= file_get_contents('home.html');} + $o .= file_get_contents('home.html');} - else $o .= '

'.((x($a->config,'sitename')) ? sprintf(t("Welcome to %s"), $a->config['sitename']) : "").'

'; + else { + $o .= '

'.((x($a->config,'sitename')) ? sprintf(t("Welcome to %s"), $a->config['sitename']) : "").'

'; + } $o .= login(($a->config['register_policy'] == REGISTER_CLOSED) ? 0 : 1); From 4299cce71907ec820281be2e2208e2c62727ce00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Tue, 20 Dec 2016 11:18:54 +0100 Subject: [PATCH 02/13] added curly braces + space between "if" and brace + added missing @param MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- mod/item.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/mod/item.php b/mod/item.php index a665c6ffe3..a11845e55f 100644 --- a/mod/item.php +++ b/mod/item.php @@ -766,8 +766,9 @@ function item_post(App &$a) { } $json = array('cancel' => 1); - if(x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload'])) + if (x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload'])) { $json['reload'] = App::get_baseurl() . '/' . $_REQUEST['jsreload']; + } echo json_encode($json); killme(); @@ -1049,13 +1050,14 @@ function item_post_return($baseurl, $api_source, $return_path) { if($api_source) return; - if($return_path) { + if ($return_path) { goaway($return_path); } $json = array('success' => 1); - if(x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload'])) + if (x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload'])) { $json['reload'] = $baseurl . '/' . $_REQUEST['jsreload']; + } logger('post_json: ' . print_r($json,true), LOGGER_DEBUG); @@ -1067,15 +1069,16 @@ function item_post_return($baseurl, $api_source, $return_path) { function item_content(App &$a) { - if((! local_user()) && (! remote_user())) + if ((! local_user()) && (! remote_user())) { return; + } require_once('include/security.php'); $o = ''; - if(($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) { + if (($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) { $o = drop_item($a->argv[2], !is_ajax()); - if (is_ajax()){ + if (is_ajax()) { // ajax return: [, 0 (no perm) | ] echo json_encode(array(intval($a->argv[2]), intval($o))); killme(); @@ -1088,6 +1091,7 @@ function item_content(App &$a) { * This function removes the tag $tag from the text $body and replaces it with * the appropiate link. * + * @param App $a Application instance @TODO is unused in this function's scope (excluding included files) * @param unknown_type $body the text to replace the tag in * @param string $inform a comma-seperated string containing everybody to inform * @param string $str_tags string to add the tag to @@ -1105,13 +1109,14 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo $r = null; //is it a person tag? - if(strpos($tag,'@') === 0) { + if (strpos($tag,'@') === 0) { //is it already replaced? - if(strpos($tag,'[url=')) { + if (strpos($tag,'[url=')) { //append tag to str_tags - if(!stristr($str_tags,$tag)) { - if(strlen($str_tags)) + if (!stristr($str_tags,$tag)) { + if (strlen($str_tags)) { $str_tags .= ','; + } $str_tags .= $tag; } From 9c097c20dd7d9bc3cc611c4da9448b8be23af45c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Tue, 20 Dec 2016 11:21:32 +0100 Subject: [PATCH 03/13] added curly braces + space between "if" and brace + initialized $result (was only within if() block but not outside of it) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- mod/group.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/mod/group.php b/mod/group.php index 08b7801a7b..75bb2b7c81 100644 --- a/mod/group.php +++ b/mod/group.php @@ -104,26 +104,32 @@ function group_content(App &$a) { } - if(($a->argc == 3) && ($a->argv[1] === 'drop')) { + if (($a->argc == 3) && ($a->argv[1] === 'drop')) { check_form_security_token_redirectOnErr('/group', 'group_drop', 't'); - if(intval($a->argv[2])) { + if (intval($a->argv[2])) { $r = q("SELECT `name` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[2]), intval(local_user()) ); - if (dbm::is_result($r)) + + $result = null; + + if (dbm::is_result($r)) { $result = group_rmv(local_user(),$r[0]['name']); - if($result) + } + + if ($result) { info( t('Group removed.') . EOL); - else + } else { notice( t('Unable to remove group.') . EOL); + } } goaway(App::get_baseurl() . '/group'); // NOTREACHED } - if(($a->argc > 2) && intval($a->argv[1]) && intval($a->argv[2])) { + if (($a->argc > 2) && intval($a->argv[1]) && intval($a->argv[2])) { check_form_security_token_ForbiddenOnErr('group_member_change', 't'); $r = q("SELECT `id` FROM `contact` WHERE `id` = %d AND `uid` = %d and `self` = 0 and `blocked` = 0 AND `pending` = 0 LIMIT 1", @@ -134,7 +140,7 @@ function group_content(App &$a) { $change = intval($a->argv[2]); } - if(($a->argc > 1) && (intval($a->argv[1]))) { + if (($a->argc > 1) && (intval($a->argv[1]))) { require_once('include/acl_selectors.php'); $r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1", From 507db84243e637b289f7e5381ef7bad44822421b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Tue, 20 Dec 2016 11:27:40 +0100 Subject: [PATCH 04/13] added curly braces + space between "if" and brace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- mod/notify.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/mod/notify.php b/mod/notify.php index cd836dada7..2d34821ded 100644 --- a/mod/notify.php +++ b/mod/notify.php @@ -3,10 +3,13 @@ require_once('include/NotificationsManager.php'); function notify_init(App &$a) { - if(! local_user()) return; + if (! local_user()) { + return; + } + $nm = new NotificationsManager(); - - if($a->argc > 2 && $a->argv[1] === 'view' && intval($a->argv[2])) { + + if ($a->argc > 2 && $a->argv[1] === 'view' && intval($a->argv[2])) { $note = $nm->getByID($a->argv[2]); if ($note) { $nm->setSeen($note); @@ -17,8 +20,9 @@ function notify_init(App &$a) { $urldata = parse_url($note['link']); $guid = basename($urldata["path"]); $itemdata = get_item_id($guid, local_user()); - if ($itemdata["id"] != 0) + if ($itemdata["id"] != 0) { $note['link'] = App::get_baseurl().'/display/'.$itemdata["nick"].'/'.$itemdata["id"]; + } } goaway($note['link']); @@ -27,7 +31,7 @@ function notify_init(App &$a) { goaway(App::get_baseurl(true)); } - if($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all' ) { + if ($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all' ) { $r = $nm->setAllSeen(); $j = json_encode(array('result' => ($r) ? 'success' : 'fail')); echo $j; @@ -37,7 +41,9 @@ function notify_init(App &$a) { } function notify_content(App &$a) { - if(! local_user()) return login(); + if (! local_user()) { + return login(); + } $nm = new NotificationsManager(); From c1845c97cc944882865a9542e1c76572f4cf03e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Tue, 20 Dec 2016 11:33:04 +0100 Subject: [PATCH 05/13] added more curly braces + fixed space->tab for code indentation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- mod/videos.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mod/videos.php b/mod/videos.php index eb5a2cee4e..de6e016666 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -106,13 +106,17 @@ function videos_post(App &$a) { $owner_uid = $a->data['user']['uid']; - if (local_user() != $owner_uid) goaway(App::get_baseurl() . '/videos/' . $a->data['user']['nickname']); + if (local_user() != $owner_uid) { + goaway(App::get_baseurl() . '/videos/' . $a->data['user']['nickname']); + } - if(($a->argc == 2) && x($_POST,'delete') && x($_POST, 'id')) { + if (($a->argc == 2) && x($_POST,'delete') && x($_POST, 'id')) { // Check if we should do HTML-based delete confirmation if(!x($_REQUEST,'confirm')) { - if(x($_REQUEST,'canceled')) goaway(App::get_baseurl() . '/videos/' . $a->data['user']['nickname']); + if (x($_REQUEST,'canceled')) { + goaway(App::get_baseurl() . '/videos/' . $a->data['user']['nickname']); + } $drop_url = $a->query_string; $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), array( @@ -149,7 +153,7 @@ function videos_post(App &$a) { dbesc($video_id), intval(local_user()) ); - #echo "
"; var_dump($i); killme();
+			//echo "
"; var_dump($i); killme();
 			if(count($i)) {
 				q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
 					dbesc(datetime_convert()),
@@ -172,7 +176,7 @@ function videos_post(App &$a) {
 		return; // NOTREACHED
 	}
 
-    goaway(App::get_baseurl() . '/videos/' . $a->data['user']['nickname']);
+	goaway(App::get_baseurl() . '/videos/' . $a->data['user']['nickname']);
 
 }
 

From c86f09a89467f14cb138611dbffb73bcbb6c0861 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roland=20H=C3=A4der?= 
Date: Tue, 20 Dec 2016 11:36:03 +0100
Subject: [PATCH 06/13] added spaces + curly braces
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Roland Häder 
---
 include/notifier.php  |  2 +-
 include/socgraph.php  | 14 +++++++-------
 mod/profile_photo.php |  6 ++++--
 mod/profiles.php      |  3 ++-
 mod/redir.php         |  8 +++++---
 mod/regmod.php        |  3 ++-
 mod/settings.php      |  3 ++-
 7 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/include/notifier.php b/include/notifier.php
index 8823834c1d..9e1450ba2b 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -558,7 +558,7 @@ function notifier_run(&$argv, &$argc){
 	if($slap && count($url_recipients) && ($public_message || $push_notify) && $normal_mode) {
 		if(!get_config('system','dfrn_only')) {
 			foreach($url_recipients as $url) {
-				if($url) {
+				if ($url) {
 					logger('notifier: urldelivery: ' . $url);
 					$deliver_status = slapper($owner,$url,$slap);
 					/// @TODO Redeliver/queue these items on failure, though there is no contact record
diff --git a/include/socgraph.php b/include/socgraph.php
index 31c7e597d3..3fe1227f31 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -93,19 +93,19 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
 
 		if(isset($entry->urls)) {
 			foreach($entry->urls as $url) {
-				if($url->type == 'profile') {
+				if ($url->type == 'profile') {
 					$profile_url = $url->value;
 					continue;
 				}
-				if($url->type == 'webfinger') {
+				if ($url->type == 'webfinger') {
 					$connect_url = str_replace('acct:' , '', $url->value);
 					continue;
 				}
 			}
 		}
-		if(isset($entry->photos)) {
+		if (isset($entry->photos)) {
 			foreach($entry->photos as $photo) {
-				if($photo->type == 'profile') {
+				if ($photo->type == 'profile') {
 					$profile_photo = $photo->value;
 					continue;
 				}
@@ -1334,7 +1334,7 @@ function poco_discover_server_users($data, $server) {
 		$username = "";
 		if (isset($entry->urls)) {
 			foreach($entry->urls as $url)
-				if($url->type == 'profile') {
+				if ($url->type == 'profile') {
 					$profile_url = $url->value;
 					$urlparts = parse_url($profile_url);
 					$username = end(explode("/", $urlparts["path"]));
@@ -1378,11 +1378,11 @@ function poco_discover_server($data, $default_generation = 0) {
 
 		if(isset($entry->urls)) {
 			foreach($entry->urls as $url) {
-				if($url->type == 'profile') {
+				if ($url->type == 'profile') {
 					$profile_url = $url->value;
 					continue;
 				}
-				if($url->type == 'webfinger') {
+				if ($url->type == 'webfinger') {
 					$connect_url = str_replace('acct:' , '', $url->value);
 					continue;
 				}
diff --git a/mod/profile_photo.php b/mod/profile_photo.php
index 52cf6d26f4..fd7302e4da 100644
--- a/mod/profile_photo.php
+++ b/mod/profile_photo.php
@@ -124,8 +124,9 @@ function profile_photo_post(App &$a) {
 				info( t('Shift-reload the page or clear browser cache if the new photo does not display immediately.') . EOL);
 				// Update global directory in background
 				$url = App::get_baseurl() . '/profile/' . $a->user['nickname'];
-				if($url && strlen(get_config('system','directory')))
+				if ($url && strlen(get_config('system','directory'))) {
 					proc_run(PRIORITY_LOW, "include/directory.php", $url);
+				}
 
 				require_once('include/profile_update.php');
 				profile_change();
@@ -223,8 +224,9 @@ function profile_photo_content(App &$a) {
 
 			// Update global directory in background
 			$url = $_SESSION['my_url'];
-			if($url && strlen(get_config('system','directory')))
+			if ($url && strlen(get_config('system','directory'))) {
 				proc_run(PRIORITY_LOW, "include/directory.php", $url);
+			}
 
 			goaway(App::get_baseurl() . '/profiles');
 			return; // NOTREACHED
diff --git a/mod/profiles.php b/mod/profiles.php
index 186d7a615e..cca7a57ec5 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -502,8 +502,9 @@ function profiles_post(App &$a) {
 
 			// Update global directory in background
 			$url = $_SESSION['my_url'];
-			if($url && strlen(get_config('system','directory')))
+			if ($url && strlen(get_config('system','directory'))) {
 				proc_run(PRIORITY_LOW, "include/directory.php", $url);
+			}
 
 			require_once('include/profile_update.php');
 			profile_change();
diff --git a/mod/redir.php b/mod/redir.php
index e581580271..b0c0b2c099 100644
--- a/mod/redir.php
+++ b/mod/redir.php
@@ -63,12 +63,14 @@ function redir_init(App &$a) {
 			. '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest . $quiet );
 	}
 
-	if(local_user())
+	if (local_user()) {
 		$handle = $a->user['nickname'] . '@' . substr($a->get_baseurl(),strpos($a->get_baseurl(),'://')+3);
-	if(remote_user())
+	}
+	if (remote_user()) {
 		$handle = $_SESSION['handle'];
+	}
 
-	if($url) {
+	if ($url) {
 		$url = str_replace('{zid}','&zid=' . $handle,$url);
 		goaway($url);
 	}
diff --git a/mod/regmod.php b/mod/regmod.php
index d20383ba53..60da71321e 100644
--- a/mod/regmod.php
+++ b/mod/regmod.php
@@ -38,8 +38,9 @@ function user_allow($hash) {
 	);
 	if (dbm::is_result($r) && $r[0]['net-publish']) {
 		$url = App::get_baseurl() . '/profile/' . $user[0]['nickname'];
-		if($url && strlen(get_config('system','directory')))
+		if ($url && strlen(get_config('system','directory'))) {
 			proc_run(PRIORITY_LOW, "include/directory.php", $url);
+		}
 	}
 
 	push_lang($register[0]['language']);
diff --git a/mod/settings.php b/mod/settings.php
index 0d052cc1b7..14ef33fc86 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -629,8 +629,9 @@ function settings_post(App &$a) {
 	if(($old_visibility != $net_publish) || ($page_flags != $old_page_flags)) {
 		// Update global directory in background
 		$url = $_SESSION['my_url'];
-		if($url && strlen(get_config('system','directory')))
+		if ($url && strlen(get_config('system','directory'))) {
 			proc_run(PRIORITY_LOW, "include/directory.php", $url);
+		}
 	}
 
 	require_once('include/profile_update.php');

From 5588472f6d2c4dade67955af67c72fe43150d76d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roland=20H=C3=A4der?= 
Date: Tue, 20 Dec 2016 11:38:16 +0100
Subject: [PATCH 07/13] added spaces + curly braces
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Roland Häder 
---
 include/conversation.php |  6 ++++--
 include/email.php        | 19 +++++++++++++------
 include/socgraph.php     |  7 ++++---
 include/text.php         |  2 +-
 mod/randprof.php         |  6 +++++-
 5 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/include/conversation.php b/include/conversation.php
index 916a9e229e..ccfc070d4e 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -324,11 +324,13 @@ function localize_item(&$item){
 	// add sparkle links to appropriate permalinks
 
 	$x = stristr($item['plink'],'/display/');
-	if($x) {
+	if ($x) {
 		$sparkle = false;
 		$y = best_link_url($item,$sparkle,true);
-		if(strstr($y,'/redir/'))
+
+		if (strstr($y,'/redir/')) {
 			$item['plink'] = $y . '?f=&url=' . $item['plink'];
+		}
 	}
 
 
diff --git a/include/email.php b/include/email.php
index 2c05d3233f..42f80c2427 100644
--- a/include/email.php
+++ b/include/email.php
@@ -96,15 +96,20 @@ function email_get_msg($mbox,$uid, $reply) {
 		$html = '';
 		foreach($struc->parts as $ptop => $p) {
 			$x = email_get_part($mbox,$uid,$p,$ptop + 1, 'plain');
-			if($x)	$text .= $x;
+			if ($x) {
+				$text .= $x;
+			}
 
 			$x = email_get_part($mbox,$uid,$p,$ptop + 1, 'html');
-			if($x)	$html .= $x;
+			if ($x) {
+				$html .= $x;
+			}
 		}
-		if (trim($html) != '')
+		if (trim($html) != '') {
 			$ret['body'] = html2bbcode($html);
-		else
+		} else {
 			$ret['body'] = $text;
+		}
 	}
 
 	$ret['body'] = removegpg($ret['body']);
@@ -112,8 +117,9 @@ function email_get_msg($mbox,$uid, $reply) {
 	$ret['body'] = $msg['body'];
 	$ret['body'] = convertquote($ret['body'], $reply);
 
-	if (trim($html) != '')
+	if (trim($html) != '') {
 		$ret['body'] = removelinebreak($ret['body']);
+	}
 
 	$ret['body'] = unifyattributionline($ret['body']);
 
@@ -189,8 +195,9 @@ function email_get_part($mbox,$uid,$p,$partno, $subtype) {
 		$x = "";
 		foreach ($p->parts as $partno0=>$p2) {
 			$x .=  email_get_part($mbox,$uid,$p2,$partno . '.' . ($partno0+1), $subtype);  // 1.2, 1.2.1, etc.
-			//if($x)
+			//if ($x) {
 			//	return $x;
+			//}
 		}
 		return $x;
 	}
diff --git a/include/socgraph.php b/include/socgraph.php
index 3fe1227f31..a779e88eff 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -1188,16 +1188,17 @@ function update_suggestions() {
 
 	if(strlen(get_config('system','directory'))) {
 		$x = fetch_url(get_server()."/pubsites");
-		if($x) {
+		if ($x) {
 			$j = json_decode($x);
-			if($j->entries) {
+			if ($j->entries) {
 				foreach($j->entries as $entry) {
 
 					poco_check_server($entry->url);
 
 					$url = $entry->url . '/poco';
-					if(! in_array($url,$done))
+					if (! in_array($url,$done)) {
 						poco_load(0,0,0,$entry->url . '/poco');
+					}
 				}
 			}
 		}
diff --git a/include/text.php b/include/text.php
index 59d4e1cc9f..8d3b6a8050 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1367,7 +1367,7 @@ function prepare_body(&$item,$attach = false, $preview = false) {
 	// map
 	if(strpos($s,'
') !== false && $item['coord']) { $x = generate_map(trim($item['coord'])); - if($x) { + if ($x) { $s = preg_replace('/\
/','$0' . $x,$s); } } diff --git a/mod/randprof.php b/mod/randprof.php index bf9fa34256..08157a3851 100644 --- a/mod/randprof.php +++ b/mod/randprof.php @@ -3,8 +3,12 @@ function randprof_init(App &$a) { require_once('include/Contact.php'); + $x = random_profile(); - if($x) + + if ($x) { goaway(zrl($x)); + } + goaway(App::get_baseurl() . '/profile'); } From 51d352922ad485a537a70302423d5edc824733a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Tue, 20 Dec 2016 11:39:53 +0100 Subject: [PATCH 08/13] Continued: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - added curly braces + spaces - added todo about testing empty/non-empty strings Signed-off-by: Roland Häder --- mod/settings.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mod/settings.php b/mod/settings.php index 14ef33fc86..97d4f5f603 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -824,8 +824,10 @@ function settings_content(App &$a) { $settings_connectors .= mini_group_select(local_user(), $default_group, t("Default group for OStatus contacts")); - if ($legacy_contact != "") + /// @TODO Found to much different usage to test empty/non-empty strings (e.g. empty(), trim() == '' ) which is wanted? + if ($legacy_contact != "") { $a->page['htmlhead'] = ''; + } $settings_connectors .= '
'; $settings_connectors .= ''; From e24c3a5b826d2357e40a173d9e7b66048dab5b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Tue, 20 Dec 2016 11:56:34 +0100 Subject: [PATCH 09/13] added much more curly braces + space between "if" and brace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- doc/themes.md | 3 +- include/acl_selectors.php | 5 +- include/contact_widgets.php | 15 ++++-- include/group.php | 2 +- mod/allfriends.php | 11 ++-- mod/api.php | 4 +- mod/bookmarklet.php | 2 +- mod/community.php | 2 +- mod/contactgroup.php | 2 +- mod/contacts.php | 15 +++--- mod/content.php | 2 +- mod/crepair.php | 8 +-- mod/delegate.php | 2 +- mod/dirfind.php | 2 +- mod/editpost.php | 6 +-- mod/events.php | 8 +-- mod/filer.php | 2 +- mod/filerm.php | 2 +- mod/follow.php | 4 +- mod/fsuggest.php | 7 +-- mod/group.php | 4 +- mod/ignored.php | 14 +++-- mod/invite.php | 4 +- mod/manage.php | 5 +- mod/match.php | 3 +- mod/message.php | 4 +- mod/mood.php | 5 +- mod/network.php | 4 +- mod/nogroup.php | 8 +-- mod/notes.php | 5 +- mod/notifications.php | 4 +- mod/oexchange.php | 4 +- mod/ostatus_subscribe.php | 2 +- mod/poke.php | 14 +++-- mod/profile_photo.php | 6 +-- mod/profiles.php | 9 ++-- mod/profperm.php | 5 +- mod/qsearch.php | 3 +- mod/regmod.php | 11 ++-- mod/repair_ostatus.php | 2 +- mod/settings.php | 7 +-- mod/starred.php | 9 ++-- mod/suggest.php | 11 ++-- mod/tagrm.php | 8 +-- mod/uexport.php | 5 +- mod/viewsrc.php | 2 +- view/theme/duepuntozero/config.php | 84 ++++++++++++++++-------------- view/theme/frio/config.php | 9 +++- view/theme/quattro/config.php | 18 ++++--- view/theme/vier/config.php | 15 ++++-- 50 files changed, 224 insertions(+), 164 deletions(-) diff --git a/doc/themes.md b/doc/themes.md index 0ae7e694fe..0b8f6cb83d 100644 --- a/doc/themes.md +++ b/doc/themes.md @@ -124,8 +124,9 @@ The selected 1st part will be saved in the database by the theme_post function. function theme_post(App &$a){ // non local users shall not pass - if(! local_user()) + if (! local_user()) { return; + } // if the one specific submit button was pressed then proceed if (isset($_POST['duepuntozero-settings-submit'])){ // and save the selection key into the personal config of the user diff --git a/include/acl_selectors.php b/include/acl_selectors.php index cd68ffaa7d..c1edc8cc03 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -392,8 +392,9 @@ function construct_acl_data(&$a, $user) { function acl_lookup(&$a, $out_type = 'json') { - if(!local_user()) - return ""; + if (!local_user()) { + return ''; + } $start = (x($_REQUEST,'start') ? $_REQUEST['start'] : 0); $count = (x($_REQUEST,'count') ? $_REQUEST['count'] : 100); diff --git a/include/contact_widgets.php b/include/contact_widgets.php index a74080e75b..71a75d431e 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -80,11 +80,13 @@ function networks_widget($baseurl,$selected = '') { $a = get_app(); - if(!local_user()) + if (!local_user()) { return ''; + } - if(!feature_enabled(local_user(),'networks')) + if (!feature_enabled(local_user(),'networks')) { return ''; + } $extra_sql = unavailable_networks(); @@ -116,15 +118,18 @@ function networks_widget($baseurl,$selected = '') { } function fileas_widget($baseurl,$selected = '') { - if(! local_user()) + if (! local_user()) { return ''; + } - if(! feature_enabled(local_user(),'filing')) + if (! feature_enabled(local_user(),'filing')) { return ''; + } $saved = get_pconfig(local_user(),'system','filetags'); - if(! strlen($saved)) + if (! strlen($saved)) { return; + } $matches = false; $terms = array(); diff --git a/include/group.php b/include/group.php index 67712aae7c..a2a55c4440 100644 --- a/include/group.php +++ b/include/group.php @@ -234,7 +234,7 @@ function group_side($every="contacts",$each="group",$editmode = "standard", $gro $o = ''; - if(! local_user()) + if (! local_user()) return ''; $groups = array(); diff --git a/mod/allfriends.php b/mod/allfriends.php index 43490e9640..f9cffcbb2d 100644 --- a/mod/allfriends.php +++ b/mod/allfriends.php @@ -8,16 +8,18 @@ require_once('mod/contacts.php'); function allfriends_content(App &$a) { $o = ''; - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } - if($a->argc > 1) + if ($a->argc > 1) { $cid = intval($a->argv[1]); + } - if(! $cid) + if (! $cid) { return; + } $uid = $a->user['uid']; @@ -26,7 +28,8 @@ function allfriends_content(App &$a) { intval(local_user()) ); - if(! count($c)) + if (! count($c)) { + } return; $a->page['aside'] = ""; diff --git a/mod/api.php b/mod/api.php index b398daac8c..74a0cff6f4 100644 --- a/mod/api.php +++ b/mod/api.php @@ -22,7 +22,7 @@ function oauth_get_client($request){ function api_post(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } @@ -84,7 +84,7 @@ function api_content(App &$a) { } - if(! local_user()) { + if (! local_user()) { /// @TODO We need login form to redirect to this page notice( t('Please login to continue.') . EOL ); return login(false,$request->get_parameters()); diff --git a/mod/bookmarklet.php b/mod/bookmarklet.php index 1d68069439..9bc8c33535 100644 --- a/mod/bookmarklet.php +++ b/mod/bookmarklet.php @@ -8,7 +8,7 @@ function bookmarklet_init(App &$a) { } function bookmarklet_content(App &$a) { - if(!local_user()) { + if (!local_user()) { $o = '

'.t('Login').'

'; $o .= login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true); return $o; diff --git a/mod/community.php b/mod/community.php index 7a1e727338..2c2ea32b33 100644 --- a/mod/community.php +++ b/mod/community.php @@ -1,7 +1,7 @@ argv[1]==="batch") { contacts_batch_actions($a); @@ -147,15 +149,16 @@ function contacts_post(App &$a) { } $contact_id = intval($a->argv[1]); - if(! $contact_id) + if (! $contact_id) { return; + } $orig_record = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($contact_id), intval(local_user()) ); - if(! count($orig_record)) { + if (! count($orig_record)) { notice( t('Could not access contact record.') . EOL); goaway('contacts'); return; // NOTREACHED @@ -164,7 +167,7 @@ function contacts_post(App &$a) { call_hooks('contact_edit_post', $_POST); $profile_id = intval($_POST['profile-assign']); - if($profile_id) { + if ($profile_id) { $r = q("SELECT `id` FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($profile_id), intval(local_user()) @@ -346,7 +349,7 @@ function contacts_content(App &$a) { nav_set_selected('contacts'); - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } diff --git a/mod/content.php b/mod/content.php index 1a3fb10952..2377032a79 100644 --- a/mod/content.php +++ b/mod/content.php @@ -23,7 +23,7 @@ function content_content(&$a, $update = 0) { // Currently security is based on the logged in user - if(! local_user()) { + if (! local_user()) { return; } diff --git a/mod/crepair.php b/mod/crepair.php index 308d5b95e9..2661deaeed 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -3,8 +3,9 @@ require_once("include/contact_selectors.php"); require_once("mod/contacts.php"); function crepair_init(App &$a) { - if(! local_user()) + if (! local_user()) { return; + } $contact_id = 0; @@ -31,8 +32,9 @@ function crepair_init(App &$a) { function crepair_post(App &$a) { - if(! local_user()) + if (! local_user()) { return; + } $cid = (($a->argc > 1) ? intval($a->argv[1]) : 0); @@ -97,7 +99,7 @@ function crepair_post(App &$a) { function crepair_content(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } diff --git a/mod/delegate.php b/mod/delegate.php index 7dbeef7377..8470a7ba0b 100644 --- a/mod/delegate.php +++ b/mod/delegate.php @@ -8,7 +8,7 @@ function delegate_init(App &$a) { function delegate_content(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } diff --git a/mod/dirfind.php b/mod/dirfind.php index 80cba1c475..fc5750f2dd 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -7,7 +7,7 @@ require_once('mod/contacts.php'); function dirfind_init(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL ); return; } diff --git a/mod/editpost.php b/mod/editpost.php index 29f3dadff0..1bf150a5dd 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -6,14 +6,14 @@ function editpost_content(App &$a) { $o = ''; - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); - if(! $post_id) { + if (! $post_id) { notice( t('Item not found') . EOL); return; } @@ -23,7 +23,7 @@ function editpost_content(App &$a) { intval(local_user()) ); - if(! count($itm)) { + if (! count($itm)) { notice( t('Item not found') . EOL); return; } diff --git a/mod/events.php b/mod/events.php index bf65ff1267..0c1e9ae2f5 100644 --- a/mod/events.php +++ b/mod/events.php @@ -9,8 +9,9 @@ require_once('include/event.php'); require_once('include/items.php'); function events_init(App &$a) { - if(! local_user()) + if (! local_user()) { return; + } if ($a->argc == 1) { // if it's a json request abort here becaus we don't @@ -34,8 +35,9 @@ function events_post(App &$a) { logger('post: ' . print_r($_REQUEST,true)); - if(! local_user()) + if (! local_user()) { return; + } $event_id = ((x($_POST,'event_id')) ? intval($_POST['event_id']) : 0); $cid = ((x($_POST,'cid')) ? intval($_POST['cid']) : 0); @@ -187,7 +189,7 @@ function events_post(App &$a) { function events_content(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } diff --git a/mod/filer.php b/mod/filer.php index 4198502c4c..1b5589380b 100644 --- a/mod/filer.php +++ b/mod/filer.php @@ -7,7 +7,7 @@ require_once('include/items.php'); function filer_content(App &$a) { - if(! local_user()) { + if (! local_user()) { killme(); } diff --git a/mod/filerm.php b/mod/filerm.php index e109ed404b..cdc5a034aa 100644 --- a/mod/filerm.php +++ b/mod/filerm.php @@ -2,7 +2,7 @@ function filerm_content(App &$a) { - if(! local_user()) { + if (! local_user()) { killme(); } diff --git a/mod/follow.php b/mod/follow.php index d17c874f69..56e698547b 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -7,7 +7,7 @@ require_once('include/contact_selectors.php'); function follow_content(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); goaway($_SESSION['return_url']); // NOTREACHED @@ -151,7 +151,7 @@ function follow_content(App &$a) { function follow_post(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); goaway($_SESSION['return_url']); // NOTREACHED diff --git a/mod/fsuggest.php b/mod/fsuggest.php index 9d862848f1..fcbadcc9b7 100644 --- a/mod/fsuggest.php +++ b/mod/fsuggest.php @@ -3,12 +3,13 @@ function fsuggest_post(App &$a) { - if(! local_user()) { + if (! local_user()) { return; } - if($a->argc != 2) + if ($a->argc != 2) { return; + } $contact_id = intval($a->argv[1]); @@ -74,7 +75,7 @@ function fsuggest_content(App &$a) { require_once('include/acl_selectors.php'); - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } diff --git a/mod/group.php b/mod/group.php index 75bb2b7c81..fc5c481817 100644 --- a/mod/group.php +++ b/mod/group.php @@ -15,7 +15,7 @@ function group_init(App &$a) { function group_post(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } @@ -73,7 +73,7 @@ function group_post(App &$a) { function group_content(App &$a) { $change = false; - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied') . EOL); return; } diff --git a/mod/ignored.php b/mod/ignored.php index 446d12a6ab..99b3a3ddcc 100644 --- a/mod/ignored.php +++ b/mod/ignored.php @@ -5,12 +5,15 @@ function ignored_init(App &$a) { $ignored = 0; - if(! local_user()) + if (! local_user()) { killme(); - if($a->argc > 1) + } + if ($a->argc > 1) { $message_id = intval($a->argv[1]); - if(! $message_id) + } + if (! $message_id) { killme(); + } $r = q("SELECT `ignored` FROM `thread` WHERE `uid` = %d AND `iid` = %d LIMIT 1", intval(local_user()), @@ -20,8 +23,9 @@ function ignored_init(App &$a) { killme(); } - if(! intval($r[0]['ignored'])) + if (! intval($r[0]['ignored'])) { $ignored = 1; + } $r = q("UPDATE `thread` SET `ignored` = %d WHERE `uid` = %d and `iid` = %d", intval($ignored), @@ -31,7 +35,7 @@ function ignored_init(App &$a) { // See if we've been passed a return path to redirect to $return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : ''); - if($return_path) { + if ($return_path) { $rand = '_=' . time(); if(strpos($return_path, '?')) $rand = "&$rand"; else $rand = "?$rand"; diff --git a/mod/invite.php b/mod/invite.php index 79b30d6e4b..2db71742f1 100644 --- a/mod/invite.php +++ b/mod/invite.php @@ -11,7 +11,7 @@ require_once('include/email.php'); function invite_post(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } @@ -97,7 +97,7 @@ function invite_post(App &$a) { function invite_content(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } diff --git a/mod/manage.php b/mod/manage.php index 3eecfbb715..835a7fbcb7 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -5,8 +5,9 @@ require_once("include/text.php"); function manage_post(App &$a) { - if(! local_user()) + if (! local_user()) { return; + } $uid = local_user(); $orig_record = $a->user; @@ -93,7 +94,7 @@ function manage_post(App &$a) { function manage_content(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } diff --git a/mod/match.php b/mod/match.php index cdf2f8eacd..8bc255023f 100644 --- a/mod/match.php +++ b/mod/match.php @@ -16,8 +16,9 @@ require_once('mod/proxy.php'); function match_content(App &$a) { $o = ''; - if(! local_user()) + if (! local_user()) { return; + } $a->page['aside'] .= findpeople_widget(); $a->page['aside'] .= follow_widget(); diff --git a/mod/message.php b/mod/message.php index 0191eab0c9..ef62a78981 100644 --- a/mod/message.php +++ b/mod/message.php @@ -42,7 +42,7 @@ function message_init(App &$a) { function message_post(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } @@ -178,7 +178,7 @@ function message_content(App &$a) { $o = ''; nav_set_selected('messages'); - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } diff --git a/mod/mood.php b/mod/mood.php index e98c16108f..0e603c869a 100644 --- a/mod/mood.php +++ b/mod/mood.php @@ -7,8 +7,9 @@ require_once('include/items.php'); function mood_init(App &$a) { - if(! local_user()) + if (! local_user()) { return; + } $uid = local_user(); $verb = notags(trim($_GET['verb'])); @@ -110,7 +111,7 @@ function mood_init(App &$a) { function mood_content(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } diff --git a/mod/network.php b/mod/network.php index dde3a3bae7..8b24b3e11b 100644 --- a/mod/network.php +++ b/mod/network.php @@ -1,6 +1,6 @@ query_string; return login(false); } diff --git a/mod/nogroup.php b/mod/nogroup.php index 3cf02069df..900ca4de09 100644 --- a/mod/nogroup.php +++ b/mod/nogroup.php @@ -6,14 +6,16 @@ require_once('include/contact_selectors.php'); function nogroup_init(App &$a) { - if(! local_user()) + if (! local_user()) { return; + } require_once('include/group.php'); require_once('include/contact_widgets.php'); - if(! x($a->page,'aside')) + if (! x($a->page,'aside')) { $a->page['aside'] = ''; + } $a->page['aside'] .= group_side('contacts','group','extended',0,$contact_id); } @@ -21,7 +23,7 @@ function nogroup_init(App &$a) { function nogroup_content(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return ''; } diff --git a/mod/notes.php b/mod/notes.php index f50f41eaf2..b2aa5487af 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -2,8 +2,9 @@ function notes_init(App &$a) { - if(! local_user()) + if (! local_user()) { return; + } $profile = 0; @@ -18,7 +19,7 @@ function notes_init(App &$a) { function notes_content(&$a,$update = false) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } diff --git a/mod/notifications.php b/mod/notifications.php index e7f32a5872..e4fa08f3e2 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -11,7 +11,7 @@ require_once("include/network.php"); function notifications_post(App &$a) { - if(! local_user()) { + if (! local_user()) { goaway(z_root()); } @@ -67,7 +67,7 @@ function notifications_post(App &$a) { function notifications_content(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } diff --git a/mod/oexchange.php b/mod/oexchange.php index 83b9453f2f..49c5d01f45 100644 --- a/mod/oexchange.php +++ b/mod/oexchange.php @@ -16,12 +16,12 @@ function oexchange_init(App &$a) { function oexchange_content(App &$a) { - if(! local_user()) { + if (! local_user()) { $o = login(false); return $o; } - if(($a->argc > 1) && $a->argv[1] === 'done') { + if (($a->argc > 1) && $a->argv[1] === 'done') { info( t('Post successful.') . EOL); return; } diff --git a/mod/ostatus_subscribe.php b/mod/ostatus_subscribe.php index 55abdf183f..ba17e28b73 100644 --- a/mod/ostatus_subscribe.php +++ b/mod/ostatus_subscribe.php @@ -5,7 +5,7 @@ require_once('include/follow.php'); function ostatus_subscribe_content(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); goaway($_SESSION['return_url']); // NOTREACHED diff --git a/mod/poke.php b/mod/poke.php index cc6d4ff896..2e15ed853f 100644 --- a/mod/poke.php +++ b/mod/poke.php @@ -21,25 +21,29 @@ require_once('include/items.php'); function poke_init(App &$a) { - if(! local_user()) + if (! local_user()) { return; + } $uid = local_user(); $verb = notags(trim($_GET['verb'])); - if(! $verb) + if (! $verb) { return; + } $verbs = get_poke_verbs(); - if(! array_key_exists($verb,$verbs)) + if (! array_key_exists($verb,$verbs)) { return; + } $activity = ACTIVITY_POKE . '#' . urlencode($verbs[$verb][0]); $contact_id = intval($_GET['cid']); - if(! $contact_id) + if (! $contact_id) { return; + } $parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : 0); @@ -146,7 +150,7 @@ function poke_init(App &$a) { function poke_content(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } diff --git a/mod/profile_photo.php b/mod/profile_photo.php index fd7302e4da..356c507f7a 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -4,7 +4,7 @@ require_once("include/Photo.php"); function profile_photo_init(App &$a) { - if(! local_user()) { + if (! local_user()) { return; } @@ -15,7 +15,7 @@ function profile_photo_init(App &$a) { function profile_photo_post(App &$a) { - if(! local_user()) { + if (! local_user()) { notice ( t('Permission denied.') . EOL ); return; } @@ -172,7 +172,7 @@ function profile_photo_post(App &$a) { if(! function_exists('profile_photo_content')) { function profile_photo_content(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL ); return; } diff --git a/mod/profiles.php b/mod/profiles.php index cca7a57ec5..20bd4cf6f1 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -6,7 +6,7 @@ function profiles_init(App &$a) { nav_set_selected('profiles'); - if(! local_user()) { + if (! local_user()) { return; } @@ -162,7 +162,7 @@ function profile_clean_keywords($keywords) { function profiles_post(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } @@ -595,14 +595,15 @@ function profile_activity($changed, $value) { $arr['deny_gid'] = $a->user['deny_gid']; $i = item_store($arr); - if($i) + if ($i) { proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i); + } } function profiles_content(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } diff --git a/mod/profperm.php b/mod/profperm.php index 694e2f4db7..bbb055b021 100644 --- a/mod/profperm.php +++ b/mod/profperm.php @@ -2,8 +2,9 @@ function profperm_init(App &$a) { - if(! local_user()) + if (! local_user()) { return; + } $which = $a->user['nickname']; $profile = $a->argv[1]; @@ -15,7 +16,7 @@ function profperm_init(App &$a) { function profperm_content(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied') . EOL); return; } diff --git a/mod/qsearch.php b/mod/qsearch.php index b42b1cfd84..118c93d9fa 100644 --- a/mod/qsearch.php +++ b/mod/qsearch.php @@ -2,8 +2,9 @@ function qsearch_init(App &$a) { - if(! local_user()) + if (! local_user()) { killme(); + } $limit = (get_config('system','qsearch_limit') ? intval(get_config('system','qsearch_limit')) : 100); diff --git a/mod/regmod.php b/mod/regmod.php index 60da71321e..44bdfe6644 100644 --- a/mod/regmod.php +++ b/mod/regmod.php @@ -103,32 +103,33 @@ function regmod_content(App &$a) { $_SESSION['return_url'] = $a->cmd; - if(! local_user()) { + if (! local_user()) { info( t('Please login.') . EOL); $o .= '

' . login(($a->config['register_policy'] == REGISTER_CLOSED) ? 0 : 1); return $o; } - if((!is_site_admin()) || (x($_SESSION,'submanage') && intval($_SESSION['submanage']))) { + if ((!is_site_admin()) || (x($_SESSION,'submanage') && intval($_SESSION['submanage']))) { notice( t('Permission denied.') . EOL); return ''; } - if($a->argc != 3) + if ($a->argc != 3) { killme(); + } $cmd = $a->argv[1]; $hash = $a->argv[2]; - if($cmd === 'deny') { + if ($cmd === 'deny') { user_deny($hash); goaway(App::get_baseurl()."/admin/users/"); killme(); } - if($cmd === 'allow') { + if ($cmd === 'allow') { user_allow($hash); goaway(App::get_baseurl()."/admin/users/"); killme(); diff --git a/mod/repair_ostatus.php b/mod/repair_ostatus.php index 2ade3c2dcc..07721220a0 100755 --- a/mod/repair_ostatus.php +++ b/mod/repair_ostatus.php @@ -5,7 +5,7 @@ require_once('include/follow.php'); function repair_ostatus_content(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); goaway($_SESSION['return_url']); // NOTREACHED diff --git a/mod/settings.php b/mod/settings.php index 97d4f5f603..9aa7c57624 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -18,7 +18,7 @@ function get_theme_config_file($theme){ function settings_init(App &$a) { - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL ); return; } @@ -118,8 +118,9 @@ function settings_init(App &$a) { function settings_post(App &$a) { - if(! local_user()) + if (! local_user()) { return; + } if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) { return; @@ -658,7 +659,7 @@ function settings_content(App &$a) { $o = ''; nav_set_selected('settings'); - if(! local_user()) { + if (! local_user()) { #notice( t('Permission denied.') . EOL ); return; } diff --git a/mod/starred.php b/mod/starred.php index f3fc5870ea..0a78f51aa7 100644 --- a/mod/starred.php +++ b/mod/starred.php @@ -7,12 +7,15 @@ function starred_init(App &$a) { $starred = 0; - if(! local_user()) + if (! local_user()) { killme(); - if($a->argc > 1) + } + if ($a->argc > 1) { $message_id = intval($a->argv[1]); - if(! $message_id) + } + if (! $message_id) { killme(); + } $r = q("SELECT starred FROM item WHERE uid = %d AND id = %d LIMIT 1", intval(local_user()), diff --git a/mod/suggest.php b/mod/suggest.php index 514b8f83c6..5af337ae1b 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -5,12 +5,13 @@ require_once('include/contact_widgets.php'); function suggest_init(App &$a) { - if(! local_user()) + if (! local_user()) { return; + } - if(x($_GET,'ignore') && intval($_GET['ignore'])) { + if (x($_GET,'ignore') && intval($_GET['ignore'])) { // Check if we should do HTML-based delete confirmation - if($_REQUEST['confirm']) { + if ($_REQUEST['confirm']) { //
can't take arguments in its "action" parameter // so add any arguments as hidden inputs $query = explode_querystring($a->query_string); @@ -35,7 +36,7 @@ function suggest_init(App &$a) { return; } // Now check how the user responded to the confirmation query - if(!$_REQUEST['canceled']) { + if (!$_REQUEST['canceled']) { q("INSERT INTO `gcign` ( `uid`, `gcid` ) VALUES ( %d, %d ) ", intval(local_user()), intval($_GET['ignore']) @@ -54,7 +55,7 @@ function suggest_content(App &$a) { require_once("mod/proxy.php"); $o = ''; - if(! local_user()) { + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } diff --git a/mod/tagrm.php b/mod/tagrm.php index 5c87d0ce26..212f91d16e 100644 --- a/mod/tagrm.php +++ b/mod/tagrm.php @@ -4,7 +4,7 @@ require_once('include/bbcode.php'); function tagrm_post(App &$a) { - if(! local_user()) + if (! local_user()) goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); @@ -52,7 +52,7 @@ function tagrm_content(App &$a) { $o = ''; - if(! local_user()) { + if (! local_user()) { goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); // NOTREACHED } @@ -63,7 +63,6 @@ function tagrm_content(App &$a) { // NOTREACHED } - $r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($item), intval(local_user()) @@ -75,8 +74,9 @@ function tagrm_content(App &$a) { $arr = explode(',', $r[0]['tag']); - if(! count($arr)) + if (! count($arr)) { goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); + } $o .= '

' . t('Remove Item Tag') . '

'; diff --git a/mod/uexport.php b/mod/uexport.php index e98449a877..7aa9724d58 100644 --- a/mod/uexport.php +++ b/mod/uexport.php @@ -1,11 +1,12 @@ t('default'), - 'greenzero'=>t('greenzero'), - 'purplezero'=>t('purplezero'), - 'easterbunny'=>t('easterbunny'), - 'darkzero'=>t('darkzero'), - 'comix'=>t('comix'), - 'slackr'=>t('slackr'), - ); - if ($user) { - $color = get_pconfig(local_user(), 'duepuntozero', 'colorset'); - } else { - $color = get_config( 'duepuntozero', 'colorset'); - } - $t = get_markup_template("theme_settings.tpl" ); - $o .= replace_macros($t, array( - '$submit' => t('Submit'), - '$baseurl' => App::get_baseurl(), - '$title' => t("Theme settings"), - '$colorset' => array('duepuntozero_colorset', t('Variations'), $color, '', $colorset), - )); - return $o; + $colorset = array( + 'default'=>t('default'), + 'greenzero'=>t('greenzero'), + 'purplezero'=>t('purplezero'), + 'easterbunny'=>t('easterbunny'), + 'darkzero'=>t('darkzero'), + 'comix'=>t('comix'), + 'slackr'=>t('slackr'), + ); + + if ($user) { + $color = get_pconfig(local_user(), 'duepuntozero', 'colorset'); + } else { + $color = get_config( 'duepuntozero', 'colorset'); + } + + $t = get_markup_template("theme_settings.tpl" ); + /// @TODO No need for adding string here, $o is not defined + $o .= replace_macros($t, array( + '$submit' => t('Submit'), + '$baseurl' => App::get_baseurl(), + '$title'=> t("Theme settings"), + '$colorset' => array('duepuntozero_colorset', t('Variations'), $color, '', $colorset), + )); + + return $o; } diff --git a/view/theme/frio/config.php b/view/theme/frio/config.php index cb2683aa0b..000ef26092 100644 --- a/view/theme/frio/config.php +++ b/view/theme/frio/config.php @@ -2,7 +2,9 @@ require_once('view/theme/frio/php/Image.php'); function theme_content(App &$a) { - if(!local_user()) { return;} + if (!local_user()) { + return; + } $arr = array(); $arr["schema"] = get_pconfig(local_user(),'frio', 'schema'); @@ -18,7 +20,10 @@ function theme_content(App &$a) { } function theme_post(App &$a) { - if(!local_user()) { return;} + if (!local_user()) { + return; + } + if (isset($_POST['frio-settings-submit'])) { set_pconfig(local_user(), 'frio', 'schema', $_POST["frio_schema"]); set_pconfig(local_user(), 'frio', 'nav_bg', $_POST["frio_nav_bg"]); diff --git a/view/theme/quattro/config.php b/view/theme/quattro/config.php index 11e6f6cbce..1a5a9c0213 100644 --- a/view/theme/quattro/config.php +++ b/view/theme/quattro/config.php @@ -6,21 +6,23 @@ function theme_content(App &$a){ - if(!local_user()) - return; - + if (!local_user()) { + return; + } + $align = get_pconfig(local_user(), 'quattro', 'align' ); $color = get_pconfig(local_user(), 'quattro', 'color' ); - $tfs = get_pconfig(local_user(),"quattro","tfs"); - $pfs = get_pconfig(local_user(),"quattro","pfs"); - + $tfs = get_pconfig(local_user(),"quattro","tfs"); + $pfs = get_pconfig(local_user(),"quattro","pfs"); + return quattro_form($a,$align, $color, $tfs, $pfs); } function theme_post(App &$a){ - if(! local_user()) + if (! local_user()) { return; - + } + if (isset($_POST['quattro-settings-submit'])){ set_pconfig(local_user(), 'quattro', 'align', $_POST['quattro_align']); set_pconfig(local_user(), 'quattro', 'color', $_POST['quattro_color']); diff --git a/view/theme/vier/config.php b/view/theme/vier/config.php index 55ef2654f1..5326498908 100644 --- a/view/theme/vier/config.php +++ b/view/theme/vier/config.php @@ -6,19 +6,23 @@ function theme_content(App &$a){ - if(!local_user()) + if (!local_user()) { return; + } - if (!function_exists('get_vier_config')) + if (!function_exists('get_vier_config')) { return; + } $style = get_pconfig(local_user(), 'vier', 'style'); - if ($style == "") + if ($style == "") { $style = get_config('vier', 'style'); + } - if ($style == "") + if ($style == "") { $style = "plus"; + } $show_pages = get_vier_config('show_pages', true); $show_profiles = get_vier_config('show_profiles', true); @@ -32,8 +36,9 @@ function theme_content(App &$a){ } function theme_post(App &$a){ - if(! local_user()) + if (! local_user()) { return; + } if (isset($_POST['vier-settings-submit'])){ set_pconfig(local_user(), 'vier', 'style', $_POST['vier_style']); From 8d28135c59e08ae5505b04b1899b76764bdab0e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Tue, 20 Dec 2016 12:35:18 +0100 Subject: [PATCH 10/13] added curly braces + space between "if" and brace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- mod/tagrm.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mod/tagrm.php b/mod/tagrm.php index 212f91d16e..8379495a2d 100644 --- a/mod/tagrm.php +++ b/mod/tagrm.php @@ -4,12 +4,13 @@ require_once('include/bbcode.php'); function tagrm_post(App &$a) { - if (! local_user()) + if (! local_user()) { goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); + } - - if((x($_POST,'submit')) && ($_POST['submit'] === t('Cancel'))) + if ((x($_POST,'submit')) && ($_POST['submit'] === t('Cancel'))) { goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); + } $tag = ((x($_POST,'tag')) ? hex2bin(notags(trim($_POST['tag']))) : ''); $item = ((x($_POST,'item')) ? intval($_POST['item']) : 0 ); @@ -24,8 +25,8 @@ function tagrm_post(App &$a) { } $arr = explode(',', $r[0]['tag']); - for($x = 0; $x < count($arr); $x ++) { - if($arr[$x] === $tag) { + for ($x = 0; $x < count($arr); $x ++) { + if ($arr[$x] === $tag) { unset($arr[$x]); break; } From c22878643b91ca164e8aca25af18debbf46ee94c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Tue, 20 Dec 2016 12:36:51 +0100 Subject: [PATCH 11/13] Opps, forgot this ... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- mod/toggle_mobile.php | 10 ++++++---- view/theme/frost-mobile/theme.php | 6 ++++-- view/theme/frost/theme.php | 4 +++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/mod/toggle_mobile.php b/mod/toggle_mobile.php index 6c3651393d..89b73cd448 100644 --- a/mod/toggle_mobile.php +++ b/mod/toggle_mobile.php @@ -2,15 +2,17 @@ function toggle_mobile_init(App &$a) { - if(isset($_GET['off'])) + if (isset($_GET['off'])) { $_SESSION['show-mobile'] = false; - else + } else { $_SESSION['show-mobile'] = true; + } - if(isset($_GET['address'])) + if (isset($_GET['address'])) { $address = $_GET['address']; - else + } else { $address = App::get_baseurl(); + } goaway($address); } diff --git a/view/theme/frost-mobile/theme.php b/view/theme/frost-mobile/theme.php index 7fe17ce7e1..4ca592f4c8 100644 --- a/view/theme/frost-mobile/theme.php +++ b/view/theme/frost-mobile/theme.php @@ -22,11 +22,13 @@ function frost_mobile_content_loaded(App &$a) { // I could do this in style.php, but by having the CSS in a file the browser will cache it, // making pages load faster - if( $a->module === 'home' || $a->module === 'login' || $a->module === 'register' || $a->module === 'lostpass' ) { + if ( $a->module === 'home' || $a->module === 'login' || $a->module === 'register' || $a->module === 'lostpass' ) { // $a->page['htmlhead'] = str_replace('$stylesheet', App::get_baseurl() . '/view/theme/frost-mobile/login-style.css', $a->page['htmlhead']); $a->theme['stylesheet'] = App::get_baseurl() . '/view/theme/frost-mobile/login-style.css'; } - if( $a->module === 'login' ) + + if ( $a->module === 'login' ) { $a->page['end'] .= ''; + } } diff --git a/view/theme/frost/theme.php b/view/theme/frost/theme.php index 964ea88ec4..7746109e56 100644 --- a/view/theme/frost/theme.php +++ b/view/theme/frost/theme.php @@ -24,8 +24,10 @@ function frost_content_loaded(App &$a) { //$a->page['htmlhead'] = str_replace('$stylesheet', App::get_baseurl() . '/view/theme/frost/login-style.css', $a->page['htmlhead']); $a->theme['stylesheet'] = App::get_baseurl() . '/view/theme/frost/login-style.css'; } - if( $a->module === 'login' ) + + if ( $a->module === 'login' ) { $a->page['end'] .= ''; + } } From d5f2d387bddd649b15591dfd3c21f8b2f02dea15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Tue, 20 Dec 2016 12:36:51 +0100 Subject: [PATCH 12/13] Continued a bit: - added more curly braces around conditional blocks - added space between "if" and brace - aligned "=>" (will do with more if wanted) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- mod/videos.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mod/videos.php b/mod/videos.php index de6e016666..52176524a2 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -380,12 +380,12 @@ function videos_content(App &$a) { $videos[] = array( 'id' => $rr['id'], - 'link' => App::get_baseurl() . '/videos/' . $a->data['user']['nickname'] . '/video/' . $rr['resource-id'], - 'title' => t('View Video'), - 'src' => App::get_baseurl() . '/attach/' . $rr['id'] . '?attachment=0', - 'alt' => $alt_e, - 'mime' => $rr['filetype'], - 'album' => array( + 'link' => App::get_baseurl() . '/videos/' . $a->data['user']['nickname'] . '/video/' . $rr['resource-id'], + 'title' => t('View Video'), + 'src' => App::get_baseurl() . '/attach/' . $rr['id'] . '?attachment=0', + 'alt' => $alt_e, + 'mime' => $rr['filetype'], + 'album' => array( 'link' => App::get_baseurl() . '/videos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']), 'name' => $name_e, 'alt' => t('View Album'), @@ -397,11 +397,11 @@ function videos_content(App &$a) { $tpl = get_markup_template('videos_recent.tpl'); $o .= replace_macros($tpl, array( - '$title' => t('Recent Videos'), - '$can_post' => $can_post, - '$upload' => array(t('Upload New Videos'), App::get_baseurl().'/videos/'.$a->data['user']['nickname'].'/upload'), - '$videos' => $videos, - '$delete_url' => (($can_post)?App::get_baseurl().'/videos/'.$a->data['user']['nickname']:False) + '$title' => t('Recent Videos'), + '$can_post' => $can_post, + '$upload' => array(t('Upload New Videos'), App::get_baseurl().'/videos/'.$a->data['user']['nickname'].'/upload'), + '$videos' => $videos, + '$delete_url' => (($can_post)?App::get_baseurl().'/videos/'.$a->data['user']['nickname']:False) )); From 0e58bf66753af9e79e6654e4f4f09aa61541290b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Tue, 20 Dec 2016 12:45:16 +0100 Subject: [PATCH 13/13] Changed $a->get_baseurl() to App::get_baseurl() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- boot.php | 6 +++--- index.php | 10 +++++----- mod/filerm.php | 2 +- mod/follow.php | 6 +++--- mod/help.php | 2 +- mod/match.php | 6 +++--- mod/redir.php | 2 +- mod/removeme.php | 2 +- mod/subthread.php | 4 ++-- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/boot.php b/boot.php index c80da23529..ccff45f734 100644 --- a/boot.php +++ b/boot.php @@ -1548,9 +1548,9 @@ 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',$a->get_baseurl()); - if((! link_compare($url,$a->get_baseurl())) && (! preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/",$a->get_hostname))) - $url = set_config('system','url',$a->get_baseurl()); + $url = set_config('system','url',App::get_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()); return; } diff --git a/index.php b/index.php index 08f24af60f..39e8c583a0 100644 --- a/index.php +++ b/index.php @@ -60,15 +60,15 @@ if(!$install) { if ($a->max_processes_reached() OR $a->maxload_reached()) { header($_SERVER["SERVER_PROTOCOL"].' 503 Service Temporarily Unavailable'); header('Retry-After: 120'); - header('Refresh: 120; url='.$a->get_baseurl()."/".$a->query_string); + header('Refresh: 120; url='.App::get_baseurl()."/".$a->query_string); die("System is currently unavailable. Please try again later"); } if (get_config('system','force_ssl') AND ($a->get_scheme() == "http") AND (intval(get_config('system','ssl_policy')) == SSL_POLICY_FULL) AND - (substr($a->get_baseurl(), 0, 8) == "https://")) { + (substr(App::get_baseurl(), 0, 8) == "https://")) { header("HTTP/1.1 302 Moved Temporarily"); - header("Location: ".$a->get_baseurl()."/".$a->query_string); + header("Location: ".App::get_baseurl()."/".$a->query_string); exit(); } @@ -150,7 +150,7 @@ if((x($_GET,'zrl')) && (!$install && !$maintenance)) { * */ -// header('Link: <' . $a->get_baseurl() . '/amcd>; rel="acct-mgmt";'); +// header('Link: <' . App::get_baseurl() . '/amcd>; rel="acct-mgmt";'); if(x($_COOKIE["Friendica"]) || (x($_SESSION,'authenticated')) || (x($_POST,'auth-params')) || ($a->module === 'login')) require("include/auth.php"); @@ -281,7 +281,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($a->get_baseurl() . $_SERVER['REQUEST_URI']); + goaway(App::get_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/filerm.php b/mod/filerm.php index cdc5a034aa..f34421ba52 100644 --- a/mod/filerm.php +++ b/mod/filerm.php @@ -21,7 +21,7 @@ function filerm_content(App &$a) { file_tag_unsave_file(local_user(),$item_id,$term, $category); if(x($_SESSION,'return_url')) - goaway($a->get_baseurl() . '/' . $_SESSION['return_url']); + goaway(App::get_baseurl() . '/' . $_SESSION['return_url']); killme(); } diff --git a/mod/follow.php b/mod/follow.php index 56e698547b..f318dc202c 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -63,7 +63,7 @@ function follow_content(App &$a) { $request = $ret["request"]; $tpl = get_markup_template('dfrn_request.tpl'); } else { - $request = $a->get_baseurl()."/follow"; + $request = App::get_baseurl()."/follow"; $tpl = get_markup_template('auto_request.tpl'); } @@ -175,12 +175,12 @@ function follow_post(App &$a) { notice($result['message']); goaway($return_url); } elseif ($result['cid']) - goaway($a->get_baseurl().'/contacts/'.$result['cid']); + goaway(App::get_baseurl().'/contacts/'.$result['cid']); info( t('Contact added').EOL); if(strstr($return_url,'contacts')) - goaway($a->get_baseurl().'/contacts/'.$contact_id); + goaway(App::get_baseurl().'/contacts/'.$contact_id); goaway($return_url); // NOTREACHED diff --git a/mod/help.php b/mod/help.php index fa574c9839..c2693dedba 100644 --- a/mod/help.php +++ b/mod/help.php @@ -77,7 +77,7 @@ function help_content(App &$a) { if ($level>$lastlevel) $toc.="
    "; $idnum[$level]++; $id = implode("_", array_slice($idnum,1,$level)); - $href = $a->get_baseurl()."/help/{$filename}#{$id}"; + $href = App::get_baseurl()."/help/{$filename}#{$id}"; $toc .= "
  • ".strip_tags($line)."
  • "; $line = "".$line; $lastlevel = $level; diff --git a/mod/match.php b/mod/match.php index 8bc255023f..f7274e4366 100644 --- a/mod/match.php +++ b/mod/match.php @@ -23,7 +23,7 @@ function match_content(App &$a) { $a->page['aside'] .= findpeople_widget(); $a->page['aside'] .= follow_widget(); - $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd; + $_SESSION['return_url'] = App::get_baseurl() . '/' . $a->cmd; $r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", intval(local_user()) @@ -47,7 +47,7 @@ function match_content(App &$a) { if(strlen(get_config('system','directory'))) $x = post_url(get_server().'/msearch', $params); else - $x = post_url($a->get_baseurl() . '/msearch', $params); + $x = post_url(App::get_baseurl() . '/msearch', $params); $j = json_decode($x); @@ -68,7 +68,7 @@ function match_content(App &$a) { if (!count($match)) { $jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo); - $connlnk = $a->get_baseurl() . '/follow/?url=' . $jj->url; + $connlnk = App::get_baseurl() . '/follow/?url=' . $jj->url; $photo_menu = array( 'profile' => array(t("View Profile"), zrl($jj->url)), 'follow' => array(t("Connect/Follow"), $connlnk) diff --git a/mod/redir.php b/mod/redir.php index b0c0b2c099..e951b2d2a9 100644 --- a/mod/redir.php +++ b/mod/redir.php @@ -64,7 +64,7 @@ function redir_init(App &$a) { } if (local_user()) { - $handle = $a->user['nickname'] . '@' . substr($a->get_baseurl(),strpos($a->get_baseurl(),'://')+3); + $handle = $a->user['nickname'] . '@' . substr(App::get_baseurl(),strpos(App::get_baseurl(),'://')+3); } if (remote_user()) { $handle = $_SESSION['handle']; diff --git a/mod/removeme.php b/mod/removeme.php index b7bdaa9400..4257667c4b 100644 --- a/mod/removeme.php +++ b/mod/removeme.php @@ -47,7 +47,7 @@ function removeme_content(App &$a) { $tpl = get_markup_template('removeme.tpl'); $o .= replace_macros($tpl, array( - '$basedir' => $a->get_baseurl(), + '$basedir' => App::get_baseurl(), '$hash' => $hash, '$title' => t('Remove My Account'), '$desc' => t('This will completely remove your account. Once this has been done it is not recoverable.'), diff --git a/mod/subthread.php b/mod/subthread.php index 02b1482c3e..3d16f8ca9c 100644 --- a/mod/subthread.php +++ b/mod/subthread.php @@ -87,7 +87,7 @@ function subthread_content(App &$a) { $post_type = (($item['resource-id']) ? t('photo') : t('status')); $objtype = (($item['resource-id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE ); - $link = xmlify('' . "\n") ; + $link = xmlify('' . "\n") ; $body = $item['body']; $obj = <<< EOT @@ -128,7 +128,7 @@ EOT; $ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]'; $alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]'; - $plink = '[url=' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . ']' . $post_type . '[/url]'; + $plink = '[url=' . App::get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . ']' . $post_type . '[/url]'; $arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink ); $arr['verb'] = $activity;