added spaces + some curly braces + some usage of dbm::is_result()

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-01-26 15:23:30 +01:00 committed by Roland Haeder
parent 720e7d6034
commit 0cd241bcbe
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78
92 changed files with 1190 additions and 1087 deletions

View file

@ -54,7 +54,7 @@ function wk_social_relay(App $a) {
}
$taglist = array();
foreach($tags AS $tag) {
foreach ($tags AS $tag) {
$taglist[] = $tag;
}

View file

@ -4,11 +4,11 @@ require_once('include/Scrape.php');
function acctlink_init(App $a) {
if(x($_GET,'addr')) {
if (x($_GET,'addr')) {
$addr = trim($_GET['addr']);
$res = probe_url($addr);
//logger('acctlink: ' . print_r($res,true));
if($res['url']) {
if ($res['url']) {
goaway($res['url']);
killme();
}

View file

@ -861,6 +861,7 @@ function admin_page_site(App $a) {
foreach ($files as $file) {
if (intval(file_exists($file.'/unsupported')))
continue;
}
$f = basename($file);
@ -1274,7 +1275,7 @@ function admin_page_users(App $a) {
if ($a->argc>2) {
$uid = $a->argv[3];
$user = q("SELECT `username`, `blocked` FROM `user` WHERE `uid` = %d", intval($uid));
if (count($user) == 0) {
if (!dbm::is_result($user)) {
notice('User not found'.EOL);
goaway('admin/users');
return ''; // NOTREACHED
@ -1609,7 +1610,7 @@ function admin_page_plugins(App $a) {
* @param int $result
*/
function toggle_theme(&$themes,$th,&$result) {
for($x = 0; $x < count($themes); $x ++) {
for ($x = 0; $x < count($themes); $x ++) {
if ($themes[$x]['name'] === $th) {
if ($themes[$x]['allowed']) {
$themes[$x]['allowed'] = 0;
@ -1629,7 +1630,7 @@ function toggle_theme(&$themes,$th,&$result) {
* @return int
*/
function theme_status($themes,$th) {
for($x = 0; $x < count($themes); $x ++) {
for ($x = 0; $x < count($themes); $x ++) {
if ($themes[$x]['name'] === $th) {
if ($themes[$x]['allowed']) {
return 1;
@ -1761,7 +1762,7 @@ function admin_page_themes(App $a) {
$status="off"; $action= t("Enable");
}
$readme = Null;
$readme = null;
if (is_file("view/theme/$theme/README.md")) {
$readme = file_get_contents("view/theme/$theme/README.md");
$readme = Markdown($readme);

View file

@ -37,8 +37,9 @@ function allfriends_content(App $a) {
$total = count_all_friends(local_user(), $cid);
if(count($total))
if (count($total)) {
$a->set_pager_total($total);
}
$r = all_friends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);

View file

@ -27,7 +27,7 @@ function api_post(App $a) {
return;
}
if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_user()) {
if (count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_user()) {
notice( t('Permission denied.') . EOL);
return;
}

View file

@ -1,25 +1,23 @@
<?php
function apps_content(App $a) {
$privateaddons = get_config('config','private_addons');
if ($privateaddons === "1") {
if((! (local_user()))) {
info( t("You must be logged in to use addons. "));
return;};
}
$privateaddons = get_config('config','private_addons');
if ($privateaddons === "1") {
if ((! (local_user()))) {
info( t("You must be logged in to use addons. "));
return;
}
}
$title = t('Applications');
$title = t('Applications');
if(count($a->apps)==0)
if (count($a->apps) == 0) {
notice( t('No installed applications.') . EOL);
}
$tpl = get_markup_template("apps.tpl");
return replace_macros($tpl, array(
'$title' => $title,
'$apps' => $a->apps,
));
}

View file

@ -4,7 +4,7 @@ require_once('include/security.php');
function attach_init(App $a) {
if($a->argc != 2) {
if ($a->argc != 2) {
notice( t('Item not available.') . EOL);
return;
}
@ -38,7 +38,7 @@ function attach_init(App $a) {
// error in Chrome for filenames with commas in them
header('Content-type: ' . $r[0]['filetype']);
header('Content-length: ' . $r[0]['filesize']);
if(isset($_GET['attachment']) && $_GET['attachment'] === '0')
if (isset($_GET['attachment']) && $_GET['attachment'] === '0')
header('Content-disposition: filename="' . $r[0]['filename'] . '"');
else
header('Content-disposition: attachment; filename="' . $r[0]['filename'] . '"');

View file

@ -25,7 +25,7 @@ function babel_content(App $a) {
$o .= '<br /><br />';
if(x($_REQUEST,'text')) {
if (x($_REQUEST,'text')) {
$text = trim($_REQUEST['text']);
$o .= "<h2>" . t("Source input: ") . "</h2>" . EOL. EOL;
@ -63,7 +63,7 @@ function babel_content(App $a) {
}
if(x($_REQUEST,'d2bbtext')) {
if (x($_REQUEST,'d2bbtext')) {
$d2bbtext = trim($_REQUEST['d2bbtext']);
$o .= "<h2>" . t("Source input (Diaspora format): ") . "</h2>" . EOL. EOL;

View file

@ -10,10 +10,10 @@ require_once('include/event.php');
require_once('include/redir.php');
function cal_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;
}
@ -21,13 +21,13 @@ function cal_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(! count($user))
if (! count($user))
return;
$a->data['user'] = $user[0];
@ -54,7 +54,7 @@ function cal_init(App $a) {
$cal_widget = widget_events();
if(! x($a->page,'aside'))
if (! x($a->page,'aside'))
$a->page['aside'] = '';
$a->page['aside'] .= $vcard_widget;
@ -69,6 +69,7 @@ function cal_content(App $a) {
// First day of the week (0 = Sunday)
$firstDay = get_pconfig(local_user(),'system','first_day_of_week');
/// @TODO Convert all these to with curly braces
if ($firstDay === false) $firstDay=0;
// get the translation strings for the callendar
@ -94,8 +95,9 @@ function cal_content(App $a) {
$m = 0;
$ignored = ((x($_REQUEST,'ignored')) ? intval($_REQUEST['ignored']) : 0);
if($a->argc == 4) {
if($a->argv[2] == 'export') {
/// @TODO Convert to one if() statement
if ($a->argc == 4) {
if ($a->argv[2] == 'export') {
$mode = 'export';
$format = $a->argv[3];
}
@ -112,15 +114,15 @@ function cal_content(App $a) {
$owner_uid = $a->data['user']['uid'];
$nick = $a->data['user']['nickname'];
if(is_array($_SESSION['remote'])) {
foreach($_SESSION['remote'] as $v) {
if($v['uid'] == $a->profile['profile_uid']) {
if (is_array($_SESSION['remote'])) {
foreach ($_SESSION['remote'] as $v) {
if ($v['uid'] == $a->profile['profile_uid']) {
$contact_id = $v['cid'];
break;
}
}
}
if($contact_id) {
if ($contact_id) {
$groups = init_groups_visitor($contact_id);
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
@ -131,15 +133,15 @@ function cal_content(App $a) {
$remote_contact = true;
}
}
if(! $remote_contact) {
if(local_user()) {
if (! $remote_contact) {
if (local_user()) {
$contact_id = $_SESSION['cid'];
$contact = $a->contact;
}
}
$is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
if ($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
notice( t('Access to this profile has been restricted.') . EOL);
return;
}
@ -153,33 +155,33 @@ function cal_content(App $a) {
$tabs .= profile_tabs($a,false, $a->data['user']['nickname']);
// The view mode part is similiar to /mod/events.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;
if($nextmonth > 12) {
if ($nextmonth > 12) {
$nextmonth = 1;
$nextyear ++;
}
$prevyear = $y;
if($m > 1)
if ($m > 1)
$prevmonth = $m - 1;
else {
$prevmonth = 12;
@ -235,9 +237,10 @@ function cal_content(App $a) {
$events=array();
// transform the event in a usable array
if (dbm::is_result($r))
if (dbm::is_result($r)) {
$r = sort_by_date($r);
$events = process_events($r);
}
if ($a->argv[2] === 'json'){
echo json_encode($events); killme();
@ -255,9 +258,9 @@ function cal_content(App $a) {
}
// Get rid of dashes in key names, Smarty3 can't handle them
foreach($events as $key => $event) {
foreach ($events as $key => $event) {
$event_item = array();
foreach($event['item'] as $k => $v) {
foreach ($event['item'] as $k => $v) {
$k = str_replace('-','_',$k);
$event_item[$k] = $v;
}
@ -287,15 +290,15 @@ function cal_content(App $a) {
return $o;
}
if($mode == 'export') {
if(! (intval($owner_uid))) {
if ($mode == 'export') {
if (! (intval($owner_uid))) {
notice( t('User not found'));
return;
}
// Test permissions
// Respect the export feature setting for all other /cal pages if it's not the own profile
if( ((local_user() !== intval($owner_uid))) && ! feature_enabled($owner_uid, "export_calendar")) {
if ( ((local_user() !== intval($owner_uid))) && ! feature_enabled($owner_uid, "export_calendar")) {
notice( t('Permission denied.') . EOL);
goaway('cal/' . $nick);
}
@ -304,7 +307,7 @@ function cal_content(App $a) {
$evexport = event_export($owner_uid, $format);
if (!$evexport["success"]) {
if($evexport["content"])
if ($evexport["content"])
notice( t('This calendar format is not supported') );
else
notice( t('No exportable data found'));

View file

@ -57,20 +57,21 @@ function common_content(App $a) {
return;
}
if(! $cid) {
if(get_my_url()) {
if (! $cid) {
if (get_my_url()) {
$r = q("SELECT `id` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d LIMIT 1",
dbesc(normalise_link(get_my_url())),
intval($profile_uid)
);
if (dbm::is_result($r))
if (dbm::is_result($r)) {
$cid = $r[0]['id'];
else {
} else {
$r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
dbesc(normalise_link(get_my_url()))
);
if (dbm::is_result($r))
if (dbm::is_result($r)) {
$zcid = $r[0]['id'];
}
}
}
}

View file

@ -18,12 +18,12 @@ function community_content(App $a, $update = 0) {
if ($update)
return;
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','community_page_style') == CP_NO_COMMUNITY_PAGE) {
if (get_config('system','community_page_style') == CP_NO_COMMUNITY_PAGE) {
notice( t('Not available.') . EOL);
return;
}
@ -34,11 +34,11 @@ function community_content(App $a, $update = 0) {
$o .= '<h3>' . t('Community') . '</h3>';
if(! $update) {
if (! $update) {
nav_set_selected('community');
}
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']))) : '');
@ -79,14 +79,15 @@ function community_content(App $a, $update = 0) {
$r = community_getitems($a->pager['start'] + ($count * $a->pager['itemspage']), $a->pager['itemspage']);
} while ((sizeof($s) < $a->pager['itemspage']) AND (++$count < 50) AND (sizeof($r) > 0));
} else
} else {
$s = $r;
}
// we behave the same in message lists as the search module
$o .= conversation($a, $s, 'community', $update);
$o .= alt_pager($a, count($r));
$o .= alt_pager($a, count($r));
return $o;
}

View file

@ -9,16 +9,17 @@ function contactgroup_content(App $a) {
killme();
}
if(($a->argc > 2) && intval($a->argv[1]) && intval($a->argv[2])) {
if (($a->argc > 2) && intval($a->argv[1]) && intval($a->argv[2])) {
$r = q("SELECT `id` FROM `contact` WHERE `id` = %d AND `uid` = %d and `self` = 0 and `blocked` = 0 AND `pending` = 0 LIMIT 1",
intval($a->argv[2]),
intval(local_user())
);
if (dbm::is_result($r))
if (dbm::is_result($r)) {
$change = intval($a->argv[2]);
}
}
if(($a->argc > 1) && (intval($a->argv[1]))) {
if (($a->argc > 1) && (intval($a->argv[1]))) {
$r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1",
intval($a->argv[1]),
@ -31,16 +32,16 @@ function contactgroup_content(App $a) {
$group = $r[0];
$members = group_get_members($group['id']);
$preselected = array();
if(count($members)) {
foreach($members as $member)
if (count($members)) {
foreach ($members as $member) {
$preselected[] = $member['id'];
}
}
if($change) {
if(in_array($change,$preselected)) {
if ($change) {
if (in_array($change,$preselected)) {
group_rmv_member(local_user(),$group['name'],$change);
}
else {
} else {
group_add_member(local_user(),$group['name'],$change);
}
}

View file

@ -14,7 +14,7 @@ function contacts_init(App $a) {
$contact_id = 0;
if((($a->argc == 2) && intval($a->argv[1])) OR (($a->argc == 3) && intval($a->argv[1]) && ($a->argv[2] == "posts"))) {
if ((($a->argc == 2) && intval($a->argv[1])) OR (($a->argc == 3) && intval($a->argv[1]) && ($a->argv[2] == "posts"))) {
$contact_id = intval($a->argv[1]);
$r = q("SELECT * FROM `contact` WHERE `uid` = %d and `id` = %d LIMIT 1",
intval(local_user()),
@ -107,7 +107,7 @@ function contacts_batch_actions(App $a) {
);
$count_actions=0;
foreach($orig_records as $orig_record) {
foreach ($orig_records as $orig_record) {
$contact_id = $orig_record['id'];
if (x($_POST, 'contacts_batch_update')) {
_contact_update($contact_id);
@ -281,7 +281,7 @@ function _contact_update_profile($contact_id) {
$update["subhub"] = true;
}
foreach($updatefields AS $field)
foreach ($updatefields AS $field)
if (isset($data[$field]) AND ($data[$field] != ""))
$update[$field] = $data[$field];
@ -292,7 +292,7 @@ function _contact_update_profile($contact_id) {
if (isset($data["priority"]) AND ($data["priority"] != 0))
$query = "`priority` = ".intval($data["priority"]);
foreach($update AS $key => $value) {
foreach ($update AS $key => $value) {
if ($query != "")
$query .= ", ";
@ -365,10 +365,10 @@ function contacts_content(App $a) {
return;
}
if($a->argc == 3) {
if ($a->argc == 3) {
$contact_id = intval($a->argv[1]);
if(! $contact_id)
if (! $contact_id)
return;
$cmd = $a->argv[2];
@ -378,25 +378,25 @@ function contacts_content(App $a) {
intval(local_user())
);
if(! count($orig_record)) {
if (! count($orig_record)) {
notice( t('Could not access contact record.') . EOL);
goaway('contacts');
return; // NOTREACHED
}
if($cmd === 'update') {
if ($cmd === 'update') {
_contact_update($contact_id);
goaway('contacts/' . $contact_id);
// NOTREACHED
}
if($cmd === 'updateprofile') {
if ($cmd === 'updateprofile') {
_contact_update_profile($contact_id);
goaway('crepair/' . $contact_id);
// NOTREACHED
}
if($cmd === 'block') {
if ($cmd === 'block') {
$r = _contact_block($contact_id, $orig_record[0]);
if ($r) {
$blocked = (($orig_record[0]['blocked']) ? 0 : 1);
@ -407,7 +407,7 @@ function contacts_content(App $a) {
return; // NOTREACHED
}
if($cmd === 'ignore') {
if ($cmd === 'ignore') {
$r = _contact_ignore($contact_id, $orig_record[0]);
if ($r) {
$readonly = (($orig_record[0]['readonly']) ? 0 : 1);
@ -419,7 +419,7 @@ function contacts_content(App $a) {
}
if($cmd === 'archive') {
if ($cmd === 'archive') {
$r = _contact_archive($contact_id, $orig_record[0]);
if ($r) {
$archived = (($orig_record[0]['archive']) ? 0 : 1);
@ -430,16 +430,16 @@ function contacts_content(App $a) {
return; // NOTREACHED
}
if($cmd === 'drop') {
if ($cmd === 'drop') {
// Check if we should do HTML-based delete confirmation
if($_REQUEST['confirm']) {
if ($_REQUEST['confirm']) {
// <form> can't take arguments in its "action" parameter
// so add any arguments as hidden inputs
$query = explode_querystring($a->query_string);
$inputs = array();
foreach($query['args'] as $arg) {
if(strpos($arg, 'confirm=') === false) {
foreach ($query['args'] as $arg) {
if (strpos($arg, 'confirm=') === false) {
$arg_parts = explode('=', $arg);
$inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]);
}
@ -488,7 +488,7 @@ function contacts_content(App $a) {
$_SESSION['return_url'] = $a->query_string;
if((x($a->data,'contact')) && (is_array($a->data['contact']))) {
if ((x($a->data,'contact')) && (is_array($a->data['contact']))) {
$contact_id = $a->data['contact']['id'];
$contact = $a->data['contact'];
@ -522,12 +522,12 @@ function contacts_content(App $a) {
break;
}
if(!in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA)))
if (!in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA)))
$relation_text = "";
$relation_text = sprintf($relation_text,htmlentities($contact['name']));
if(($contact['network'] === NETWORK_DFRN) && ($contact['rel'])) {
if (($contact['network'] === NETWORK_DFRN) && ($contact['rel'])) {
$url = "redir/{$contact['id']}";
$sparkle = ' class="sparkle" ';
}
@ -542,7 +542,7 @@ function contacts_content(App $a) {
? t('Never')
: datetime_convert('UTC',date_default_timezone_get(),$contact['last-update'],'D, j M Y, g:i A'));
if($contact['last-update'] !== '0000-00-00 00:00:00')
if ($contact['last-update'] !== '0000-00-00 00:00:00')
$last_update .= ' ' . (($contact['last-update'] <= $contact['success_update']) ? t("\x28Update was successful\x29") : t("\x28Update was not successful\x29"));
$lblsuggest = (($contact['network'] === NETWORK_DFRN) ? t('Suggest friends') : '');
@ -665,23 +665,23 @@ function contacts_content(App $a) {
$ignored = false;
$all = false;
if(($a->argc == 2) && ($a->argv[1] === 'all')) {
if (($a->argc == 2) && ($a->argv[1] === 'all')) {
$sql_extra = '';
$all = true;
}
elseif(($a->argc == 2) && ($a->argv[1] === 'blocked')) {
elseif (($a->argc == 2) && ($a->argv[1] === 'blocked')) {
$sql_extra = " AND `blocked` = 1 ";
$blocked = true;
}
elseif(($a->argc == 2) && ($a->argv[1] === 'hidden')) {
elseif (($a->argc == 2) && ($a->argv[1] === 'hidden')) {
$sql_extra = " AND `hidden` = 1 ";
$hidden = true;
}
elseif(($a->argc == 2) && ($a->argv[1] === 'ignored')) {
elseif (($a->argc == 2) && ($a->argv[1] === 'ignored')) {
$sql_extra = " AND `readonly` = 1 ";
$ignored = true;
}
elseif(($a->argc == 2) && ($a->argv[1] === 'archived')) {
elseif (($a->argc == 2) && ($a->argv[1] === 'archived')) {
$sql_extra = " AND `archive` = 1 ";
$archived = true;
}
@ -761,14 +761,14 @@ function contacts_content(App $a) {
$searching = false;
if($search) {
if ($search) {
$search_hdr = $search;
$search_txt = dbesc(protect_sprintf(preg_quote($search)));
$searching = true;
}
$sql_extra .= (($searching) ? " AND (name REGEXP '$search_txt' OR url REGEXP '$search_txt' OR nick REGEXP '$search_txt') " : "");
if($nets)
if ($nets)
$sql_extra .= sprintf(" AND network = '%s' ", dbesc($nets));
$sql_extra2 = ((($sort_type > 0) && ($sort_type <= CONTACT_IS_FRIEND)) ? sprintf(" AND `rel` = %d ",intval($sort_type)) : '');
@ -929,7 +929,7 @@ function _contact_detail_for_template($rr){
default:
break;
}
if(($rr['network'] === NETWORK_DFRN) && ($rr['rel'])) {
if (($rr['network'] === NETWORK_DFRN) && ($rr['rel'])) {
$url = "redir/{$rr['id']}";
$sparkle = ' class="sparkle" ';
}
@ -971,7 +971,7 @@ function contact_actions($contact) {
$contact_action = array();
// Provide friend suggestion only for Friendica contacts
if($contact['network'] === NETWORK_DFRN) {
if ($contact['network'] === NETWORK_DFRN) {
$contact_actions['suggest'] = array(
'label' => t('Suggest friends'),
'url' => 'fsuggest/' . $contact['id'],
@ -981,7 +981,7 @@ function contact_actions($contact) {
);
}
if($poll_enabled) {
if ($poll_enabled) {
$contact_actions['update'] = array(
'label' => t('Update now'),
'url' => 'contacts/' . $contact['id'] . '/update',

View file

@ -38,20 +38,18 @@ function content_content(App $a, $update = 0) {
$nouveau = false;
if($a->argc > 1) {
for($x = 1; $x < $a->argc; $x ++) {
if(is_a_date_arg($a->argv[$x])) {
if($datequery)
if ($a->argc > 1) {
for ($x = 1; $x < $a->argc; $x ++) {
if (is_a_date_arg($a->argv[$x])) {
if ($datequery) {
$datequery2 = escape_tags($a->argv[$x]);
else {
} else {
$datequery = escape_tags($a->argv[$x]);
$_GET['order'] = 'post';
}
}
elseif($a->argv[$x] === 'new') {
} elseif ($a->argv[$x] === 'new') {
$nouveau = true;
}
elseif(intval($a->argv[$x])) {
} elseif (intval($a->argv[$x])) {
$group = intval($a->argv[$x]);
$def_acl = array('allow_gid' => '<' . $group . '>');
}
@ -81,12 +79,12 @@ function content_content(App $a, $update = 0) {
if(x($_GET,'search') || x($_GET,'file'))
if (x($_GET,'search') || x($_GET,'file'))
$nouveau = true;
if($cid)
if ($cid)
$def_acl = array('allow_cid' => '<' . intval($cid) . '>');
if($nets) {
if ($nets) {
$r = q("select id from contact where uid = %d and network = '%s' and self = 0",
intval(local_user()),
dbesc($nets)
@ -94,9 +92,9 @@ function content_content(App $a, $update = 0) {
$str = '';
if (dbm::is_result($r))
foreach($r as $rr)
foreach ($r as $rr)
$str .= '<' . $rr['id'] . '>';
if(strlen($str))
if (strlen($str))
$def_acl = array('allow_cid' => $str);
}
@ -108,13 +106,13 @@ function content_content(App $a, $update = 0) {
$sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` $sql_options ) ";
if($group) {
if ($group) {
$r = q("SELECT `name`, `id` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($group),
intval($_SESSION['uid'])
);
if (! dbm::is_result($r)) {
if($update)
if ($update)
killme();
notice( t('No such group') . EOL );
goaway(App::get_baseurl(true) . '/network');
@ -122,7 +120,7 @@ function content_content(App $a, $update = 0) {
}
$contacts = expand_groups(array($group));
if((is_array($contacts)) && count($contacts)) {
if ((is_array($contacts)) && count($contacts)) {
$contact_str = implode(',',$contacts);
}
else {
@ -135,7 +133,7 @@ function content_content(App $a, $update = 0) {
'$title' => sprintf( t('Group: %s'), $r[0]['name'])
)) . $o;
}
elseif($cid) {
elseif ($cid) {
$r = q("SELECT `id`,`name`,`network`,`writable`,`nurl` FROM `contact` WHERE `id` = %d
AND `blocked` = 0 AND `pending` = 0 LIMIT 1",
@ -153,10 +151,10 @@ function content_content(App $a, $update = 0) {
$sql_extra3 = '';
if($datequery) {
if ($datequery) {
$sql_extra3 .= protect_sprintf(sprintf(" AND item.created <= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery))));
}
if($datequery2) {
if ($datequery2) {
$sql_extra3 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
}
@ -164,10 +162,10 @@ function content_content(App $a, $update = 0) {
$sql_extra3 = (($nouveau) ? '' : $sql_extra3);
$sql_table = "`item`";
if(x($_GET,'search')) {
if (x($_GET,'search')) {
$search = escape_tags($_GET['search']);
if(strpos($search,'#') === 0) {
if (strpos($search,'#') === 0) {
$tag = true;
$search = substr($search,1);
}
@ -175,7 +173,7 @@ function content_content(App $a, $update = 0) {
if (get_config('system','only_tag_search'))
$tag = true;
if($tag) {
if ($tag) {
//$sql_extra = sprintf(" AND `term`.`term` = '%s' AND `term`.`otype` = %d AND `term`.`type` = %d ",
// dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG));
//$sql_table = "`term` INNER JOIN `item` ON `item`.`id` = `term`.`oid` AND `item`.`uid` = `term`.`uid` ";
@ -192,11 +190,11 @@ function content_content(App $a, $update = 0) {
}
}
if(strlen($file)) {
if (strlen($file)) {
$sql_extra .= file_tag_file_query('item',unxmlify($file));
}
if($conv) {
if ($conv) {
$myurl = App::get_baseurl() . '/profile/'. $a->user['nickname'];
$myurl = substr($myurl,strpos($myurl,'://')+3);
$myurl = str_replace('www.','',$myurl);
@ -211,7 +209,7 @@ function content_content(App $a, $update = 0) {
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
if($nouveau) {
if ($nouveau) {
// "New Item View" - show all items unthreaded in reverse created date order
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`,
@ -234,7 +232,7 @@ function content_content(App $a, $update = 0) {
// Normal conversation view
if($order === 'post')
if ($order === 'post')
$ordering = "`created`";
else
$ordering = "`commented`";
@ -260,8 +258,8 @@ function content_content(App $a, $update = 0) {
$parents_str = '';
if (dbm::is_result($r)) {
foreach($r as $rr)
if(! in_array($rr['item_id'],$parents_arr))
foreach ($r as $rr)
if (! in_array($rr['item_id'],$parents_arr))
$parents_arr[] = $rr['item_id'];
$parents_str = implode(', ', $parents_arr);
@ -328,32 +326,32 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
);
}
if($mode === 'network') {
if ($mode === 'network') {
$profile_owner = local_user();
$page_writeable = true;
}
if($mode === 'profile') {
if ($mode === 'profile') {
$profile_owner = $a->profile['profile_uid'];
$page_writeable = can_write_wall($a,$profile_owner);
}
if($mode === 'notes') {
if ($mode === 'notes') {
$profile_owner = local_user();
$page_writeable = true;
}
if($mode === 'display') {
if ($mode === 'display') {
$profile_owner = $a->profile['uid'];
$page_writeable = can_write_wall($a,$profile_owner);
}
if($mode === 'community') {
if ($mode === 'community') {
$profile_owner = 0;
$page_writeable = false;
}
if($update)
if ($update)
$return_url = $_SESSION['return_url'];
else
$return_url = $_SESSION['return_url'] = $a->query_string;
@ -378,9 +376,9 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
$threads = array();
$threadsid = -1;
if($items && count($items)) {
if ($items && count($items)) {
if($mode === 'network-new' || $mode === 'search' || $mode === 'community') {
if ($mode === 'network-new' || $mode === 'search' || $mode === 'community') {
// "New Item View" on network page or search page results
// - just loop through the items and format them minimally for display
@ -388,7 +386,7 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
//$tpl = get_markup_template('search_item.tpl');
$tpl = 'search_item.tpl';
foreach($items as $item) {
foreach ($items as $item) {
$threadsid++;
$comment = '';
@ -397,8 +395,8 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
$owner_name = '';
$sparkle = '';
if($mode === 'search' || $mode === 'community') {
if(((activity_match($item['verb'],ACTIVITY_LIKE))
if ($mode === 'search' || $mode === 'community') {
if (((activity_match($item['verb'],ACTIVITY_LIKE))
|| (activity_match($item['verb'],ACTIVITY_DISLIKE))
|| activity_match($item['verb'],ACTIVITY_ATTEND)
|| activity_match($item['verb'],ACTIVITY_ATTENDNO)
@ -411,20 +409,20 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
$nickname = $a->user['nickname'];
// prevent private email from leaking.
if($item['network'] === NETWORK_MAIL && local_user() != $item['uid'])
if ($item['network'] === NETWORK_MAIL && local_user() != $item['uid'])
continue;
$profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']);
if($item['author-link'] && (! $item['author-name']))
if ($item['author-link'] && (! $item['author-name']))
$profile_name = $item['author-link'];
$sp = false;
$profile_link = best_link_url($item,$sp);
if($profile_link === 'mailbox')
if ($profile_link === 'mailbox')
$profile_link = '';
if($sp)
if ($sp)
$sparkle = ' sparkle';
else
$profile_link = zrl($profile_link);
@ -442,7 +440,7 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
$location = ((strlen($locate['html'])) ? $locate['html'] : render_location_dummy($locate));
localize_item($item);
if($mode === 'network-new')
if ($mode === 'network-new')
$dropping = true;
else
$dropping = false;
@ -463,7 +461,7 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
$body = prepare_body($item,true);
if($a->theme['template_engine'] === 'internal') {
if ($a->theme['template_engine'] === 'internal') {
$name_e = template_escape($profile_name);
$title_e = template_escape($item['title']);
$body_e = template_escape($body);
@ -534,20 +532,20 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
// Store the result in the $comments array
$comments = array();
foreach($items as $item) {
if((intval($item['gravity']) == 6) && ($item['id'] != $item['parent'])) {
if(! x($comments,$item['parent']))
foreach ($items as $item) {
if ((intval($item['gravity']) == 6) && ($item['id'] != $item['parent'])) {
if (! x($comments,$item['parent']))
$comments[$item['parent']] = 1;
else
$comments[$item['parent']] += 1;
} elseif(! x($comments,$item['parent']))
} elseif (! x($comments,$item['parent']))
$comments[$item['parent']] = 0; // avoid notices later on
}
// map all the like/dislike/attendance activities for each parent item
// Store these in the $alike and $dlike arrays
foreach($items as $item) {
foreach ($items as $item) {
builtin_activity_puller($item, $conv_responses);
}
@ -559,7 +557,7 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
$blowhard_count = 0;
foreach($items as $item) {
foreach ($items as $item) {
$comment = '';
$template = $tpl;
@ -569,7 +567,7 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
// We've already parsed out like/dislike for special treatment. We can ignore them now
if(((activity_match($item['verb'],ACTIVITY_LIKE))
if (((activity_match($item['verb'],ACTIVITY_LIKE))
|| (activity_match($item['verb'],ACTIVITY_DISLIKE)
|| activity_match($item['verb'],ACTIVITY_ATTEND)
|| activity_match($item['verb'],ACTIVITY_ATTENDNO)
@ -585,7 +583,7 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
// If a single author has more than 3 consecutive top-level posts, squash the remaining ones.
// If there are more than two comments, squash all but the last 2.
if($toplevelpost) {
if ($toplevelpost) {
$item_writeable = (($item['writable'] || $item['self']) ? true : false);
@ -603,7 +601,7 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
else {
// prevent private email reply to public conversation from leaking.
if($item['network'] === NETWORK_MAIL && local_user() != $item['uid'])
if ($item['network'] === NETWORK_MAIL && local_user() != $item['uid'])
continue;
$comments_seen ++;
@ -615,7 +613,7 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
$show_comment_box = ((($page_writeable) && ($item_writeable) && ($comments_seen == $comments[$item['parent']])) ? true : false);
if(($comments[$item['parent']] > 2) && ($comments_seen <= ($comments[$item['parent']] - 2)) && ($item['gravity'] == 6)) {
if (($comments[$item['parent']] > 2) && ($comments_seen <= ($comments[$item['parent']] - 2)) && ($item['gravity'] == 6)) {
if (!$comments_collapsed){
$threads[$threadsid]['num_comments'] = sprintf( tt('%d comment','%d comments',$comments[$item['parent']]),$comments[$item['parent']] );
@ -626,7 +624,7 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
$comment_firstcollapsed = true;
}
}
if(($comments[$item['parent']] > 2) && ($comments_seen == ($comments[$item['parent']] - 1))) {
if (($comments[$item['parent']] > 2) && ($comments_seen == ($comments[$item['parent']] - 1))) {
$comment_lastcollapsed = true;
}
@ -644,9 +642,9 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
$osparkle = '';
if(($toplevelpost) && (! $item['self']) && ($mode !== 'profile')) {
if (($toplevelpost) && (! $item['self']) && ($mode !== 'profile')) {
if($item['wall']) {
if ($item['wall']) {
// 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.
@ -659,12 +657,12 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
$commentww = 'ww';
}
if((! $item['wall']) && $item['owner-link']) {
if ((! $item['wall']) && $item['owner-link']) {
$owner_linkmatch = (($item['owner-link']) && link_compare($item['owner-link'],$item['author-link']));
$alias_linkmatch = (($item['alias']) && link_compare($item['alias'],$item['author-link']));
$owner_namematch = (($item['owner-name']) && $item['owner-name'] == $item['author-name']);
if((! $owner_linkmatch) && (! $alias_linkmatch) && (! $owner_namematch)) {
if ((! $owner_linkmatch) && (! $alias_linkmatch) && (! $owner_namematch)) {
// The author url doesn't match the owner (typically the contact)
// and also doesn't match the contact alias.
@ -682,7 +680,7 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
$template = $wallwall;
$commentww = 'ww';
// If it is our contact, use a friendly redirect link
if((link_compare($item['owner-link'],$item['url']))
if ((link_compare($item['owner-link'],$item['url']))
&& ($item['network'] === NETWORK_DFRN)) {
$owner_url = $redirect_url;
$osparkle = ' sparkle';
@ -696,8 +694,8 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
$likebuttons = '';
$shareable = ((($profile_owner == local_user()) && ($item['private'] != 1)) ? true : false);
if($page_writeable) {
/* if($toplevelpost) { */
if ($page_writeable) {
/* if ($toplevelpost) { */
$likebuttons = array(
'like' => array( t("I like this \x28toggle\x29"), t("like")),
'dislike' => array( t("I don't like this \x28toggle\x29"), t("dislike")),
@ -707,12 +705,12 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
$qc = $qcomment = null;
if(in_array('qcomment',$a->plugins)) {
if (in_array('qcomment',$a->plugins)) {
$qc = ((local_user()) ? get_pconfig(local_user(),'qcomment','words') : null);
$qcomment = (($qc) ? explode("\n",$qc) : null);
}
if(($show_comment_box) || (($show_comment_box == false) && ($override_comment_box == false) && ($item['last-child']))) {
if (($show_comment_box) || (($show_comment_box == false) && ($override_comment_box == false) && ($item['last-child']))) {
$comment = replace_macros($cmnt_tpl,array(
'$return_path' => '',
'$jsreload' => (($mode === 'display') ? $_SESSION['return_url'] : ''),
@ -751,7 +749,7 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
$drop = '';
$dropping = false;
if((intval($item['contact-id']) && $item['contact-id'] == remote_user()) || ($item['uid'] == local_user()))
if ((intval($item['contact-id']) && $item['contact-id'] == remote_user()) || ($item['uid'] == local_user()))
$dropping = true;
$drop = array(
@ -815,7 +813,7 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
$profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']);
if($item['author-link'] && (! $item['author-name']))
if ($item['author-link'] && (! $item['author-name']))
$profile_name = $item['author-link'];
$sp = false;
@ -842,13 +840,14 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
// process action responses - e.g. like/dislike/attend/agree/whatever
$response_verbs = array('like');
if(feature_enabled($profile_owner,'dislike'))
if (feature_enabled($profile_owner,'dislike')) {
$response_verbs[] = 'dislike';
if($item['object-type'] === ACTIVITY_OBJ_EVENT) {
}
if ($item['object-type'] === ACTIVITY_OBJ_EVENT) {
$response_verbs[] = 'attendyes';
$response_verbs[] = 'attendno';
$response_verbs[] = 'attendmaybe';
if($page_writeable) {
if ($page_writeable) {
$isevent = true;
$attend = array( t('I will attend'), t('I will not attend'), t('I might attend'));
}
@ -863,17 +862,20 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
$indent = (($toplevelpost) ? '' : ' comment');
$shiny = "";
if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
if (strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0) {
$shiny = 'shiny';
}
//
localize_item($item);
$tags=array();
foreach(explode(',',$item['tag']) as $tag){
foreach (explode(',',$item['tag']) as $tag){
$tag = trim($tag);
if ($tag!="") $tags[] = bbcode($tag);
if ($tag!="") {
$tags[] = bbcode($tag);
}
}
// Build the HTML
@ -881,15 +883,14 @@ function render_content(App $a, $items, $mode, $update, $preview = false) {
$body = prepare_body($item,true);
//$tmp_item = replace_macros($template,
if($a->theme['template_engine'] === 'internal') {
if ($a->theme['template_engine'] === 'internal') {
$body_e = template_escape($body);
$text_e = strip_tags(template_escape($body));
$name_e = template_escape($profile_name);
$title_e = template_escape($item['title']);
$location_e = template_escape($location);
$owner_name_e = template_escape($owner_name);
}
else {
} else {
$body_e = $body;
$text_e = strip_tags($body);
$name_e = $profile_name;

View file

@ -9,7 +9,7 @@ function crepair_init(App $a) {
$contact_id = 0;
if(($a->argc == 2) && intval($a->argv[1])) {
if (($a->argc == 2) && intval($a->argv[1])) {
$contact_id = intval($a->argv[1]);
$r = q("SELECT * FROM `contact` WHERE `uid` = %d and `id` = %d LIMIT 1",
intval(local_user()),
@ -109,7 +109,7 @@ function crepair_content(App $a) {
$cid = (($a->argc > 1) ? intval($a->argv[1]) : 0);
if($cid) {
if ($cid) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($cid),
intval(local_user())

View file

@ -23,16 +23,16 @@ function delegate_content(App $a) {
$id = $a->argv[2];
$r = q("select `nickname` from user where uid = %d limit 1",
$r = q("SELECT `nickname` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($id)
);
if (dbm::is_result($r)) {
$r = q("select id from contact where uid = %d and nurl = '%s' limit 1",
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' LIMIT 1",
intval(local_user()),
dbesc(normalise_link(App::get_baseurl() . '/profile/' . $r[0]['nickname']))
);
if (dbm::is_result($r)) {
q("insert into manage ( uid, mid ) values ( %d , %d ) ",
q("INSERT INTO `manage` ( `uid`, `mid` ) VALUES ( %d , %d ) ",
intval($a->argv[2]),
intval(local_user())
);
@ -64,34 +64,40 @@ function delegate_content(App $a) {
dbesc($a->user['email']),
dbesc($a->user['password'])
);
if (dbm::is_result($r))
if (dbm::is_result($r)) {
$full_managers = $r;
}
$delegates = array();
// find everybody that currently has delegated management to this account/page
$r = q("select * from user where uid in ( select uid from manage where mid = %d ) ",
$r = q("SELECT * FROM `user` WHERE `uid` IN ( SELECT `uid` FROM `manage` WHERE `mid` = %d ) ",
intval(local_user())
);
if (dbm::is_result($r))
if (dbm::is_result($r)) {
$delegates = $r;
}
$uids = array();
if(count($full_managers))
foreach($full_managers as $rr)
if (count($full_managers)) {
foreach ($full_managers as $rr) {
$uids[] = $rr['uid'];
}
}
if(count($delegates))
foreach($delegates as $rr)
if (count($delegates)) {
foreach ($delegates as $rr) {
$uids[] = $rr['uid'];
}
}
// find every contact who might be a candidate for delegation
$r = q("select nurl from contact where substring_index(contact.nurl,'/',3) = '%s'
and contact.uid = %d and contact.self = 0 and network = '%s' ",
$r = q("SELECT `nurl` FROM `contact` WHERE SUBSTRING_INDEX(`contact`.`nurl`,'/',3) = '%s'
AND `contact`.`uid` = %d AND `contact`.`self` = 0 AND `network` = '%s' ",
dbesc(normalise_link(App::get_baseurl())),
intval(local_user()),
dbesc(NETWORK_DFRN)
@ -116,12 +122,15 @@ function delegate_content(App $a) {
// get user records for all potential page delegates who are not already delegates or managers
$r = q("select `uid`, `username`, `nickname` from user where nickname in ( $nicks )");
$r = q("SELECT `uid`, `username`, `nickname` FROM `user` WHERE `nickname` IN ( $nicks )");
if (dbm::is_result($r))
foreach($r as $rr)
if(! in_array($rr['uid'],$uids))
if (dbm::is_result($r)) {
foreach ($r as $rr) {
if (! in_array($rr['uid'],$uids)) {
$potentials[] = $rr;
}
}
}
require_once("mod/settings.php");
settings_init($a);

View file

@ -24,7 +24,7 @@ require_once('include/Probe.php');
function dfrn_confirm_post(App $a, $handsfree = null) {
if(is_array($handsfree)) {
if (is_array($handsfree)) {
/*
* We were called directly from dfrn_request due to automatic friend acceptance.
@ -37,7 +37,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
}
else {
if($a->argc > 1)
if ($a->argc > 1)
$node = $a->argv[1];
}
@ -53,11 +53,11 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
*
*/
if(! x($_POST,'source_url')) {
if (! x($_POST,'source_url')) {
$uid = ((is_array($handsfree)) ? $handsfree['uid'] : local_user());
if(! $uid) {
if (! $uid) {
notice( t('Permission denied.') . EOL );
return;
}
@ -66,7 +66,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
intval($uid)
);
if(! $user) {
if (! $user) {
notice( t('Profile not found.') . EOL );
return;
}
@ -74,7 +74,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
// These data elements may come from either the friend request notification form or $handsfree array.
if(is_array($handsfree)) {
if (is_array($handsfree)) {
logger('Confirm in handsfree mode');
$dfrn_id = $handsfree['dfrn_id'];
$intro_id = $handsfree['intro_id'];
@ -99,11 +99,11 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
*
*/
if(strlen($dfrn_id))
if (strlen($dfrn_id))
$cid = 0;
logger('Confirming request for dfrn_id (issued) ' . $dfrn_id);
if($cid)
if ($cid)
logger('Confirming follower with contact_id: ' . $cid);
@ -138,10 +138,10 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
$network = ((strlen($contact['issued-id'])) ? NETWORK_DFRN : NETWORK_OSTATUS);
if($contact['network'])
if ($contact['network'])
$network = $contact['network'];
if($network === NETWORK_DFRN) {
if ($network === NETWORK_DFRN) {
/*
*
@ -199,19 +199,19 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
openssl_public_encrypt($my_url, $params['source_url'], $site_pubkey);
$params['source_url'] = bin2hex($params['source_url']);
if($aes_allow && function_exists('openssl_encrypt')) {
if ($aes_allow && function_exists('openssl_encrypt')) {
openssl_public_encrypt($src_aes_key, $params['aes_key'], $site_pubkey);
$params['aes_key'] = bin2hex($params['aes_key']);
$params['public_key'] = bin2hex(openssl_encrypt($public_key,'AES-256-CBC',$src_aes_key));
}
$params['dfrn_version'] = DFRN_PROTOCOL_VERSION ;
if($duplex == 1)
if ($duplex == 1)
$params['duplex'] = 1;
if($user[0]['page-flags'] == PAGE_COMMUNITY)
if ($user[0]['page-flags'] == PAGE_COMMUNITY)
$params['page'] = 1;
if($user[0]['page-flags'] == PAGE_PRVGROUP)
if ($user[0]['page-flags'] == PAGE_PRVGROUP)
$params['page'] = 2;
logger('Confirm: posting data to ' . $dfrn_confirm . ': ' . print_r($params,true), LOGGER_DATA);
@ -234,7 +234,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
$leading_junk = substr($res,0,strpos($res,'<?xml'));
$res = substr($res,strpos($res,'<?xml'));
if(! strlen($res)) {
if (! strlen($res)) {
// No XML at all, this exchange is messed up really bad.
// We shouldn't proceed, because the xml parser might choke,
@ -245,7 +245,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
return;
}
if(strlen($leading_junk) && get_config('system','debugging')) {
if (strlen($leading_junk) && get_config('system','debugging')) {
// This might be more common. Mixed error text and some XML.
// If we're configured for debugging, show the text. Proceed in either case.
@ -253,7 +253,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
notice( t('Unexpected response from remote site: ') . EOL . $leading_junk . EOL );
}
if(stristr($res, "<status")===false) {
if (stristr($res, "<status")===false) {
// wrong xml! stop here!
notice( t('Unexpected response from remote site: ') . EOL . htmlspecialchars($res) . EOL );
return;
@ -265,7 +265,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
switch($status) {
case 0:
info( t("Confirmation completed successfully.") . EOL);
if(strlen($message))
if (strlen($message))
notice( t('Remote site reported: ') . $message . EOL);
break;
case 1:
@ -279,19 +279,19 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
case 2:
notice( t("Temporary failure. Please wait and try again.") . EOL);
if(strlen($message))
if (strlen($message))
notice( t('Remote site reported: ') . $message . EOL);
break;
case 3:
notice( t("Introduction failed or was revoked.") . EOL);
if(strlen($message))
if (strlen($message))
notice( t('Remote site reported: ') . $message . EOL);
break;
}
if(($status == 0) && ($intro_id)) {
if (($status == 0) && ($intro_id)) {
// Success. Delete the notification.
@ -302,7 +302,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
}
if($status != 0)
if ($status != 0)
return;
}
@ -323,13 +323,13 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
logger('dfrn_confirm: confirm - imported photos');
if($network === NETWORK_DFRN) {
if ($network === NETWORK_DFRN) {
$new_relation = CONTACT_IS_FOLLOWER;
if(($relation == CONTACT_IS_SHARING) || ($duplex))
if (($relation == CONTACT_IS_SHARING) || ($duplex))
$new_relation = CONTACT_IS_FRIEND;
if(($relation == CONTACT_IS_SHARING) && ($duplex))
if (($relation == CONTACT_IS_SHARING) && ($duplex))
$duplex = 0;
$r = q("UPDATE `contact` SET `rel` = %d,
@ -349,8 +349,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
dbesc(NETWORK_DFRN),
intval($contact_id)
);
}
else {
} else {
// $network !== NETWORK_DFRN
@ -358,13 +357,13 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
$notify = (($contact['notify']) ? $contact['notify'] : '');
$poll = (($contact['poll']) ? $contact['poll'] : '');
if((! $contact['notify']) || (! $contact['poll'])) {
if ((! $contact['notify']) || (! $contact['poll'])) {
$arr = Probe::lrdd($contact['url']);
if(count($arr)) {
foreach($arr as $link) {
if($link['@attributes']['rel'] === 'salmon')
if (count($arr)) {
foreach ($arr as $link) {
if ($link['@attributes']['rel'] === 'salmon')
$notify = $link['@attributes']['href'];
if($link['@attributes']['rel'] === NAMESPACE_FEED)
if ($link['@attributes']['rel'] === NAMESPACE_FEED)
$poll = $link['@attributes']['href'];
}
}
@ -373,13 +372,13 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
$new_relation = $contact['rel'];
$writable = $contact['writable'];
if($network === NETWORK_DIASPORA) {
if($duplex)
if ($network === NETWORK_DIASPORA) {
if ($duplex)
$new_relation = CONTACT_IS_FRIEND;
else
$new_relation = CONTACT_IS_FOLLOWER;
if($new_relation != CONTACT_IS_FOLLOWER)
if ($new_relation != CONTACT_IS_FOLLOWER)
$writable = 1;
}
@ -444,7 +443,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
intval($uid)
);
if((dbm::is_result($r)) && ($r[0]['hide-friends'] == 0) && ($activity) && (! $hidden)) {
if ((dbm::is_result($r)) && ($r[0]['hide-friends'] == 0) && ($activity) && (! $hidden)) {
require_once('include/items.php');
@ -452,7 +451,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
intval($uid)
);
if(count($self)) {
if (count($self)) {
$arr = array();
$arr['guid'] = get_guid(32);
@ -491,14 +490,14 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
$arr['deny_gid'] = $user[0]['deny_gid'];
$i = item_store($arr);
if($i)
if ($i)
proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i);
}
}
}
$def_gid = get_default_group($uid, $contact["network"]);
if($contact && intval($def_gid))
if ($contact && intval($def_gid))
group_add_member($uid, '', $contact['id'], $def_gid);
// Let's send our user to the contact editor in case they want to
@ -565,7 +564,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
$local_uid = $r[0]['uid'];
if(! strstr($my_prvkey,'PRIVATE KEY')) {
if (! strstr($my_prvkey,'PRIVATE KEY')) {
$message = t('Our site encryption key is apparently messed up.');
xml_status(3,$message);
}
@ -576,7 +575,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
openssl_private_decrypt($source_url,$decrypted_source_url,$my_prvkey);
if(! strlen($decrypted_source_url)) {
if (! strlen($decrypted_source_url)) {
$message = t('Empty site URL was provided or URL could not be decrypted by us.');
xml_status(3,$message);
// NOTREACHED
@ -651,7 +650,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
// It's possible that the other person also requested friendship.
// If it is a duplex relationship, ditch the issued-id if one exists.
if($duplex) {
if ($duplex) {
$r = q("UPDATE `contact` SET `issued-id` = '' WHERE `id` = %d",
intval($dfrn_record)
);
@ -723,7 +722,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
if (dbm::is_result($r))
$combined = $r[0];
if((dbm::is_result($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) {
if ((dbm::is_result($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) {
$mutual = ($new_relation == CONTACT_IS_FRIEND);
notification(array(
'type' => NOTIFY_CONFIRM,
@ -743,12 +742,12 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
// Send a new friend post if we are allowed to...
if($page && intval(get_pconfig($local_uid,'system','post_joingroup'))) {
if ($page && intval(get_pconfig($local_uid,'system','post_joingroup'))) {
$r = q("SELECT `hide-friends` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
intval($local_uid)
);
if((dbm::is_result($r)) && ($r[0]['hide-friends'] == 0)) {
if ((dbm::is_result($r)) && ($r[0]['hide-friends'] == 0)) {
require_once('include/items.php');
@ -756,7 +755,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
intval($local_uid)
);
if(count($self)) {
if (dbm::is_result($self)) {
$arr = array();
$arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), $local_uid);
@ -793,8 +792,9 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
$arr['deny_gid'] = $user[0]['deny_gid'];
$i = item_store($arr);
if($i)
if ($i) {
proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i);
}
}
}

View file

@ -28,12 +28,12 @@ function dfrn_notify_post(App $a) {
$prv = (($page == 2) ? 1 : 0);
$writable = (-1);
if($dfrn_version >= 2.21) {
if ($dfrn_version >= 2.21) {
$writable = (($perm === 'rw') ? 1 : 0);
}
$direction = (-1);
if(strpos($dfrn_id,':') == 1) {
if (strpos($dfrn_id,':') == 1) {
$direction = intval(substr($dfrn_id,0,1));
$dfrn_id = substr($dfrn_id,2);
}
@ -100,14 +100,14 @@ function dfrn_notify_post(App $a) {
logger("Remote rino version: ".$rino_remote." for ".$importer["url"], LOGGER_DEBUG);
if((($writable != (-1)) && ($writable != $importer['writable'])) || ($importer['forum'] != $forum) || ($importer['prv'] != $prv)) {
if ((($writable != (-1)) && ($writable != $importer['writable'])) || ($importer['forum'] != $forum) || ($importer['prv'] != $prv)) {
q("UPDATE `contact` SET `writable` = %d, forum = %d, prv = %d WHERE `id` = %d",
intval(($writable == (-1)) ? $importer['writable'] : $writable),
intval($forum),
intval($prv),
intval($importer['id'])
);
if($writable != (-1))
if ($writable != (-1))
$importer['writable'] = $writable;
$importer['forum'] = $page;
}
@ -120,7 +120,7 @@ function dfrn_notify_post(App $a) {
logger('dfrn_notify: received notify from ' . $importer['name'] . ' for ' . $importer['username']);
logger('dfrn_notify: data: ' . $data, LOGGER_DATA);
if($dissolve == 1) {
if ($dissolve == 1) {
/*
* Relationship is dissolved permanently
@ -137,7 +137,7 @@ function dfrn_notify_post(App $a) {
// If we are setup as a soapbox we aren't accepting input from this person
// This behaviour is deactivated since it really doesn't make sense to even disallow comments
// The check if someone is a friend or simply a follower is done in a later place so it needn't to be done here
//if($importer['page-flags'] == PAGE_SOAPBOX)
//if ($importer['page-flags'] == PAGE_SOAPBOX)
// xml_status(0);
$rino = get_config('system','rino_encrypt');
@ -147,7 +147,7 @@ function dfrn_notify_post(App $a) {
logger("Local rino version: ". $rino, LOGGER_DEBUG);
if(strlen($key)) {
if (strlen($key)) {
// if local rino is lower than remote rino, abort: should not happen!
// but only for $remote_rino > 1, because old code did't send rino version
@ -160,8 +160,8 @@ function dfrn_notify_post(App $a) {
logger('rino: md5 raw key: ' . md5($rawkey));
$final_key = '';
if($dfrn_version >= 2.1) {
if((($importer['duplex']) && strlen($importer['cprvkey'])) || (! strlen($importer['cpubkey']))) {
if ($dfrn_version >= 2.1) {
if ((($importer['duplex']) && strlen($importer['cprvkey'])) || (! strlen($importer['cpubkey']))) {
openssl_private_decrypt($rawkey,$final_key,$importer['cprvkey']);
}
else {
@ -169,7 +169,7 @@ function dfrn_notify_post(App $a) {
}
}
else {
if((($importer['duplex']) && strlen($importer['cpubkey'])) || (! strlen($importer['cprvkey']))) {
if ((($importer['duplex']) && strlen($importer['cpubkey'])) || (! strlen($importer['cprvkey']))) {
openssl_public_decrypt($rawkey,$final_key,$importer['cpubkey']);
}
else {
@ -223,7 +223,7 @@ function dfrn_notify_post(App $a) {
function dfrn_notify_content(App $a) {
if(x($_GET,'dfrn_id')) {
if (x($_GET,'dfrn_id')) {
// initial communication from external contact, $direction is their direction.
// If this is a duplex communication, ours will be the opposite.
@ -237,7 +237,7 @@ function dfrn_notify_content(App $a) {
logger('dfrn_notify: new notification dfrn_id=' . $dfrn_id);
$direction = (-1);
if(strpos($dfrn_id,':') == 1) {
if (strpos($dfrn_id,':') == 1) {
$direction = intval(substr($dfrn_id,0,1));
$dfrn_id = substr($dfrn_id,2);
}
@ -298,16 +298,15 @@ function dfrn_notify_content(App $a) {
$pub_key = trim($r[0]['pubkey']);
$dplx = intval($r[0]['duplex']);
if((($dplx) && (strlen($prv_key))) || ((strlen($prv_key)) && (!(strlen($pub_key))))) {
if ((($dplx) && (strlen($prv_key))) || ((strlen($prv_key)) && (!(strlen($pub_key))))) {
openssl_private_encrypt($hash,$challenge,$prv_key);
openssl_private_encrypt($id_str,$encrypted_id,$prv_key);
}
elseif(strlen($pub_key)) {
} elseif (strlen($pub_key)) {
openssl_public_encrypt($hash,$challenge,$pub_key);
openssl_public_encrypt($id_str,$encrypted_id,$pub_key);
}
else
} else {
$status = 1;
}
$challenge = bin2hex($challenge);
$encrypted_id = bin2hex($encrypted_id);
@ -324,10 +323,9 @@ function dfrn_notify_content(App $a) {
// if requested rino is higher than enabled local rino, reply with local rino
if ($rino_remote < $rino) $rino = $rino_remote;
if((($r[0]['rel']) && ($r[0]['rel'] != CONTACT_IS_SHARING)) || ($r[0]['page-flags'] == PAGE_COMMUNITY)) {
if ((($r[0]['rel']) && ($r[0]['rel'] != CONTACT_IS_SHARING)) || ($r[0]['page-flags'] == PAGE_COMMUNITY)) {
$perm = 'rw';
}
else {
} else {
$perm = 'r';
}

View file

@ -20,20 +20,20 @@ function dfrn_poll_init(App $a) {
$direction = (-1);
if(strpos($dfrn_id,':') == 1) {
if (strpos($dfrn_id,':') == 1) {
$direction = intval(substr($dfrn_id,0,1));
$dfrn_id = substr($dfrn_id,2);
}
$hidewall = false;
if(($dfrn_id === '') && (! x($_POST,'dfrn_id'))) {
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
if (($dfrn_id === '') && (! x($_POST,'dfrn_id'))) {
if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
http_status_exit(403);
}
$user = '';
if($a->argc > 1) {
if ($a->argc > 1) {
$r = q("SELECT `hidewall`,`nickname` FROM `user` WHERE `user`.`nickname` = '%s' LIMIT 1",
dbesc($a->argv[1])
);
@ -51,7 +51,7 @@ function dfrn_poll_init(App $a) {
killme();
}
if(($type === 'profile') && (! strlen($sec))) {
if (($type === 'profile') && (! strlen($sec))) {
$sql_extra = '';
switch($direction) {
@ -85,13 +85,13 @@ function dfrn_poll_init(App $a) {
logger("dfrn_poll: old profile returns " . $s, LOGGER_DATA);
if(strlen($s)) {
if (strlen($s)) {
$xml = parse_xml_string($s);
if((int) $xml->status == 1) {
if ((int) $xml->status == 1) {
$_SESSION['authenticated'] = 1;
if(! x($_SESSION,'remote'))
if (! x($_SESSION,'remote'))
$_SESSION['remote'] = array();
$_SESSION['remote'][] = array('cid' => $r[0]['id'],'uid' => $r[0]['uid'],'url' => $r[0]['url']);
@ -100,7 +100,7 @@ function dfrn_poll_init(App $a) {
$_SESSION['visitor_home'] = $r[0]['url'];
$_SESSION['visitor_handle'] = $r[0]['addr'];
$_SESSION['visitor_visiting'] = $r[0]['uid'];
if(!$quiet)
if (!$quiet)
info( sprintf(t('%1$s welcomes %2$s'), $r[0]['username'] , $r[0]['name']) . EOL);
// Visitors get 1 day session.
$session_id = session_id();
@ -118,9 +118,9 @@ function dfrn_poll_init(App $a) {
}
if($type === 'profile-check' && $dfrn_version < 2.2 ) {
if ($type === 'profile-check' && $dfrn_version < 2.2 ) {
if((strlen($challenge)) && (strlen($sec))) {
if ((strlen($challenge)) && (strlen($sec))) {
q("DELETE FROM `profile_check` WHERE `expire` < " . intval(time()));
$r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
@ -131,7 +131,7 @@ function dfrn_poll_init(App $a) {
// NOTREACHED
}
$orig_id = $r[0]['dfrn_id'];
if(strpos($orig_id, ':'))
if (strpos($orig_id, ':'))
$orig_id = substr($orig_id,2);
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
@ -147,7 +147,7 @@ function dfrn_poll_init(App $a) {
$final_dfrn_id = '';
if(($contact['duplex']) && strlen($contact['prvkey'])) {
if (($contact['duplex']) && strlen($contact['prvkey'])) {
openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
openssl_private_decrypt($challenge,$decoded_challenge,$contact['prvkey']);
}
@ -158,10 +158,10 @@ function dfrn_poll_init(App $a) {
$final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.'));
if(strpos($final_dfrn_id,':') == 1)
if (strpos($final_dfrn_id,':') == 1)
$final_dfrn_id = substr($final_dfrn_id,2);
if($final_dfrn_id != $orig_id) {
if ($final_dfrn_id != $orig_id) {
logger('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
// did not decode properly - cannot trust this site
xml_status(3, 'Bad decryption');
@ -213,9 +213,9 @@ function dfrn_poll_post(App $a) {
$dfrn_version = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version'] : 2.0);
$perm = ((x($_POST,'perm')) ? $_POST['perm'] : 'r');
if($ptype === 'profile-check') {
if ($ptype === 'profile-check') {
if((strlen($challenge)) && (strlen($sec))) {
if ((strlen($challenge)) && (strlen($sec))) {
logger('dfrn_poll: POST: profile-check');
@ -228,7 +228,7 @@ function dfrn_poll_post(App $a) {
// NOTREACHED
}
$orig_id = $r[0]['dfrn_id'];
if(strpos($orig_id, ':'))
if (strpos($orig_id, ':'))
$orig_id = substr($orig_id,2);
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
@ -244,7 +244,7 @@ function dfrn_poll_post(App $a) {
$final_dfrn_id = '';
if(($contact['duplex']) && strlen($contact['prvkey'])) {
if (($contact['duplex']) && strlen($contact['prvkey'])) {
openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
openssl_private_decrypt($challenge,$decoded_challenge,$contact['prvkey']);
}
@ -255,10 +255,10 @@ function dfrn_poll_post(App $a) {
$final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.'));
if(strpos($final_dfrn_id,':') == 1)
if (strpos($final_dfrn_id,':') == 1)
$final_dfrn_id = substr($final_dfrn_id,2);
if($final_dfrn_id != $orig_id) {
if ($final_dfrn_id != $orig_id) {
logger('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
// did not decode properly - cannot trust this site
xml_status(3, 'Bad decryption');
@ -273,7 +273,7 @@ function dfrn_poll_post(App $a) {
}
$direction = (-1);
if(strpos($dfrn_id,':') == 1) {
if (strpos($dfrn_id,':') == 1) {
$direction = intval(substr($dfrn_id,0,1));
$dfrn_id = substr($dfrn_id,2);
}
@ -329,7 +329,7 @@ function dfrn_poll_post(App $a) {
$contact_id = $r[0]['id'];
if($type === 'reputation' && strlen($url)) {
if ($type === 'reputation' && strlen($url)) {
$r = q("SELECT * FROM `contact` WHERE `url` = '%s' AND `uid` = %d LIMIT 1",
dbesc($url),
intval($owner_uid)
@ -341,7 +341,7 @@ function dfrn_poll_post(App $a) {
$reputation = $r[0]['rating'];
$text = $r[0]['reason'];
if($r[0]['id'] == $contact_id) { // inquiring about own reputation not allowed
if ($r[0]['id'] == $contact_id) { // inquiring about own reputation not allowed
$reputation = 0;
$text = '';
}
@ -361,13 +361,13 @@ function dfrn_poll_post(App $a) {
// Update the writable flag if it changed
logger('dfrn_poll: post request feed: ' . print_r($_POST,true),LOGGER_DATA);
if($dfrn_version >= 2.21) {
if($perm === 'rw')
if ($dfrn_version >= 2.21) {
if ($perm === 'rw')
$writable = 1;
else
$writable = 0;
if($writable != $contact['writable']) {
if ($writable != $contact['writable']) {
q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d",
intval($writable),
intval($contact_id)
@ -395,13 +395,13 @@ function dfrn_poll_content(App $a) {
$quiet = ((x($_GET,'quiet')) ? true : false);
$direction = (-1);
if(strpos($dfrn_id,':') == 1) {
if (strpos($dfrn_id,':') == 1) {
$direction = intval(substr($dfrn_id,0,1));
$dfrn_id = substr($dfrn_id,2);
}
if($dfrn_id != '') {
if ($dfrn_id != '') {
// initial communication from external contact
$hash = random_string();
@ -409,7 +409,7 @@ function dfrn_poll_content(App $a) {
$r = q("DELETE FROM `challenge` WHERE `expire` < " . intval(time()));
if($type !== 'profile') {
if ($type !== 'profile') {
$r = q("INSERT INTO `challenge` ( `challenge`, `dfrn-id`, `expire` , `type`, `last_update` )
VALUES( '%s', '%s', '%s', '%s', '%s' ) ",
dbesc($hash),
@ -422,7 +422,7 @@ function dfrn_poll_content(App $a) {
$sql_extra = '';
switch($direction) {
case (-1):
if($type === 'profile')
if ($type === 'profile')
$sql_extra = sprintf(" AND ( `dfrn-id` = '%s' OR `issued-id` = '%s' ) ", dbesc($dfrn_id),dbesc($dfrn_id));
else
$sql_extra = sprintf(" AND `issued-id` = '%s' ", dbesc($dfrn_id));
@ -456,7 +456,7 @@ function dfrn_poll_content(App $a) {
$encrypted_id = '';
$id_str = $my_id . '.' . mt_rand(1000,9999);
if(($r[0]['duplex'] && strlen($r[0]['pubkey'])) || (! strlen($r[0]['prvkey']))) {
if (($r[0]['duplex'] && strlen($r[0]['pubkey'])) || (! strlen($r[0]['prvkey']))) {
openssl_public_encrypt($hash,$challenge,$r[0]['pubkey']);
openssl_public_encrypt($id_str,$encrypted_id,$r[0]['pubkey']);
}
@ -474,11 +474,11 @@ function dfrn_poll_content(App $a) {
$encrypted_id = '';
}
if(($type === 'profile') && (strlen($sec))) {
if (($type === 'profile') && (strlen($sec))) {
// URL reply
if($dfrn_version < 2.2) {
if ($dfrn_version < 2.2) {
$s = fetch_url($r[0]['poll']
. '?dfrn_id=' . $encrypted_id
. '&type=profile-check'
@ -517,7 +517,7 @@ function dfrn_poll_content(App $a) {
logger("dfrn_poll: sec profile: " . $s, LOGGER_DATA);
if(strlen($s) && strstr($s,'<?xml')) {
if (strlen($s) && strstr($s,'<?xml')) {
$xml = parse_xml_string($s);
@ -527,15 +527,15 @@ function dfrn_poll_content(App $a) {
logger('dfrn_poll: secure profile: sec: ' . $xml->sec . ' expecting ' . $sec);
if(((int) $xml->status == 0) && ($xml->challenge == $hash) && ($xml->sec == $sec)) {
if (((int) $xml->status == 0) && ($xml->challenge == $hash) && ($xml->sec == $sec)) {
$_SESSION['authenticated'] = 1;
if(! x($_SESSION,'remote'))
if (! x($_SESSION,'remote'))
$_SESSION['remote'] = array();
$_SESSION['remote'][] = array('cid' => $r[0]['id'],'uid' => $r[0]['uid'],'url' => $r[0]['url']);
$_SESSION['visitor_id'] = $r[0]['id'];
$_SESSION['visitor_home'] = $r[0]['url'];
$_SESSION['visitor_visiting'] = $r[0]['uid'];
if(!$quiet)
if (!$quiet)
info( sprintf(t('%1$s welcomes %2$s'), $r[0]['username'] , $r[0]['name']) . EOL);
// Visitors get 1 day session.
$session_id = session_id();

View file

@ -19,7 +19,7 @@ require_once('include/group.php');
function dfrn_request_init(App $a) {
if($a->argc > 1)
if ($a->argc > 1)
$which = $a->argv[1];
profile_load($a,$which);
@ -44,13 +44,13 @@ function dfrn_request_init(App $a) {
*/
function dfrn_request_post(App $a) {
if(($a->argc != 2) || (! count($a->profile))) {
if (($a->argc != 2) || (! count($a->profile))) {
logger('Wrong count of argc or profiles: argc=' . $a->argc . ',profile()=' . count($a->profile));
return;
}
if(x($_POST, 'cancel')) {
if (x($_POST, 'cancel')) {
goaway(z_root());
}
@ -63,13 +63,13 @@ function dfrn_request_post(App $a) {
*
*/
if((x($_POST,'localconfirm')) && ($_POST['localconfirm'] == 1)) {
if ((x($_POST,'localconfirm')) && ($_POST['localconfirm'] == 1)) {
/*
* Ensure this is a valid request
*/
if(local_user() && ($a->user['nickname'] == $a->argv[1]) && (x($_POST,'dfrn_url'))) {
if (local_user() && ($a->user['nickname'] == $a->argv[1]) && (x($_POST,'dfrn_url'))) {
$dfrn_url = notags(trim($_POST['dfrn_url']));
@ -80,7 +80,7 @@ function dfrn_request_post(App $a) {
$blocked = 1;
$pending = 1;
if(x($dfrn_url)) {
if (x($dfrn_url)) {
/*
* Lookup the contact based on their URL (which is the only unique thing we have at the moment)
@ -92,7 +92,7 @@ function dfrn_request_post(App $a) {
);
if (dbm::is_result($r)) {
if(strlen($r[0]['dfrn-id'])) {
if (strlen($r[0]['dfrn-id'])) {
/*
* We don't need to be here. It has already happened.
@ -105,7 +105,7 @@ function dfrn_request_post(App $a) {
$contact_record = $r[0];
}
if(is_array($contact_record)) {
if (is_array($contact_record)) {
$r = q("UPDATE `contact` SET `ret-aes` = %d, hidden = %d WHERE `id` = %d",
intval($aes_allow),
intval($hidden),
@ -187,7 +187,7 @@ function dfrn_request_post(App $a) {
);
if (dbm::is_result($r)) {
$def_gid = get_default_group(local_user(), $r[0]["network"]);
if(intval($def_gid))
if (intval($def_gid))
group_add_member(local_user(), '', $r[0]['id'], $def_gid);
if (isset($photo))
@ -249,7 +249,7 @@ function dfrn_request_post(App $a) {
*
*/
if(! (is_array($a->profile) && count($a->profile))) {
if (! (is_array($a->profile) && count($a->profile))) {
notice( t('Profile unavailable.') . EOL);
return;
}
@ -265,13 +265,13 @@ function dfrn_request_post(App $a) {
$pending = 1;
if( x($_POST,'dfrn_url')) {
if ( x($_POST,'dfrn_url')) {
/*
* Block friend request spam
*/
if($maxreq) {
if ($maxreq) {
$r = q("SELECT * FROM `intro` WHERE `datetime` > '%s' AND `uid` = %d",
dbesc(datetime_convert('UTC','UTC','now - 24 hours')),
intval($uid)
@ -300,7 +300,7 @@ function dfrn_request_post(App $a) {
);
if (dbm::is_result($r)) {
foreach ($r as $rr) {
if(! $rr['rel']) {
if (! $rr['rel']) {
q("DELETE FROM `contact` WHERE `id` = %d AND NOT `self`",
intval($rr['cid'])
);
@ -325,7 +325,7 @@ function dfrn_request_post(App $a) {
);
if (dbm::is_result($r)) {
foreach ($r as $rr) {
if(! $rr['rel']) {
if (! $rr['rel']) {
q("DELETE FROM `contact` WHERE `id` = %d AND NOT `self`",
intval($rr['cid'])
);
@ -340,16 +340,16 @@ function dfrn_request_post(App $a) {
$real_name = (x($_POST,'realname') ? notags(trim($_POST['realname'])) : '');
$url = trim($_POST['dfrn_url']);
if(! strlen($url)) {
if (! strlen($url)) {
notice( t("Invalid locator") . EOL );
return;
}
$hcard = '';
if($email_follow) {
if ($email_follow) {
if(! validate_email($url)) {
if (! validate_email($url)) {
notice( t('Invalid email address.') . EOL);
return;
}
@ -365,10 +365,10 @@ function dfrn_request_post(App $a) {
$rel = CONTACT_IS_FOLLOWER;
$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($uid)
@ -470,18 +470,18 @@ function dfrn_request_post(App $a) {
logger('dfrn_request: url: ' . $url . ',network=' . $network, LOGGER_DEBUG);
if($network === NETWORK_DFRN) {
if ($network === NETWORK_DFRN) {
$ret = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1",
intval($uid),
dbesc($url)
);
if (dbm::is_result($ret)) {
if(strlen($ret[0]['issued-id'])) {
if (strlen($ret[0]['issued-id'])) {
notice( t('You have already introduced yourself here.') . EOL );
return;
}
elseif($ret[0]['rel'] == CONTACT_IS_FRIEND) {
elseif ($ret[0]['rel'] == CONTACT_IS_FRIEND) {
notice( sprintf( t('Apparently you are already friends with %s.'), $a->profile['name']) . EOL);
return;
}
@ -493,7 +493,7 @@ function dfrn_request_post(App $a) {
$issued_id = random_string();
if(is_array($contact_record)) {
if (is_array($contact_record)) {
// There is a contact record but no issued-id, so this
// is a reciprocal introduction from a known contact
$r = q("UPDATE `contact` SET `issued-id` = '%s' WHERE `id` = %d",
@ -718,7 +718,7 @@ function dfrn_request_content(App $a) {
return $o;
}
elseif((x($_GET,'confirm_key')) && strlen($_GET['confirm_key'])) {
elseif ((x($_GET,'confirm_key')) && strlen($_GET['confirm_key'])) {
// we are the requestee and it is now safe to send our user their introduction,
// We could just unblock it, but first we have to jump through a few hoops to
@ -738,10 +738,10 @@ function dfrn_request_content(App $a) {
$auto_confirm = false;
if (dbm::is_result($r)) {
if(($r[0]['page-flags'] != PAGE_NORMAL) && ($r[0]['page-flags'] != PAGE_PRVGROUP))
if (($r[0]['page-flags'] != PAGE_NORMAL) && ($r[0]['page-flags'] != PAGE_PRVGROUP))
$auto_confirm = true;
if(! $auto_confirm) {
if (! $auto_confirm) {
notification(array(
'type' => NOTIFY_INTRO,
@ -759,7 +759,7 @@ function dfrn_request_content(App $a) {
));
}
if($auto_confirm) {
if ($auto_confirm) {
require_once('mod/dfrn_confirm.php');
$handsfree = array(
'uid' => $r[0]['uid'],
@ -774,7 +774,7 @@ function dfrn_request_content(App $a) {
}
if(! $auto_confirm) {
if (! $auto_confirm) {
// If we are auto_confirming, this record will have already been nuked
// in dfrn_confirm_post()
@ -794,8 +794,8 @@ function dfrn_request_content(App $a) {
* Normal web request. Display our user's introduction form.
*/
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
if(! get_config('system','local_block')) {
if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
if (! get_config('system','local_block')) {
notice( t('Public access denied.') . EOL);
return;
}

View file

@ -3,7 +3,7 @@
function directory_init(App $a) {
$a->set_pager_itemspage(60);
if(local_user()) {
if (local_user()) {
require_once('include/contact_widgets.php');
$a->page['aside'] .= findpeople_widget();
@ -21,7 +21,7 @@ function directory_init(App $a) {
function directory_post(App $a) {
if(x($_POST,'search'))
if (x($_POST,'search'))
$a->data['search'] = $_POST['search'];
}
@ -32,7 +32,7 @@ function directory_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()) ||
(get_config('system','block_local_dir')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL);
return;
@ -41,18 +41,18 @@ function directory_content(App $a) {
$o = '';
nav_set_selected('directory');
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']))) : '');
$gdirpath = '';
$dirurl = get_config('system','directory');
if(strlen($dirurl)) {
if (strlen($dirurl)) {
$gdirpath = zrl($dirurl,true);
}
if($search) {
if ($search) {
$search = dbesc($search);
$sql_extra = " AND ((`profile`.`name` LIKE '%$search%') OR
@ -110,28 +110,28 @@ function directory_content(App $a) {
$pdesc = (($rr['pdesc']) ? $rr['pdesc'] . '<br />' : '');
$details = '';
if(strlen($rr['locality']))
if (strlen($rr['locality']))
$details .= $rr['locality'];
if(strlen($rr['region'])) {
if(strlen($rr['locality']))
if (strlen($rr['region'])) {
if (strlen($rr['locality']))
$details .= ', ';
$details .= $rr['region'];
}
if(strlen($rr['country-name'])) {
if(strlen($details))
if (strlen($rr['country-name'])) {
if (strlen($details))
$details .= ', ';
$details .= $rr['country-name'];
}
// if(strlen($rr['dob'])) {
// if(($years = age($rr['dob'],$rr['timezone'],'')) != 0)
// if (strlen($rr['dob'])) {
// if (($years = age($rr['dob'],$rr['timezone'],'')) != 0)
// $details .= '<br />' . t('Age: ') . $years ;
// }
// if(strlen($rr['gender']))
// if (strlen($rr['gender']))
// $details .= '<br />' . t('Gender: ') . $rr['gender'];
$profile = $rr;
if((x($profile,'address') == 1)
if ((x($profile,'address') == 1)
|| (x($profile,'locality') == 1)
|| (x($profile,'region') == 1)
|| (x($profile,'postal-code') == 1)
@ -146,7 +146,7 @@ function directory_content(App $a) {
$about = ((x($profile,'about') == 1) ? t('About:') : False);
if($a->theme['template_engine'] === 'internal') {
if ($a->theme['template_engine'] === 'internal') {
$location_e = template_escape($location);
}
else {
@ -185,8 +185,9 @@ function directory_content(App $a) {
unset($profile);
unset($location);
if(! $arr['entry'])
if (! $arr['entry']) {
continue;
}
$entries[] = $arr['entry'];

View file

@ -166,8 +166,9 @@ function dirfind_content(App $a, $prefix = "") {
$p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : '');
if(strlen(get_config('system','directory')))
if (strlen(get_config('system','directory'))) {
$x = fetch_url(get_server().'/lsearch?f=' . $p . '&search=' . urlencode($search));
}
$j = json_decode($x);
}

View file

@ -51,7 +51,7 @@ function editpost_content(App $a) {
$tpl = get_markup_template("jot.tpl");
if(($group) || (is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid'])))))
if (($group) || (is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid'])))))
$lockstate = 'lock';
else
$lockstate = 'unlock';
@ -64,13 +64,13 @@ function editpost_content(App $a) {
$mail_enabled = false;
$pubmail_enabled = false;
if(! $mail_disabled) {
if (! $mail_disabled) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
intval(local_user())
);
if (dbm::is_result($r)) {
$mail_enabled = true;
if(intval($r[0]['pubmail']))
if (intval($r[0]['pubmail']))
$pubmail_enabled = true;
}
}
@ -78,7 +78,7 @@ function editpost_content(App $a) {
// I don't think there's any need for the $jotnets when editing the post,
// and including them makes it difficult for the JS-free theme, so let's
// disable them
/* if($mail_enabled) {
/* if ($mail_enabled) {
$selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
$jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
. t("Post to Email") . '</div>';

View file

@ -105,9 +105,9 @@ function events_post(App $a) {
goaway($onerror_url);
}
if((! $summary) || (! $start)) {
if ((! $summary) || (! $start)) {
notice( t('Event title and start time are required.') . EOL);
if(intval($_REQUEST['preview'])) {
if (intval($_REQUEST['preview'])) {
echo( t('Event title and start time are required.'));
killme();
}
@ -119,27 +119,27 @@ function events_post(App $a) {
$c = q("select id from contact where uid = %d and self = 1 limit 1",
intval(local_user())
);
if(count($c))
if (count($c))
$self = $c[0]['id'];
else
$self = 0;
if($share) {
if ($share) {
$str_group_allow = perms2str($_POST['group_allow']);
$str_contact_allow = perms2str($_POST['contact_allow']);
$str_group_deny = perms2str($_POST['group_deny']);
$str_contact_deny = perms2str($_POST['contact_deny']);
// Undo the pseudo-contact of self, since there are real contacts now
if( strpos($str_contact_allow, '<' . $self . '>') !== false )
if ( strpos($str_contact_allow, '<' . $self . '>') !== false )
{
$str_contact_allow = str_replace('<' . $self . '>', '', $str_contact_allow);
}
// Make sure to set the `private` field as true. This is necessary to
// have the posts show up correctly in Diaspora if an event is created
// as visible only to self at first, but then edited to display to others.
if( strlen($str_group_allow) or strlen($str_contact_allow) or strlen($str_group_deny) or strlen($str_contact_deny) )
if ( strlen($str_group_allow) or strlen($str_contact_allow) or strlen($str_group_deny) or strlen($str_contact_deny) )
{
$private_event = true;
}
@ -173,7 +173,7 @@ function events_post(App $a) {
$datarray['created'] = $created;
$datarray['edited'] = $edited;
if(intval($_REQUEST['preview'])) {
if (intval($_REQUEST['preview'])) {
$html = format_event_html($datarray);
echo $html;
killme();
@ -181,7 +181,7 @@ function events_post(App $a) {
$item_id = event_store($datarray);
if(! $cid)
if (! $cid)
proc_run(PRIORITY_HIGH, "include/notifier.php", "event", $item_id);
goaway($_SESSION['return_url']);
@ -248,7 +248,7 @@ function events_content(App $a) {
$m = 0;
$ignored = ((x($_REQUEST,'ignored')) ? intval($_REQUEST['ignored']) : 0);
if($a->argc > 1) {
if ($a->argc > 1) {
if ($a->argc > 2 && $a->argv[1] == 'event') {
$mode = 'edit';
$event_id = intval($a->argv[2]);
@ -289,13 +289,13 @@ function events_content(App $a) {
$nextyear = $y;
$nextmonth = $m + 1;
if($nextmonth > 12) {
if ($nextmonth > 12) {
$nextmonth = 1;
$nextyear ++;
}
$prevyear = $y;
if($m > 1)
if ($m > 1)
$prevmonth = $m - 1;
else {
$prevmonth = 12;
@ -371,9 +371,9 @@ function events_content(App $a) {
}
// Get rid of dashes in key names, Smarty3 can't handle them
foreach($events as $key => $event) {
foreach ($events as $key => $event) {
$event_item = array();
foreach($event['item'] as $k => $v) {
foreach ($event['item'] as $k => $v) {
$k = str_replace('-','_',$k);
$event_item[$k] = $v;
}
@ -405,7 +405,7 @@ function events_content(App $a) {
}
if($mode === 'edit' && $event_id) {
if ($mode === 'edit' && $event_id) {
$r = q("SELECT * FROM `event` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($event_id),
intval(local_user())
@ -415,19 +415,19 @@ function events_content(App $a) {
}
// Passed parameters overrides anything found in the DB
if($mode === 'edit' || $mode === 'new') {
if(!x($orig_event)) $orig_event = array();
if ($mode === 'edit' || $mode === 'new') {
if (!x($orig_event)) $orig_event = array();
// In case of an error the browser is redirected back here, with these parameters filled in with the previous values
if(x($_REQUEST,'nofinish')) $orig_event['nofinish'] = $_REQUEST['nofinish'];
if(x($_REQUEST,'adjust')) $orig_event['adjust'] = $_REQUEST['adjust'];
if(x($_REQUEST,'summary')) $orig_event['summary'] = $_REQUEST['summary'];
if(x($_REQUEST,'description')) $orig_event['description'] = $_REQUEST['description'];
if(x($_REQUEST,'location')) $orig_event['location'] = $_REQUEST['location'];
if(x($_REQUEST,'start')) $orig_event['start'] = $_REQUEST['start'];
if(x($_REQUEST,'finish')) $orig_event['finish'] = $_REQUEST['finish'];
if (x($_REQUEST,'nofinish')) $orig_event['nofinish'] = $_REQUEST['nofinish'];
if (x($_REQUEST,'adjust')) $orig_event['adjust'] = $_REQUEST['adjust'];
if (x($_REQUEST,'summary')) $orig_event['summary'] = $_REQUEST['summary'];
if (x($_REQUEST,'description')) $orig_event['description'] = $_REQUEST['description'];
if (x($_REQUEST,'location')) $orig_event['location'] = $_REQUEST['location'];
if (x($_REQUEST,'start')) $orig_event['start'] = $_REQUEST['start'];
if (x($_REQUEST,'finish')) $orig_event['finish'] = $_REQUEST['finish'];
}
if($mode === 'edit' || $mode === 'new') {
if ($mode === 'edit' || $mode === 'new') {
$n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : '');
$a_checked = ((x($orig_event) && $orig_event['adjust']) ? ' checked="checked" ' : '');
@ -439,21 +439,24 @@ function events_content(App $a) {
$uri = ((x($orig_event)) ? $orig_event['uri'] : '');
if(! x($orig_event))
if (! x($orig_event)) {
$sh_checked = '';
else
} else {
$sh_checked = (($orig_event['allow_cid'] === '<' . local_user() . '>' && (! $orig_event['allow_gid']) && (! $orig_event['deny_cid']) && (! $orig_event['deny_gid'])) ? '' : ' checked="checked" ' );
}
if($cid OR ($mode !== 'new'))
if ($cid OR ($mode !== 'new')) {
$sh_checked .= ' disabled="disabled" ';
}
$sdt = ((x($orig_event)) ? $orig_event['start'] : 'now');
$fdt = ((x($orig_event)) ? $orig_event['finish'] : 'now');
$tz = date_default_timezone_get();
if(x($orig_event))
if (x($orig_event)) {
$tz = (($orig_event['adjust']) ? date_default_timezone_get() : 'UTC');
}
$syear = datetime_convert('UTC', $tz, $sdt, 'Y');
$smonth = datetime_convert('UTC', $tz, $sdt, 'm');
@ -470,8 +473,9 @@ function events_content(App $a) {
$fminute = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'i') : 0);
$f = get_config('system','event_input_format');
if(! $f)
if (! $f) {
$f = 'ymd';
}
require_once('include/acl_selectors.php');

View file

@ -66,10 +66,9 @@ function fbrowser_content(App $a) {
$types = Photo::supportedTypes();
$ext = $types[$rr['type']];
if($a->theme['template_engine'] === 'internal') {
if ($a->theme['template_engine'] === 'internal') {
$filename_e = template_escape($rr['filename']);
}
else {
} else {
$filename_e = $rr['filename'];
}

View file

@ -16,7 +16,7 @@ function filer_content(App $a) {
logger('filer: tag ' . $term . ' item ' . $item_id);
if($item_id && strlen($term)){
if ($item_id && strlen($term)){
// file item
file_tag_save_file(local_user(),$item_id,$term);
} else {

View file

@ -7,7 +7,7 @@ function friendica_init(App $a) {
$register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
$sql_extra = '';
if(x($a->config,'admin_nickname')) {
if (x($a->config,'admin_nickname')) {
$sql_extra = sprintf(" AND nickname = '%s' ",dbesc($a->config['admin_nickname']));
}
if (isset($a->config['admin_email']) && $a->config['admin_email']!=''){
@ -24,18 +24,18 @@ function friendica_init(App $a) {
}
$visible_plugins = array();
if(is_array($a->plugins) && count($a->plugins)) {
if (is_array($a->plugins) && count($a->plugins)) {
$r = q("select * from addon where hidden = 0");
if (dbm::is_result($r))
foreach($r as $rr)
foreach ($r as $rr)
$visible_plugins[] = $rr['name'];
}
Config::load('feature_lock');
$locked_features = array();
if(is_array($a->config['feature_lock']) && count($a->config['feature_lock'])) {
foreach($a->config['feature_lock'] as $k => $v) {
if($k === 'config_loaded')
if (is_array($a->config['feature_lock']) && count($a->config['feature_lock'])) {
foreach ($a->config['feature_lock'] as $k => $v) {
if ($k === 'config_loaded')
continue;
$locked_features[$k] = intval($v);
}
@ -80,22 +80,24 @@ function friendica_content(App $a) {
$o .= '<p></p>';
$visible_plugins = array();
if(is_array($a->plugins) && count($a->plugins)) {
if (is_array($a->plugins) && count($a->plugins)) {
$r = q("select * from addon where hidden = 0");
if (dbm::is_result($r))
foreach($r as $rr)
foreach ($r as $rr)
$visible_plugins[] = $rr['name'];
}
if(count($visible_plugins)) {
if (count($visible_plugins)) {
$o .= '<p>' . t('Installed plugins/addons/apps:') . '</p>';
$sorted = $visible_plugins;
$s = '';
sort($sorted);
foreach($sorted as $p) {
if(strlen($p)) {
if(strlen($s)) $s .= ', ';
foreach ($sorted as $p) {
if (strlen($p)) {
if (strlen($s)) {
$s .= ', ';
}
$s .= $p;
}
}

View file

@ -29,7 +29,7 @@ function fsuggest_post(App $a) {
$note = escape_tags(trim($_POST['note']));
if($new_contact) {
if ($new_contact) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($new_contact),
intval(local_user())
@ -80,8 +80,9 @@ function fsuggest_content(App $a) {
return;
}
if($a->argc != 2)
if ($a->argc != 2) {
return;
}
$contact_id = intval($a->argv[1]);

View file

@ -5,7 +5,7 @@ function validate_members(&$item) {
}
function group_init(App $a) {
if(local_user()) {
if (local_user()) {
require_once('include/group.php');
$a->page['aside'] = group_side('contacts','group','extended',(($a->argc > 1) ? intval($a->argv[1]) : 0));
}
@ -20,7 +20,7 @@ function group_post(App $a) {
return;
}
if(($a->argc == 2) && ($a->argv[1] === 'new')) {
if (($a->argc == 2) && ($a->argv[1] === 'new')) {
check_form_security_token_redirectOnErr('/group/new', 'group_edit');
$name = notags(trim($_POST['groupname']));
@ -80,10 +80,12 @@ function group_content(App $a) {
// Switch to text mode interface if we have more than 'n' contacts or group members
$switchtotext = get_pconfig(local_user(),'system','groupedit_image_limit');
if($switchtotext === false)
if ($switchtotext === false) {
$switchtotext = get_config('system','groupedit_image_limit');
if($switchtotext === false)
}
if ($switchtotext === false) {
$switchtotext = 400;
}
$tpl = get_markup_template('group_edit.tpl');
@ -99,8 +101,6 @@ function group_content(App $a) {
'$gid' => 'new',
'$form_security_token' => get_form_security_token("group_edit"),
));
}
if (($a->argc == 3) && ($a->argv[1] === 'drop')) {
@ -135,8 +135,9 @@ function group_content(App $a) {
intval($a->argv[2]),
intval(local_user())
);
if (dbm::is_result($r))
if (dbm::is_result($r)) {
$change = intval($a->argv[2]);
}
}
if (($a->argc > 1) && (intval($a->argv[1]))) {
@ -153,23 +154,23 @@ function group_content(App $a) {
$group = $r[0];
$members = group_get_members($group['id']);
$preselected = array();
if(count($members)) {
foreach($members as $member)
if (count($members)) {
foreach ($members as $member) {
$preselected[] = $member['id'];
}
}
if($change) {
if(in_array($change,$preselected)) {
if ($change) {
if (in_array($change,$preselected)) {
group_rmv_member(local_user(),$group['name'],$change);
}
else {
} else {
group_add_member(local_user(),$group['name'],$change);
}
$members = group_get_members($group['id']);
$preselected = array();
if(count($members)) {
foreach($members as $member)
if (count($members)) {
foreach ($members as $member)
$preselected[] = $member['id'];
}
}
@ -193,8 +194,9 @@ function group_content(App $a) {
}
if(! isset($group))
if (! isset($group)) {
return;
}
$groupeditor = array(
'label_members' => t('Members'),
@ -206,13 +208,13 @@ function group_content(App $a) {
$sec_token = addslashes(get_form_security_token('group_member_change'));
$textmode = (($switchtotext && (count($members) > $switchtotext)) ? true : false);
foreach($members as $member) {
if($member['url']) {
foreach ($members as $member) {
if ($member['url']) {
$member['click'] = 'groupChangeMember(' . $group['id'] . ',' . $member['id'] . ',\'' . $sec_token . '\'); return true;';
$groupeditor['members'][] = micropro($member,true,'mpgroup', $textmode);
}
else
} else {
group_rmv_member(local_user(),$group['name'],$member['id']);
}
}
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `self` ORDER BY `name` ASC",
@ -221,8 +223,8 @@ function group_content(App $a) {
if (dbm::is_result($r)) {
$textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
foreach($r as $member) {
if(! in_array($member['id'],$preselected)) {
foreach ($r as $member) {
if (! in_array($member['id'],$preselected)) {
$member['click'] = 'groupChangeMember(' . $group['id'] . ',' . $member['id'] . ',\'' . $sec_token . '\'); return true;';
$groupeditor['contacts'][] = micropro($member,true,'mpall', $textmode);
}
@ -232,7 +234,7 @@ function group_content(App $a) {
$context['$groupeditor'] = $groupeditor;
$context['$desc'] = t('Click on a contact to add or remove.');
if($change) {
if ($change) {
$tpl = get_markup_template('groupeditor.tpl');
echo replace_macros($tpl, $context);
killme();

View file

@ -30,9 +30,10 @@ function help_content(App $a) {
$path = '';
// looping through the argv keys bigger than 0 to build
// a path relative to /help
for($x = 1; $x < argc(); $x ++) {
if(strlen($path))
for ($x = 1; $x < argc(); $x ++) {
if (strlen($path)) {
$path .= '/';
}
$path .= argv($x);
}
$title = basename($path);
@ -65,16 +66,22 @@ function help_content(App $a) {
$toc="<style>aside ul {padding-left: 1em;}aside h1{font-size:2em}</style><h2>TOC</h2><ul id='toc'>";
$lastlevel=1;
$idnum = array(0,0,0,0,0,0,0);
foreach($lines as &$line){
foreach ($lines as &$line){
if (substr($line,0,2)=="<h") {
$level = substr($line,2,1);
if ($level!="r") {
$level = intval($level);
if ($level<$lastlevel) {
for($k=$level;$k<$lastlevel; $k++) $toc.="</ul>";
for($k=$level+1;$k<count($idnum);$k++) $idnum[$k]=0;
for ($k=$level;$k<$lastlevel; $k++) {
$toc.="</ul>";
}
for ($k=$level+1;$k<count($idnum);$k++) {
$idnum[$k]=0;
}
}
if ($level>$lastlevel) {
$toc.="<ul>";
}
if ($level>$lastlevel) $toc.="<ul>";
$idnum[$level]++;
$id = implode("_", array_slice($idnum,1,$level));
$href = App::get_baseurl()."/help/{$filename}#{$id}";
@ -84,7 +91,7 @@ function help_content(App $a) {
}
}
}
for($k=0;$k<$lastlevel; $k++) $toc.="</ul>";
for ($k=0;$k<$lastlevel; $k++) $toc.="</ul>";
$html = implode("\n",$lines);
$a->page['aside'] = $toc.$a->page['aside'];

View file

@ -1,6 +1,6 @@
<?php
if(! function_exists('home_init')) {
if (! function_exists('home_init')) {
function home_init(App $a) {
$ret = array();
@ -16,7 +16,7 @@ function home_init(App $a) {
}}
if(! function_exists('home_content')) {
if (! function_exists('home_content')) {
function home_content(App $a) {
$o = '';

View file

@ -7,7 +7,7 @@ function hostxrd_init(App $a) {
header("Content-type: text/xml");
$pubkey = get_config('system','site_pubkey');
if(! $pubkey) {
if (! $pubkey) {
$res = new_keypair(1024);
set_config('system','site_prvkey', $res['prvkey']);

View file

@ -20,7 +20,7 @@ function hovercard_content() {
$datatype = (x($_REQUEST,'datatype') ?$_REQUEST['datatype'] : "json");
// Get out if the system doesn't have public access allowed
if(intval(get_config('system','block_public')))
if (intval(get_config('system','block_public')))
http_status_exit(401);
// Return the raw content of the template. We use this to make templates usable for js functions.
@ -36,7 +36,7 @@ function hovercard_content() {
// If a contact is connected the url is internally changed to "redir/CID". We need the pure url to search for
// the contact. So we strip out the contact id from the internal url and look in the contact table for
// the real url (nurl)
if(local_user() && strpos($profileurl, "redir/") === 0) {
if (local_user() && strpos($profileurl, "redir/") === 0) {
$cid = intval(substr($profileurl, 6));
$r = q("SELECT `nurl`, `self` FROM `contact` WHERE `id` = '%d' LIMIT 1", intval($cid));
$profileurl = ($r[0]["nurl"] ? $r[0]["nurl"] : "");
@ -45,16 +45,16 @@ function hovercard_content() {
// if it's the url containing https it should be converted to http
$nurl = normalise_link(clean_contact_url($profileurl));
if($nurl) {
if ($nurl) {
// Search for contact data
$contact = get_contact_details_by_url($nurl);
}
if(!is_array($contact))
if (!is_array($contact))
return;
// Get the photo_menu - the menu if possible contact actions
if(local_user())
if (local_user())
$actions = contact_photo_menu($contact);
@ -80,7 +80,7 @@ function hovercard_content() {
'account_type' => account_type($contact),
'actions' => $actions,
);
if($datatype == "html") {
if ($datatype == "html") {
$t = get_markup_template("hovercard.tpl");
$o = replace_macros($t, array(
@ -110,7 +110,7 @@ function get_template_content($template, $root = "") {
$filename = $t->filename;
// Get the content of the template file
if(file_exists($filename)) {
if (file_exists($filename)) {
$content = file_get_contents($filename);
return $content;

View file

@ -37,8 +37,11 @@ function ignored_init(App $a) {
$return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
if ($return_path) {
$rand = '_=' . time();
if(strpos($return_path, '?')) $rand = "&$rand";
else $rand = "?$rand";
if (strpos($return_path, '?')) {
$rand = "&$rand";
} else {
$rand = "?$rand";
}
goaway(App::get_baseurl() . "/" . $return_path . $rand);
}

View file

@ -43,11 +43,11 @@ function install_post(App $a) {
require_once("include/dba.php");
unset($db);
$db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true);
/*if(get_db_errno()) {
/*if (get_db_errno()) {
unset($db);
$db = new dba($dbhost, $dbuser, $dbpass, '', true);
if(! get_db_errno()) {
if (! get_db_errno()) {
$r = q("CREATE DATABASE '%s'",
dbesc($dbdata)
);
@ -164,7 +164,7 @@ function install_content(App $a) {
$db_return_text .= $txt;
}
if($db && $db->connected) {
if ($db && $db->connected) {
$r = q("SELECT COUNT(*) as `total` FROM `user`");
if (dbm::is_result($r) && $r[0]['total']) {
$tpl = get_markup_template('install.tpl');
@ -360,13 +360,13 @@ function check_php(&$phpath, &$checks) {
check_add($checks, t('Command line PHP').($passed?" (<tt>$phpath</tt>)":""), $passed, false, $help);
if($passed) {
if ($passed) {
$cmd = "$phpath -v";
$result = trim(shell_exec($cmd));
$passed2 = ( strpos($result, "(cli)") !== false );
list($result) = explode("\n", $result);
$help = "";
if(!$passed2) {
if (!$passed2) {
$help .= t('PHP executable is not the php cli binary (could be cgi-fgci version)'). EOL;
$help .= t('Found PHP version: ')."<tt>$result</tt>";
}
@ -380,7 +380,7 @@ function check_php(&$phpath, &$checks) {
$result = trim(shell_exec($cmd));
$passed3 = $result == $str;
$help = "";
if(!$passed3) {
if (!$passed3) {
$help .= t('The command line version of PHP on your system does not have "register_argc_argv" enabled.'). EOL;
$help .= t('This is required for message delivery to work.');
}
@ -485,7 +485,7 @@ function check_funcs(&$checks) {
$ck_funcs[6]['help'] = t('Error, XML PHP module required but not installed.');
}
/*if((x($_SESSION,'sysmsg')) && is_array($_SESSION['sysmsg']) && count($_SESSION['sysmsg']))
/*if ((x($_SESSION,'sysmsg')) && is_array($_SESSION['sysmsg']) && count($_SESSION['sysmsg']))
notice( t('Please see the file "INSTALL.txt".') . EOL);*/
}
@ -589,10 +589,10 @@ function load_database($db) {
/* $str = file_get_contents('database.sql');
$arr = explode(';',$str);
$errors = false;
foreach($arr as $a) {
if(strlen(trim($a))) {
foreach ($arr as $a) {
if (strlen(trim($a))) {
$r = @$db->q(trim($a));
if(false === $r) {
if (false === $r) {
$errors .= t('Errors encountered creating database tables.') . $a . EOL;
}
}

View file

@ -83,7 +83,7 @@ function invite_post(App $a) {
$total ++;
$current_invites ++;
set_pconfig(local_user(),'system','sent_invites',$current_invites);
if($current_invites > $max_invites) {
if ($current_invites > $max_invites) {
notice( t('Invitation limit exceeded. Please contact your site administrator.') . EOL);
return;
}

View file

@ -29,14 +29,14 @@ require_once('include/Contact.php');
function item_post(App $a) {
if((! local_user()) && (! remote_user()) && (! x($_REQUEST,'commenter')))
if ((! local_user()) && (! remote_user()) && (! x($_REQUEST,'commenter')))
return;
require_once('include/security.php');
$uid = local_user();
if(x($_REQUEST,'dropitems')) {
if (x($_REQUEST,'dropitems')) {
$arr_drop = explode(',',$_REQUEST['dropitems']);
drop_items($arr_drop);
$json = array('success' => 1);
@ -125,7 +125,7 @@ function item_post(App $a) {
$parent = $r[0]['id'];
// multi-level threading - preserve the info but re-parent to our single level threading
//if(($parid) && ($parid != $parent))
//if (($parid) && ($parid != $parent))
$thr_parent = $parent_uri;
if ($parent_item['contact-id'] && $uid) {
@ -162,7 +162,7 @@ function item_post(App $a) {
}
}
if($parent) logger('mod_item: item_post parent=' . $parent);
if ($parent) logger('mod_item: item_post parent=' . $parent);
$profile_uid = ((x($_REQUEST,'profile_uid')) ? intval($_REQUEST['profile_uid']) : 0);
$post_id = ((x($_REQUEST,'post_id')) ? intval($_REQUEST['post_id']) : 0);
@ -189,9 +189,9 @@ function item_post(App $a) {
// First check that the parent exists and it is a wall item.
if((x($_REQUEST,'commenter')) && ((! $parent) || (! $parent_item['wall']))) {
if ((x($_REQUEST,'commenter')) && ((! $parent) || (! $parent_item['wall']))) {
notice( t('Permission denied.') . EOL) ;
if(x($_REQUEST,'return'))
if (x($_REQUEST,'return'))
goaway($return_path);
killme();
}
@ -201,9 +201,9 @@ function item_post(App $a) {
if((! can_write_wall($a,$profile_uid)) && (! $allow_moderated)) {
if ((! can_write_wall($a,$profile_uid)) && (! $allow_moderated)) {
notice( t('Permission denied.') . EOL) ;
if(x($_REQUEST,'return'))
if (x($_REQUEST,'return'))
goaway($return_path);
killme();
}
@ -213,7 +213,7 @@ function item_post(App $a) {
$orig_post = null;
if($post_id) {
if ($post_id) {
$i = q("SELECT * FROM `item` WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval($profile_uid),
intval($post_id)
@ -232,7 +232,7 @@ function item_post(App $a) {
if (dbm::is_result($r))
$user = $r[0];
if($orig_post) {
if ($orig_post) {
$str_group_allow = $orig_post['allow_gid'];
$str_contact_allow = $orig_post['allow_cid'];
$str_group_deny = $orig_post['deny_gid'];
@ -258,7 +258,7 @@ function item_post(App $a) {
// use the user default permissions - as they won't have
// been supplied via a form.
if(($api_source)
if (($api_source)
&& (! array_key_exists('contact_allow',$_REQUEST))
&& (! array_key_exists('group_allow',$_REQUEST))
&& (! array_key_exists('contact_deny',$_REQUEST))
@ -295,12 +295,12 @@ function item_post(App $a) {
$private = ((strlen($str_group_allow) || strlen($str_contact_allow) || strlen($str_group_deny) || strlen($str_contact_deny)) ? 1 : 0);
if($user['hidewall'])
if ($user['hidewall'])
$private = 2;
// If this is a comment, set the permissions from the parent.
if($parent_item) {
if ($parent_item) {
// for non native networks use the network of the original post as network of the item
if (($parent_item['network'] != NETWORK_DIASPORA)
@ -319,9 +319,9 @@ function item_post(App $a) {
// if using the API, we won't see pubmail_enable - figure out if it should be set
if($api_source && $profile_uid && $profile_uid == local_user() && (! $private)) {
if ($api_source && $profile_uid && $profile_uid == local_user() && (! $private)) {
$mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
if(! $mail_disabled) {
if (! $mail_disabled) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
intval(local_user())
);
@ -330,17 +330,17 @@ function item_post(App $a) {
}
}
if(! strlen($body)) {
if($preview)
if (! strlen($body)) {
if ($preview)
killme();
info( t('Empty post discarded.') . EOL );
if(x($_REQUEST,'return'))
if (x($_REQUEST,'return'))
goaway($return_path);
killme();
}
}
if(strlen($categories)) {
if (strlen($categories)) {
// get the "fileas" tags for this post
$filedas = file_tag_file_to_list($categories, 'file');
}
@ -348,7 +348,7 @@ function item_post(App $a) {
$categories_old = $categories;
$categories = file_tag_list_to_file(trim($_REQUEST['category']), 'category');
$categories_new = $categories;
if(strlen($filedas)) {
if (strlen($filedas)) {
// append the fileas stuff to the new categories list
$categories .= file_tag_list_to_file($filedas, 'file');
}
@ -359,21 +359,21 @@ function item_post(App $a) {
$self = false;
$contact_id = 0;
if((local_user()) && (local_user() == $profile_uid)) {
if ((local_user()) && (local_user() == $profile_uid)) {
$self = true;
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
intval($_SESSION['uid']));
}
elseif(remote_user()) {
if(is_array($_SESSION['remote'])) {
foreach($_SESSION['remote'] as $v) {
if($v['uid'] == $profile_uid) {
elseif (remote_user()) {
if (is_array($_SESSION['remote'])) {
foreach ($_SESSION['remote'] as $v) {
if ($v['uid'] == $profile_uid) {
$contact_id = $v['cid'];
break;
}
}
}
if($contact_id) {
if ($contact_id) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($contact_id)
);
@ -387,7 +387,7 @@ function item_post(App $a) {
// get contact info for owner
if($profile_uid == local_user()) {
if ($profile_uid == local_user()) {
$contact_record = $author;
}
else {
@ -400,9 +400,9 @@ function item_post(App $a) {
$post_type = notags(trim($_REQUEST['type']));
if($post_type === 'net-comment') {
if($parent_item !== null) {
if($parent_item['wall'] == 1)
if ($post_type === 'net-comment') {
if ($parent_item !== null) {
if ($parent_item['wall'] == 1)
$post_type = 'wall-comment';
else
$post_type = 'remote-comment';
@ -423,9 +423,9 @@ function item_post(App $a) {
$match = null;
if((! $preview) && preg_match_all("/\[img([\=0-9x]*?)\](.*?)\[\/img\]/",$body,$match)) {
if ((! $preview) && preg_match_all("/\[img([\=0-9x]*?)\](.*?)\[\/img\]/",$body,$match)) {
$images = $match[2];
if(count($images)) {
if (count($images)) {
$objecttype = ACTIVITY_OBJ_IMAGE;
@ -472,10 +472,10 @@ function item_post(App $a) {
$match = false;
if((! $preview) && preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",$body,$match)) {
if ((! $preview) && preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",$body,$match)) {
$attaches = $match[1];
if(count($attaches)) {
foreach($attaches as $attach) {
if (count($attaches)) {
foreach ($attaches as $attach) {
$r = q("SELECT * FROM `attach` WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval($profile_uid),
intval($attach)
@ -572,24 +572,26 @@ function item_post(App $a) {
$private_forum = false;
if(count($tags)) {
foreach($tags as $tag) {
if (count($tags)) {
foreach ($tags as $tag) {
if(strpos($tag,'#') === 0)
if (strpos($tag,'#') === 0) {
continue;
}
// If we already tagged 'Robert Johnson', don't try and tag 'Robert'.
// Robert Johnson should be first in the $tags array
$fullnametagged = false;
for($x = 0; $x < count($tagged); $x ++) {
if(stristr($tagged[$x],$tag . ' ')) {
for ($x = 0; $x < count($tagged); $x ++) {
if (stristr($tagged[$x],$tag . ' ')) {
$fullnametagged = true;
break;
}
}
if($fullnametagged)
if ($fullnametagged) {
continue;
}
$success = handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag, $network);
if ($success['replaced']) {
@ -722,15 +724,16 @@ function item_post(App $a) {
$datarray['last-child'] = 1;
$datarray['visible'] = 1;
if($orig_post)
if ($orig_post) {
$datarray['edit'] = true;
}
// Search for hashtags
item_body_set_hashtags($datarray);
// preview mode - prepare the body for display and send it via json
if($preview) {
if ($preview) {
require_once('include/conversation.php');
// We set the datarray ID to -1 because in preview mode the dataray
// doesn't have an ID.
@ -744,9 +747,9 @@ function item_post(App $a) {
call_hooks('post_local',$datarray);
if(x($datarray,'cancel')) {
if (x($datarray,'cancel')) {
logger('mod_item: post cancelled by plugin.');
if($return_path) {
if ($return_path) {
goaway($return_path);
}
@ -762,7 +765,7 @@ function item_post(App $a) {
// Fill the cache field
put_item_in_cache($datarray);
if($orig_post) {
if ($orig_post) {
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `attach` = '%s', `file` = '%s', `rendered-html` = '%s', `rendered-hash` = '%s', `edited` = '%s', `changed` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($datarray['title']),
dbesc($datarray['body']),
@ -785,7 +788,7 @@ function item_post(App $a) {
file_tag_update_pconfig($uid,$categories_old,$categories_new,'category');
proc_run(PRIORITY_HIGH, "include/notifier.php", 'edit_post', $post_id);
if((x($_REQUEST,'return')) && strlen($return_path)) {
if ((x($_REQUEST,'return')) && strlen($return_path)) {
logger('return: ' . $return_path);
goaway($return_path);
}
@ -900,7 +903,7 @@ function item_post(App $a) {
// update filetags in pconfig
file_tag_update_pconfig($uid,$categories_old,$categories_new,'category');
if($parent) {
if ($parent) {
// This item is the last leaf and gets the comment box, clear any ancestors
$r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent` = %d AND `last-child` AND `id` != %d",
@ -916,7 +919,7 @@ function item_post(App $a) {
intval($parent)
);
if($contact_record != $author) {
if ($contact_record != $author) {
notification(array(
'type' => NOTIFY_COMMENT,
'notify_flags' => $user['notify-flags'],
@ -948,7 +951,7 @@ function item_post(App $a) {
intval($parent),
intval($post_id));
if($contact_record != $author) {
if ($contact_record != $author) {
notification(array(
'type' => NOTIFY_WALL,
'notify_flags' => $user['notify-flags'],
@ -957,7 +960,7 @@ function item_post(App $a) {
'to_email' => $user['email'],
'uid' => $user['uid'],
'item' => $datarray,
'link' => App::get_baseurl().'/display/'.urlencode($datarray['guid']),
'link' => App::get_baseurl().'/display/'.urlencode($datarray['guid']),
'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'],
'source_photo' => $datarray['author-avatar'],
@ -969,12 +972,12 @@ function item_post(App $a) {
call_hooks('post_local_end', $datarray);
if(strlen($emailcc) && $profile_uid == local_user()) {
if (strlen($emailcc) && $profile_uid == local_user()) {
$erecips = explode(',', $emailcc);
if(count($erecips)) {
foreach($erecips as $recip) {
if (count($erecips)) {
foreach ($erecips as $recip) {
$addr = trim($recip);
if(! strlen($addr))
if (! strlen($addr))
continue;
$disclaimer = '<hr />' . sprintf( t('This message was sent to you by %s, a member of the Friendica social network.'),$a->user['username'])
. '<br />';
@ -1032,8 +1035,9 @@ function item_post(App $a) {
function item_post_return($baseurl, $api_source, $return_path) {
// figure out how to return, depending on from whence we came
if($api_source)
if ($api_source) {
return;
}
if ($return_path) {
goaway($return_path);
@ -1111,19 +1115,24 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
$r = q("SELECT `alias`, `name` FROM `contact` WHERE `nurl` = '%s' AND `alias` != '' AND `uid` = 0",
normalise_link($matches[1]));
if (!$r)
if (!dbm::is_result($r)) {
$r = q("SELECT `alias`, `name` FROM `gcontact` WHERE `nurl` = '%s' AND `alias` != ''",
normalise_link($matches[1]));
if ($r)
}
if (dbm::is_result($r)) {
$data = $r[0];
else
} else {
$data = probe_url($matches[1]);
}
if ($data["alias"] != "") {
$newtag = '@[url='.$data["alias"].']'.$data["name"].'[/url]';
if(!stristr($str_tags,$newtag)) {
if(strlen($str_tags))
if (!stristr($str_tags,$newtag)) {
if (strlen($str_tags)) {
$str_tags .= ',';
}
$str_tags .= $newtag;
}
}
@ -1155,7 +1164,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
);
// Then check in the contact table for the url
if (!$r)
if (!dbm::is_result($r)) {
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network`, `notify` FROM `contact`
WHERE `nurl` = '%s' AND `uid` = %d AND
(`network` != '%s' OR (`notify` != '' AND `alias` != ''))
@ -1164,6 +1173,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
intval($profile_uid),
dbesc(NETWORK_OSTATUS)
);
}
// Then check in the global contacts for the address
if (!$r)
@ -1175,15 +1185,16 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
);
// Then check in the global contacts for the url
if (!$r)
if (!dbm::is_result($r)) {
$r = q("SELECT `url`, `nick`, `name`, `alias`, `network`, `notify` FROM `gcontact`
WHERE `nurl` = '%s' AND (`network` != '%s' OR (`notify` != '' AND `alias` != ''))
LIMIT 1",
dbesc(normalise_link($name)),
dbesc(NETWORK_OSTATUS)
);
}
if (!$r) {
if (!dbm::is_result($r)) {
$probed = probe_url($name);
if ($result['network'] != NETWORK_PHANTOM) {
update_gcontact($probed);
@ -1204,54 +1215,60 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
}
//select someone by attag or nick and the name passed in the current network
if(!$r AND ($network != ""))
if (!dbm::is_result($r) AND ($network != "")) {
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `network` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
dbesc($name),
dbesc($name),
dbesc($network),
intval($profile_uid)
);
}
//select someone from this user's contacts by name in the current network
if (!$r AND ($network != ""))
if (!dbm::is_result($r) AND ($network != "")) {
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `name` = '%s' AND `network` = '%s' AND `uid` = %d LIMIT 1",
dbesc($name),
dbesc($network),
intval($profile_uid)
);
}
//select someone by attag or nick and the name passed in
if(!$r)
if (!dbm::is_result($r)) {
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
dbesc($name),
dbesc($name),
intval($profile_uid)
);
}
//select someone from this user's contacts by name
if(!$r)
if (!dbm::is_result($r)) {
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($name),
intval($profile_uid)
);
}
}
if ($r) {
if(strlen($inform) AND (isset($r[0]["notify"]) OR isset($r[0]["id"])))
if (dbm::is_result($r)) {
if (strlen($inform) AND (isset($r[0]["notify"]) OR isset($r[0]["id"]))) {
$inform .= ',';
}
if (isset($r[0]["id"]))
if (isset($r[0]["id"])) {
$inform .= 'cid:' . $r[0]["id"];
elseif (isset($r[0]["notify"]))
} elseif (isset($r[0]["notify"])) {
$inform .= $r[0]["notify"];
}
$profile = $r[0]["url"];
$alias = $r[0]["alias"];
$newname = $r[0]["nick"];
if (($newname == "") OR (($r[0]["network"] != NETWORK_OSTATUS) AND ($r[0]["network"] != NETWORK_TWITTER)
AND ($r[0]["network"] != NETWORK_STATUSNET) AND ($r[0]["network"] != NETWORK_APPNET)))
AND ($r[0]["network"] != NETWORK_STATUSNET) AND ($r[0]["network"] != NETWORK_APPNET))) {
$newname = $r[0]["name"];
}
}
//if there is an url for this persons profile
@ -1263,20 +1280,22 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
$newtag = '@[url='.$profile.']'.$newname.'[/url]';
$body = str_replace('@'.$name, $newtag, $body);
//append tag to str_tags
if(! stristr($str_tags,$newtag)) {
if(strlen($str_tags))
if (! stristr($str_tags,$newtag)) {
if (strlen($str_tags)) {
$str_tags .= ',';
}
$str_tags .= $newtag;
}
// Status.Net seems to require the numeric ID URL in a mention if the person isn't
// subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both.
if(strlen($alias)) {
if (strlen($alias)) {
$newtag = '@[url='.$alias.']'.$newname.'[/url]';
if(! stristr($str_tags,$newtag)) {
if(strlen($str_tags))
if (! stristr($str_tags,$newtag)) {
if (strlen($str_tags)) {
$str_tags .= ',';
}
$str_tags .= $newtag;
}
}

View file

@ -6,20 +6,23 @@ require_once('include/items.php');
require_once('include/like.php');
function like_content(App $a) {
if(! local_user() && ! remote_user()) {
if (! local_user() && ! remote_user()) {
return false;
}
$verb = notags(trim($_GET['verb']));
if(! $verb)
if (! $verb) {
$verb = 'like';
}
$item_id = (($a->argc > 1) ? notags(trim($a->argv[1])) : 0);
$r = do_like($item_id, $verb);
if (!$r) return;
if (!$r) {
return;
}
// See if we've been passed a return path to redirect to
$return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
@ -35,10 +38,13 @@ function like_content(App $a) {
function like_content_return($baseurl, $return_path) {
if($return_path) {
if ($return_path) {
$rand = '_=' . time();
if(strpos($return_path, '?')) $rand = "&$rand";
else $rand = "?$rand";
if (strpos($return_path, '?')) {
$rand = "&$rand";
} else {
$rand = "?$rand";
}
goaway($baseurl . "/" . $return_path . $rand);
}

View file

@ -6,20 +6,23 @@ require_once('include/datetime.php');
function localtime_post(App $a) {
$t = $_REQUEST['time'];
if(! $t)
if (! $t) {
$t = 'now';
}
$bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM
if($_POST['timezone'])
if ($_POST['timezone']) {
$a->data['mod-localtime'] = datetime_convert('UTC',$_POST['timezone'],$t,$bd_format);
}
}
function localtime_content(App $a) {
$t = $_REQUEST['time'];
if(! $t)
if (! $t) {
$t = 'now';
}
$o .= '<h3>' . t('Time Conversion') . '</h3>';
@ -29,11 +32,13 @@ function localtime_content(App $a) {
$o .= '<p>' . sprintf( t('UTC time: %s'), $t) . '</p>';
if($_REQUEST['timezone'])
if ($_REQUEST['timezone']) {
$o .= '<p>' . sprintf( t('Current timezone: %s'), $_REQUEST['timezone']) . '</p>';
}
if(x($a->data,'mod-localtime'))
if (x($a->data,'mod-localtime')) {
$o .= '<p>' . sprintf( t('Converted localtime: %s'),$a->data['mod-localtime']) . '</p>';
}
$o .= '<form action ="' . App::get_baseurl() . '/localtime?f=&time=' . $t . '" method="post" >';

View file

@ -11,7 +11,7 @@ function lockview_content(App $a) {
$item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);
}
if(! $item_id)
if (! $item_id)
killme();
if (!in_array($type, array('item','photo','event')))
@ -28,13 +28,13 @@ function lockview_content(App $a) {
call_hooks('lockview_content', $item);
if($item['uid'] != local_user()) {
if ($item['uid'] != local_user()) {
echo t('Remote privacy information not available.') . '<br />';
killme();
}
if(($item['private'] == 1) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid']))
if (($item['private'] == 1) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid']))
&& (! strlen($item['deny_cid'])) && (! strlen($item['deny_gid']))) {
echo t('Remote privacy information not available.') . '<br />';
@ -49,39 +49,47 @@ function lockview_content(App $a) {
$o = t('Visible to:') . '<br />';
$l = array();
if(count($allowed_groups)) {
if (count($allowed_groups)) {
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
dbesc(implode(', ', $allowed_groups))
);
if (dbm::is_result($r))
foreach($r as $rr)
if (dbm::is_result($r)) {
foreach ($r as $rr) {
$l[] = '<b>' . $rr['name'] . '</b>';
}
}
}
if(count($allowed_users)) {
if (count($allowed_users)) {
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
dbesc(implode(', ',$allowed_users))
);
if (dbm::is_result($r))
foreach($r as $rr)
if (dbm::is_result($r)) {
foreach ($r as $rr) {
$l[] = $rr['name'];
}
}
}
if(count($deny_groups)) {
if (count($deny_groups)) {
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
dbesc(implode(', ', $deny_groups))
);
if (dbm::is_result($r))
foreach($r as $rr)
if (dbm::is_result($r)) {
foreach ($r as $rr) {
$l[] = '<b><strike>' . $rr['name'] . '</strike></b>';
}
}
}
if(count($deny_users)) {
if (count($deny_users)) {
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
dbesc(implode(', ',$deny_users))
);
if (dbm::is_result($r))
foreach($r as $rr)
if (dbm::is_result($r)) {
foreach ($r as $rr) {
$l[] = '<strike>' . $rr['name'] . '</strike>';
}
}
}

View file

@ -1,13 +1,16 @@
<?php
function login_content(App $a) {
if(x($_SESSION,'theme'))
if (x($_SESSION,'theme')) {
unset($_SESSION['theme']);
if(x($_SESSION,'mobile-theme'))
}
if (x($_SESSION,'mobile-theme')) {
unset($_SESSION['mobile-theme']);
}
if(local_user())
if (local_user()) {
goaway(z_root());
}
return login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
}

View file

@ -7,7 +7,7 @@ require_once('include/text.php');
function lostpass_post(App $a) {
$loginame = notags(trim($_POST['login-name']));
if(! $loginame)
if (! $loginame)
goaway(z_root());
$r = q("SELECT * FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' ) AND `verified` = 1 AND `blocked` = 0 LIMIT 1",
@ -31,7 +31,7 @@ function lostpass_post(App $a) {
dbesc($new_password_encoded),
intval($uid)
);
if($r)
if ($r)
info( t('Password reset request issued. Check your email.') . EOL);
@ -79,8 +79,7 @@ function lostpass_post(App $a) {
function lostpass_content(App $a) {
if(x($_GET,'verify')) {
if (x($_GET,'verify')) {
$verify = $_GET['verify'];
$hash = hash('whirlpool', $verify);

View file

@ -12,8 +12,8 @@ function manage_post(App $a) {
$uid = local_user();
$orig_record = $a->user;
if((x($_SESSION,'submanage')) && intval($_SESSION['submanage'])) {
$r = q("select * from user where uid = %d limit 1",
if ((x($_SESSION,'submanage')) && intval($_SESSION['submanage'])) {
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($_SESSION['submanage'])
);
if (dbm::is_result($r)) {
@ -22,34 +22,34 @@ function manage_post(App $a) {
}
}
$r = q("select * from manage where uid = %d",
$r = q("SELECT * FROM `manage` WHERE `uid` = %d",
intval($uid)
);
$submanage = $r;
$identity = ((x($_POST['identity'])) ? intval($_POST['identity']) : 0);
if(! $identity)
if (! $identity) {
return;
}
$limited_id = 0;
$original_id = $uid;
if(count($submanage)) {
foreach($submanage as $m) {
if($identity == $m['mid']) {
if (count($submanage)) {
foreach ($submanage as $m) {
if ($identity == $m['mid']) {
$limited_id = $m['mid'];
break;
}
}
}
if($limited_id) {
if ($limited_id) {
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($limited_id)
);
}
else {
} else {
$r = q("SELECT * FROM `user` WHERE `uid` = %d AND `email` = '%s' AND `password` = '%s' LIMIT 1",
intval($identity),
dbesc($orig_record['email']),
@ -70,18 +70,22 @@ function manage_post(App $a) {
unset($_SESSION['mobile-theme']);
unset($_SESSION['page_flags']);
unset($_SESSION['return_url']);
if(x($_SESSION,'submanage'))
if (x($_SESSION,'submanage')) {
unset($_SESSION['submanage']);
if(x($_SESSION,'sysmsg'))
}
if (x($_SESSION,'sysmsg')) {
unset($_SESSION['sysmsg']);
if(x($_SESSION,'sysmsg_info'))
}
if (x($_SESSION,'sysmsg_info')) {
unset($_SESSION['sysmsg_info']);
}
require_once('include/security.php');
authenticate_success($r[0],true,true);
if($limited_id)
if ($limited_id) {
$_SESSION['submanage'] = $original_id;
}
$ret = array();
call_hooks('home_init',$ret);

View file

@ -31,7 +31,7 @@ function match_content(App $a) {
if (! dbm::is_result($r)) {
return;
}
if(! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) {
if (! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) {
notice( t('No keywords to match. Please add keywords to your default profile.') . EOL);
return;
}
@ -39,28 +39,28 @@ function match_content(App $a) {
$params = array();
$tags = trim($r[0]['pub_keywords'] . ' ' . $r[0]['prv_keywords']);
if($tags) {
if ($tags) {
$params['s'] = $tags;
if($a->pager['page'] != 1)
if ($a->pager['page'] != 1)
$params['p'] = $a->pager['page'];
if(strlen(get_config('system','directory')))
if (strlen(get_config('system','directory')))
$x = post_url(get_server().'/msearch', $params);
else
$x = post_url(App::get_baseurl() . '/msearch', $params);
$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) {
$match_nurl = normalise_link($jj->url);
$match = q("SELECT `nurl` FROM `contact` WHERE `uid` = '%d' AND nurl='%s' LIMIT 1",
intval(local_user()),

View file

@ -75,18 +75,18 @@ function message_post(App $a) {
// fake it to go back to the input form if no recipient listed
if($norecip) {
if ($norecip) {
$a->argc = 2;
$a->argv[1] = 'new';
}
else
} else {
goaway($_SESSION['return_url']);
}
}
// Note: the code in 'item_extract_images' and 'item_redir_and_replace_images'
// is identical to the code in include/conversation.php
if(! function_exists('item_extract_images')) {
if (! function_exists('item_extract_images')) {
function item_extract_images($body) {
$saved_image = array();
@ -97,26 +97,27 @@ function item_extract_images($body) {
$img_start = strpos($orig_body, '[img');
$img_st_close = ($img_start !== false ? strpos(substr($orig_body, $img_start), ']') : false);
$img_end = ($img_start !== false ? strpos(substr($orig_body, $img_start), '[/img]') : false);
while(($img_st_close !== false) && ($img_end !== false)) {
while (($img_st_close !== false) && ($img_end !== false)) {
$img_st_close++; // make it point to AFTER the closing bracket
$img_end += $img_start;
if(! strcmp(substr($orig_body, $img_start + $img_st_close, 5), 'data:')) {
if (! strcmp(substr($orig_body, $img_start + $img_st_close, 5), 'data:')) {
// This is an embedded image
$saved_image[$cnt] = substr($orig_body, $img_start + $img_st_close, $img_end - ($img_start + $img_st_close));
$new_body = $new_body . substr($orig_body, 0, $img_start) . '[!#saved_image' . $cnt . '#!]';
$cnt++;
}
else
} else {
$new_body = $new_body . substr($orig_body, 0, $img_end + strlen('[/img]'));
}
$orig_body = substr($orig_body, $img_end + strlen('[/img]'));
if($orig_body === false) // in case the body ends on a closing image tag
if ($orig_body === false) {// in case the body ends on a closing image tag
$orig_body = '';
}
$img_start = strpos($orig_body, '[img');
$img_st_close = ($img_start !== false ? strpos(substr($orig_body, $img_start), ']') : false);
@ -128,13 +129,13 @@ function item_extract_images($body) {
return array('body' => $new_body, 'images' => $saved_image);
}}
if(! function_exists('item_redir_and_replace_images')) {
if (! function_exists('item_redir_and_replace_images')) {
function item_redir_and_replace_images($body, $images, $cid) {
$origbody = $body;
$newbody = '';
for($i = 0; $i < count($images); $i++) {
for ($i = 0; $i < count($images); $i++) {
$search = '/\[url\=(.*?)\]\[!#saved_image' . $i . '#!\]\[\/url\]' . '/is';
$replace = '[url=' . z_path() . '/redir/' . $cid
. '?f=1&url=' . '$1' . '][!#saved_image' . $i . '#!][/url]' ;
@ -181,18 +182,18 @@ function message_content(App $a) {
));
if(($a->argc == 3) && ($a->argv[1] === 'drop' || $a->argv[1] === 'dropconv')) {
if(! intval($a->argv[2]))
if (($a->argc == 3) && ($a->argv[1] === 'drop' || $a->argv[1] === 'dropconv')) {
if (! intval($a->argv[2]))
return;
// Check if we should do HTML-based delete confirmation
if($_REQUEST['confirm']) {
if ($_REQUEST['confirm']) {
// <form> can't take arguments in its "action" parameter
// so add any arguments as hidden inputs
$query = explode_querystring($a->query_string);
$inputs = array();
foreach($query['args'] as $arg) {
if(strpos($arg, 'confirm=') === false) {
foreach ($query['args'] as $arg) {
if (strpos($arg, 'confirm=') === false) {
$arg_parts = explode('=', $arg);
$inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]);
}
@ -210,12 +211,12 @@ function message_content(App $a) {
));
}
// Now check how the user responded to the confirmation query
if($_REQUEST['canceled']) {
if ($_REQUEST['canceled']) {
goaway($_SESSION['return_url']);
}
$cmd = $a->argv[1];
if($cmd === 'drop') {
if ($cmd === 'drop') {
$r = q("DELETE FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($a->argv[2]),
intval(local_user())
@ -245,7 +246,7 @@ function message_content(App $a) {
// as we will never again have the info we need to re-create it.
// We'll just have to orphan it.
//if($convid) {
//if ($convid) {
// q("delete from conv where id = %d limit 1",
// intval($convid)
// );
@ -261,7 +262,7 @@ function message_content(App $a) {
}
if(($a->argc > 1) && ($a->argv[1] === 'new')) {
if (($a->argc > 1) && ($a->argv[1] === 'new')) {
$o .= $header;
@ -284,7 +285,7 @@ function message_content(App $a) {
$prename = $preurl = $preid = '';
if($preselect) {
if ($preselect) {
$r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval(local_user()),
intval($a->argv[2])
@ -373,7 +374,7 @@ function message_content(App $a) {
return $o;
}
if(($a->argc > 1) && (intval($a->argv[1]))) {
if (($a->argc > 1) && (intval($a->argv[1]))) {
$o .= $header;
@ -388,7 +389,7 @@ function message_content(App $a) {
$convid = $r[0]['convid'];
$sql_extra = sprintf(" and `mail`.`parent-uri` = '%s' ", dbesc($r[0]['parent-uri']));
if($convid)
if ($convid)
$sql_extra = sprintf(" and ( `mail`.`parent-uri` = '%s' OR `mail`.`convid` = '%d' ) ",
dbesc($r[0]['parent-uri']),
intval($convid)
@ -400,7 +401,7 @@ function message_content(App $a) {
intval(local_user())
);
}
if(! count($messages)) {
if (! count($messages)) {
notice( t('Message not available.') . EOL );
return $o;
}
@ -430,10 +431,11 @@ function message_content(App $a) {
$seen = 0;
$unknown = false;
foreach($messages as $message) {
if($message['unknown'])
foreach ($messages as $message) {
if ($message['unknown']) {
$unknown = true;
if($message['from-url'] == $myprofile) {
}
if ($message['from-url'] == $myprofile) {
$from_url = $myprofile;
$sparkle = '';
} elseif ($message['contact-id'] != 0) {
@ -446,10 +448,11 @@ function message_content(App $a) {
$extracted = item_extract_images($message['body']);
if($extracted['images'])
if ($extracted['images']) {
$message['body'] = item_redir_and_replace_images($extracted['body'], $extracted['images'], $message['contact-id']);
}
if($a->theme['template_engine'] === 'internal') {
if ($a->theme['template_engine'] === 'internal') {
$from_name_e = template_escape($message['from-name']);
$subject_e = template_escape($message['title']);
$body_e = template_escape(Smilies::replace(bbcode($message['body'])));
@ -462,23 +465,24 @@ function message_content(App $a) {
}
$contact = get_contact_details_by_url($message['from-url']);
if (isset($contact["thumb"]))
if (isset($contact["thumb"])) {
$from_photo = $contact["thumb"];
else
} else {
$from_photo = $message['from-photo'];
}
$mails[] = array(
'id' => $message['id'],
'from_name' => $from_name_e,
'from_url' => $from_url,
'sparkle' => $sparkle,
'id' => $message['id'],
'from_name' => $from_name_e,
'from_url' => $from_url,
'sparkle' => $sparkle,
'from_photo' => proxy_url($from_photo, false, PROXY_SIZE_THUMB),
'subject' => $subject_e,
'body' => $body_e,
'delete' => t('Delete message'),
'to_name' => $to_name_e,
'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A'),
'ago' => relative_date($message['created']),
'subject' => $subject_e,
'body' => $body_e,
'delete' => t('Delete message'),
'to_name' => $to_name_e,
'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A'),
'ago' => relative_date($message['created']),
);
$seen = $message['seen'];
@ -490,10 +494,9 @@ function message_content(App $a) {
$tpl = get_markup_template('mail_display.tpl');
if($a->theme['template_engine'] === 'internal') {
if ($a->theme['template_engine'] === 'internal') {
$subjtxt_e = template_escape($message['title']);
}
else {
} else {
$subjtxt_e = $message['title'];
}
@ -548,16 +551,16 @@ function render_messages(array $msg, $t) {
$myprofile = App::get_baseurl().'/profile/' . $a->user['nickname'];
foreach($msg as $rr) {
foreach ($msg as $rr) {
if($rr['unknown'])
if ($rr['unknown'])
$participants = sprintf( t("Unknown sender - %s"),$rr['from-name']);
elseif (link_compare($rr['from-url'], $myprofile))
$participants = sprintf( t("You and %s"), $rr['name']);
else
$participants = sprintf(t("%s and You"), $rr['from-name']);
if($a->theme['template_engine'] === 'internal') {
if ($a->theme['template_engine'] === 'internal') {
$subject_e = template_escape((($rr['mailseen']) ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>'));
$body_e = template_escape($rr['body']);
$to_name_e = template_escape($rr['name']);

View file

@ -4,7 +4,7 @@ require_once('library/asn1.php');
function modexp_init(App $a) {
if($a->argc != 2)
if ($a->argc != 2)
killme();
$nick = $a->argv[1];

View file

@ -14,12 +14,12 @@ function mood_init(App $a) {
$uid = local_user();
$verb = notags(trim($_GET['verb']));
if(! $verb)
if (! $verb)
return;
$verbs = get_mood_verbs();
if(! in_array($verb,$verbs))
if (! in_array($verb,$verbs))
return;
$activity = ACTIVITY_MOOD . '#' . urlencode($verb);
@ -30,7 +30,7 @@ function mood_init(App $a) {
logger('mood: verb ' . $verb, LOGGER_DEBUG);
if($parent) {
if ($parent) {
$r = q("select uri, private, allow_cid, allow_gid, deny_cid, deny_gid
from item where id = %d and parent = %d and uid = %d limit 1",
intval($parent),
@ -90,7 +90,7 @@ function mood_init(App $a) {
$arr['body'] = $action;
$item_id = item_store($arr);
if($item_id) {
if ($item_id) {
q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d",
dbesc(App::get_baseurl() . '/display/' . $poster['nickname'] . '/' . $item_id),
intval($uid),
@ -123,9 +123,11 @@ function mood_content(App $a) {
$verbs = get_mood_verbs();
$shortlist = array();
foreach($verbs as $k => $v)
if($v !== 'NOTRANSLATION')
foreach ($verbs as $k => $v) {
if ($v !== 'NOTRANSLATION') {
$shortlist[] = array($k,$v);
}
}
$tpl = get_markup_template('mood_content.tpl');

View file

@ -7,7 +7,7 @@ function msearch_post(App $a) {
$startrec = (($page+1) * $perpage) - $perpage;
$search = $_POST['s'];
if(! strlen($search))
if (! strlen($search))
killme();
$r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') ",
@ -26,7 +26,7 @@ function msearch_post(App $a) {
);
if (dbm::is_result($r)) {
foreach($r as $rr)
foreach ($r as $rr)
$results[] = array(
'name' => $rr['name'],
'url' => App::get_baseurl() . '/profile/' . $rr['nickname'],

View file

@ -43,11 +43,11 @@ function network_init(App $a) {
if ($remember_group) {
$net_baseurl .= '/' . $last_sel_groups; // Note that the group number must come before the "/new" tab selection
} elseif($sel_groups !== false) {
} elseif ($sel_groups !== false) {
$net_baseurl .= '/' . $sel_groups;
}
if($remember_tab) {
if ($remember_tab) {
// redirect if current selected tab is '/network' and
// last selected tab is _not_ '/network?f=&order=comment'.
// and this isn't a date query
@ -81,19 +81,19 @@ function network_init(App $a) {
parse_str( $dest_qs, $dest_qa);
$net_args = array_merge($net_args, $dest_qa);
}
else if($sel_tabs[4] === 'active') {
else if ($sel_tabs[4] === 'active') {
// The '/new' tab is selected
$net_baseurl .= '/new';
}
if($remember_net) {
if ($remember_net) {
$net_args['nets'] = $last_sel_nets;
}
else if($sel_nets!==false) {
else if ($sel_nets!==false) {
$net_args['nets'] = $sel_nets;
}
if($remember_tab || $remember_net || $remember_group) {
if ($remember_tab || $remember_net || $remember_group) {
$net_args = array_merge($query_array, $net_args);
$net_queries = build_querystring($net_args);
@ -103,7 +103,7 @@ function network_init(App $a) {
}
}
if(x($_GET['nets']) && $_GET['nets'] === 'all')
if (x($_GET['nets']) && $_GET['nets'] === 'all')
unset($_GET['nets']);
$group_id = (($a->argc > 1 && is_numeric($a->argv[1])) ? intval($a->argv[1]) : 0);
@ -115,12 +115,12 @@ function network_init(App $a) {
require_once('include/items.php');
require_once('include/ForumManager.php');
if(! x($a->page,'aside'))
if (! x($a->page,'aside'))
$a->page['aside'] = '';
$search = ((x($_GET,'search')) ? escape_tags($_GET['search']) : '');
if(x($_GET,'save')) {
if (x($_GET,'save')) {
$r = qu("SELECT * FROM `search` WHERE `uid` = %d AND `term` = '%s' LIMIT 1",
intval(local_user()),
dbesc($search)
@ -132,7 +132,7 @@ function network_init(App $a) {
);
}
}
if(x($_GET,'remove')) {
if (x($_GET,'remove')) {
q("DELETE FROM `search` WHERE `uid` = %d AND `term` = '%s'",
intval(local_user()),
dbesc($search)
@ -140,7 +140,7 @@ function network_init(App $a) {
}
// search terms header
if(x($_GET,'search')) {
if (x($_GET,'search')) {
$a->page['content'] .= replace_macros(get_markup_template("section_title.tpl"),array(
'$title' => sprintf( t('Results for: %s'), $search)
));
@ -157,7 +157,7 @@ function network_init(App $a) {
function saved_searches($search) {
if(! feature_enabled(local_user(),'savedsearch'))
if (! feature_enabled(local_user(),'savedsearch'))
return '';
$a = get_app();
@ -232,28 +232,28 @@ function network_query_get_sel_tab(App $a) {
$spam_active = '';
$postord_active = '';
if(($a->argc > 1 && $a->argv[1] === 'new')
if (($a->argc > 1 && $a->argv[1] === 'new')
|| ($a->argc > 2 && $a->argv[2] === 'new')) {
$new_active = 'active';
}
if(x($_GET,'search')) {
if (x($_GET,'search')) {
$search_active = 'active';
}
if(x($_GET,'star')) {
if (x($_GET,'star')) {
$starred_active = 'active';
}
if(x($_GET,'bmark')) {
if (x($_GET,'bmark')) {
$bookmarked_active = 'active';
}
if(x($_GET,'conv')) {
if (x($_GET,'conv')) {
$conv_active = 'active';
}
if(x($_GET,'spam')) {
if (x($_GET,'spam')) {
$spam_active = 'active';
}
@ -285,7 +285,7 @@ function network_query_get_sel_tab(App $a) {
function network_query_get_sel_net() {
$network = false;
if(x($_GET,'nets')) {
if (x($_GET,'nets')) {
$network = $_GET['nets'];
}
@ -295,7 +295,7 @@ function network_query_get_sel_net() {
function network_query_get_sel_group(App $a) {
$group = false;
if($a->argc >= 2 && is_numeric($a->argv[1])) {
if ($a->argc >= 2 && is_numeric($a->argv[1])) {
$group = $a->argv[1];
}
@ -326,20 +326,18 @@ function network_content(App $a, $update = 0) {
$nouveau = false;
if($a->argc > 1) {
for($x = 1; $x < $a->argc; $x ++) {
if(is_a_date_arg($a->argv[$x])) {
if($datequery)
if ($a->argc > 1) {
for ($x = 1; $x < $a->argc; $x ++) {
if (is_a_date_arg($a->argv[$x])) {
if ($datequery) {
$datequery2 = escape_tags($a->argv[$x]);
else {
} else {
$datequery = escape_tags($a->argv[$x]);
$_GET['order'] = 'post';
}
}
elseif($a->argv[$x] === 'new') {
} elseif ($a->argv[$x] === 'new') {
$nouveau = true;
}
elseif(intval($a->argv[$x])) {
} elseif (intval($a->argv[$x])) {
$group = intval($a->argv[$x]);
$def_acl = array('allow_gid' => '<' . $group . '>');
}
@ -368,12 +366,12 @@ function network_content(App $a, $update = 0) {
if(x($_GET,'search') || x($_GET,'file'))
if (x($_GET,'search') || x($_GET,'file'))
$nouveau = true;
if($cid)
if ($cid)
$def_acl = array('allow_cid' => '<' . intval($cid) . '>');
if($nets) {
if ($nets) {
$r = qu("SELECT `id` FROM `contact` WHERE `uid` = %d AND network = '%s' AND `self` = 0",
intval(local_user()),
dbesc($nets)
@ -381,19 +379,19 @@ function network_content(App $a, $update = 0) {
$str = '';
if (dbm::is_result($r))
foreach($r as $rr)
foreach ($r as $rr)
$str .= '<' . $rr['id'] . '>';
if(strlen($str))
if (strlen($str))
$def_acl = array('allow_cid' => $str);
}
set_pconfig(local_user(), 'network.view', 'net.selected', ($nets ? $nets : 'all'));
if(!$update AND !$rawmode) {
if (!$update AND !$rawmode) {
$tabs = network_tabs($a);
$o .= $tabs;
if($group) {
if(($t = group_public_members($group)) && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {
if ($group) {
if (($t = group_public_members($group)) && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {
notice(sprintf(tt("Warning: This group contains %s member from a network that doesn't allow non public messages.",
"Warning: This group contains %s members from a network that doesn't allow non public messages.",
$t), $t).EOL);
@ -457,13 +455,13 @@ function network_content(App $a, $update = 0) {
$sql_nets = (($nets) ? sprintf(" and $sql_table.`network` = '%s' ", dbesc($nets)) : '');
if($group) {
if ($group) {
$r = qu("SELECT `name`, `id` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($group),
intval($_SESSION['uid'])
);
if (! dbm::is_result($r)) {
if($update)
if ($update)
killme();
notice( t('No such group') . EOL );
goaway('network/0');
@ -473,7 +471,7 @@ function network_content(App $a, $update = 0) {
$contacts = expand_groups(array($group));
$gcontacts = expand_groups(array($group), false, true);
if((is_array($contacts)) && count($contacts)) {
if ((is_array($contacts)) && count($contacts)) {
$contact_str_self = "";
$gcontact_str_self = "";
@ -500,7 +498,7 @@ function network_content(App $a, $update = 0) {
)) . $o;
}
elseif($cid) {
elseif ($cid) {
$r = qu("SELECT `id`,`name`,`network`,`writable`,`nurl`, `forum`, `prv`, `contact-type`, `addr`, `thumb`, `location` FROM `contact` WHERE `id` = %d
AND (NOT `blocked` OR `pending`) LIMIT 1",
@ -524,7 +522,7 @@ function network_content(App $a, $update = 0) {
'id' => 'network',
)) . $o;
if($r[0]['network'] === NETWORK_OSTATUS && $r[0]['writable'] && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {
if ($r[0]['network'] === NETWORK_OSTATUS && $r[0]['writable'] && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {
notice( t('Private messages to this person are at risk of public disclosure.') . EOL);
}
@ -536,15 +534,15 @@ function network_content(App $a, $update = 0) {
}
}
if((! $group) && (! $cid) && (! $update) && (! get_config('theme','hide_eventlist'))) {
if ((! $group) && (! $cid) && (! $update) && (! get_config('theme','hide_eventlist'))) {
$o .= get_birthdays();
$o .= get_events();
}
if($datequery) {
if ($datequery) {
$sql_extra3 .= protect_sprintf(sprintf(" AND $sql_table.created <= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery))));
}
if($datequery2) {
if ($datequery2) {
$sql_extra3 .= protect_sprintf(sprintf(" AND $sql_table.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
}
@ -555,10 +553,10 @@ function network_content(App $a, $update = 0) {
$order_mode = "received";
$tag = false;
if(x($_GET,'search')) {
if (x($_GET,'search')) {
$search = escape_tags($_GET['search']);
if(strpos($search,'#') === 0) {
if (strpos($search,'#') === 0) {
$tag = true;
$search = substr($search,1);
}
@ -566,7 +564,7 @@ function network_content(App $a, $update = 0) {
if (get_config('system','only_tag_search'))
$tag = true;
if($tag) {
if ($tag) {
$sql_extra = "";
$sql_post_table .= sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ",
@ -583,17 +581,17 @@ function network_content(App $a, $update = 0) {
$order_mode = "id";
}
}
if(strlen($file)) {
if (strlen($file)) {
$sql_post_table .= sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ",
dbesc(protect_sprintf($file)), intval(TERM_OBJ_POST), intval(TERM_FILE), intval(local_user()));
$sql_order = "`item`.`id`";
$order_mode = "id";
}
if($conv)
if ($conv)
$sql_extra3 .= " AND $sql_table.`mention`";
if($update) {
if ($update) {
// only setup pagination on initial page view
$pager_sql = '';
@ -611,14 +609,14 @@ function network_content(App $a, $update = 0) {
// now that we have the user settings, see if the theme forces
// a maximum item number which is lower then the user choice
if(($a->force_max_items > 0) && ($a->force_max_items < $itemspage_network))
if (($a->force_max_items > 0) && ($a->force_max_items < $itemspage_network))
$itemspage_network = $a->force_max_items;
$a->set_pager_itemspage($itemspage_network);
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
}
if($nouveau) {
if ($nouveau) {
$simple_update = (($update) ? " AND `item`.`unseen` " : '');
if ($sql_order == "")
@ -640,7 +638,7 @@ function network_content(App $a, $update = 0) {
// Normal conversation view
if($order === 'post') {
if ($order === 'post') {
$ordering = "`created`";
if ($sql_order == "")
$order_mode = "created";
@ -657,7 +655,7 @@ function network_content(App $a, $update = 0) {
$sql_extra3 .= sprintf(" AND $sql_order <= '%s'", dbesc($_GET["offset"]));
// Fetch a page full of parent items for this page
if($update) {
if ($update) {
if (get_config("system", "like_no_comment"))
$sql_extra4 = " AND `item`.`verb` = '".ACTIVITY_POST."'";
else
@ -691,8 +689,8 @@ function network_content(App $a, $update = 0) {
$date_offset = "";
if (dbm::is_result($r)) {
foreach($r as $rr)
if(! in_array($rr['item_id'],$parents_arr))
foreach ($r as $rr)
if (! in_array($rr['item_id'],$parents_arr))
$parents_arr[] = $rr['item_id'];
$parents_str = implode(", ", $parents_arr);
@ -730,7 +728,7 @@ function network_content(App $a, $update = 0) {
$a->page_offset = $date_offset;
if($parents_str)
if ($parents_str)
$update_unseen = ' WHERE uid = ' . intval(local_user()) . ' AND unseen = 1 AND parent IN ( ' . dbesc($parents_str) . ' )';
}
@ -824,7 +822,7 @@ function network_tabs(App $a) {
),
);
if(feature_enabled(local_user(),'personal_tab')) {
if (feature_enabled(local_user(),'personal_tab')) {
$tabs[] = array(
'label' => t('Personal'),
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1',
@ -835,7 +833,7 @@ function network_tabs(App $a) {
);
}
if(feature_enabled(local_user(),'new_tab')) {
if (feature_enabled(local_user(),'new_tab')) {
$tabs[] = array(
'label' => t('New'),
'url' => str_replace('/new', '', $cmd) . ($len_naked_cmd ? '/' : '') . 'new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''),
@ -846,7 +844,7 @@ function network_tabs(App $a) {
);
}
if(feature_enabled(local_user(),'link_tab')) {
if (feature_enabled(local_user(),'link_tab')) {
$tabs[] = array(
'label' => t('Shared Links'),
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1',
@ -857,7 +855,7 @@ function network_tabs(App $a) {
);
}
if(feature_enabled(local_user(),'star_posts')) {
if (feature_enabled(local_user(),'star_posts')) {
$tabs[] = array(
'label' => t('Starred'),
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1',
@ -869,7 +867,7 @@ function network_tabs(App $a) {
}
// save selected tab, but only if not in search or file mode
if(!x($_GET,'search') && !x($_GET,'file')) {
if (!x($_GET,'search') && !x($_GET,'file')) {
set_pconfig( local_user(), 'network.view','tab.selected',array($all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active) );
}

View file

@ -47,8 +47,9 @@ function newmember_content(App $a) {
$mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
if(! $mail_disabled)
if (! $mail_disabled) {
$o .= '<li>' . '<a target="newmember" href="settings/connectors">' . t('Importing Emails') . '</a><br />' . t('Enter your email access information on your Connector Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '</li>' . EOL;
}
$o .= '<li>' . '<a target="newmember" href="contacts">' . t('Go to Your Contacts Page') . '</a><br />' . t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the <em>Add New Contact</em> dialog.') . '</li>' . EOL;
@ -64,7 +65,7 @@ function newmember_content(App $a) {
$o .= '<li>' . '<a target="newmember" href="contacts">' . t('Group Your Contacts') . '</a><br />' . t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . '</li>' . EOL;
if(get_config('system', 'newuser_private')) {
if (get_config('system', 'newuser_private')) {
$o .= '<li>' . '<a target="newmember" href="help/Groups-and-Privacy">' . t("Why Aren't My Posts Public?") . '</a><br />' . t("Friendica respects your privacy. By default, your posts will only show up to people you've added as friends. For more information, see the help section from the link above.") . '</li>' . EOL;
}

View file

@ -158,7 +158,7 @@ function nodeinfo_cron() {
$plugins = get_config("system","addon");
$plugins_arr = array();
if($plugins) {
if ($plugins) {
$plugins_arr = explode(",",str_replace(" ", "",$plugins));
$idx = array_search($plugin, $plugins_arr);
@ -175,10 +175,10 @@ function nodeinfo_cron() {
$last = get_config('nodeinfo','last_calucation');
if($last) {
if ($last) {
// Calculate every 24 hours
$next = $last + (24 * 60 * 60);
if($next > time()) {
if ($next > time()) {
logger("calculation intervall not reached");
return;
}

View file

@ -2,13 +2,14 @@
function noscrape_init(App $a) {
if($a->argc > 1)
if ($a->argc > 1) {
$which = $a->argv[1];
else
} else {
killme();
}
$profile = 0;
if((local_user()) && ($a->argc > 2) && ($a->argv[2] === 'view')) {
if ((local_user()) && ($a->argc > 2) && ($a->argv[2] === 'view')) {
$which = $a->user['nickname'];
$profile = $a->argv[1];
}

View file

@ -43,7 +43,7 @@ function notes_content(App $a, $update = false) {
$o ="";
$o .= profile_tabs($a,True);
if(! $update) {
if (! $update) {
$o .= '<h3>' . t('Personal Notes') . '</h3>';
$commpage = false;
@ -104,8 +104,9 @@ function notes_content(App $a, $update = false) {
$parents_str = '';
if (dbm::is_result($r)) {
foreach($r as $rr)
foreach ($r as $rr) {
$parents_arr[] = $rr['item_id'];
}
$parents_str = implode(', ', $parents_arr);
$r = q("SELECT %s FROM `item` %s

View file

@ -17,10 +17,10 @@ function notifications_post(App $a) {
$request_id = (($a->argc > 1) ? $a->argv[1] : 0);
if($request_id === "all")
if ($request_id === "all")
return;
if($request_id) {
if ($request_id) {
$r = q("SELECT * FROM `intro` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($request_id),
@ -41,11 +41,11 @@ function notifications_post(App $a) {
$fid = $r[0]['fid'];
if($_POST['submit'] == t('Discard')) {
if ($_POST['submit'] == t('Discard')) {
$r = q("DELETE FROM `intro` WHERE `id` = %d",
intval($intro_id)
);
if(! $fid) {
if (! $fid) {
// The check for blocked and pending is in case the friendship was already approved
// and we just want to get rid of the now pointless notification
@ -57,7 +57,7 @@ function notifications_post(App $a) {
}
goaway('notifications/intros');
}
if($_POST['submit'] == t('Ignore')) {
if ($_POST['submit'] == t('Ignore')) {
$r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d",
intval($intro_id));
goaway('notifications/intros');
@ -91,7 +91,7 @@ function notifications_content(App $a) {
$startrec = ($page * $perpage) - $perpage;
// Get introductions
if( (($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) {
if ( (($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) {
nav_set_selected('introductions');
$notif_header = t('Notifications');
@ -135,13 +135,13 @@ function notifications_content(App $a) {
$notifs['page'] = $a->pager['page'];
// Json output
if(intval($json) === 1)
if (intval($json) === 1)
json_return_and_die($notifs);
$notif_tpl = get_markup_template('notifications.tpl');
// Process the data for template creation
if($notifs['ident'] === 'introductions') {
if ($notifs['ident'] === 'introductions') {
$sugg = get_markup_template('suggestions.tpl');
$tpl = get_markup_template("intros.tpl");
@ -190,8 +190,8 @@ function notifications_content(App $a) {
$knowyou = '';
$dfrn_text = '';
if($it['network'] === NETWORK_DFRN || $it['network'] === NETWORK_DIASPORA) {
if($it['network'] === NETWORK_DFRN) {
if ($it['network'] === NETWORK_DFRN || $it['network'] === NETWORK_DIASPORA) {
if ($it['network'] === NETWORK_DFRN) {
$lbl_knowyou = t('Claims to be known to you: ');
$knowyou = (($it['knowyou']) ? t('yes') : t('no'));
$helptext = t('Shall your connection be bidirectional or not?');
@ -262,7 +262,7 @@ function notifications_content(App $a) {
}
}
if($notifs['total'] == 0)
if ($notifs['total'] == 0)
info( t('No introductions.') . EOL);
// Normal notifications (no introductions)
@ -301,7 +301,7 @@ function notifications_content(App $a) {
// It doesn't make sense to show the Show unread / Show all link visible if the user is on the
// "Show all" page and there are no notifications. So we will hide it.
if($show == 0 || intval($show) && $notifs['total'] > 0) {
if ($show == 0 || intval($show) && $notifs['total'] > 0) {
$notif_show_lnk = array(
'href' => ($show ? 'notifications/'.$notifs['ident'] : 'notifications/'.$notifs['ident'].'?show=all' ),
'text' => ($show ? t('Show unread') : t('Show all')),
@ -309,8 +309,9 @@ function notifications_content(App $a) {
}
// Output if there aren't any notifications available
if($notifs['total'] == 0)
if ($notifs['total'] == 0) {
$notif_nocontent = sprintf( t('No more %s notifications.'), $notifs['ident']);
}
}
$o .= replace_macros($notif_tpl, array(

View file

@ -7,20 +7,20 @@ require_once('library/openid.php');
function openid_content(App $a) {
$noid = get_config('system','no_openid');
if($noid)
if ($noid)
goaway(z_root());
logger('mod_openid ' . print_r($_REQUEST,true), LOGGER_DATA);
if((x($_GET,'openid_mode')) && (x($_SESSION,'openid'))) {
if ((x($_GET,'openid_mode')) && (x($_SESSION,'openid'))) {
$openid = new LightOpenID;
if($openid->validate()) {
if ($openid->validate()) {
$authid = $_REQUEST['openid_identity'];
if(! strlen($authid)) {
if (! strlen($authid)) {
logger( t('OpenID protocol error. No ID returned.') . EOL);
goaway(z_root());
}
@ -69,10 +69,10 @@ function openid_content(App $a) {
if ($k === 'namePerson/friendly') {
$nick = notags(trim($v));
}
if($k === 'namePerson/first') {
if ($k === 'namePerson/first') {
$first = notags(trim($v));
}
if($k === 'namePerson') {
if ($k === 'namePerson') {
$args .= '&username=' . notags(trim($v));
}
if ($k === 'contact/email') {

View file

@ -59,7 +59,7 @@ function parse_url_content(App $a) {
$redirects = 0;
// Fetch the header of the URL
$result = z_fetch_url($url, false, $redirects, array("novalidate" => true, "nobody" => true));
if($result["success"]) {
if ($result["success"]) {
// Convert the header fields into an array
$hdrs = array();
$h = explode("\n", $result["header"]);
@ -71,7 +71,7 @@ function parse_url_content(App $a) {
$type = $hdrs["Content-Type"];
}
if ($type) {
if(stripos($type, "image/") !== false) {
if (stripos($type, "image/") !== false) {
echo $br . "[img]" . $url . "[/img]" . $br;
killme();
}

View file

@ -36,7 +36,7 @@ function photo_init(App $a) {
header('Etag: '.$_SERVER['HTTP_IF_NONE_MATCH']);
header("Expires: " . gmdate("D, d M Y H:i:s", time() + (31536000)) . " GMT");
header("Cache-Control: max-age=31536000");
if(function_exists('header_remove')) {
if (function_exists('header_remove')) {
header_remove('Last-Modified');
header_remove('Expires');
header_remove('Cache-Control');
@ -46,7 +46,7 @@ function photo_init(App $a) {
$default = 'images/person-175.jpg';
if(isset($type)) {
if (isset($type)) {
/**
@ -80,23 +80,22 @@ function photo_init(App $a) {
$data = $r[0]['data'];
$mimetype = $r[0]['type'];
}
if(! isset($data)) {
if (! isset($data)) {
$data = file_get_contents($default);
$mimetype = 'image/jpeg';
}
}
else {
} else {
/**
* Other photos
*/
$resolution = 0;
foreach( Photo::supportedTypes() as $m=>$e){
foreach ( Photo::supportedTypes() as $m=>$e){
$photo = str_replace(".$e",'',$photo);
}
if(substr($photo,-2,1) == '-') {
if (substr($photo,-2,1) == '-') {
$resolution = intval(substr($photo,-1,1));
$photo = substr($photo,0,-2);
}
@ -134,8 +133,8 @@ function photo_init(App $a) {
}
}
if(! isset($data)) {
if(isset($resolution)) {
if (! isset($data)) {
if (isset($resolution)) {
switch($resolution) {
case 4:
@ -161,8 +160,8 @@ function photo_init(App $a) {
// Resize only if its not a GIF
if ($mime != "image/gif") {
$ph = new Photo($data, $mimetype);
if($ph->is_valid()) {
if(isset($customres) && $customres > 0 && $customres < 500) {
if ($ph->is_valid()) {
if (isset($customres) && $customres > 0 && $customres < 500) {
$ph->scaleImageSquare($customres);
}
$data = $ph->imageString();
@ -170,14 +169,14 @@ function photo_init(App $a) {
}
}
if(function_exists('header_remove')) {
if (function_exists('header_remove')) {
header_remove('Pragma');
header_remove('pragma');
}
header("Content-type: ".$mimetype);
if($prvcachecontrol) {
if ($prvcachecontrol) {
// it is a private photo that they have no permission to view.
// tell the browser not to cache it, in case they authenticate

View file

@ -1356,7 +1356,7 @@ function photos_content(App $a) {
intval($owner_uid)
);
if (count($prvnxt)) {
if (dbm::is_result($prvnxt)) {
for($z = 0; $z < count($prvnxt); $z++) {
if ($prvnxt[$z]['resource-id'] == $ph[0]['resource-id']) {
$prv = $z - 1;
@ -1374,8 +1374,9 @@ function photos_content(App $a) {
}
}
if (count($ph) == 1)
if (count($ph) == 1) {
$hires = $lores = $ph[0];
}
if (count($ph) > 1) {
if ($ph[1]['scale'] == 2) {
// original is 640 or less, we can display it directly

View file

@ -216,7 +216,7 @@ function ping_init(App $a)
if ($all_events) {
$str_now = datetime_convert('UTC', $a->timezone, 'now', 'Y-m-d');
foreach($ev as $x) {
foreach ($ev as $x) {
$bd = false;
if ($x['type'] === 'birthday') {
$birthdays ++;
@ -486,7 +486,7 @@ function ping_get_notifications($uid)
function ping_format_xml_data($data, $sysnotify, $notifs, $sysmsgs, $sysmsgs_info, $groups_unseen, $forums_unseen)
{
$notifications = array();
foreach($notifs as $key => $notif) {
foreach ($notifs as $key => $notif) {
$notifications[$key . ':note'] = $notif['message'];
$notifications[$key . ':@attributes'] = array(

View file

@ -157,27 +157,27 @@ function poco_init(App $a) {
if (x($_GET,'updatedSince') AND !$global) {
$ret['updatedSince'] = false;
}
$ret['startIndex'] = (int) $startIndex;
$ret['itemsPerPage'] = (int) $itemsPerPage;
$ret['totalResults'] = (int) $totalResults;
$ret['entry'] = array();
$fields_ret = array(
'id' => false,
'displayName' => false,
'urls' => false,
'updated' => false,
'id' => false,
'displayName' => false,
'urls' => false,
'updated' => false,
'preferredUsername' => false,
'photos' => false,
'aboutMe' => false,
'currentLocation' => false,
'network' => false,
'gender' => false,
'tags' => false,
'address' => false,
'contactType' => false,
'generation' => false
'photos' => false,
'aboutMe' => false,
'currentLocation' => false,
'network' => false,
'gender' => false,
'tags' => false,
'address' => false,
'contactType' => false,
'generation' => false
);
if ((! x($_GET,'fields')) || ($_GET['fields'] === '@all')) {
@ -207,14 +207,17 @@ function poco_init(App $a) {
if (($rr['about'] == "") AND isset($rr['pabout'])) {
$rr['about'] = $rr['pabout'];
}
if ($rr['location'] == "") {
if (isset($rr['plocation'])) {
$rr['location'] = $rr['plocation'];
}
if (isset($rr['pregion']) AND ($rr['pregion'] != "")) {
if ($rr['location'] != "") {
$rr['location'] .= ", ";
}
$rr['location'] .= $rr['pregion'];
}
@ -292,6 +295,7 @@ function poco_init(App $a) {
} else {
$entry['updated'] = $rr['updated'];
}
$entry['updated'] = date("c", strtotime($entry['updated']));
}
if ($fields_ret['photos']) {
@ -345,6 +349,7 @@ function poco_init(App $a) {
if ($fields_ret['contactType']) {
$entry['contactType'] = intval($rr['contact-type']);
}
$ret['entry'][] = $entry;
}
} else {
@ -353,6 +358,7 @@ function poco_init(App $a) {
} else {
http_status_exit(500);
}
logger("End of poco", LOGGER_DEBUG);
if ($format === 'xml') {
@ -367,4 +373,5 @@ function poco_init(App $a) {
} else {
http_status_exit(500);
}
}

View file

@ -63,7 +63,7 @@ function poke_init(App $a) {
$target = $r[0];
if($parent) {
if ($parent) {
$r = q("SELECT `uri`, `private`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`
FROM `item` WHERE `id` = %d AND `parent` = %d AND `uid` = %d LIMIT 1",
intval($parent),
@ -129,7 +129,7 @@ function poke_init(App $a) {
$arr['object'] .= '</link></object>' . "\n";
$item_id = item_store($arr);
if($item_id) {
if ($item_id) {
//q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d",
// dbesc(App::get_baseurl() . '/display/' . $poster['nickname'] . '/' . $item_id),
// intval($uid),
@ -158,7 +158,7 @@ function poke_content(App $a) {
$name = '';
$id = '';
if(intval($_GET['c'])) {
if (intval($_GET['c'])) {
$r = q("SELECT `id`,`name` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($_GET['c']),
intval(local_user())
@ -185,9 +185,11 @@ function poke_content(App $a) {
$verbs = get_poke_verbs();
$shortlist = array();
foreach($verbs as $k => $v)
if($v[1] !== 'NOTRANSLATION')
foreach ($verbs as $k => $v) {
if ($v[1] !== 'NOTRANSLATION') {
$shortlist[] = array($k,$v[1]);
}
}
$tpl = get_markup_template('poke_content.tpl');

View file

@ -16,8 +16,7 @@ function post_post(App $a) {
if ($a->argc == 1) {
$bulk_delivery = true;
}
else {
} else {
$nickname = $a->argv[2];
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s'
AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
@ -34,15 +33,17 @@ function post_post(App $a) {
logger('mod-post: new zot: ' . $xml, LOGGER_DATA);
if(! $xml)
if (! $xml) {
http_status_exit(500);
}
$msg = zot_decode($importer,$xml);
logger('mod-post: decoded msg: ' . print_r($msg,true), LOGGER_DATA);
if(! is_array($msg))
if (! is_array($msg)) {
http_status_exit(500);
}
$ret = 0;
$ret = zot_incoming($bulk_delivery, $importer,$msg);

View file

@ -2,16 +2,15 @@
function pretheme_init(App $a) {
if($_REQUEST['theme']) {
if ($_REQUEST['theme']) {
$theme = $_REQUEST['theme'];
$info = get_theme_info($theme);
if($info) {
if ($info) {
// unfortunately there will be no translation for this string
$desc = $info['description'];
$version = $info['version'];
$credits = $info['credits'];
}
else {
} else {
$desc = '';
$version = '';
$credits = '';

View file

@ -12,7 +12,7 @@ function probe_content(App $a) {
$o .= '<br /><br />';
if(x($_GET,'addr')) {
if (x($_GET,'addr')) {
$addr = trim($_GET['addr']);
$res = probe_url($addr);

View file

@ -6,17 +6,17 @@ require_once('include/redir.php');
function profile_init(App $a) {
if(! x($a->page,'aside'))
if (! x($a->page,'aside')) {
$a->page['aside'] = '';
}
if($a->argc > 1)
if ($a->argc > 1) {
$which = htmlspecialchars($a->argv[1]);
else {
}else {
$r = q("select nickname from user where blocked = 0 and account_expired = 0 and account_removed = 0 and verified = 1 order by rand() limit 1");
if (dbm::is_result($r)) {
goaway(App::get_baseurl() . '/profile/' . $r[0]['nickname']);
}
else {
} else {
logger('profile error: mod_profile ' . $a->query_string, LOGGER_DEBUG);
notice( t('Requested profile is not available.') . EOL );
$a->error = 404;
@ -25,11 +25,10 @@ function profile_init(App $a) {
}
$profile = 0;
if((local_user()) && ($a->argc > 2) && ($a->argv[2] === 'view')) {
if ((local_user()) && ($a->argc > 2) && ($a->argv[2] === 'view')) {
$which = $a->user['nickname'];
$profile = htmlspecialchars($a->argv[1]);
}
else {
} else {
auto_redir($a, $which);
}
@ -38,7 +37,7 @@ function profile_init(App $a) {
$blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
$userblock = (($a->profile['hidewall'] && (! local_user()) && (! remote_user())) ? true : false);
if((x($a->profile,'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY)) {
if ((x($a->profile,'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY)) {
$a->page['htmlhead'] .= '<meta name="friendica.community" content="true" />';
}
if (x($a->profile,'openidserver')) {
@ -52,7 +51,7 @@ function profile_init(App $a) {
if ((! $blocked) && (! $userblock)) {
$keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : '');
$keywords = str_replace(array('#',',',' ',',,'),array('',' ',',',','),$keywords);
if(strlen($keywords))
if (strlen($keywords))
$a->page['htmlhead'] .= '<meta name="keywords" content="' . $keywords . '" />' . "\r\n" ;
}
@ -262,7 +261,7 @@ function profile_content(App $a, $update = 0) {
}
// now that we have the user settings, see if the theme forces
// a maximum item number which is lower then the user choice
if(($a->force_max_items > 0) && ($a->force_max_items < $itemspage_network))
if (($a->force_max_items > 0) && ($a->force_max_items < $itemspage_network))
$itemspage_network = $a->force_max_items;
$a->set_pager_itemspage($itemspage_network);
@ -289,8 +288,9 @@ function profile_content(App $a, $update = 0) {
$parents_str = '';
if (dbm::is_result($r)) {
foreach($r as $rr)
foreach ($r as $rr) {
$parents_arr[] = $rr['item_id'];
}
$parents_str = implode(', ', $parents_arr);
$items = q(item_query()." AND `item`.`uid` = %d
@ -305,13 +305,13 @@ function profile_content(App $a, $update = 0) {
$items = array();
}
if($is_owner && (! $update) && (! get_config('theme','hide_eventlist'))) {
if ($is_owner && (! $update) && (! get_config('theme','hide_eventlist'))) {
$o .= get_birthdays();
$o .= get_events();
}
if($is_owner) {
if ($is_owner) {
$r = q("UPDATE `item` SET `unseen` = 0
WHERE `wall` = 1 AND `unseen` = 1 AND `uid` = %d",
intval(local_user())

View file

@ -22,12 +22,12 @@ function profile_photo_post(App $a) {
check_form_security_token_redirectOnErr('/profile_photo', 'profile_photo');
if((x($_POST,'cropfinal')) && ($_POST['cropfinal'] == 1)) {
if ((x($_POST,'cropfinal')) && ($_POST['cropfinal'] == 1)) {
// unless proven otherwise
$is_default_profile = 1;
if($_REQUEST['profile']) {
if ($_REQUEST['profile']) {
$r = q("select id, `is-default` from profile where id = %d and uid = %d limit 1",
intval($_REQUEST['profile']),
intval(local_user())
@ -40,14 +40,14 @@ function profile_photo_post(App $a) {
// phase 2 - we have finished cropping
if($a->argc != 2) {
if ($a->argc != 2) {
notice( t('Image uploaded but image cropping failed.') . EOL );
return;
}
$image_id = $a->argv[1];
if(substr($image_id,-2,1) == '-') {
if (substr($image_id,-2,1) == '-') {
$scale = substr($image_id,-1,1);
$image_id = substr($image_id,0,-2);
}
@ -68,7 +68,7 @@ function profile_photo_post(App $a) {
$base_image = $r[0];
$im = new Photo($base_image['data'], $base_image['type']);
if($im->is_valid()) {
if ($im->is_valid()) {
$im->cropImage(175,$srcX,$srcY,$srcW,$srcH);
$r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 4, $is_default_profile);
@ -95,7 +95,7 @@ function profile_photo_post(App $a) {
// If setting for the default profile, unset the profile photo flag from any other photos I own
if($is_default_profile) {
if ($is_default_profile) {
$r = q("UPDATE `photo` SET `profile` = 0 WHERE `profile` = 1 AND `resource-id` != '%s' AND `uid` = %d",
dbesc($base_image['resource-id']),
intval(local_user())
@ -173,7 +173,7 @@ function profile_photo_post(App $a) {
}
if(! function_exists('profile_photo_content')) {
if (! function_exists('profile_photo_content')) {
function profile_photo_content(App $a) {
if (! local_user()) {
@ -183,10 +183,10 @@ function profile_photo_content(App $a) {
$newuser = false;
if($a->argc == 2 && $a->argv[1] === 'new')
if ($a->argc == 2 && $a->argv[1] === 'new')
$newuser = true;
if( $a->argv[1]=='use'){
if ( $a->argv[1]=='use'){
if ($a->argc<3){
notice( t('Permission denied.') . EOL );
return;
@ -206,7 +206,7 @@ function profile_photo_content(App $a) {
}
$havescale = false;
foreach ($r as $rr) {
if($rr['scale'] == 5)
if ($rr['scale'] == 5)
$havescale = true;
}
@ -245,7 +245,7 @@ function profile_photo_content(App $a) {
);
if(! x($a->config,'imagecrop')) {
if (! x($a->config,'imagecrop')) {
$tpl = get_markup_template('profile_photo.tpl');
@ -283,7 +283,7 @@ function profile_photo_content(App $a) {
}}
if(! function_exists('profile_photo_crop_ui_head')) {
if (! function_exists('profile_photo_crop_ui_head')) {
function profile_photo_crop_ui_head(App $a, $ph) {
$max_length = get_config('system','max_image_length');
if (! $max_length) {

View file

@ -10,7 +10,7 @@ function profiles_init(App $a) {
return;
}
if(($a->argc > 2) && ($a->argv[1] === "drop") && intval($a->argv[2])) {
if (($a->argc > 2) && ($a->argv[1] === "drop") && intval($a->argv[2])) {
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d AND `is-default` = 0 LIMIT 1",
intval($a->argv[2]),
intval(local_user())
@ -46,7 +46,7 @@ function profiles_init(App $a) {
if(($a->argc > 1) && ($a->argv[1] === 'new')) {
if (($a->argc > 1) && ($a->argv[1] === 'new')) {
check_form_security_token_redirectOnErr('/profiles', 'profile_new', 't');
@ -74,13 +74,13 @@ function profiles_init(App $a) {
);
info( t('New profile created.') . EOL);
if(count($r3) == 1)
if (count($r3) == 1)
goaway('profiles/'.$r3[0]['id']);
goaway('profiles');
}
if(($a->argc > 2) && ($a->argv[1] === 'clone')) {
if (($a->argc > 2) && ($a->argv[1] === 'clone')) {
check_form_security_token_redirectOnErr('/profiles', 'profile_clone', 't');
@ -93,7 +93,7 @@ function profiles_init(App $a) {
intval(local_user()),
intval($a->argv[2])
);
if(! dbm::is_result($r1)) {
if (! dbm::is_result($r1)) {
notice( t('Profile unavailable to clone.') . EOL);
killme();
return;
@ -126,7 +126,7 @@ function profiles_init(App $a) {
}
if(($a->argc > 1) && (intval($a->argv[1]))) {
if (($a->argc > 1) && (intval($a->argv[1]))) {
$r = q("SELECT id FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($a->argv[1]),
intval(local_user())
@ -172,12 +172,12 @@ function profiles_post(App $a) {
call_hooks('profile_post', $_POST);
if(($a->argc > 1) && ($a->argv[1] !== "new") && intval($a->argv[1])) {
if (($a->argc > 1) && ($a->argv[1] !== "new") && intval($a->argv[1])) {
$orig = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($a->argv[1]),
intval(local_user())
);
if(! count($orig)) {
if (! count($orig)) {
notice( t('Profile not found.') . EOL);
return;
}
@ -187,7 +187,7 @@ function profiles_post(App $a) {
$is_default = (($orig[0]['is-default']) ? 1 : 0);
$profile_name = notags(trim($_POST['profile_name']));
if(! strlen($profile_name)) {
if (! strlen($profile_name)) {
notice( t('Profile Name is required.') . EOL);
return;
}
@ -195,27 +195,27 @@ function profiles_post(App $a) {
$dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0000-00-00'; // FIXME: Needs to be validated?
$y = substr($dob,0,4);
if((! ctype_digit($y)) || ($y < 1900))
if ((! ctype_digit($y)) || ($y < 1900))
$ignore_year = true;
else
$ignore_year = false;
if($dob != '0000-00-00') {
if(strpos($dob,'0000-') === 0) {
if ($dob != '0000-00-00') {
if (strpos($dob,'0000-') === 0) {
$ignore_year = true;
$dob = substr($dob,5);
}
$dob = datetime_convert('UTC','UTC',(($ignore_year) ? '1900-' . $dob : $dob),(($ignore_year) ? 'm-d' : 'Y-m-d'));
if($ignore_year)
if ($ignore_year)
$dob = '0000-' . $dob;
}
$name = notags(trim($_POST['name']));
if(! strlen($name)) {
if (! strlen($name)) {
$name = '[No Name]';
}
if($orig[0]['name'] != $name)
if ($orig[0]['name'] != $name)
$namechanged = true;
@ -234,7 +234,7 @@ function profiles_post(App $a) {
$with = ((x($_POST,'with')) ? notags(trim($_POST['with'])) : '');
if(! strlen($howlong))
if (! strlen($howlong))
$howlong = '0000-00-00 00:00:00';
else
$howlong = datetime_convert(date_default_timezone_get(),'UTC',$howlong);
@ -243,20 +243,20 @@ function profiles_post(App $a) {
$withchanged = false;
if(strlen($with)) {
if($with != strip_tags($orig[0]['with'])) {
if (strlen($with)) {
if ($with != strip_tags($orig[0]['with'])) {
$withchanged = true;
$prf = '';
$lookup = $with;
if(strpos($lookup,'@') === 0)
if (strpos($lookup,'@') === 0)
$lookup = substr($lookup,1);
$lookup = str_replace('_',' ', $lookup);
if(strpos($lookup,'@') || (strpos($lookup,'http://'))) {
if (strpos($lookup,'@') || (strpos($lookup,'http://'))) {
$newname = $lookup;
$links = @Probe::lrdd($lookup);
if(count($links)) {
foreach($links as $link) {
if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') {
if (count($links)) {
foreach ($links as $link) {
if ($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') {
$prf = $link['@attributes']['href'];
}
}
@ -280,7 +280,7 @@ function profiles_post(App $a) {
dbesc($newname),
intval(local_user())
);
if(! $r) {
if (! $r) {
$r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
dbesc($lookup),
intval(local_user())
@ -292,9 +292,9 @@ function profiles_post(App $a) {
}
}
if($prf) {
if ($prf) {
$with = str_replace($lookup,'<a href="' . $prf . '">' . $newname . '</a>', $with);
if(strpos($with,'@') === 0)
if (strpos($with,'@') === 0)
$with = substr($with,1);
}
}
@ -333,61 +333,61 @@ function profiles_post(App $a) {
$changes = array();
$value = '';
if($is_default) {
if($marital != $orig[0]['marital']) {
if ($is_default) {
if ($marital != $orig[0]['marital']) {
$changes[] = '[color=#ff0000]&hearts;[/color] ' . t('Marital Status');
$value = $marital;
}
if($withchanged) {
if ($withchanged) {
$changes[] = '[color=#ff0000]&hearts;[/color] ' . t('Romantic Partner');
$value = strip_tags($with);
}
if($likes != $orig[0]['likes']) {
if ($likes != $orig[0]['likes']) {
$changes[] = t('Likes');
$value = $likes;
}
if($dislikes != $orig[0]['dislikes']) {
if ($dislikes != $orig[0]['dislikes']) {
$changes[] = t('Dislikes');
$value = $dislikes;
}
if($work != $orig[0]['work']) {
if ($work != $orig[0]['work']) {
$changes[] = t('Work/Employment');
}
if($religion != $orig[0]['religion']) {
if ($religion != $orig[0]['religion']) {
$changes[] = t('Religion');
$value = $religion;
}
if($politic != $orig[0]['politic']) {
if ($politic != $orig[0]['politic']) {
$changes[] = t('Political Views');
$value = $politic;
}
if($gender != $orig[0]['gender']) {
if ($gender != $orig[0]['gender']) {
$changes[] = t('Gender');
$value = $gender;
}
if($sexual != $orig[0]['sexual']) {
if ($sexual != $orig[0]['sexual']) {
$changes[] = t('Sexual Preference');
$value = $sexual;
}
if($xmpp != $orig[0]['xmpp']) {
if ($xmpp != $orig[0]['xmpp']) {
$changes[] = t('XMPP');
$value = $xmpp;
}
if($homepage != $orig[0]['homepage']) {
if ($homepage != $orig[0]['homepage']) {
$changes[] = t('Homepage');
$value = $homepage;
}
if($interest != $orig[0]['interest']) {
if ($interest != $orig[0]['interest']) {
$changes[] = t('Interests');
$value = $interest;
}
if($address != $orig[0]['address']) {
if ($address != $orig[0]['address']) {
$changes[] = t('Address');
// New address not sent in notifications, potential privacy issues
// in case this leaks to unintended recipients. Yes, it's in the public
// profile but that doesn't mean we have to broadcast it to everybody.
}
if($locality != $orig[0]['locality'] || $region != $orig[0]['region']
if ($locality != $orig[0]['locality'] || $region != $orig[0]['region']
|| $country_name != $orig[0]['country-name']) {
$changes[] = t('Location');
$comma1 = ((($locality) && ($region || $country_name)) ? ', ' : ' ');
@ -520,13 +520,13 @@ function profiles_post(App $a) {
function profile_activity($changed, $value) {
$a = get_app();
if(! local_user() || ! is_array($changed) || ! count($changed))
if (! local_user() || ! is_array($changed) || ! count($changed))
return;
if($a->user['hidewall'] || get_config('system','block_public'))
if ($a->user['hidewall'] || get_config('system','block_public'))
return;
if(! get_pconfig(local_user(),'system','post_profilechange'))
if (! get_pconfig(local_user(),'system','post_profilechange'))
return;
require_once('include/items.php');
@ -535,7 +535,7 @@ function profile_activity($changed, $value) {
intval(local_user())
);
if(! count($self))
if (! count($self))
return;
$arr = array();
@ -560,8 +560,8 @@ function profile_activity($changed, $value) {
$changes = '';
$t = count($changed);
$z = 0;
foreach($changed as $ch) {
if(strlen($changes)) {
foreach ($changed as $ch) {
if (strlen($changes)) {
if ($z == ($t - 1))
$changes .= t(' and ');
else
@ -573,7 +573,7 @@ function profile_activity($changed, $value) {
$prof = '[url=' . $self[0]['url'] . '?tab=profile' . ']' . t('public profile') . '[/url]';
if($t == 1 && strlen($value)) {
if ($t == 1 && strlen($value)) {
$message = sprintf( t('%1$s changed %2$s to &ldquo;%3$s&rdquo;'), $A, $changes, $value);
$message .= "\n\n" . sprintf( t(' - Visit %1$s\'s %2$s'), $A, $prof);
}
@ -611,7 +611,7 @@ function profiles_content(App $a) {
$o = '';
if(($a->argc > 1) && (intval($a->argv[1]))) {
if (($a->argc > 1) && (intval($a->argv[1]))) {
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($a->argv[1]),
intval(local_user())
@ -623,7 +623,6 @@ function profiles_content(App $a) {
require_once('include/profile_selectors.php');
$a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array(
'$baseurl' => App::get_baseurl(true),
));
@ -653,7 +652,7 @@ function profiles_content(App $a) {
$detailled_profile = (get_pconfig(local_user(),'system','detailled_profile') AND $personal_account);
$f = get_config('system','birthday_input_format');
if(! $f)
if (! $f)
$f = 'ymd';
$is_default = (($r[0]['is-default']) ? 1 : 0);
@ -755,7 +754,7 @@ function profiles_content(App $a) {
else {
//If we don't support multi profiles, don't display this list.
if(!feature_enabled(local_user(),'multi_profiles')){
if (!feature_enabled(local_user(),'multi_profiles')){
$r = q(
"SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1",
local_user()

View file

@ -22,7 +22,7 @@ function profperm_content(App $a) {
}
if($a->argc < 2) {
if ($a->argc < 2) {
notice( t('Invalid profile identifier.') . EOL );
return;
}
@ -30,13 +30,13 @@ function profperm_content(App $a) {
// Switch to text mod interface if we have more than 'n' contacts or group members
$switchtotext = get_pconfig(local_user(),'system','groupedit_image_limit');
if($switchtotext === false)
if ($switchtotext === false)
$switchtotext = get_config('system','groupedit_image_limit');
if($switchtotext === false)
if ($switchtotext === false)
$switchtotext = 400;
if(($a->argc > 2) && intval($a->argv[1]) && intval($a->argv[2])) {
if (($a->argc > 2) && intval($a->argv[1]) && intval($a->argv[2])) {
$r = q("SELECT `id` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `self` = 0
AND `network` = '%s' AND `id` = %d AND `uid` = %d LIMIT 1",
dbesc(NETWORK_DFRN),
@ -48,7 +48,7 @@ function profperm_content(App $a) {
}
if(($a->argc > 1) && (intval($a->argv[1]))) {
if (($a->argc > 1) && (intval($a->argv[1]))) {
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d AND `is-default` = 0 LIMIT 1",
intval($a->argv[1]),
intval(local_user())
@ -66,13 +66,13 @@ function profperm_content(App $a) {
$ingroup = array();
if (dbm::is_result($r))
foreach($r as $member)
foreach ($r as $member)
$ingroup[] = $member['id'];
$members = $r;
if($change) {
if(in_array($change,$ingroup)) {
if ($change) {
if (in_array($change,$ingroup)) {
q("UPDATE `contact` SET `profile-id` = 0 WHERE `id` = %d AND `uid` = %d",
intval($change),
intval(local_user())
@ -96,7 +96,7 @@ function profperm_content(App $a) {
$ingroup = array();
if (dbm::is_result($r))
foreach($r as $member)
foreach ($r as $member)
$ingroup[] = $member['id'];
}
@ -109,7 +109,7 @@ function profperm_content(App $a) {
}
$o .= '<div id="prof-update-wrapper">';
if($change)
if ($change)
$o = '';
$o .= '<div id="prof-members-title">';
@ -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 .= '</div><div id="prof-all-contacts-end"></div>';
if($change) {
if ($change) {
echo $o;
killme();
}

View file

@ -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,'<?xml')) {
// if (! stristr($xml,'<?xml')) {
// logger('pubsub_post: bad xml');
// hub_post_return();
// }
@ -142,8 +142,9 @@ function pubsub_post(App $a) {
// we have no way to match Diaspora guid's with atom post id's and could get duplicates.
// we'll assume that direct delivery is robust (and this is a bad assumption, but the duplicates are messy).
if($r[0]['network'] === NETWORK_DIASPORA)
if ($r[0]['network'] === NETWORK_DIASPORA) {
hub_post_return();
}
$feedhub = '';

View file

@ -21,7 +21,7 @@ function pubsubhubbub_init(App $a) {
// [hub_secret] => 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');
@ -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);

View file

@ -10,12 +10,14 @@ 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();
@ -25,9 +27,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') " : "");
@ -40,9 +42,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);

View file

@ -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);

View file

@ -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;
}

View file

@ -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 = '<input type="hidden" name="profile_publish_reg" value="1" />';
}
else {

View file

@ -54,7 +54,7 @@ function user_allow($hash) {
pop_lang();
if($res) {
if ($res) {
info( t('Account approved.') . EOL );
return true;
}
@ -72,8 +72,9 @@ 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'])

View file

@ -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);

View file

@ -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);

View file

@ -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);
}
@ -487,7 +487,7 @@ 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) {
$err .= t(' Please use a shorter name.');
@ -511,7 +511,7 @@ function settings_post(App $a) {
$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')) && (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)) {
@ -727,7 +727,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",
@ -865,10 +865,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()
);
@ -1176,7 +1176,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 = '<input type="hidden" name="profile_in_directory" value="1" />';
} else {
$profile_in_dir = replace_macros($opt_tpl,array(

View file

@ -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) {

View file

@ -10,12 +10,11 @@ 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);
}
}

View file

@ -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']),

View file

@ -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'])

View file

@ -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;
}*/

View file

@ -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,14 +19,15 @@ 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(! count($user))
if (!dbm::is_result($user)) {
return;
}
$a->data['user'] = $user[0];
$a->profile_uid = $user[0]['uid'];
@ -52,35 +53,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 .= '<div id="sidebar-photos-albums" class="widget">';
$o .= '<h3>' . '<a href="' . App::get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '">' . t('Photo Albums') . '</a></h3>';
$o .= '<ul>';
foreach($albums as $album) {
foreach ($albums as $album) {
// don't show contact photos. We once translated this name, but then you could still access it under
// a different language setting. Now we store the name in English and check in English (and translated for legacy albums).
if((! strlen($album['album'])) || ($album['album'] === 'Contact Photos') || ($album['album'] === t('Contact Photos')))
if ((! strlen($album['album'])) || ($album['album'] === 'Contact Photos') || ($album['album'] === t('Contact Photos')))
continue;
$o .= '<li>' . '<a href="photos/' . $a->argv[1] . '/album/' . bin2hex($album['album']) . '" >' . $album['album'] . '</a></li>';
}
$o .= '</ul>';
}
if(local_user() && $a->data['user']['uid'] == local_user()) {
if (local_user() && $a->data['user']['uid'] == local_user()) {
$o .= '<div id="photo-albums-upload-link"><a href="' . App::get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/upload" >' .t('Upload New Photos') . '</a></div>';
}
$o .= '</div>';
}*/
if(! x($a->page,'aside'))
if (! x($a->page,'aside'))
$a->page['aside'] = '';
$a->page['aside'] .= $vcard_widget;
@ -194,7 +195,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;
}
@ -204,7 +205,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;
}
@ -217,16 +218,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';
@ -245,19 +246,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),
@ -275,17 +276,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),
@ -298,14 +299,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;
}
@ -323,13 +324,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
@ -337,7 +338,7 @@ function videos_content(App $a) {
}
if($datatype === 'video') {
if ($datatype === 'video') {
return; // no single video view for now

View file

@ -9,8 +9,9 @@ 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();

View file

@ -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,10 +90,11 @@ 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);

View file

@ -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",'<br />',$r[0]['body']);
killme();
} else {

View file

@ -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));

View file

@ -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);
}

View file

@ -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,16 +93,19 @@ 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($r[0]['total'] > $user['cntunkmail']) {
if (!dbm::is_result($r)) {
///@TODO Output message to use of failed query
return;
} elseif ($r[0]['total'] > $user['cntunkmail']) {
notice( sprintf( t('Number of daily wall messages for %s exceeded. Message failed.', $user['username'])));
return;
}

View file

@ -11,7 +11,7 @@ function webfinger_content(App $a) {
$o .= '<br /><br />';
if(x($_GET,'addr')) {
if (x($_GET,'addr')) {
$addr = trim($_GET['addr']);
$res = Probe::lrdd($addr);
$o .= '<pre>';

View file

@ -6,14 +6,15 @@ 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,'@'));
}