diff --git a/boot.php b/boot.php
index ccff45f73..70f7d324d 100644
--- a/boot.php
+++ b/boot.php
@@ -670,22 +670,23 @@ class App {
#set_include_path("include/$this->hostname" . PATH_SEPARATOR . get_include_path());
- if((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,9) === "pagename=") {
+ if ((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,9) === "pagename=") {
$this->query_string = substr($_SERVER['QUERY_STRING'],9);
// removing trailing / - maybe a nginx problem
if (substr($this->query_string, 0, 1) == "/")
$this->query_string = substr($this->query_string, 1);
- } elseif((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,2) === "q=") {
+ } elseif ((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,2) === "q=") {
$this->query_string = substr($_SERVER['QUERY_STRING'],2);
// removing trailing / - maybe a nginx problem
if (substr($this->query_string, 0, 1) == "/")
$this->query_string = substr($this->query_string, 1);
}
- if (x($_GET,'pagename'))
+ if (x($_GET,'pagename')) {
$this->cmd = trim($_GET['pagename'],'/\\');
- elseif (x($_GET,'q'))
+ } elseif (x($_GET,'q')) {
$this->cmd = trim($_GET['q'],'/\\');
+ }
// fix query_string
@@ -694,13 +695,15 @@ class App {
// unix style "homedir"
- if(substr($this->cmd,0,1) === '~')
+ if (substr($this->cmd,0,1) === '~') {
$this->cmd = 'profile/' . substr($this->cmd,1);
+ }
// Diaspora style profile url
- if(substr($this->cmd,0,2) === 'u/')
+ if (substr($this->cmd,0,2) === 'u/') {
$this->cmd = 'profile/' . substr($this->cmd,2);
+ }
/*
diff --git a/include/follow.php b/include/follow.php
index e67beb84c..15e8dd28d 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -77,12 +77,12 @@ function new_contact($uid,$url,$interactive = false) {
$url = str_replace('/#!/','/',$url);
- if(! allowed_url($url)) {
+ if (! allowed_url($url)) {
$result['message'] = t('Disallowed profile URL.');
return $result;
}
- if(! $url) {
+ if (! $url) {
$result['message'] = t('Connect URL missing.');
return $result;
}
@@ -91,17 +91,21 @@ function new_contact($uid,$url,$interactive = false) {
call_hooks('follow', $arr);
- if(x($arr['contact'],'name'))
+ if (x($arr['contact'],'name')) {
$ret = $arr['contact'];
- else
+ }
+ else {
$ret = probe_url($url);
+ }
- if($ret['network'] === NETWORK_DFRN) {
- if($interactive) {
- if(strlen($a->path))
+ if ($ret['network'] === NETWORK_DFRN) {
+ if ($interactive) {
+ if (strlen($a->path)) {
$myaddr = bin2hex(App::get_baseurl() . '/profile/' . $a->user['nickname']);
- else
+ }
+ else {
$myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());
+ }
goaway($ret['request'] . "&addr=$myaddr");
diff --git a/include/salmon.php b/include/salmon.php
index c5c3d7223..2b5833470 100644
--- a/include/salmon.php
+++ b/include/salmon.php
@@ -24,22 +24,24 @@ function get_salmon_key($uri,$keyhash) {
// We have found at least one key URL
// If it's inline, parse it - otherwise get the key
- if(count($ret) > 0) {
- for($x = 0; $x < count($ret); $x ++) {
- if(substr($ret[$x],0,5) === 'data:') {
- if(strstr($ret[$x],','))
+ if (count($ret) > 0) {
+ for ($x = 0; $x < count($ret); $x ++) {
+ if (substr($ret[$x],0,5) === 'data:') {
+ if (strstr($ret[$x],',')) {
$ret[$x] = substr($ret[$x],strpos($ret[$x],',')+1);
- else
+ } else {
$ret[$x] = substr($ret[$x],5);
- } elseif (normalise_link($ret[$x]) == 'http://')
+ }
+ } elseif (normalise_link($ret[$x]) == 'http://') {
$ret[$x] = fetch_url($ret[$x]);
+ }
}
}
logger('Key located: ' . print_r($ret,true));
- if(count($ret) == 1) {
+ if (count($ret) == 1) {
// We only found one one key so we don't care if the hash matches.
// If it's the wrong key we'll find out soon enough because
@@ -50,10 +52,11 @@ function get_salmon_key($uri,$keyhash) {
return $ret[0];
}
else {
- foreach($ret as $a) {
+ foreach ($ret as $a) {
$hash = base64url_encode(hash('sha256',$a));
- if($hash == $keyhash)
+ if ($hash == $keyhash) {
return $a;
+ }
}
}
diff --git a/include/security.php b/include/security.php
index 7e14146d9..cd00b5f7b 100644
--- a/include/security.php
+++ b/include/security.php
@@ -94,11 +94,12 @@ function authenticate_success($user_record, $login_initial = false, $interactive
}
- if($login_initial) {
+ if ($login_initial) {
call_hooks('logged_in', $a->user);
- if(($a->module !== 'home') && isset($_SESSION['return_url']))
+ if (($a->module !== 'home') && isset($_SESSION['return_url'])) {
goaway(App::get_baseurl() . '/' . $_SESSION['return_url']);
+ }
}
}
@@ -109,16 +110,17 @@ function can_write_wall(&$a,$owner) {
static $verified = 0;
- if((! (local_user())) && (! (remote_user())))
+ if ((! (local_user())) && (! (remote_user()))) {
return false;
+ }
$uid = local_user();
- if(($uid) && ($uid == $owner)) {
+ if (($uid) && ($uid == $owner)) {
return true;
}
- if(remote_user()) {
+ if (remote_user()) {
// use remembered decision and avoid a DB lookup for each and every display item
// DO NOT use this function if there are going to be multiple owners
@@ -126,25 +128,25 @@ function can_write_wall(&$a,$owner) {
// We have a contact-id for an authenticated remote user, this block determines if the contact
// belongs to this page owner, and has the necessary permissions to post content
- if($verified === 2)
+ if ($verified === 2) {
return true;
- elseif($verified === 1)
+ } elseif ($verified === 1) {
return false;
- else {
+ } else {
$cid = 0;
- if(is_array($_SESSION['remote'])) {
- foreach($_SESSION['remote'] as $visitor) {
- if($visitor['uid'] == $owner) {
+ if (is_array($_SESSION['remote'])) {
+ foreach ($_SESSION['remote'] as $visitor) {
+ if ($visitor['uid'] == $owner) {
$cid = $visitor['cid'];
break;
}
}
}
- if(! $cid)
+ if (! $cid) {
return false;
-
+ }
$r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` INNER JOIN `user` on `user`.`uid` = `contact`.`uid`
WHERE `contact`.`uid` = %d AND `contact`.`id` = %d AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
diff --git a/include/socgraph.php b/include/socgraph.php
index a779e88ef..7c70a22a5 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -91,8 +91,8 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
$name = $entry->displayName;
- if(isset($entry->urls)) {
- foreach($entry->urls as $url) {
+ if (isset($entry->urls)) {
+ foreach ($entry->urls as $url) {
if ($url->type == 'profile') {
$profile_url = $url->value;
continue;
@@ -104,7 +104,7 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
}
}
if (isset($entry->photos)) {
- foreach($entry->photos as $photo) {
+ foreach ($entry->photos as $photo) {
if ($photo->type == 'profile') {
$profile_photo = $photo->value;
continue;
@@ -112,29 +112,37 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
}
}
- if(isset($entry->updated))
+ if (isset($entry->updated)) {
$updated = date("Y-m-d H:i:s", strtotime($entry->updated));
+ }
- if(isset($entry->network))
+ if (isset($entry->network)) {
$network = $entry->network;
+ }
- if(isset($entry->currentLocation))
+ if (isset($entry->currentLocation)) {
$location = $entry->currentLocation;
+ }
- if(isset($entry->aboutMe))
+ if (isset($entry->aboutMe)) {
$about = html2bbcode($entry->aboutMe);
+ }
- if(isset($entry->gender))
+ if (isset($entry->gender)) {
$gender = $entry->gender;
+ }
- if(isset($entry->generation) AND ($entry->generation > 0))
+ if (isset($entry->generation) AND ($entry->generation > 0)) {
$generation = ++$entry->generation;
+ }
- if(isset($entry->tags))
- foreach($entry->tags as $tag)
+ if (isset($entry->tags)) {
+ foreach($entry->tags as $tag) {
$keywords = implode(", ", $tag);
+ }
+ }
- if(isset($entry->contactType) AND ($entry->contactType >= 0))
+ if (isset($entry->contactType) AND ($entry->contactType >= 0))
$contact_type = $entry->contactType;
// If you query a Friendica server for its profiles, the network has to be Friendica
@@ -171,8 +179,6 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
function poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $generation, $cid = 0, $uid = 0, $zcid = 0) {
- $a = get_app();
-
// Generation:
// 0: No definition
// 1: Profiles on this server
@@ -1186,12 +1192,12 @@ function update_suggestions() {
$done[] = App::get_baseurl() . '/poco';
- if(strlen(get_config('system','directory'))) {
+ if (strlen(get_config('system','directory'))) {
$x = fetch_url(get_server()."/pubsites");
if ($x) {
$j = json_decode($x);
if ($j->entries) {
- foreach($j->entries as $entry) {
+ foreach ($j->entries as $entry) {
poco_check_server($entry->url);
@@ -1210,7 +1216,7 @@ function update_suggestions() {
);
if (dbm::is_result($r)) {
- foreach($r as $rr) {
+ foreach ($r as $rr) {
$base = substr($rr['poco'],0,strrpos($rr['poco'],'/'));
if(! in_array($base,$done))
poco_load(0,0,0,$base);
@@ -1221,7 +1227,7 @@ function update_suggestions() {
function poco_discover_federation() {
$last = get_config('poco','last_federation_discovery');
- if($last) {
+ if ($last) {
$next = $last + (24 * 60 * 60);
if($next > time())
return;
@@ -1377,7 +1383,7 @@ function poco_discover_server($data, $default_generation = 0) {
$name = $entry->displayName;
- if(isset($entry->urls)) {
+ if (isset($entry->urls)) {
foreach($entry->urls as $url) {
if ($url->type == 'profile') {
$profile_url = $url->value;
@@ -1390,39 +1396,48 @@ function poco_discover_server($data, $default_generation = 0) {
}
}
- if(isset($entry->photos)) {
- foreach($entry->photos as $photo) {
- if($photo->type == 'profile') {
+ if (isset($entry->photos)) {
+ foreach ($entry->photos as $photo) {
+ if ($photo->type == 'profile') {
$profile_photo = $photo->value;
continue;
}
}
}
- if(isset($entry->updated))
+ if (isset($entry->updated)) {
$updated = date("Y-m-d H:i:s", strtotime($entry->updated));
+ }
- if(isset($entry->network))
+ if(isset($entry->network)) {
$network = $entry->network;
+ }
- if(isset($entry->currentLocation))
+ if(isset($entry->currentLocation)) {
$location = $entry->currentLocation;
+ }
- if(isset($entry->aboutMe))
+ if(isset($entry->aboutMe)) {
$about = html2bbcode($entry->aboutMe);
+ }
- if(isset($entry->gender))
+ if(isset($entry->gender)) {
$gender = $entry->gender;
+ }
- if(isset($entry->generation) AND ($entry->generation > 0))
+ if(isset($entry->generation) AND ($entry->generation > 0)) {
$generation = ++$entry->generation;
+ }
- if(isset($entry->contactType) AND ($entry->contactType >= 0))
+ if(isset($entry->contactType) AND ($entry->contactType >= 0)) {
$contact_type = $entry->contactType;
+ }
- if(isset($entry->tags))
- foreach($entry->tags as $tag)
+ if(isset($entry->tags)) {
+ foreach ($entry->tags as $tag) {
$keywords = implode(", ", $tag);
+ }
+ }
if ($generation > 0) {
$success = true;
diff --git a/index.php b/index.php
index 39e8c583a..f05151757 100644
--- a/index.php
+++ b/index.php
@@ -152,22 +152,26 @@ if((x($_GET,'zrl')) && (!$install && !$maintenance)) {
// header('Link: <' . App::get_baseurl() . '/amcd>; rel="acct-mgmt";');
-if(x($_COOKIE["Friendica"]) || (x($_SESSION,'authenticated')) || (x($_POST,'auth-params')) || ($a->module === 'login'))
+if (x($_COOKIE["Friendica"]) || (x($_SESSION,'authenticated')) || (x($_POST,'auth-params')) || ($a->module === 'login')) {
require("include/auth.php");
+}
-if(! x($_SESSION,'authenticated'))
+if (! x($_SESSION,'authenticated')) {
header('X-Account-Management-Status: none');
+}
/* set up page['htmlhead'] and page['end'] for the modules to use */
$a->page['htmlhead'] = '';
$a->page['end'] = '';
-if(! x($_SESSION,'sysmsg'))
+if (! x($_SESSION,'sysmsg')) {
$_SESSION['sysmsg'] = array();
+}
-if(! x($_SESSION,'sysmsg_info'))
+if (! x($_SESSION,'sysmsg_info')) {
$_SESSION['sysmsg_info'] = array();
+}
/*
* check_config() is responsible for running update scripts. These automatically
@@ -177,11 +181,11 @@ if(! x($_SESSION,'sysmsg_info'))
// in install mode, any url loads install module
// but we need "view" module for stylesheet
-if($install && $a->module!="view")
+if ($install && $a->module!="view") {
$a->module = 'install';
-elseif($maintenance && $a->module!="view")
+} elseif ($maintenance && $a->module!="view") {
$a->module = 'maintenance';
-else {
+} else {
check_url($a);
check_db();
check_plugins($a);
@@ -191,8 +195,7 @@ nav_set_selected('nothing');
//Don't populate apps_menu if apps are private
$privateapps = get_config('config','private_addons');
-if((local_user()) || (! $privateapps === "1"))
-{
+if ((local_user()) || (! $privateapps === "1")) {
$arr = array('app_menu' => $a->apps);
call_hooks('app_menu', $arr);
@@ -238,9 +241,9 @@ if(strlen($a->module)) {
$privateapps = get_config('config','private_addons');
- if(is_array($a->plugins) && in_array($a->module,$a->plugins) && file_exists("addon/{$a->module}/{$a->module}.php")) {
+ if (is_array($a->plugins) && in_array($a->module,$a->plugins) && file_exists("addon/{$a->module}/{$a->module}.php")) {
//Check if module is an app and if public access to apps is allowed or not
- if((!local_user()) && plugin_is_app($a->module) && $privateapps === "1") {
+ if ((!local_user()) && plugin_is_app($a->module) && $privateapps === "1") {
info( t("You must be logged in to use addons. "));
}
else {
@@ -254,7 +257,7 @@ if(strlen($a->module)) {
* If not, next look for a 'standard' program module in the 'mod' directory
*/
- if((! $a->module_loaded) && (file_exists("mod/{$a->module}.php"))) {
+ if ((! $a->module_loaded) && (file_exists("mod/{$a->module}.php"))) {
include_once("mod/{$a->module}.php");
$a->module_loaded = true;
}
@@ -272,14 +275,14 @@ if(strlen($a->module)) {
*
*/
- if(! $a->module_loaded) {
+ if (! $a->module_loaded) {
// Stupid browser tried to pre-fetch our Javascript img template. Don't log the event or return anything - just quietly exit.
- if((x($_SERVER,'QUERY_STRING')) && preg_match('/{[0-9]}/',$_SERVER['QUERY_STRING']) !== 0) {
+ if ((x($_SERVER,'QUERY_STRING')) && preg_match('/{[0-9]}/',$_SERVER['QUERY_STRING']) !== 0) {
killme();
}
- if((x($_SERVER,'QUERY_STRING')) && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') && isset($dreamhost_error_hack)) {
+ if ((x($_SERVER,'QUERY_STRING')) && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') && isset($dreamhost_error_hack)) {
logger('index.php: dreamhost_error_hack invoked. Original URI =' . $_SERVER['REQUEST_URI']);
goaway(App::get_baseurl() . $_SERVER['REQUEST_URI']);
}
@@ -304,11 +307,13 @@ if (file_exists($theme_info_file)){
/* initialise content region */
-if(! x($a->page,'content'))
+if (! x($a->page,'content')) {
$a->page['content'] = '';
+}
-if(!$install && !$maintenance)
+if (!$install && !$maintenance) {
call_hooks('page_content_top',$a->page['content']);
+}
/**
* Call module functions
diff --git a/mod/admin.php b/mod/admin.php
index 040f55a5a..26d7da26b 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -1129,19 +1129,19 @@ function admin_page_dbsync(App &$a) {
$failed[] = $upd;
}
}
- if(! count($failed)) {
+ if (! count($failed)) {
$o = replace_macros(get_markup_template('structure_check.tpl'),array(
- '$base' => App::get_baseurl(true),
+ '$base' => App::get_baseurl(true),
'$banner' => t('No failed updates.'),
- '$check' => t('Check database structure'),
+ '$check' => t('Check database structure'),
));
} else {
$o = replace_macros(get_markup_template('failed_updates.tpl'),array(
- '$base' => App::get_baseurl(true),
+ '$base' => App::get_baseurl(true),
'$banner' => t('Failed Updates'),
- '$desc' => t('This does not include updates prior to 1139, which did not return a status.'),
- '$mark' => t('Mark success (if update was manually applied)'),
- '$apply' => t('Attempt to execute this update step automatically'),
+ '$desc' => t('This does not include updates prior to 1139, which did not return a status.'),
+ '$mark' => t('Mark success (if update was manually applied)'),
+ '$apply' => t('Attempt to execute this update step automatically'),
'$failed' => $failed
));
}
@@ -1156,11 +1156,11 @@ function admin_page_dbsync(App &$a) {
* @param App $a
*/
function admin_page_users_post(App &$a){
- $pending = (x($_POST, 'pending') ? $_POST['pending'] : array());
- $users = (x($_POST, 'user') ? $_POST['user'] : array());
- $nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : '');
- $nu_nickname = (x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : '');
- $nu_email = (x($_POST, 'new_user_email') ? $_POST['new_user_email'] : '');
+ $pending = (x($_POST, 'pending') ? $_POST['pending'] : array());
+ $users = (x($_POST, 'user') ? $_POST['user'] : array());
+ $nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : '');
+ $nu_nickname = (x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : '');
+ $nu_email = (x($_POST, 'new_user_email') ? $_POST['new_user_email'] : '');
$nu_language = get_config('system', 'language');
check_form_security_token_redirectOnErr('/admin/users', 'admin_users');
@@ -1546,7 +1546,7 @@ function admin_page_plugins(App &$a){
* List plugins
*/
- if(x($_GET,"a") && $_GET['a']=="r") {
+ if (x($_GET,"a") && $_GET['a']=="r") {
check_form_security_token_redirectOnErr(App::get_baseurl().'/admin/plugins', 'admin_themes', 't');
reload_plugins();
info("Plugins reloaded");
@@ -1555,23 +1555,26 @@ function admin_page_plugins(App &$a){
$plugins = array();
$files = glob("addon/*/");
- if($files) {
- foreach($files as $file) {
- if(is_dir($file)) {
+ if ($files) {
+ foreach ($files as $file) {
+ if (is_dir($file)) {
list($tmp, $id)=array_map("trim", explode("/",$file));
$info = get_plugin_info($id);
$show_plugin = true;
// If the addon is unsupported, then only show it, when it is enabled
- if((strtolower($info["status"]) == "unsupported") AND !in_array($id, $a->plugins))
+ if ((strtolower($info["status"]) == "unsupported") AND !in_array($id, $a->plugins)) {
$show_plugin = false;
+ }
// Override the above szenario, when the admin really wants to see outdated stuff
- if(get_config("system", "show_unsupported_addons"))
+ if (get_config("system", "show_unsupported_addons")) {
$show_plugin = true;
+ }
- if($show_plugin)
+ if ($show_plugin) {
$plugins[] = array($id, (in_array($id, $a->plugins)?"on":"off") , $info);
+ }
}
}
}
@@ -1798,11 +1801,11 @@ function admin_page_themes(App &$a){
// reload active themes
- if(x($_GET,"a") && $_GET['a']=="r") {
+ if (x($_GET,"a") && $_GET['a']=="r") {
check_form_security_token_redirectOnErr(App::get_baseurl().'/admin/themes', 'admin_themes', 't');
- if($themes) {
- foreach($themes as $th) {
- if($th['allowed']) {
+ if ($themes) {
+ foreach ($themes as $th) {
+ if ($th['allowed']) {
uninstall_theme($th['name']);
install_theme($th['name']);
}
@@ -1817,7 +1820,7 @@ function admin_page_themes(App &$a){
*/
$xthemes = array();
- if($themes) {
+ if ($themes) {
foreach($themes as $th) {
$xthemes[] = array($th['name'],(($th['allowed']) ? "on" : "off"), get_theme_info($th['name']));
}
@@ -1826,17 +1829,17 @@ function admin_page_themes(App &$a){
$t = get_markup_template("admin_plugins.tpl");
return replace_macros($t, array(
- '$title' => t('Administration'),
- '$page' => t('Themes'),
- '$submit' => t('Save Settings'),
- '$reload' => t('Reload active themes'),
- '$baseurl' => App::get_baseurl(true),
- '$function' => 'themes',
- '$plugins' => $xthemes,
- '$pcount' => count($themes),
- '$noplugshint' => sprintf(t('No themes found on the system. They should be paced in %1$s'),'/view/themes
'),
- '$experimental' => t('[Experimental]'),
- '$unsupported' => t('[Unsupported]'),
+ '$title' => t('Administration'),
+ '$page' => t('Themes'),
+ '$submit' => t('Save Settings'),
+ '$reload' => t('Reload active themes'),
+ '$baseurl' => App::get_baseurl(true),
+ '$function' => 'themes',
+ '$plugins' => $xthemes,
+ '$pcount' => count($themes),
+ '$noplugshint' => sprintf(t('No themes found on the system. They should be paced in %1$s'),'/view/themes
'),
+ '$experimental' => t('[Experimental]'),
+ '$unsupported' => t('[Unsupported]'),
'$form_security_token' => get_form_security_token("admin_themes"),
));
}
diff --git a/mod/allfriends.php b/mod/allfriends.php
index f9cffcbb2..0682b2dd4 100644
--- a/mod/allfriends.php
+++ b/mod/allfriends.php
@@ -29,8 +29,8 @@ function allfriends_content(App &$a) {
);
if (! count($c)) {
- }
return;
+ }
$a->page['aside'] = "";
profile_load($a, "", 0, get_contact_details_by_url($c[0]["url"]));
diff --git a/mod/cal.php b/mod/cal.php
index 48ba06ed6..e6c9c7224 100644
--- a/mod/cal.php
+++ b/mod/cal.php
@@ -231,7 +231,7 @@ function cal_content(App &$a) {
$r = sort_by_date($r);
foreach($r as $rr) {
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
- if(! x($links,$j)) {
+ if (! x($links,$j)) {
$links[$j] = App::get_baseurl() . '/' . $a->cmd . '#link-' . $j;
}
}
diff --git a/mod/delegate.php b/mod/delegate.php
index 8470a7ba0..1f261bb71 100644
--- a/mod/delegate.php
+++ b/mod/delegate.php
@@ -13,7 +13,7 @@ function delegate_content(App &$a) {
return;
}
- if($a->argc > 2 && $a->argv[1] === 'add' && intval($a->argv[2])) {
+ if ($a->argc > 2 && $a->argv[1] === 'add' && intval($a->argv[2])) {
// delegated admins can view but not change delegation permissions
@@ -42,7 +42,7 @@ function delegate_content(App &$a) {
goaway(App::get_baseurl() . '/delegate');
}
- if($a->argc > 2 && $a->argv[1] === 'remove' && intval($a->argv[2])) {
+ if ($a->argc > 2 && $a->argv[1] === 'remove' && intval($a->argv[2])) {
// delegated admins can view but not change delegation permissions
diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php
index ba8e27431..22d4c1535 100644
--- a/mod/dfrn_confirm.php
+++ b/mod/dfrn_confirm.php
@@ -506,10 +506,11 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
// Let's send our user to the contact editor in case they want to
// do anything special with this new friend.
- if($handsfree === null)
+ if ($handsfree === null) {
goaway(App::get_baseurl() . '/contacts/' . intval($contact_id));
- else
+ } else {
return;
+ }
//NOTREACHED
}
@@ -525,7 +526,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
*
*/
- if(x($_POST,'source_url')) {
+ if (x($_POST,'source_url')) {
// We are processing an external confirmation to an introduction created by our user.
@@ -546,7 +547,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
// If $aes_key is set, both of these items require unpacking from the hex transport encoding.
- if(x($aes_key)) {
+ if (x($aes_key)) {
$aes_key = hex2bin($aes_key);
$public_key = hex2bin($public_key);
}
diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php
index d5e8abe90..3a5711d0f 100644
--- a/mod/dfrn_request.php
+++ b/mod/dfrn_request.php
@@ -120,17 +120,19 @@ function dfrn_request_post(App &$a) {
$parms = Probe::profile($dfrn_url);
- if(! count($parms)) {
+ if (! count($parms)) {
notice( t('Profile location is not valid or does not contain profile information.') . EOL );
return;
}
else {
- if(! x($parms,'fn'))
+ if (! x($parms,'fn')) {
notice( t('Warning: profile location has no identifiable owner name.') . EOL );
- if(! x($parms,'photo'))
+ }
+ if (! x($parms,'photo')) {
notice( t('Warning: profile location has no profile photo.') . EOL );
+ }
$invalid = Probe::valid_dfrn($parms);
- if($invalid) {
+ if ($invalid) {
notice( sprintf( tt("%d required parameter was not found at the given location",
"%d required parameters were not found at the given location",
$invalid), $invalid) . EOL );
@@ -502,13 +504,13 @@ function dfrn_request_post(App &$a) {
);
}
else {
- if(! validate_url($url)) {
+ if (! validate_url($url)) {
notice( t('Invalid profile URL.') . EOL);
goaway(App::get_baseurl() . '/' . $a->cmd);
return; // NOTREACHED
}
- if(! allowed_url($url)) {
+ if (! allowed_url($url)) {
notice( t('Disallowed profile URL.') . EOL);
goaway(App::get_baseurl() . '/' . $a->cmd);
return; // NOTREACHED
@@ -519,17 +521,19 @@ function dfrn_request_post(App &$a) {
$parms = Probe::profile(($hcard) ? $hcard : $url);
- if(! count($parms)) {
+ if (! count($parms)) {
notice( t('Profile location is not valid or does not contain profile information.') . EOL );
goaway(App::get_baseurl() . '/' . $a->cmd);
}
else {
- if(! x($parms,'fn'))
+ if (! x($parms,'fn')) {
notice( t('Warning: profile location has no identifiable owner name.') . EOL );
- if(! x($parms,'photo'))
+ }
+ if (! x($parms,'photo')) {
notice( t('Warning: profile location has no profile photo.') . EOL );
+ }
$invalid = Probe::valid_dfrn($parms);
- if($invalid) {
+ if ($invalid) {
notice( sprintf( tt("%d required parameter was not found at the given location",
"%d required parameters were not found at the given location",
$invalid), $invalid) . EOL );
@@ -810,15 +814,18 @@ function dfrn_request_content(App &$a) {
$myaddr = hex2bin($_GET['addr']);
elseif (x($_GET,'address') AND ($_GET['address'] != ""))
$myaddr = $_GET['address'];
- elseif(local_user()) {
- if(strlen($a->path)) {
+ elseif (local_user()) {
+ if (strlen($a->path)) {
$myaddr = App::get_baseurl() . '/profile/' . $a->user['nickname'];
}
else {
$myaddr = $a->user['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
}
- } else // last, try a zrl
+ }
+ else {
+ // last, try a zrl
$myaddr = get_my_url();
+ }
$target_addr = $a->profile['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
@@ -831,10 +838,12 @@ function dfrn_request_content(App &$a) {
*
*/
- if($a->profile['page-flags'] == PAGE_NORMAL)
+ if ($a->profile['page-flags'] == PAGE_NORMAL) {
$tpl = get_markup_template('dfrn_request.tpl');
- else
+ }
+ else {
$tpl = get_markup_template('auto_request.tpl');
+ }
$page_desc = t("Please enter your 'Identity Address' from one of the following supported communications networks:");
diff --git a/mod/dirfind.php b/mod/dirfind.php
index fc5750f2d..2b2badb64 100644
--- a/mod/dirfind.php
+++ b/mod/dirfind.php
@@ -12,8 +12,9 @@ function dirfind_init(App &$a) {
return;
}
- if(! x($a->page,'aside'))
+ if (! x($a->page,'aside')) {
$a->page['aside'] = '';
+ }
$a->page['aside'] .= findpeople_widget();
@@ -31,7 +32,7 @@ function dirfind_content(&$a, $prefix = "") {
$search = $prefix.notags(trim($_REQUEST['search']));
- if(strpos($search,'@') === 0) {
+ if (strpos($search,'@') === 0) {
$search = substr($search,1);
$header = sprintf( t('People Search - %s'), $search);
if ((valid_email($search) AND validate_email($search)) OR
@@ -41,7 +42,7 @@ function dirfind_content(&$a, $prefix = "") {
}
}
- if(strpos($search,'!') === 0) {
+ if (strpos($search,'!') === 0) {
$search = substr($search,1);
$community = true;
$header = sprintf( t('Forum Search - %s'), $search);
@@ -49,7 +50,7 @@ function dirfind_content(&$a, $prefix = "") {
$o = '';
- if($search) {
+ if ($search) {
if ($discover_user) {
$j = new stdClass();
@@ -85,15 +86,19 @@ function dirfind_content(&$a, $prefix = "") {
$perpage = 80;
$startrec = (($a->pager['page']) * $perpage) - $perpage;
- if (get_config('system','diaspora_enabled'))
+ if (get_config('system','diaspora_enabled')) {
$diaspora = NETWORK_DIASPORA;
- else
+ }
+ else {
$diaspora = NETWORK_DFRN;
+ }
- if (!get_config('system','ostatus_disabled'))
+ if (!get_config('system','ostatus_disabled')) {
$ostatus = NETWORK_OSTATUS;
- else
+ }
+ else {
$ostatus = NETWORK_DFRN;
+ }
$search2 = "%".$search."%";
@@ -133,8 +138,9 @@ function dirfind_content(&$a, $prefix = "") {
$j->items_page = $perpage;
$j->page = $a->pager['page'];
foreach ($results AS $result) {
- if (poco_alternate_ostatus_url($result["url"]))
- continue;
+ if (poco_alternate_ostatus_url($result["url"])) {
+ continue;
+ }
$result = get_contact_details_by_url($result["url"], local_user(), $result);
@@ -167,16 +173,16 @@ function dirfind_content(&$a, $prefix = "") {
$j = json_decode($x);
}
- if($j->total) {
+ if ($j->total) {
$a->set_pager_total($j->total);
$a->set_pager_itemspage($j->items_page);
}
- if(count($j->results)) {
+ if (count($j->results)) {
$id = 0;
- foreach($j->results as $jj) {
+ foreach ($j->results as $jj) {
$alt_text = "";
@@ -194,8 +200,10 @@ function dirfind_content(&$a, $prefix = "") {
$photo_menu = contact_photo_menu($contact[0]);
$details = _contact_detail_for_template($contact[0]);
$alt_text = $details['alt_text'];
- } else
+ }
+ else {
$photo_menu = array();
+ }
} else {
$connlnk = App::get_baseurl().'/follow/?url='.(($jj->connect) ? $jj->connect : $jj->url);
$conntxt = t('Connect');
diff --git a/mod/events.php b/mod/events.php
index 0c1e9ae2f..6bf7da6a2 100644
--- a/mod/events.php
+++ b/mod/events.php
@@ -254,15 +254,15 @@ function events_content(App &$a) {
$ignored = ((x($_REQUEST,'ignored')) ? intval($_REQUEST['ignored']) : 0);
if($a->argc > 1) {
- if($a->argc > 2 && $a->argv[1] == 'event') {
+ if ($a->argc > 2 && $a->argv[1] == 'event') {
$mode = 'edit';
$event_id = intval($a->argv[2]);
}
- if($a->argv[1] === 'new') {
+ if ($a->argv[1] === 'new') {
$mode = 'new';
$event_id = 0;
}
- if($a->argc > 2 && intval($a->argv[1]) && intval($a->argv[2])) {
+ if ($a->argc > 2 && intval($a->argv[1]) && intval($a->argv[2])) {
$mode = 'view';
$y = intval($a->argv[1]);
$m = intval($a->argv[2]);
@@ -270,23 +270,27 @@ function events_content(App &$a) {
}
// The view mode part is similiar to /mod/cal.php
- if($mode == 'view') {
+ if ($mode == 'view') {
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
- if(! $y)
+ if (! $y) {
$y = intval($thisyear);
- if(! $m)
+ }
+ if (! $m) {
$m = intval($thismonth);
+ }
// Put some limits on dates. The PHP date functions don't seem to do so well before 1900.
// An upper limit was chosen to keep search engines from exploring links millions of years in the future.
- if($y < 1901)
+ if ($y < 1901) {
$y = 1900;
- if($y > 2099)
+ }
+ if ($y > 2099) {
$y = 2100;
+ }
$nextyear = $y;
$nextmonth = $m + 1;
@@ -342,7 +346,7 @@ function events_content(App &$a) {
$r = sort_by_date($r);
foreach($r as $rr) {
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
- if(! x($links,$j)) {
+ if (! x($links,$j)) {
$links[$j] = App::get_baseurl() . '/' . $a->cmd . '#link-' . $j;
}
}
diff --git a/mod/settings.php b/mod/settings.php
index 9aa7c5762..515a97c14 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -1170,13 +1170,14 @@ function settings_content(App &$a) {
));
}
- if(strlen(get_config('system','directory'))) {
+ if (strlen(get_config('system','directory'))) {
$profile_in_net_dir = replace_macros($opt_tpl,array(
'$field' => array('profile_in_netdirectory', t('Publish your default profile in the global social directory?'), $profile['net-publish'], '', array(t('No'),t('Yes'))),
));
}
- else
+ else {
$profile_in_net_dir = '';
+ }
$hide_friends = replace_macros($opt_tpl,array(