';
- if ($change)
+ if($change)
$o = '';
$o .= '
';
@@ -119,8 +119,8 @@ function profperm_content(App $a) {
$textmode = (($switchtotext && (count($members) > $switchtotext)) ? true : false);
- foreach ($members as $member) {
- if ($member['url']) {
+ foreach($members as $member) {
+ if($member['url']) {
$member['click'] = 'profChangeMember(' . $profile['id'] . ',' . $member['id'] . '); return true;';
$o .= micropro($member,true,'mpprof', $textmode);
}
@@ -141,8 +141,8 @@ function profperm_content(App $a) {
if (dbm::is_result($r)) {
$textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
- foreach ($r as $member) {
- if (! in_array($member['id'],$ingroup)) {
+ foreach($r as $member) {
+ if(! in_array($member['id'],$ingroup)) {
$member['click'] = 'profChangeMember(' . $profile['id'] . ',' . $member['id'] . '); return true;';
$o .= micropro($member,true,'mpprof',$textmode);
}
@@ -151,7 +151,7 @@ function profperm_content(App $a) {
$o .= '
';
- if ($change) {
+ if($change) {
echo $o;
killme();
}
diff --git a/mod/pubsub.php b/mod/pubsub.php
index 0924610447..2ba1958a25 100644
--- a/mod/pubsub.php
+++ b/mod/pubsub.php
@@ -2,7 +2,7 @@
function hub_return($valid,$body) {
- if ($valid) {
+ if($valid) {
header($_SERVER["SERVER_PROTOCOL"] . ' 200 ' . 'OK');
echo $body;
killme();
@@ -31,7 +31,7 @@ function pubsub_init(App $a) {
$nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
$contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0 );
- if ($_SERVER['REQUEST_METHOD'] === 'GET') {
+ if($_SERVER['REQUEST_METHOD'] === 'GET') {
$hub_mode = ((x($_GET,'hub_mode')) ? notags(trim($_GET['hub_mode'])) : '');
$hub_topic = ((x($_GET,'hub_topic')) ? notags(trim($_GET['hub_topic'])) : '');
@@ -68,7 +68,7 @@ function pubsub_init(App $a) {
}
if ($hub_topic)
- if (! link_compare($hub_topic,$r[0]['poll'])) {
+ if(! link_compare($hub_topic,$r[0]['poll'])) {
logger('pubsub: hub topic ' . $hub_topic . ' != ' . $r[0]['poll']);
// should abort but let's humour them.
}
@@ -78,8 +78,8 @@ function pubsub_init(App $a) {
// We must initiate an unsubscribe request with a verify_token.
// Don't allow outsiders to unsubscribe us.
- if ($hub_mode === 'unsubscribe') {
- if (! strlen($hub_verify)) {
+ if($hub_mode === 'unsubscribe') {
+ if(! strlen($hub_verify)) {
logger('pubsub: bogus unsubscribe');
hub_return(false, '');
}
@@ -106,7 +106,7 @@ function pubsub_post(App $a) {
logger('pubsub: user-agent: ' . $_SERVER['HTTP_USER_AGENT'] );
logger('pubsub: data: ' . $xml, LOGGER_DATA);
-// if (! stristr($xml,' af11...
// [hub_topic] => http://friendica.local/dfrn_poll/sazius
- if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ if($_SERVER['REQUEST_METHOD'] === 'POST') {
$hub_mode = post_var('hub_mode');
$hub_callback = post_var('hub_callback');
$hub_verify = post_var('hub_verify');
@@ -32,7 +32,7 @@ function pubsubhubbub_init(App $a) {
// check for valid hub_mode
if ($hub_mode === 'subscribe') {
$subscribe = 1;
- } elseif ($hub_mode === 'unsubscribe') {
+ } else if ($hub_mode === 'unsubscribe') {
$subscribe = 0;
} else {
logger("pubsubhubbub: invalid hub_mode=$hub_mode, ignoring.");
@@ -81,7 +81,7 @@ function pubsubhubbub_init(App $a) {
$contact = $r[0];
// sanity check that topic URLs are the same
- if (!link_compare($hub_topic, $contact['poll'])) {
+ if(!link_compare($hub_topic, $contact['poll'])) {
logger('pubsubhubbub: hub topic ' . $hub_topic . ' != ' .
$contact['poll']);
http_status_exit(404);
diff --git a/mod/qsearch.php b/mod/qsearch.php
index efc095a263..8512bea51e 100644
--- a/mod/qsearch.php
+++ b/mod/qsearch.php
@@ -10,14 +10,12 @@ function qsearch_init(App $a) {
$search = ((x($_GET,'s')) ? notags(trim(urldecode($_GET['s']))) : '');
- if (! strlen($search)) {
+ if(! strlen($search))
killme();
- }
- if ($search) {
+ if($search)
$search = dbesc($search);
- }
$results = array();
@@ -27,9 +25,9 @@ function qsearch_init(App $a) {
);
if (dbm::is_result($r)) {
- foreach ($r as $rr) {
+
+ foreach($r as $rr)
$results[] = array( 0, (int) $rr['id'], $rr['name'], '', '');
- }
}
$sql_extra = ((strlen($search)) ? " AND (`name` REGEXP '$search' OR `nick` REGEXP '$search') " : "");
@@ -42,9 +40,9 @@ function qsearch_init(App $a) {
if (dbm::is_result($r)) {
- foreach ($r as $rr) {
+
+ foreach($r as $rr)
$results[] = array( (int) $rr['id'], 0, $rr['name'],$rr['url'],$rr['photo']);
- }
}
echo json_encode((object) $results);
diff --git a/mod/receive.php b/mod/receive.php
index d11bfdb854..3563f2d705 100644
--- a/mod/receive.php
+++ b/mod/receive.php
@@ -14,19 +14,19 @@ function receive_post(App $a) {
$enabled = intval(get_config('system','diaspora_enabled'));
- if (! $enabled) {
+ if(! $enabled) {
logger('mod-diaspora: disabled');
http_status_exit(500);
}
$public = false;
- if (($a->argc == 2) && ($a->argv[1] === 'public')) {
+ if(($a->argc == 2) && ($a->argv[1] === 'public')) {
$public = true;
}
else {
- if ($a->argc != 3 || $a->argv[1] !== 'users')
+ if($a->argc != 3 || $a->argv[1] !== 'users')
http_status_exit(500);
$guid = $a->argv[2];
@@ -49,7 +49,7 @@ function receive_post(App $a) {
logger('mod-diaspora: new salmon ' . $xml, LOGGER_DATA);
- if (! $xml)
+ if(! $xml)
http_status_exit(500);
logger('mod-diaspora: message is okay', LOGGER_DEBUG);
@@ -60,13 +60,13 @@ function receive_post(App $a) {
logger('mod-diaspora: decoded msg: ' . print_r($msg,true), LOGGER_DATA);
- if (! is_array($msg))
+ if(! is_array($msg))
http_status_exit(500);
logger('mod-diaspora: dispatching', LOGGER_DEBUG);
$ret = 0;
- if ($public) {
+ if($public) {
Diaspora::dispatch_public($msg);
} else {
$ret = Diaspora::dispatch($importer,$msg);
diff --git a/mod/redir.php b/mod/redir.php
index 32a235de4b..12f53900a7 100644
--- a/mod/redir.php
+++ b/mod/redir.php
@@ -8,9 +8,9 @@ function redir_init(App $a) {
// traditional DFRN
- if ( $con_url || (local_user() && $a->argc > 1 && intval($a->argv[1])) ) {
+ if( $con_url || (local_user() && $a->argc > 1 && intval($a->argv[1])) ) {
- if ($con_url) {
+ if($con_url) {
$con_url = str_replace('https', 'http', $con_url);
$r = q("SELECT * FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d LIMIT 1",
@@ -18,7 +18,7 @@ function redir_init(App $a) {
intval(local_user())
);
- if ((! dbm::is_result($r)) || ($r[0]['network'] !== NETWORK_DFRN))
+ if((! dbm::is_result($r)) || ($r[0]['network'] !== NETWORK_DFRN))
goaway(z_root());
$cid = $r[0]['id'];
@@ -31,17 +31,17 @@ function redir_init(App $a) {
intval(local_user())
);
- if ((! dbm::is_result($r)) || ($r[0]['network'] !== NETWORK_DFRN))
+ if((! dbm::is_result($r)) || ($r[0]['network'] !== NETWORK_DFRN))
goaway(z_root());
}
$dfrn_id = $orig_id = (($r[0]['issued-id']) ? $r[0]['issued-id'] : $r[0]['dfrn-id']);
- if ($r[0]['duplex'] && $r[0]['issued-id']) {
+ if($r[0]['duplex'] && $r[0]['issued-id']) {
$orig_id = $r[0]['issued-id'];
$dfrn_id = '1:' . $orig_id;
}
- if ($r[0]['duplex'] && $r[0]['dfrn-id']) {
+ if($r[0]['duplex'] && $r[0]['dfrn-id']) {
$orig_id = $r[0]['dfrn-id'];
$dfrn_id = '0:' . $orig_id;
}
diff --git a/mod/register.php b/mod/register.php
index fe799f4c60..81e8c3ad83 100644
--- a/mod/register.php
+++ b/mod/register.php
@@ -4,7 +4,7 @@ require_once('include/enotify.php');
require_once('include/bbcode.php');
require_once('include/user.php');
-if (! function_exists('register_post')) {
+if(! function_exists('register_post')) {
function register_post(App $a) {
global $lang;
@@ -16,9 +16,9 @@ function register_post(App $a) {
call_hooks('register_post', $arr);
$max_dailies = intval(get_config('system','max_daily_registrations'));
- if ($max_dailies) {
+ if($max_dailies) {
$r = q("select count(*) as total from user where register_date > UTC_TIMESTAMP - INTERVAL 1 day");
- if ($r && $r[0]['total'] >= $max_dailies) {
+ if($r && $r[0]['total'] >= $max_dailies) {
return;
}
}
@@ -38,7 +38,7 @@ function register_post(App $a) {
default:
case REGISTER_CLOSED:
- if ((! x($_SESSION,'authenticated') && (! x($_SESSION,'administrator')))) {
+ if((! x($_SESSION,'authenticated') && (! x($_SESSION,'administrator')))) {
notice( t('Permission denied.') . EOL );
return;
}
@@ -56,14 +56,14 @@ function register_post(App $a) {
$result = create_user($arr);
- if (! $result['success']) {
+ if(! $result['success']) {
notice($result['message']);
return;
}
$user = $result['user'];
- if ($netpublish && $a->config['register_policy'] != REGISTER_APPROVE) {
+ if($netpublish && $a->config['register_policy'] != REGISTER_APPROVE) {
$url = App::get_baseurl() . '/profile/' . $user['nickname'];
proc_run(PRIORITY_LOW, "include/directory.php", $url);
}
@@ -73,9 +73,9 @@ function register_post(App $a) {
$invite_id = ((x($_POST,'invite_id')) ? notags(trim($_POST['invite_id'])) : '');
- if ( $a->config['register_policy'] == REGISTER_OPEN ) {
+ if( $a->config['register_policy'] == REGISTER_OPEN ) {
- if ($using_invites && $invite_id) {
+ if($using_invites && $invite_id) {
q("delete * from register where hash = '%s' limit 1", dbesc($invite_id));
set_pconfig($user['uid'],'system','invites_remaining',$num_invites);
}
@@ -89,7 +89,7 @@ function register_post(App $a) {
$user['username'],
$result['password']);
- if ($res) {
+ if($res) {
info( t('Registration successful. Please check your email for further instructions.') . EOL ) ;
goaway(z_root());
} else {
@@ -106,8 +106,8 @@ function register_post(App $a) {
goaway(z_root());
}
}
- elseif ($a->config['register_policy'] == REGISTER_APPROVE) {
- if (! strlen($a->config['admin_email'])) {
+ elseif($a->config['register_policy'] == REGISTER_APPROVE) {
+ if(! strlen($a->config['admin_email'])) {
notice( t('Your registration can not be processed.') . EOL);
goaway(z_root());
}
@@ -123,7 +123,7 @@ function register_post(App $a) {
);
// invite system
- if ($using_invites && $invite_id) {
+ if($using_invites && $invite_id) {
q("delete * from register where hash = '%s' limit 1", dbesc($invite_id));
set_pconfig($user['uid'],'system','invites_remaining',$num_invites);
}
@@ -171,7 +171,7 @@ function register_post(App $a) {
-if (! function_exists('register_content')) {
+if(! function_exists('register_content')) {
function register_content(App $a) {
// logged in users can register others (people/pages/groups)
@@ -180,29 +180,29 @@ function register_content(App $a) {
$block = get_config('system','block_extended_register');
- if (local_user() && ($block)) {
+ if(local_user() && ($block)) {
notice("Permission denied." . EOL);
return;
}
- if ((! local_user()) && ($a->config['register_policy'] == REGISTER_CLOSED)) {
+ if((! local_user()) && ($a->config['register_policy'] == REGISTER_CLOSED)) {
notice("Permission denied." . EOL);
return;
}
$max_dailies = intval(get_config('system','max_daily_registrations'));
- if ($max_dailies) {
+ if($max_dailies) {
$r = q("select count(*) as total from user where register_date > UTC_TIMESTAMP - INTERVAL 1 day");
- if ($r && $r[0]['total'] >= $max_dailies) {
+ if($r && $r[0]['total'] >= $max_dailies) {
logger('max daily registrations exceeded.');
notice( t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') . EOL);
return;
}
}
- 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']);
@@ -215,7 +215,7 @@ function register_content(App $a) {
$noid = get_config('system','no_openid');
- if ($noid) {
+ if($noid) {
$oidhtml = '';
$fillwith = '';
$fillext = '';
@@ -232,7 +232,7 @@ function register_content(App $a) {
$realpeople = ''; // t('Members of this network prefer to communicate with real people who use their real names.');
- if (get_config('system','publish_all')) {
+ if(get_config('system','publish_all')) {
$profile_publish_reg = '
';
}
else {
diff --git a/mod/regmod.php b/mod/regmod.php
index 19fc047cc5..1983ca0899 100644
--- a/mod/regmod.php
+++ b/mod/regmod.php
@@ -54,7 +54,7 @@ function user_allow($hash) {
pop_lang();
- if ($res) {
+ if($res) {
info( t('Account approved.') . EOL );
return true;
}
@@ -72,9 +72,8 @@ function user_deny($hash) {
dbesc($hash)
);
- if (! dbm::is_result($register)) {
+ if(! dbm::is_result($register))
return false;
- }
$user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($register[0]['uid'])
diff --git a/mod/repair_ostatus.php b/mod/repair_ostatus.php
old mode 100644
new mode 100755
diff --git a/mod/salmon.php b/mod/salmon.php
index 76ab999b2d..69809f5234 100644
--- a/mod/salmon.php
+++ b/mod/salmon.php
@@ -8,9 +8,9 @@ require_once('include/follow.php');
function salmon_return($val) {
- if ($val >= 400)
+ if($val >= 400)
$err = 'Error';
- if ($val >= 200 && $val < 300)
+ if($val >= 200 && $val < 300)
$err = 'OK';
logger('mod-salmon returns ' . $val);
@@ -43,14 +43,14 @@ function salmon_post(App $a) {
// figure out where in the DOM tree our data is hiding
- if ($dom->provenance->data)
+ if($dom->provenance->data)
$base = $dom->provenance;
- elseif ($dom->env->data)
+ elseif($dom->env->data)
$base = $dom->env;
- elseif ($dom->data)
+ elseif($dom->data)
$base = $dom;
- if (! $base) {
+ if(! $base) {
logger('mod-salmon: unable to locate salmon data in xml ');
http_status_exit(400);
}
@@ -88,7 +88,7 @@ function salmon_post(App $a) {
$author = ostatus::salmon_author($data,$importer);
$author_link = $author["author-link"];
- if (! $author_link) {
+ if(! $author_link) {
logger('mod-salmon: Could not retrieve author URI.');
http_status_exit(400);
}
@@ -99,7 +99,7 @@ function salmon_post(App $a) {
$key = get_salmon_key($author_link,$keyhash);
- if (! $key) {
+ if(! $key) {
logger('mod-salmon: Could not retrieve author key.');
http_status_exit(400);
}
@@ -117,17 +117,17 @@ function salmon_post(App $a) {
$verify = rsa_verify($compliant_format,$signature,$pubkey);
- if (! $verify) {
+ if(! $verify) {
logger('mod-salmon: message did not verify using protocol. Trying padding hack.');
$verify = rsa_verify($signed_data,$signature,$pubkey);
}
- if (! $verify) {
+ if(! $verify) {
logger('mod-salmon: message did not verify using padding. Trying old statusnet hack.');
$verify = rsa_verify($stnet_signed_data,$signature,$pubkey);
}
- if (! $verify) {
+ if(! $verify) {
logger('mod-salmon: Message did not verify. Discarding.');
http_status_exit(400);
}
@@ -153,9 +153,9 @@ function salmon_post(App $a) {
);
if (! dbm::is_result($r)) {
logger('mod-salmon: Author unknown to us.');
- if (get_pconfig($importer['uid'],'system','ostatus_autofriend')) {
+ if(get_pconfig($importer['uid'],'system','ostatus_autofriend')) {
$result = new_contact($importer['uid'],$author_link);
- if ($result['success']) {
+ if($result['success']) {
$r = q("SELECT * FROM `contact` WHERE `network` = '%s' AND ( `url` = '%s' OR `alias` = '%s')
AND `uid` = %d LIMIT 1",
dbesc(NETWORK_OSTATUS),
@@ -170,7 +170,7 @@ function salmon_post(App $a) {
// Have we ignored the person?
// If so we can not accept this post.
- //if ((dbm::is_result($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) {
+ //if((dbm::is_result($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) {
if (dbm::is_result($r) && $r[0]['blocked']) {
logger('mod-salmon: Ignoring this author.');
http_status_exit(202);
diff --git a/mod/search.php b/mod/search.php
index d073857536..7d588aa4d1 100644
--- a/mod/search.php
+++ b/mod/search.php
@@ -8,7 +8,7 @@ function search_saved_searches() {
$o = '';
- if (! feature_enabled(local_user(),'savedsearch'))
+ if(! feature_enabled(local_user(),'savedsearch'))
return $o;
$r = q("SELECT `id`,`term` FROM `search` WHERE `uid` = %d",
@@ -47,8 +47,8 @@ function search_init(App $a) {
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
- if (local_user()) {
- if (x($_GET,'save') && $search) {
+ if(local_user()) {
+ if(x($_GET,'save') && $search) {
$r = q("SELECT * FROM `search` WHERE `uid` = %d AND `term` = '%s' LIMIT 1",
intval(local_user()),
dbesc($search)
@@ -60,7 +60,7 @@ function search_init(App $a) {
);
}
}
- if (x($_GET,'remove') && $search) {
+ if(x($_GET,'remove') && $search) {
q("DELETE FROM `search` WHERE `uid` = %d AND `term` = '%s' LIMIT 1",
intval(local_user()),
dbesc($search)
@@ -82,19 +82,19 @@ function search_init(App $a) {
function search_post(App $a) {
- if (x($_POST,'search'))
+ if(x($_POST,'search'))
$a->data['search'] = $_POST['search'];
}
function search_content(App $a) {
- if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
+ if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL);
return;
}
- if (get_config('system','local_search') AND !local_user()) {
+ if(get_config('system','local_search') AND !local_user()) {
http_status_exit(403,
array("title" => t("Public access denied."),
"description" => t("Only logged in users are permitted to perform a search.")));
@@ -132,13 +132,13 @@ function search_content(App $a) {
nav_set_selected('search');
- if (x($a->data,'search'))
+ if(x($a->data,'search'))
$search = notags(trim($a->data['search']));
else
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
$tag = false;
- if (x($_GET,'tag')) {
+ if(x($_GET,'tag')) {
$tag = true;
$search = ((x($_GET,'tag')) ? notags(trim(rawurldecode($_GET['tag']))) : '');
}
@@ -151,18 +151,18 @@ function search_content(App $a) {
'$content' => search($search,'search-box','search',((local_user()) ? true : false), false)
));
- if (strpos($search,'#') === 0) {
+ if(strpos($search,'#') === 0) {
$tag = true;
$search = substr($search,1);
}
- if (strpos($search,'@') === 0) {
+ if(strpos($search,'@') === 0) {
return dirfind_content($a);
}
- if (strpos($search,'!') === 0) {
+ if(strpos($search,'!') === 0) {
return dirfind_content($a);
}
- if (x($_GET,'search-option'))
+ if(x($_GET,'search-option'))
switch($_GET['search-option']) {
case 'fulltext':
break;
@@ -177,7 +177,7 @@ function search_content(App $a) {
break;
}
- if (! $search)
+ if(! $search)
return $o;
if (get_config('system','only_tag_search'))
@@ -188,7 +188,7 @@ function search_content(App $a) {
// OR your own posts if you are a logged in member
// No items will be shown if the member has a blocked profile wall.
- if ($tag) {
+ if($tag) {
logger("Start tag search for '".$search."'", LOGGER_DEBUG);
$r = q("SELECT %s
@@ -226,7 +226,7 @@ function search_content(App $a) {
}
- if ($tag)
+ if($tag)
$title = sprintf( t('Items tagged with: %s'), $search);
else
$title = sprintf( t('Results for: %s'), $search);
diff --git a/mod/settings.php b/mod/settings.php
index a626e67f5f..5c9c439e0a 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -47,7 +47,7 @@ function settings_init(App $a) {
),
);
- if (get_features()) {
+ if(get_features()) {
$tabs[] = array(
'label' => t('Additional features'),
'url' => 'settings/features',
@@ -189,23 +189,23 @@ function settings_post(App $a) {
return;
}
- if (($a->argc > 1) && ($a->argv[1] == 'addon')) {
+ if(($a->argc > 1) && ($a->argv[1] == 'addon')) {
check_form_security_token_redirectOnErr('/settings/addon', 'settings_addon');
call_hooks('plugin_settings_post', $_POST);
return;
}
- if (($a->argc > 1) && ($a->argv[1] == 'connectors')) {
+ if(($a->argc > 1) && ($a->argv[1] == 'connectors')) {
check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors');
- if (x($_POST, 'general-submit')) {
+ if(x($_POST, 'general-submit')) {
set_pconfig(local_user(), 'system', 'no_intelligent_shortening', intval($_POST['no_intelligent_shortening']));
set_pconfig(local_user(), 'system', 'ostatus_autofriend', intval($_POST['snautofollow']));
set_pconfig(local_user(), 'ostatus', 'default_group', $_POST['group-selection']);
set_pconfig(local_user(), 'ostatus', 'legacy_contact', $_POST['legacy_contact']);
- } elseif (x($_POST, 'imap-submit')) {
+ } elseif(x($_POST, 'imap-submit')) {
$mail_server = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : '');
$mail_port = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : '');
@@ -219,10 +219,10 @@ function settings_post(App $a) {
$mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
- if (get_config('system','dfrn_only'))
+ if(get_config('system','dfrn_only'))
$mail_disabled = 1;
- if (! $mail_disabled) {
+ if(! $mail_disabled) {
$failed = false;
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval(local_user())
@@ -232,7 +232,7 @@ function settings_post(App $a) {
intval(local_user())
);
}
- if (strlen($mail_pass)) {
+ if(strlen($mail_pass)) {
$pass = '';
openssl_public_encrypt($mail_pass,$pass,$a->user['pubkey']);
q("UPDATE `mailacct` SET `pass` = '%s' WHERE `uid` = %d",
@@ -261,18 +261,18 @@ function settings_post(App $a) {
$eacct = $r[0];
require_once('include/email.php');
$mb = construct_mailbox_name($eacct);
- if (strlen($eacct['server'])) {
+ if(strlen($eacct['server'])) {
$dcrpass = '';
openssl_private_decrypt(hex2bin($eacct['pass']),$dcrpass,$a->user['prvkey']);
$mbox = email_connect($mb,$mail_user,$dcrpass);
unset($dcrpass);
- if (! $mbox) {
+ if(! $mbox) {
$failed = true;
notice( t('Failed to connect with email account using the settings provided.') . EOL);
}
}
}
- if (! $failed)
+ if(! $failed)
info( t('Email settings updated.') . EOL);
}
}
@@ -283,8 +283,8 @@ function settings_post(App $a) {
if (($a->argc > 1) && ($a->argv[1] === 'features')) {
check_form_security_token_redirectOnErr('/settings/features', 'settings_features');
- foreach ($_POST as $k => $v) {
- if (strpos($k,'feature_') === 0) {
+ foreach($_POST as $k => $v) {
+ if(strpos($k,'feature_') === 0) {
set_pconfig(local_user(),'feature',substr($k,8),((intval($v)) ? 1 : 0));
}
}
@@ -320,7 +320,7 @@ function settings_post(App $a) {
$itemspage_mobile_network = 100;
}
- if ($mobile_theme !== '') {
+ if($mobile_theme !== '') {
set_pconfig(local_user(),'system','mobile_theme',$mobile_theme);
}
@@ -364,45 +364,41 @@ function settings_post(App $a) {
call_hooks('settings_post', $_POST);
- if ((x($_POST,'password')) || (x($_POST,'confirm'))) {
+ if((x($_POST,'password')) || (x($_POST,'confirm'))) {
$newpass = $_POST['password'];
$confirm = $_POST['confirm'];
$oldpass = hash('whirlpool', $_POST['opassword']);
$err = false;
- if ($newpass != $confirm ) {
+ if($newpass != $confirm ) {
notice( t('Passwords do not match. Password unchanged.') . EOL);
$err = true;
}
- if ((! x($newpass)) || (! x($confirm))) {
+ if((! x($newpass)) || (! x($confirm))) {
notice( t('Empty passwords are not allowed. Password unchanged.') . EOL);
$err = true;
- }
+ }
- // check if the old password was supplied correctly before
- // changing it to the new value
- $r = q("SELECT `password` FROM `user`WHERE `uid` = %d LIMIT 1", intval(local_user()));
- if (!dbm::is_result($r)) {
- /// @todo Don't quit silently here
- killme();
- } elseif ( $oldpass != $r[0]['password'] ) {
- notice( t('Wrong password.') . EOL);
- $err = true;
- }
+ // check if the old password was supplied correctly before
+ // changing it to the new value
+ $r = q("SELECT `password` FROM `user`WHERE `uid` = %d LIMIT 1", intval(local_user()));
+ if( $oldpass != $r[0]['password'] ) {
+ notice( t('Wrong password.') . EOL);
+ $err = true;
+ }
- if (! $err) {
+ if(! $err) {
$password = hash('whirlpool',$newpass);
$r = q("UPDATE `user` SET `password` = '%s' WHERE `uid` = %d",
dbesc($password),
intval(local_user())
);
- if ($r) {
+ if($r)
info( t('Password changed.') . EOL);
- } else {
+ else
notice( t('Password update failed. Please try again.') . EOL);
- }
}
}
@@ -446,41 +442,32 @@ function settings_post(App $a) {
$notify = 0;
- if (x($_POST,'notify1')) {
+ if(x($_POST,'notify1'))
$notify += intval($_POST['notify1']);
- }
- if (x($_POST,'notify2')) {
+ if(x($_POST,'notify2'))
$notify += intval($_POST['notify2']);
- }
- if (x($_POST,'notify3')) {
+ if(x($_POST,'notify3'))
$notify += intval($_POST['notify3']);
- }
- if (x($_POST,'notify4')) {
+ if(x($_POST,'notify4'))
$notify += intval($_POST['notify4']);
- }
- if (x($_POST,'notify5')) {
+ if(x($_POST,'notify5'))
$notify += intval($_POST['notify5']);
- }
- if (x($_POST,'notify6')) {
+ if(x($_POST,'notify6'))
$notify += intval($_POST['notify6']);
- }
- if (x($_POST,'notify7')) {
+ if(x($_POST,'notify7'))
$notify += intval($_POST['notify7']);
- }
- if (x($_POST,'notify8')) {
+ if(x($_POST,'notify8'))
$notify += intval($_POST['notify8']);
- }
// Adjust the page flag if the account type doesn't fit to the page flag.
- if (($account_type == ACCOUNT_TYPE_PERSON) AND !in_array($page_flags, array(PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE))) {
+ if (($account_type == ACCOUNT_TYPE_PERSON) AND !in_array($page_flags, array(PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE)))
$page_flags = PAGE_NORMAL;
- } elseif (($account_type == ACCOUNT_TYPE_ORGANISATION) AND !in_array($page_flags, array(PAGE_SOAPBOX))) {
+ elseif (($account_type == ACCOUNT_TYPE_ORGANISATION) AND !in_array($page_flags, array(PAGE_SOAPBOX)))
$page_flags = PAGE_SOAPBOX;
- } elseif (($account_type == ACCOUNT_TYPE_NEWS) AND !in_array($page_flags, array(PAGE_SOAPBOX))) {
+ elseif (($account_type == ACCOUNT_TYPE_NEWS) AND !in_array($page_flags, array(PAGE_SOAPBOX)))
$page_flags = PAGE_SOAPBOX;
- } elseif (($account_type == ACCOUNT_TYPE_COMMUNITY) AND !in_array($page_flags, array(PAGE_COMMUNITY, PAGE_PRVGROUP))) {
+ elseif (($account_type == ACCOUNT_TYPE_COMMUNITY) AND !in_array($page_flags, array(PAGE_COMMUNITY, PAGE_PRVGROUP)))
$page_flags = PAGE_COMMUNITY;
- }
$email_changed = false;
@@ -488,17 +475,15 @@ function settings_post(App $a) {
$name_change = false;
- if ($username != $a->user['username']) {
+ if($username != $a->user['username']) {
$name_change = true;
- if (strlen($username) > 40) {
+ if(strlen($username) > 40)
$err .= t(' Please use a shorter name.');
- }
- if (strlen($username) < 3) {
+ if(strlen($username) < 3)
$err .= t(' Name too short.');
- }
}
- if ($email != $a->user['email']) {
+ if($email != $a->user['email']) {
$email_changed = true;
// check for the correct password
$r = q("SELECT `password` FROM `user`WHERE `uid` = %d LIMIT 1", intval(local_user()));
@@ -508,12 +493,11 @@ function settings_post(App $a) {
$email = $a->user['email'];
}
// check the email is valid
- if (! valid_email($email)) {
+ if(! valid_email($email))
$err .= t(' Not valid email.');
- }
// ensure new email is not the admin mail
- //if ((x($a->config,'admin_email')) && (strcasecmp($email,$a->config['admin_email']) == 0)) {
- if (x($a->config,'admin_email')) {
+ //if((x($a->config,'admin_email')) && (strcasecmp($email,$a->config['admin_email']) == 0)) {
+ if(x($a->config,'admin_email')) {
$adminlist = explode(",", str_replace(" ", "", strtolower($a->config['admin_email'])));
if (in_array(strtolower($email), $adminlist)) {
$err .= t(' Cannot change to that email.');
@@ -522,13 +506,14 @@ function settings_post(App $a) {
}
}
- if (strlen($err)) {
+ if(strlen($err)) {
notice($err . EOL);
return;
}
- if ($timezone != $a->user['timezone'] && strlen($timezone)) {
- date_default_timezone_set($timezone);
+ if($timezone != $a->user['timezone']) {
+ if(strlen($timezone))
+ date_default_timezone_set($timezone);
}
$str_group_allow = perms2str($_POST['group_allow']);
@@ -541,17 +526,17 @@ function settings_post(App $a) {
// If openid has changed or if there's an openid but no openidserver, try and discover it.
- if ($openid != $a->user['openid'] || (strlen($openid) && (! strlen($openidserver)))) {
+ if($openid != $a->user['openid'] || (strlen($openid) && (! strlen($openidserver)))) {
$tmp_str = $openid;
- if (strlen($tmp_str) && validate_url($tmp_str)) {
+ if(strlen($tmp_str) && validate_url($tmp_str)) {
logger('updating openidserver');
require_once('library/openid.php');
$open_id_obj = new LightOpenID;
$open_id_obj->identity = $openid;
$openidserver = $open_id_obj->discover($open_id_obj->identity);
- } else {
- $openidserver = '';
}
+ else
+ $openidserver = '';
}
set_pconfig(local_user(),'expire','items', $expire_items);
@@ -567,13 +552,14 @@ function settings_post(App $a) {
set_pconfig(local_user(),'system','email_textonly', $email_textonly);
- if ($page_flags == PAGE_PRVGROUP) {
+ if($page_flags == PAGE_PRVGROUP) {
$hidewall = 1;
- if ((! $str_contact_allow) && (! $str_group_allow) && (! $str_contact_deny) && (! $str_group_deny)) {
- if ($def_gid) {
+ if((! $str_contact_allow) && (! $str_group_allow) && (! $str_contact_deny) && (! $str_group_deny)) {
+ if($def_gid) {
info( t('Private forum has no privacy permissions. Using default privacy group.'). EOL);
$str_group_allow = '<' . $def_gid . '>';
- } else {
+ }
+ else {
notice( t('Private forum has no privacy permissions and no default privacy group.') . EOL);
}
}
@@ -613,9 +599,8 @@ function settings_post(App $a) {
dbesc($language),
intval(local_user())
);
- if ($r) {
+ if($r)
info( t('Settings updated.') . EOL);
- }
// clear session language
unset($_SESSION['language']);
@@ -634,7 +619,7 @@ function settings_post(App $a) {
);
- if ($name_change) {
+ if($name_change) {
q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self`",
dbesc($username),
dbesc(datetime_convert()),
@@ -684,6 +669,8 @@ function settings_content(App $a) {
return;
}
+
+
if (($a->argc > 1) && ($a->argv[1] === 'oauth')) {
if (($a->argc > 2) && ($a->argv[2] === 'add')) {
@@ -728,7 +715,7 @@ function settings_content(App $a) {
return $o;
}
- if (($a->argc > 3) && ($a->argv[2] === 'delete')) {
+ if(($a->argc > 3) && ($a->argv[2] === 'delete')) {
check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth', 't');
$r = q("DELETE FROM clients WHERE client_id='%s' AND uid=%d",
@@ -866,10 +853,10 @@ function settings_content(App $a) {
}
$mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
- if (get_config('system','dfrn_only'))
+ if(get_config('system','dfrn_only'))
$mail_disabled = 1;
- if (! $mail_disabled) {
+ if(! $mail_disabled) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
local_user()
);
@@ -1177,7 +1164,7 @@ function settings_content(App $a) {
}
$opt_tpl = get_markup_template("field_yesno.tpl");
- if (get_config('system','publish_all')) {
+ if(get_config('system','publish_all')) {
$profile_in_dir = '
';
} else {
$profile_in_dir = replace_macros($opt_tpl,array(
diff --git a/mod/share.php b/mod/share.php
index 59081ec62a..36a4d5945f 100644
--- a/mod/share.php
+++ b/mod/share.php
@@ -2,7 +2,7 @@
function share_init(App $a) {
$post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
- if ((! $post_id) || (! local_user()))
+ if((! $post_id) || (! local_user()))
killme();
$r = q("SELECT item.*, contact.network FROM `item`
@@ -12,7 +12,7 @@ function share_init(App $a) {
intval($post_id),
intval(local_user())
);
- if (! dbm::is_result($r) || ($r[0]['private'] == 1))
+ if(! dbm::is_result($r) || ($r[0]['private'] == 1))
killme();
if (strpos($r[0]['body'], "[/share]") !== false) {
diff --git a/mod/smilies.php b/mod/smilies.php
index 5ca3af14a4..4d8ab6bcaa 100644
--- a/mod/smilies.php
+++ b/mod/smilies.php
@@ -10,11 +10,12 @@ function smilies_content(App $a) {
if ($a->argv[1]==="json"){
$tmp = Smilies::get_list();
$results = array();
- for ($i = 0; $i < count($tmp['texts']); $i++) {
+ for($i = 0; $i < count($tmp['texts']); $i++) {
$results[] = array('text' => $tmp['texts'][$i], 'icon' => $tmp['icons'][$i]);
}
json_return_and_die($results);
- } else {
+ }
+ else {
return Smilies::replace('',true);
}
}
diff --git a/mod/subthread.php b/mod/subthread.php
index b85f461dcf..646a4230c5 100644
--- a/mod/subthread.php
+++ b/mod/subthread.php
@@ -7,7 +7,7 @@ require_once('include/items.php');
function subthread_content(App $a) {
- if (! local_user() && ! remote_user()) {
+ if(! local_user() && ! remote_user()) {
return;
}
@@ -20,7 +20,7 @@ function subthread_content(App $a) {
dbesc($item_id)
);
- if (! $item_id || (! dbm::is_result($r))) {
+ if(! $item_id || (! dbm::is_result($r))) {
logger('subthread: no item ' . $item_id);
return;
}
@@ -29,13 +29,13 @@ function subthread_content(App $a) {
$owner_uid = $item['uid'];
- if (! can_write_wall($a,$owner_uid)) {
+ if(! can_write_wall($a,$owner_uid)) {
return;
}
$remote_owner = null;
- if (! $item['wall']) {
+ if(! $item['wall']) {
// The top level post may have been written by somebody on another system
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($item['contact-id']),
diff --git a/mod/tagger.php b/mod/tagger.php
index 0ee2a01437..50099ac69c 100644
--- a/mod/tagger.php
+++ b/mod/tagger.php
@@ -7,7 +7,7 @@ require_once('include/items.php');
function tagger_content(App $a) {
- if (! local_user() && ! remote_user()) {
+ if(! local_user() && ! remote_user()) {
return;
}
@@ -15,7 +15,7 @@ function tagger_content(App $a) {
// no commas allowed
$term = str_replace(array(',',' '),array('','_'),$term);
- if (! $term)
+ if(! $term)
return;
$item_id = (($a->argc > 1) ? notags(trim($a->argv[1])) : 0);
@@ -27,7 +27,7 @@ function tagger_content(App $a) {
dbesc($item_id)
);
- if (! $item_id || (! dbm::is_result($r))) {
+ if(! $item_id || (! dbm::is_result($r))) {
logger('tagger: no item ' . $item_id);
return;
}
@@ -44,7 +44,7 @@ function tagger_content(App $a) {
$blocktags = $r[0]['blocktags'];
}
- if (local_user() != $owner_uid)
+ if(local_user() != $owner_uid)
return;
$r = q("select * from contact where self = 1 and uid = %d limit 1",
@@ -146,7 +146,7 @@ EOT;
// );
- if (! $item['visible']) {
+ if(! $item['visible']) {
$r = q("UPDATE `item` SET `visible` = 1 WHERE `id` = %d AND `uid` = %d",
intval($item['id']),
intval($owner_uid)
@@ -158,7 +158,7 @@ EOT;
intval($item['id']),
dbesc($term)
);
- if ((! $blocktags) && $t[0]['tcount']==0 ) {
+ if((! $blocktags) && $t[0]['tcount']==0 ) {
/*q("update item set tag = '%s' where id = %d",
dbesc($item['tag'] . (strlen($item['tag']) ? ',' : '') . '#[url=' . App::get_baseurl() . '/search?tag=' . $term . ']'. $term . '[/url]'),
intval($item['id'])
@@ -187,18 +187,18 @@ EOT;
intval($r[0]['id']),
dbesc($term)
);
- if (count($x) && !$x[0]['blocktags'] && $t[0]['tcount']==0){
+ if(count($x) && !$x[0]['blocktags'] && $t[0]['tcount']==0){
q("INSERT INTO term (oid, otype, type, term, url, uid) VALUE (%d, %d, %d, '%s', '%s', %d)",
- intval($r[0]['id']),
- $term_objtype,
- TERM_HASHTAG,
- dbesc($term),
- dbesc(App::get_baseurl() . '/search?tag=' . $term),
- intval($owner_uid)
- );
+ intval($r[0]['id']),
+ $term_objtype,
+ TERM_HASHTAG,
+ dbesc($term),
+ dbesc(App::get_baseurl() . '/search?tag=' . $term),
+ intval($owner_uid)
+ );
}
- /*if (count($x) && !$x[0]['blocktags'] && (! stristr($r[0]['tag'], ']' . $term . '['))) {
+ /*if(count($x) && !$x[0]['blocktags'] && (! stristr($r[0]['tag'], ']' . $term . '['))) {
q("update item set tag = '%s' where id = %d",
dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . '#[url=' . App::get_baseurl() . '/search?tag=' . $term . ']'. $term . '[/url]'),
intval($r[0]['id'])
diff --git a/mod/uexport.php b/mod/uexport.php
index 9bd3bd1384..cada539bcd 100644
--- a/mod/uexport.php
+++ b/mod/uexport.php
@@ -51,9 +51,9 @@ function _uexport_multirow($query) {
$result = array();
$r = q($query);
if (dbm::is_result($r)) {
- foreach ($r as $rr){
+ foreach($r as $rr){
$p = array();
- foreach ($rr as $k => $v) {
+ foreach($rr as $k => $v) {
$p[$k] = $v;
}
$result[] = $p;
@@ -66,8 +66,8 @@ function _uexport_row($query) {
$result = array();
$r = q($query);
if (dbm::is_result($r)) {
- foreach ($r as $rr) {
- foreach ($rr as $k => $v) {
+ foreach($r as $rr) {
+ foreach($rr as $k => $v) {
$result[$k] = $v;
}
}
@@ -151,8 +151,8 @@ function uexport_all(App $a) {
intval(500)
);
/*if (dbm::is_result($r)) {
- foreach ($r as $rr)
- foreach ($rr as $k => $v)
+ foreach($r as $rr)
+ foreach($rr as $k => $v)
$item[][$k] = $v;
}*/
diff --git a/mod/videos.php b/mod/videos.php
index 19d5ce9402..3828b8f1fe 100644
--- a/mod/videos.php
+++ b/mod/videos.php
@@ -8,10 +8,10 @@ require_once('include/redir.php');
function videos_init(App $a) {
- if ($a->argc > 1)
+ if($a->argc > 1)
auto_redir($a, $a->argv[1]);
- if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
+ if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
return;
}
@@ -19,15 +19,14 @@ function videos_init(App $a) {
$o = '';
- if ($a->argc > 1) {
+ if($a->argc > 1) {
$nick = $a->argv[1];
$user = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1",
dbesc($nick)
);
- if (!dbm::is_result($user)) {
+ if(! count($user))
return;
- }
$a->data['user'] = $user[0];
$a->profile_uid = $user[0]['uid'];
@@ -53,35 +52,35 @@ function videos_init(App $a) {
intval($a->data['user']['uid'])
);
- if (count($albums)) {
+ if(count($albums)) {
$a->data['albums'] = $albums;
$albums_visible = ((intval($a->data['user']['hidewall']) && (! local_user()) && (! remote_user())) ? false : true);
- if ($albums_visible) {
+ if($albums_visible) {
$o .= '';
}*/
- if (! x($a->page,'aside'))
+ if(! x($a->page,'aside'))
$a->page['aside'] = '';
$a->page['aside'] .= $vcard_widget;
@@ -195,7 +194,7 @@ function videos_content(App $a) {
// videos/name/video/xxxxx/edit
- if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
+ if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL);
return;
}
@@ -205,7 +204,7 @@ function videos_content(App $a) {
require_once('include/security.php');
require_once('include/conversation.php');
- if (! x($a->data,'user')) {
+ if(! x($a->data,'user')) {
notice( t('No videos selected') . EOL );
return;
}
@@ -218,16 +217,16 @@ function videos_content(App $a) {
// Parse arguments
//
- if ($a->argc > 3) {
+ if($a->argc > 3) {
$datatype = $a->argv[2];
$datum = $a->argv[3];
}
- elseif (($a->argc > 2) && ($a->argv[2] === 'upload'))
+ elseif(($a->argc > 2) && ($a->argv[2] === 'upload'))
$datatype = 'upload';
else
$datatype = 'summary';
- if ($a->argc > 4)
+ if($a->argc > 4)
$cmd = $a->argv[4];
else
$cmd = 'view';
@@ -246,19 +245,19 @@ function videos_content(App $a) {
$community_page = (($a->data['user']['page-flags'] == PAGE_COMMUNITY) ? true : false);
- if ((local_user()) && (local_user() == $owner_uid))
+ if((local_user()) && (local_user() == $owner_uid))
$can_post = true;
else {
- if ($community_page && remote_user()) {
- if (is_array($_SESSION['remote'])) {
- foreach ($_SESSION['remote'] as $v) {
- if ($v['uid'] == $owner_uid) {
+ if($community_page && remote_user()) {
+ if(is_array($_SESSION['remote'])) {
+ foreach($_SESSION['remote'] as $v) {
+ if($v['uid'] == $owner_uid) {
$contact_id = $v['cid'];
break;
}
}
}
- if ($contact_id) {
+ if($contact_id) {
$r = q("SELECT `uid` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
@@ -276,17 +275,17 @@ function videos_content(App $a) {
// perhaps they're visiting - but not a community page, so they wouldn't have write access
- if (remote_user() && (! $visitor)) {
+ if(remote_user() && (! $visitor)) {
$contact_id = 0;
- if (is_array($_SESSION['remote'])) {
- foreach ($_SESSION['remote'] as $v) {
- if ($v['uid'] == $owner_uid) {
+ if(is_array($_SESSION['remote'])) {
+ foreach($_SESSION['remote'] as $v) {
+ if($v['uid'] == $owner_uid) {
$contact_id = $v['cid'];
break;
}
}
}
- if ($contact_id) {
+ if($contact_id) {
$groups = init_groups_visitor($contact_id);
$r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
@@ -299,14 +298,14 @@ function videos_content(App $a) {
}
}
- if (! $remote_contact) {
- if (local_user()) {
+ if(! $remote_contact) {
+ if(local_user()) {
$contact_id = $_SESSION['cid'];
$contact = $a->contact;
}
}
- if ($a->data['user']['hidewall'] && (local_user() != $owner_uid) && (! $remote_contact)) {
+ if($a->data['user']['hidewall'] && (local_user() != $owner_uid) && (! $remote_contact)) {
notice( t('Access to this item is restricted.') . EOL);
return;
}
@@ -324,13 +323,13 @@ function videos_content(App $a) {
//
- if ($datatype === 'upload') {
+ if($datatype === 'upload') {
return; // no uploading for now
// DELETED -- look at mod/photos.php if you want to implement
}
- if ($datatype === 'album') {
+ if($datatype === 'album') {
return; // no albums for now
@@ -338,7 +337,7 @@ function videos_content(App $a) {
}
- if ($datatype === 'video') {
+ if($datatype === 'video') {
return; // no single video view for now
diff --git a/mod/view.php b/mod/view.php
index a6c482049c..15b3733b3f 100644
--- a/mod/view.php
+++ b/mod/view.php
@@ -9,9 +9,8 @@ function view_init($a){
if ($a->argc == 4){
$theme = $a->argv[2];
$THEMEPATH = "view/theme/$theme";
- if (file_exists("view/theme/$theme/style.php")) {
+ if(file_exists("view/theme/$theme/style.php"))
require_once("view/theme/$theme/style.php");
- }
}
killme();
diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php
index 1001f03cc2..5912f6cc77 100644
--- a/mod/viewcontacts.php
+++ b/mod/viewcontacts.php
@@ -4,13 +4,13 @@ require_once('include/contact_selectors.php');
function viewcontacts_init(App $a) {
- if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
+ if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
return;
}
nav_set_selected('home');
- if ($a->argc > 1) {
+ if($a->argc > 1) {
$nick = $a->argv[1];
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1",
dbesc($nick)
@@ -32,7 +32,7 @@ function viewcontacts_init(App $a) {
function viewcontacts_content(App $a) {
require_once("mod/proxy.php");
- if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
+ if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL);
return;
}
@@ -42,7 +42,7 @@ function viewcontacts_content(App $a) {
// tabs
$o .= profile_tabs($a,$is_owner, $a->data['user']['nickname']);
- if (((! count($a->profile)) || ($a->profile['hide-friends']))) {
+ if(((! count($a->profile)) || ($a->profile['hide-friends']))) {
notice( t('Permission denied.') . EOL);
return $o;
}
@@ -90,11 +90,10 @@ function viewcontacts_content(App $a) {
$is_owner = ((local_user() && ($a->profile['profile_uid'] == local_user())) ? true : false);
- if ($is_owner && ($rr['network'] === NETWORK_DFRN) && ($rr['rel'])) {
+ if($is_owner && ($rr['network'] === NETWORK_DFRN) && ($rr['rel']))
$url = 'redir/' . $rr['id'];
- } else {
+ else
$url = zrl($url);
- }
$contact_details = get_contact_details_by_url($rr['url'], $a->profile['uid'], $rr);
diff --git a/mod/viewsrc.php b/mod/viewsrc.php
index 74652dcca3..a3f0affb53 100644
--- a/mod/viewsrc.php
+++ b/mod/viewsrc.php
@@ -10,7 +10,7 @@ function viewsrc_content(App $a) {
$item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
- if (! $item_id) {
+ if(! $item_id) {
$a->error = 404;
notice( t('Item not found.') . EOL);
return;
@@ -25,7 +25,7 @@ function viewsrc_content(App $a) {
);
if (dbm::is_result($r))
- if (is_ajax()) {
+ if(is_ajax()) {
echo str_replace("\n",'
',$r[0]['body']);
killme();
} else {
diff --git a/mod/wall_attach.php b/mod/wall_attach.php
index 932b6241d8..0fc8b8a6a3 100644
--- a/mod/wall_attach.php
+++ b/mod/wall_attach.php
@@ -7,7 +7,7 @@ function wall_attach_post(App $a) {
$r_json = (x($_GET,'response') && $_GET['response']=='json');
- if ($a->argc > 1) {
+ if($a->argc > 1) {
$nick = $a->argv[1];
$r = q("SELECT `user`.*, `contact`.`id` FROM `user` LEFT JOIN `contact` on `user`.`uid` = `contact`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1",
dbesc($nick)
@@ -36,20 +36,20 @@ function wall_attach_post(App $a) {
$page_owner_nick = $r[0]['nickname'];
$community_page = (($r[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
- if ((local_user()) && (local_user() == $page_owner_uid))
+ if((local_user()) && (local_user() == $page_owner_uid))
$can_post = true;
else {
- if ($community_page && remote_user()) {
+ if($community_page && remote_user()) {
$contact_id = 0;
- if (is_array($_SESSION['remote'])) {
- foreach ($_SESSION['remote'] as $v) {
- if ($v['uid'] == $page_owner_uid) {
+ if(is_array($_SESSION['remote'])) {
+ foreach($_SESSION['remote'] as $v) {
+ if($v['uid'] == $page_owner_uid) {
$contact_id = $v['cid'];
break;
}
}
}
- if ($contact_id) {
+ if($contact_id) {
$r = q("SELECT `uid` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
@@ -62,7 +62,7 @@ function wall_attach_post(App $a) {
}
}
}
- if (! $can_post) {
+ if(! $can_post) {
if ($r_json) {
echo json_encode(array('error'=>t('Permission denied.')));
killme();
@@ -71,7 +71,7 @@ function wall_attach_post(App $a) {
killme();
}
- if (! x($_FILES,'userfile')) {
+ if(! x($_FILES,'userfile')) {
if ($r_json) {
echo json_encode(array('error'=>t('Invalid request.')));
}
@@ -90,7 +90,7 @@ function wall_attach_post(App $a) {
* Then Filesize gets <= 0.
*/
- if ($filesize <=0) {
+ if($filesize <=0) {
$msg = t('Sorry, maybe your upload is bigger than the PHP configuration allows') . EOL .(t('Or - did you try to upload an empty file?'));
if ($r_json) {
echo json_encode(array('error'=>$msg));
@@ -101,7 +101,7 @@ function wall_attach_post(App $a) {
killme();
}
- if (($maxfilesize) && ($filesize > $maxfilesize)) {
+ if(($maxfilesize) && ($filesize > $maxfilesize)) {
$msg = sprintf(t('File exceeds size limit of %s'), formatBytes($maxfilesize));
if ($r_json) {
echo json_encode(array('error'=>$msg));
@@ -154,7 +154,7 @@ function wall_attach_post(App $a) {
@unlink($src);
- if (! $r) {
+ if(! $r) {
$msg = t('File upload failed.');
if ($r_json) {
echo json_encode(array('error'=>$msg));
diff --git a/mod/wall_upload.php b/mod/wall_upload.php
index 85a174cff1..1f71f36b62 100644
--- a/mod/wall_upload.php
+++ b/mod/wall_upload.php
@@ -8,8 +8,8 @@ function wall_upload_post(App $a, $desktopmode = true) {
$r_json = (x($_GET,'response') && $_GET['response']=='json');
- if ($a->argc > 1) {
- if (! x($_FILES,'media')) {
+ if($a->argc > 1) {
+ if(! x($_FILES,'media')) {
$nick = $a->argv[1];
$r = q("SELECT `user`.*, `contact`.`id` FROM `user` INNER JOIN `contact` on `user`.`uid` = `contact`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1",
dbesc($nick)
@@ -44,20 +44,20 @@ function wall_upload_post(App $a, $desktopmode = true) {
$page_owner_nick = $r[0]['nickname'];
$community_page = (($r[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
- if ((local_user()) && (local_user() == $page_owner_uid))
+ if((local_user()) && (local_user() == $page_owner_uid))
$can_post = true;
else {
- if ($community_page && remote_user()) {
+ if($community_page && remote_user()) {
$contact_id = 0;
- if (is_array($_SESSION['remote'])) {
- foreach ($_SESSION['remote'] as $v) {
- if ($v['uid'] == $page_owner_uid) {
+ if(is_array($_SESSION['remote'])) {
+ foreach($_SESSION['remote'] as $v) {
+ if($v['uid'] == $page_owner_uid) {
$contact_id = $v['cid'];
break;
}
}
}
- if ($contact_id) {
+ if($contact_id) {
$r = q("SELECT `uid` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
@@ -72,7 +72,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
}
- if (! $can_post) {
+ if(! $can_post) {
if ($r_json) {
echo json_encode(array('error'=>t('Permission denied.')));
killme();
@@ -81,7 +81,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
killme();
}
- if (! x($_FILES,'userfile') && ! x($_FILES,'media')){
+ if(! x($_FILES,'userfile') && ! x($_FILES,'media')){
if ($r_json) {
echo json_encode(array('error'=>t('Invalid request.')));
}
@@ -89,13 +89,13 @@ function wall_upload_post(App $a, $desktopmode = true) {
}
$src = "";
- if (x($_FILES,'userfile')) {
+ if(x($_FILES,'userfile')) {
$src = $_FILES['userfile']['tmp_name'];
$filename = basename($_FILES['userfile']['name']);
$filesize = intval($_FILES['userfile']['size']);
$filetype = $_FILES['userfile']['type'];
}
- elseif (x($_FILES,'media')) {
+ elseif(x($_FILES,'media')) {
if (is_array($_FILES['media']['tmp_name']))
$src = $_FILES['media']['tmp_name'][0];
else
@@ -147,7 +147,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
$maximagesize = get_config('system','maximagesize');
- if (($maximagesize) && ($filesize > $maximagesize)) {
+ if(($maximagesize) && ($filesize > $maximagesize)) {
$msg = sprintf( t('Image exceeds size limit of %s'), formatBytes($maximagesize));
if ($r_json) {
echo json_encode(array('error'=>$msg));
@@ -182,7 +182,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
$imagedata = @file_get_contents($src);
$ph = new Photo($imagedata, $filetype);
- if (! $ph->is_valid()) {
+ if(! $ph->is_valid()) {
$msg = t('Unable to process image.');
if ($r_json) {
echo json_encode(array('error'=>$msg));
@@ -197,9 +197,9 @@ function wall_upload_post(App $a, $desktopmode = true) {
@unlink($src);
$max_length = get_config('system','max_image_length');
- if (! $max_length)
+ if(! $max_length)
$max_length = MAX_IMAGE_LENGTH;
- if ($max_length > 0) {
+ if($max_length > 0) {
$ph->scaleImage($max_length);
logger("File upload: Scaling picture to new size ".$max_length, LOGGER_DEBUG);
}
@@ -215,7 +215,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, t('Wall Photos'), 0, 0, $defperm);
- if (! $r) {
+ if(! $r) {
$msg = t('Image upload failed.');
if ($r_json) {
echo json_encode(array('error'=>$msg));
@@ -225,20 +225,18 @@ function wall_upload_post(App $a, $desktopmode = true) {
killme();
}
- if ($width > 640 || $height > 640) {
+ if($width > 640 || $height > 640) {
$ph->scaleImage(640);
$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, t('Wall Photos'), 1, 0, $defperm);
- if ($r) {
+ if($r)
$smallest = 1;
- }
}
- if ($width > 320 || $height > 320) {
+ if($width > 320 || $height > 320) {
$ph->scaleImage(320);
$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, t('Wall Photos'), 2, 0, $defperm);
- if ($r AND ($smallest == 0)) {
+ if($r AND ($smallest == 0))
$smallest = 2;
- }
}
$basename = basename($filename);
@@ -246,7 +244,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
if (!$desktopmode) {
$r = q("SELECT `id`, `datasize`, `width`, `height`, `type` FROM `photo` WHERE `resource-id` = '%s' ORDER BY `width` DESC LIMIT 1", $hash);
- if (!dbm::is_result($r)) {
+ if (!$r){
if ($r_json) {
echo json_encode(array('error'=>''));
killme();
diff --git a/mod/wallmessage.php b/mod/wallmessage.php
index d2fc910974..ff90e0dbcf 100644
--- a/mod/wallmessage.php
+++ b/mod/wallmessage.php
@@ -5,7 +5,7 @@ require_once('include/message.php');
function wallmessage_post(App $a) {
$replyto = get_my_url();
- if (! $replyto) {
+ if(! $replyto) {
notice( t('Permission denied.') . EOL);
return;
}
@@ -14,7 +14,7 @@ function wallmessage_post(App $a) {
$body = ((x($_REQUEST,'body')) ? escape_tags(trim($_REQUEST['body'])) : '');
$recipient = (($a->argc > 1) ? notags($a->argv[1]) : '');
- if ((! $recipient) || (! $body)) {
+ if((! $recipient) || (! $body)) {
return;
}
@@ -29,7 +29,7 @@ function wallmessage_post(App $a) {
$user = $r[0];
- if (! intval($user['unkmail'])) {
+ if(! intval($user['unkmail'])) {
notice( t('Permission denied.') . EOL);
return;
}
@@ -38,7 +38,7 @@ function wallmessage_post(App $a) {
intval($user['uid'])
);
- if ($r[0]['total'] > $user['cntunkmail']) {
+ if($r[0]['total'] > $user['cntunkmail']) {
notice( sprintf( t('Number of daily wall messages for %s exceeded. Message failed.', $user['username'])));
return;
}
@@ -69,14 +69,14 @@ function wallmessage_post(App $a) {
function wallmessage_content(App $a) {
- if (! get_my_url()) {
+ if(! get_my_url()) {
notice( t('Permission denied.') . EOL);
return;
}
$recipient = (($a->argc > 1) ? $a->argv[1] : '');
- if (! $recipient) {
+ if(! $recipient) {
notice( t('No recipient.') . EOL);
return;
}
@@ -93,19 +93,16 @@ function wallmessage_content(App $a) {
$user = $r[0];
- if (! intval($user['unkmail'])) {
+ if(! intval($user['unkmail'])) {
notice( t('Permission denied.') . EOL);
return;
}
- $r = q("SELECT COUNT(*) AS `total` FROM `mail` WHERE `uid` = %d AND `created` > UTC_TIMESTAMP() - INTERVAL 1 DAY AND `unknown` = 1",
+ $r = q("select count(*) as total from mail where uid = %d and created > UTC_TIMESTAMP() - INTERVAL 1 day and unknown = 1",
intval($user['uid'])
);
- if (!dbm::is_result($r)) {
- ///@TODO Output message to use of failed query
- return;
- } elseif ($r[0]['total'] > $user['cntunkmail']) {
+ if($r[0]['total'] > $user['cntunkmail']) {
notice( sprintf( t('Number of daily wall messages for %s exceeded. Message failed.', $user['username'])));
return;
}
diff --git a/mod/webfinger.php b/mod/webfinger.php
index 8e54dd275b..eee0580e31 100644
--- a/mod/webfinger.php
+++ b/mod/webfinger.php
@@ -11,7 +11,7 @@ function webfinger_content(App $a) {
$o .= '
';
- if (x($_GET,'addr')) {
+ if(x($_GET,'addr')) {
$addr = trim($_GET['addr']);
$res = Probe::lrdd($addr);
$o .= '
';
diff --git a/mod/xrd.php b/mod/xrd.php
index 93d7b18b06..7b812a7f9d 100644
--- a/mod/xrd.php
+++ b/mod/xrd.php
@@ -6,15 +6,14 @@ function xrd_init(App $a) {
$uri = urldecode(notags(trim($_GET['uri'])));
- if (substr($uri,0,4) === 'http') {
+ if(substr($uri,0,4) === 'http') {
$acct = false;
$name = basename($uri);
} else {
$acct = true;
$local = str_replace('acct:', '', $uri);
- if (substr($local,0,2) == '//') {
+ if(substr($local,0,2) == '//')
$local = substr($local,2);
- }
$name = substr($local,0,strpos($local,'@'));
}
diff --git a/object/BaseObject.php b/object/BaseObject.php
index 5e0c61f49b..2666dc1de5 100644
--- a/object/BaseObject.php
+++ b/object/BaseObject.php
@@ -1,7 +1,6 @@
get_mode() == $mode)
+ if($this->get_mode() == $mode)
return;
$a = $this->get_app();
@@ -93,11 +92,11 @@ class Conversation extends BaseObject {
*/
public function add_thread($item) {
$item_id = $item->get_id();
- if (!$item_id) {
+ if(!$item_id) {
logger('[ERROR] Conversation::add_thread : Item has no ID!!', LOGGER_DEBUG);
return false;
}
- if ($this->get_thread($item->get_id())) {
+ if($this->get_thread($item->get_id())) {
logger('[WARN] Conversation::add_thread : Thread already exists ('. $item->get_id() .').', LOGGER_DEBUG);
return false;
}
@@ -105,11 +104,11 @@ class Conversation extends BaseObject {
/*
* Only add will be displayed
*/
- if ($item->get_data_value('network') === NETWORK_MAIL && local_user() != $item->get_data_value('uid')) {
+ if($item->get_data_value('network') === NETWORK_MAIL && local_user() != $item->get_data_value('uid')) {
logger('[WARN] Conversation::add_thread : Thread is a mail ('. $item->get_id() .').', LOGGER_DEBUG);
return false;
}
- if ($item->get_data_value('verb') === ACTIVITY_LIKE || $item->get_data_value('verb') === ACTIVITY_DISLIKE) {
+ if($item->get_data_value('verb') === ACTIVITY_LIKE || $item->get_data_value('verb') === ACTIVITY_DISLIKE) {
logger('[WARN] Conversation::add_thread : Thread is a (dis)like ('. $item->get_id() .').', LOGGER_DEBUG);
return false;
}
@@ -133,14 +132,13 @@ class Conversation extends BaseObject {
$i = 0;
- foreach ($this->threads as $item) {
- if ($item->get_data_value('network') === NETWORK_MAIL && local_user() != $item->get_data_value('uid')) {
+ foreach($this->threads as $item) {
+ if($item->get_data_value('network') === NETWORK_MAIL && local_user() != $item->get_data_value('uid'))
continue;
- }
$item_data = $item->get_template_data($conv_responses);
- if (!$item_data) {
+ if(!$item_data) {
logger('[ERROR] Conversation::get_template_data : Failed to get item template data ('. $item->get_id() .').', LOGGER_DEBUG);
return false;
}
@@ -158,10 +156,9 @@ class Conversation extends BaseObject {
* _ false on failure
*/
private function get_thread($id) {
- foreach ($this->threads as $item) {
- if ($item->get_id() == $id) {
+ foreach($this->threads as $item) {
+ if($item->get_id() == $id)
return $item;
- }
}
return false;
diff --git a/object/Item.php b/object/Item.php
index ab36069c07..b693520b93 100644
--- a/object/Item.php
+++ b/object/Item.php
@@ -1,7 +1,6 @@
get_profile_owner(),'commtag')) {
+ if(feature_enabled($conv->get_profile_owner(),'commtag')) {
$tagger = array(
'add' => t("add tag"),
'class' => "",
@@ -504,7 +503,7 @@ class Item extends BaseObject {
*/
protected function set_parent($item) {
$parent = $this->get_parent();
- if ($parent) {
+ if($parent) {
$parent->remove_child($this);
}
$this->parent = $item;
@@ -735,9 +734,9 @@ class Item extends BaseObject {
$conv = $this->get_conversation();
$this->wall_to_wall = false;
- if ($this->is_toplevel()) {
- if ($conv->get_mode() !== 'profile') {
- if ($this->get_data_value('wall') AND !$this->get_data_value('self')) {
+ if($this->is_toplevel()) {
+ if($conv->get_mode() !== 'profile') {
+ if($this->get_data_value('wall') AND !$this->get_data_value('self')) {
// On the network page, I am the owner. On the display page it will be the profile owner.
// This will have been stored in $a->page_contact by our calling page.
// Put this person as the wall owner of the wall-to-wall notice.
@@ -746,7 +745,7 @@ class Item extends BaseObject {
$this->owner_photo = $a->page_contact['thumb'];
$this->owner_name = $a->page_contact['name'];
$this->wall_to_wall = true;
- } elseif ($this->get_data_value('owner-link')) {
+ } elseif($this->get_data_value('owner-link')) {
$owner_linkmatch = (($this->get_data_value('owner-link')) && link_compare($this->get_data_value('owner-link'),$this->get_data_value('author-link')));
$alias_linkmatch = (($this->get_data_value('alias')) && link_compare($this->get_data_value('alias'),$this->get_data_value('author-link')));
diff --git a/testargs.php b/testargs.php
index a0ddea3452..a6042f8eb9 100644
--- a/testargs.php
+++ b/testargs.php
@@ -15,8 +15,7 @@
*/
-if (($_SERVER["argc"] > 1) && isset($_SERVER["argv"][1])) {
+if(($_SERVER["argc"] > 1) && isset($_SERVER["argv"][1]))
echo $_SERVER["argv"][1];
-} else {
+else
echo '';
-}
diff --git a/tests/contains_attribute_test.php b/tests/contains_attribute_test.php
index b1e87c17a8..b0bb06acfa 100644
--- a/tests/contains_attribute_test.php
+++ b/tests/contains_attribute_test.php
@@ -1,51 +1,51 @@
assertTrue(attribute_contains($testAttr, "class3"));
- $this->assertFalse(attribute_contains($testAttr, "class2"));
- }
-
- /**
- * test attribute contains
- */
- public function testAttributeContains2() {
- $testAttr="class1 not-class2 class3";
- $this->assertTrue(attribute_contains($testAttr, "class3"));
- $this->assertFalse(attribute_contains($testAttr, "class2"));
- }
+ /**
+ * test attribute contains
+ */
+ public function testAttributeContains1() {
+ $testAttr="class1 notclass2 class3";
+ $this->assertTrue(attribute_contains($testAttr, "class3"));
+ $this->assertFalse(attribute_contains($testAttr, "class2"));
+ }
+
+ /**
+ * test attribute contains
+ */
+ public function testAttributeContains2() {
+ $testAttr="class1 not-class2 class3";
+ $this->assertTrue(attribute_contains($testAttr, "class3"));
+ $this->assertFalse(attribute_contains($testAttr, "class2"));
+ }
/**
* test with empty input
- */
- public function testAttributeContainsEmpty() {
- $testAttr="";
- $this->assertFalse(attribute_contains($testAttr, "class2"));
- }
+ */
+ public function testAttributeContainsEmpty() {
+ $testAttr="";
+ $this->assertFalse(attribute_contains($testAttr, "class2"));
+ }
/**
* test input with special chars
- */
- public function testAttributeContainsSpecialChars() {
- $testAttr="--... %\$ä() /(=?}";
- $this->assertFalse(attribute_contains($testAttr, "class2"));
+ */
+ public function testAttributeContainsSpecialChars() {
+ $testAttr="--... %\$ä() /(=?}";
+ $this->assertFalse(attribute_contains($testAttr, "class2"));
}
}
\ No newline at end of file
diff --git a/tests/expand_acl_test.php b/tests/expand_acl_test.php
index 7059fbc0d7..154bc921db 100644
--- a/tests/expand_acl_test.php
+++ b/tests/expand_acl_test.php
@@ -8,141 +8,141 @@
/** required, it is the file under test */
require_once('include/text.php');
-/**
- * TestCase for the expand_acl function
- *
- * @author Alexander Kampmann
- * @package test.util
- */
+/**
+ * TestCase for the expand_acl function
+ *
+ * @author Alexander Kampmann
+ * @package test.util
+ */
class ExpandAclTest extends PHPUnit_Framework_TestCase {
- /**
- * test expand_acl, perfect input
- */
- public function testExpandAclNormal() {
- $text='<1><2><3>';
- $this->assertEquals(array(1, 2, 3), expand_acl($text));
- }
+ /**
+ * test expand_acl, perfect input
+ */
+ public function testExpandAclNormal() {
+ $text='<1><2><3>';
+ $this->assertEquals(array(1, 2, 3), expand_acl($text));
+ }
/**
* test with a big number
- */
- public function testExpandAclBigNumber() {
- $text='<1><'.PHP_INT_MAX.'><15>';
- $this->assertEquals(array(1, PHP_INT_MAX, 15), expand_acl($text));
- }
+ */
+ public function testExpandAclBigNumber() {
+ $text='<1><'.PHP_INT_MAX.'><15>';
+ $this->assertEquals(array(1, PHP_INT_MAX, 15), expand_acl($text));
+ }
/**
* test with a string in it.
*
* TODO: is this valid input? Otherwise: should there be an exception?
- */
- public function testExpandAclString() {
- $text="<1><279012>";
- $this->assertEquals(array(1, 279012), expand_acl($text));
- }
+ */
+ public function testExpandAclString() {
+ $text="<1><279012>";
+ $this->assertEquals(array(1, 279012), expand_acl($text));
+ }
/**
* test with a ' ' in it.
*
* TODO: is this valid input? Otherwise: should there be an exception?
- */
- public function testExpandAclSpace() {
- $text="<1><279 012><32>";
- $this->assertEquals(array(1, "279", "32"), expand_acl($text));
- }
+ */
+ public function testExpandAclSpace() {
+ $text="<1><279 012><32>";
+ $this->assertEquals(array(1, "279", "32"), expand_acl($text));
+ }
/**
* test empty input
- */
- public function testExpandAclEmpty() {
- $text="";
- $this->assertEquals(array(), expand_acl($text));
- }
+ */
+ public function testExpandAclEmpty() {
+ $text="";
+ $this->assertEquals(array(), expand_acl($text));
+ }
/**
* test invalid input, no < at all
*
* TODO: should there be an exception?
- */
- public function testExpandAclNoBrackets() {
- $text="According to documentation, that's invalid. "; //should be invalid
- $this->assertEquals(array(), expand_acl($text));
- }
+ */
+ public function testExpandAclNoBrackets() {
+ $text="According to documentation, that's invalid. "; //should be invalid
+ $this->assertEquals(array(), expand_acl($text));
+ }
- /**
- * test invalid input, just open <
- *
- * TODO: should there be an exception?
- */
- public function testExpandAclJustOneBracket1() {
- $text="assertEquals(array(), expand_acl($text));
- }
+ /**
+ * test invalid input, just open <
+ *
+ * TODO: should there be an exception?
+ */
+ public function testExpandAclJustOneBracket1() {
+ $text="assertEquals(array(), expand_acl($text));
+ }
- /**
- * test invalid input, just close >
- *
- * TODO: should there be an exception?
- */
- public function testExpandAclJustOneBracket2() {
- $text="Another invalid> string"; //should be invalid
- $this->assertEquals(array(), expand_acl($text));
- }
+ /**
+ * test invalid input, just close >
+ *
+ * TODO: should there be an exception?
+ */
+ public function testExpandAclJustOneBracket2() {
+ $text="Another invalid> string"; //should be invalid
+ $this->assertEquals(array(), expand_acl($text));
+ }
- /**
- * test invalid input, just close >
- *
- * TODO: should there be an exception?
- */
- public function testExpandAclCloseOnly() {
- $text="Another> invalid> string>"; //should be invalid
- $this->assertEquals(array(), expand_acl($text));
- }
+ /**
+ * test invalid input, just close >
+ *
+ * TODO: should there be an exception?
+ */
+ public function testExpandAclCloseOnly() {
+ $text="Another> invalid> string>"; //should be invalid
+ $this->assertEquals(array(), expand_acl($text));
+ }
- /**
- * test invalid input, just open <
- *
- * TODO: should there be an exception?
- */
- public function testExpandAclOpenOnly() {
- $text="assertEquals(array(), expand_acl($text));
- }
+ /**
+ * test invalid input, just open <
+ *
+ * TODO: should there be an exception?
+ */
+ public function testExpandAclOpenOnly() {
+ $text="assertEquals(array(), expand_acl($text));
+ }
- /**
- * test invalid input, open and close do not match
- *
- * TODO: should there be an exception?
- */
- public function testExpandAclNoMatching1() {
- $text=" invalid "; //should be invalid
- $this->assertEquals(array(), expand_acl($text));
- }
+ /**
+ * test invalid input, open and close do not match
+ *
+ * TODO: should there be an exception?
+ */
+ public function testExpandAclNoMatching1() {
+ $text=" invalid "; //should be invalid
+ $this->assertEquals(array(), expand_acl($text));
+ }
- /**
- * test invalid input, open and close do not match
- *
- * TODO: should there be an exception?
- */
- public function testExpandAclNoMatching2() {
- $text="<1>2><3>";
+ /**
+ * test invalid input, open and close do not match
+ *
+ * TODO: should there be an exception?
+ */
+ public function testExpandAclNoMatching2() {
+ $text="<1>2><3>";
// The angles are delimiters which aren't important
// the important thing is the numeric content, this returns array(1,2,3) currently
// we may wish to eliminate 2 from the results, though it isn't harmful
// It would be a better test to figure out if there is any ACL input which can
// produce this $text and fix that instead.
-// $this->assertEquals(array(), expand_acl($text));
+// $this->assertEquals(array(), expand_acl($text));
}
- /**
- * test invalid input, empty <>
- *
- * TODO: should there be an exception? Or array(1, 3)
+ /**
+ * test invalid input, empty <>
+ *
+ * TODO: should there be an exception? Or array(1, 3)
* (This should be array(1,3) - mike)
- */
- public function testExpandAclEmptyMatch() {
- $text="<1><><3>";
- $this->assertEquals(array(1,3), expand_acl($text));
+ */
+ public function testExpandAclEmptyMatch() {
+ $text="<1><><3>";
+ $this->assertEquals(array(1,3), expand_acl($text));
}
}
\ No newline at end of file
diff --git a/tests/get_tags_test.php b/tests/get_tags_test.php
index 2d49eac24a..79dcb36a7f 100644
--- a/tests/get_tags_test.php
+++ b/tests/get_tags_test.php
@@ -44,23 +44,23 @@ function q($sql) {
$args=func_get_args();
//last parameter is always (in this test) uid, so, it should be 11
- if ($args[count($args)-1]!=11) {
+ if($args[count($args)-1]!=11) {
return;
}
- if (3==count($args)) {
+ if(3==count($args)) {
//first call in handle_body, id only
- if ($result[0]['id']==$args[1]) {
+ if($result[0]['id']==$args[1]) {
return $result;
}
//second call in handle_body, name
- if ($result[0]['name']===$args[1]) {
+ if($result[0]['name']===$args[1]) {
return $result;
}
}
//third call in handle_body, nick or attag
- if ($result[0]['nick']===$args[2] || $result[0]['attag']===$args[1]) {
+ if($result[0]['nick']===$args[2] || $result[0]['attag']===$args[1]) {
return $result;
}
}
@@ -108,7 +108,7 @@ class GetTagsTest extends PHPUnit_Framework_TestCase {
$inform='';
$str_tags='';
- foreach ($tags as $tag) {
+ foreach($tags as $tag) {
handle_tag($this->a, $text, $inform, $str_tags, 11, $tag);
}
@@ -197,7 +197,7 @@ class GetTagsTest extends PHPUnit_Framework_TestCase {
$inform='';
$str_tags='';
- foreach ($tags as $tag) {
+ foreach($tags as $tag) {
handle_tag($this->a, $text, $inform, $str_tags, 11, $tag);
}
@@ -257,7 +257,7 @@ class GetTagsTest extends PHPUnit_Framework_TestCase {
$inform='';
$str_tags='';
- foreach ($tags as $tag) {
+ foreach($tags as $tag) {
handle_tag($this->a, $text, $inform, $str_tags, 11, $tag);
}
diff --git a/tests/template_test.php b/tests/template_test.php
index c6e83572eb..1f9f805313 100644
--- a/tests/template_test.php
+++ b/tests/template_test.php
@@ -1,11 +1,11 @@
assertEquals('Hello Anna!', $text);
}
- public function testSimpleVariableInt() {
- $tpl='There are $num new messages!';
-
- $text=replace_macros($tpl, array('$num'=>172));
-
- $this->assertEquals('There are 172 new messages!', $text);
+ public function testSimpleVariableInt() {
+ $tpl='There are $num new messages!';
+
+ $text=replace_macros($tpl, array('$num'=>172));
+
+ $this->assertEquals('There are 172 new messages!', $text);
}
- public function testConditionalElse() {
- $tpl='There{{ if $num!=1 }} are $num new messages{{ else }} is 1 new message{{ endif }}!';
-
+ public function testConditionalElse() {
+ $tpl='There{{ if $num!=1 }} are $num new messages{{ else }} is 1 new message{{ endif }}!';
+
$text1=replace_macros($tpl, array('$num'=>1));
- $text22=replace_macros($tpl, array('$num'=>22));
-
+ $text22=replace_macros($tpl, array('$num'=>22));
+
$this->assertEquals('There is 1 new message!', $text1);
- $this->assertEquals('There are 22 new messages!', $text22);
+ $this->assertEquals('There are 22 new messages!', $text22);
}
- public function testConditionalNoElse() {
- $tpl='{{ if $num!=0 }}There are $num new messages!{{ endif }}';
-
- $text0=replace_macros($tpl, array('$num'=>0));
- $text22=replace_macros($tpl, array('$num'=>22));
-
- $this->assertEquals('', $text0);
- $this->assertEquals('There are 22 new messages!', $text22);
+ public function testConditionalNoElse() {
+ $tpl='{{ if $num!=0 }}There are $num new messages!{{ endif }}';
+
+ $text0=replace_macros($tpl, array('$num'=>0));
+ $text22=replace_macros($tpl, array('$num'=>22));
+
+ $this->assertEquals('', $text0);
+ $this->assertEquals('There are 22 new messages!', $text22);
}
- public function testConditionalFail() {
- $tpl='There {{ if $num!=1 }} are $num new messages{{ else }} is 1 new message{{ endif }}!';
-
- $text1=replace_macros($tpl, array());
-
- //$this->assertEquals('There is 1 new message!', $text1);
+ public function testConditionalFail() {
+ $tpl='There {{ if $num!=1 }} are $num new messages{{ else }} is 1 new message{{ endif }}!';
+
+ $text1=replace_macros($tpl, array());
+
+ //$this->assertEquals('There is 1 new message!', $text1);
}
- public function testSimpleFor() {
- $tpl='{{ for $messages as $message }} $message {{ endfor }}';
-
- $text=replace_macros($tpl, array('$messages'=>array('message 1', 'message 2')));
-
- $this->assertEquals(' message 1 message 2 ', $text);
+ public function testSimpleFor() {
+ $tpl='{{ for $messages as $message }} $message {{ endfor }}';
+
+ $text=replace_macros($tpl, array('$messages'=>array('message 1', 'message 2')));
+
+ $this->assertEquals(' message 1 message 2 ', $text);
}
- public function testFor() {
- $tpl='{{ for $messages as $message }} from: $message.from to $message.to {{ endfor }}';
-
- $text=replace_macros($tpl, array('$messages'=>array(array('from'=>'Mike', 'to'=>'Alex'), array('from'=>'Alex', 'to'=>'Mike'))));
-
- $this->assertEquals(' from: Mike to Alex from: Alex to Mike ', $text);
+ public function testFor() {
+ $tpl='{{ for $messages as $message }} from: $message.from to $message.to {{ endfor }}';
+
+ $text=replace_macros($tpl, array('$messages'=>array(array('from'=>'Mike', 'to'=>'Alex'), array('from'=>'Alex', 'to'=>'Mike'))));
+
+ $this->assertEquals(' from: Mike to Alex from: Alex to Mike ', $text);
}
- public function testKeyedFor() {
- $tpl='{{ for $messages as $from=>$to }} from: $from to $to {{ endfor }}';
-
- $text=replace_macros($tpl, array('$messages'=>array('Mike'=>'Alex', 'Sven'=>'Mike')));
-
- $this->assertEquals(' from: Mike to Alex from: Sven to Mike ', $text);
+ public function testKeyedFor() {
+ $tpl='{{ for $messages as $from=>$to }} from: $from to $to {{ endfor }}';
+
+ $text=replace_macros($tpl, array('$messages'=>array('Mike'=>'Alex', 'Sven'=>'Mike')));
+
+ $this->assertEquals(' from: Mike to Alex from: Sven to Mike ', $text);
}
- public function testForEmpty() {
- $tpl='messages: {{for $messages as $message}} from: $message.from to $message.to {{ endfor }}';
-
- $text=replace_macros($tpl, array('$messages'=>array()));
-
- $this->assertEquals('messages: ', $text);
+ public function testForEmpty() {
+ $tpl='messages: {{for $messages as $message}} from: $message.from to $message.to {{ endfor }}';
+
+ $text=replace_macros($tpl, array('$messages'=>array()));
+
+ $this->assertEquals('messages: ', $text);
}
- public function testForWrongType() {
- $tpl='messages: {{for $messages as $message}} from: $message.from to $message.to {{ endfor }}';
-
- $text=replace_macros($tpl, array('$messages'=>11));
-
- $this->assertEquals('messages: ', $text);
+ public function testForWrongType() {
+ $tpl='messages: {{for $messages as $message}} from: $message.from to $message.to {{ endfor }}';
+
+ $text=replace_macros($tpl, array('$messages'=>11));
+
+ $this->assertEquals('messages: ', $text);
}
- public function testForConditional() {
- $tpl='new messages: {{for $messages as $message}}{{ if $message.new }} $message.text{{endif}}{{ endfor }}';
-
+ public function testForConditional() {
+ $tpl='new messages: {{for $messages as $message}}{{ if $message.new }} $message.text{{endif}}{{ endfor }}';
+
$text=replace_macros($tpl, array('$messages'=>array(
array('new'=>true, 'text'=>'new message'),
- array('new'=>false, 'text'=>'old message'))));
-
- $this->assertEquals('new messages: new message', $text);
+ array('new'=>false, 'text'=>'old message'))));
+
+ $this->assertEquals('new messages: new message', $text);
}
- public function testConditionalFor() {
- $tpl='{{ if $enabled }}new messages:{{for $messages as $message}} $message.text{{ endfor }}{{endif}}';
-
+ public function testConditionalFor() {
+ $tpl='{{ if $enabled }}new messages:{{for $messages as $message}} $message.text{{ endfor }}{{endif}}';
+
$text=replace_macros($tpl, array('$enabled'=>true,
- '$messages'=>array(
- array('new'=>true, 'text'=>'new message'),
- array('new'=>false, 'text'=>'old message'))));
-
- $this->assertEquals('new messages: new message old message', $text);
+ '$messages'=>array(
+ array('new'=>true, 'text'=>'new message'),
+ array('new'=>false, 'text'=>'old message'))));
+
+ $this->assertEquals('new messages: new message old message', $text);
}
- public function testFantasy() {
- $tpl='Fantasy: {{fantasy $messages}}';
-
- $text=replace_macros($tpl, array('$messages'=>'no no'));
-
- $this->assertEquals('Fantasy: {{fantasy no no}}', $text);
+ public function testFantasy() {
+ $tpl='Fantasy: {{fantasy $messages}}';
+
+ $text=replace_macros($tpl, array('$messages'=>'no no'));
+
+ $this->assertEquals('Fantasy: {{fantasy no no}}', $text);
}
- public function testInc() {
- $tpl='{{inc field_input.tpl with $field=$myvar}}{{ endinc }}';
-
- $text=replace_macros($tpl, array('$myvar'=>array('myfield', 'label', 'value', 'help')));
-
+ public function testInc() {
+ $tpl='{{inc field_input.tpl with $field=$myvar}}{{ endinc }}';
+
+ $text=replace_macros($tpl, array('$myvar'=>array('myfield', 'label', 'value', 'help')));
+
$this->assertEquals(" \n"
." \n"
." \n"
." \n"
." help\n"
- ."
\n", $text);
+ ."
\n", $text);
}
- public function testIncNoVar() {
- $tpl='{{inc field_input.tpl }}{{ endinc }}';
-
- $text=replace_macros($tpl, array('$field'=>array('myfield', 'label', 'value', 'help')));
-
- $this->assertEquals(" \n