more coding convention applied:
- added curly braces - added spaces where needed - $r only needs to be tested with dbm::is_result() - made SQL keywords all uper-case Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
parent
1c6535c0b4
commit
63e4750b4a
|
@ -136,8 +136,7 @@ function contacts_batch_actions(App $a) {
|
||||||
|
|
||||||
if (x($_SESSION,'return_url')) {
|
if (x($_SESSION,'return_url')) {
|
||||||
goaway('' . $_SESSION['return_url']);
|
goaway('' . $_SESSION['return_url']);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
goaway('contacts');
|
goaway('contacts');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,8 +193,10 @@ function contacts_post(App $a) {
|
||||||
$ffi_keyword_blacklist = escape_tags(trim($_POST['ffi_keyword_blacklist']));
|
$ffi_keyword_blacklist = escape_tags(trim($_POST['ffi_keyword_blacklist']));
|
||||||
|
|
||||||
$priority = intval($_POST['poll']);
|
$priority = intval($_POST['poll']);
|
||||||
if($priority > 5 || $priority < 0)
|
|
||||||
|
if ($priority > 5 || $priority < 0) {
|
||||||
$priority = 0;
|
$priority = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$info = escape_tags(trim($_POST['info']));
|
$info = escape_tags(trim($_POST['info']));
|
||||||
|
|
||||||
|
@ -212,17 +213,20 @@ function contacts_post(App $a) {
|
||||||
intval($contact_id),
|
intval($contact_id),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
if($r)
|
if ($r) {
|
||||||
info( t('Contact updated.') . EOL);
|
info( t('Contact updated.') . EOL);
|
||||||
else
|
} else {
|
||||||
notice( t('Failed to update contact record.') . EOL);
|
notice( t('Failed to update contact record.') . EOL);
|
||||||
|
}
|
||||||
|
|
||||||
$r = q("select * from contact where id = %d and uid = %d limit 1",
|
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||||
intval($contact_id),
|
intval($contact_id),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
if($r && dbm::is_result($r))
|
|
||||||
|
if (dbm::is_result($r)) {
|
||||||
$a->data['contact'] = $r[0];
|
$a->data['contact'] = $r[0];
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,11 @@ function crepair_init(App $a) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! x($a->page,'aside'))
|
if (! x($a->page,'aside')) {
|
||||||
$a->page['aside'] = '';
|
$a->page['aside'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
if($contact_id) {
|
if ($contact_id) {
|
||||||
$a->data['contact'] = $r[0];
|
$a->data['contact'] = $r[0];
|
||||||
$contact = $r[0];
|
$contact = $r[0];
|
||||||
profile_load($a, "", 0, get_contact_details_by_url($contact["url"]));
|
profile_load($a, "", 0, get_contact_details_by_url($contact["url"]));
|
||||||
|
@ -35,9 +36,12 @@ function crepair_post(App $a) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Init $r here if $cid is not set
|
||||||
|
$r = false;
|
||||||
|
|
||||||
$cid = (($a->argc > 1) ? intval($a->argv[1]) : 0);
|
$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",
|
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||||
intval($cid),
|
intval($cid),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
|
@ -78,18 +82,18 @@ function crepair_post(App $a) {
|
||||||
local_user()
|
local_user()
|
||||||
);
|
);
|
||||||
|
|
||||||
if($photo) {
|
if ($photo) {
|
||||||
logger('mod-crepair: updating photo from ' . $photo);
|
logger('mod-crepair: updating photo from ' . $photo);
|
||||||
require_once("include/Photo.php");
|
require_once("include/Photo.php");
|
||||||
|
|
||||||
update_contact_avatar($photo,local_user(),$contact['id']);
|
update_contact_avatar($photo,local_user(),$contact['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($r)
|
if ($r) {
|
||||||
info( t('Contact settings applied.') . EOL);
|
info( t('Contact settings applied.') . EOL);
|
||||||
else
|
} else {
|
||||||
notice( t('Contact update failed.') . EOL);
|
notice( t('Contact update failed.') . EOL);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,8 +251,9 @@ function message_content(App $a) {
|
||||||
// );
|
// );
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if($r)
|
if ($r) {
|
||||||
info( t('Conversation removed.') . EOL );
|
info( t('Conversation removed.') . EOL );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//goaway(App::get_baseurl(true) . '/message' );
|
//goaway(App::get_baseurl(true) . '/message' );
|
||||||
goaway($_SESSION['return_url']);
|
goaway($_SESSION['return_url']);
|
||||||
|
|
|
@ -34,8 +34,9 @@ function profiles_init(App $a) {
|
||||||
intval($a->argv[2]),
|
intval($a->argv[2]),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
if($r)
|
if ($r) {
|
||||||
info(t('Profile deleted.').EOL);
|
info(t('Profile deleted.').EOL);
|
||||||
|
}
|
||||||
|
|
||||||
goaway('profiles');
|
goaway('profiles');
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
|
@ -473,11 +474,12 @@ function profiles_post(App $a) {
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
|
|
||||||
if($r)
|
if ($r) {
|
||||||
info( t('Profile updated.') . EOL);
|
info( t('Profile updated.') . EOL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if($namechanged && $is_default) {
|
if ($namechanged && $is_default) {
|
||||||
$r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
|
$r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
|
||||||
dbesc($name),
|
dbesc($name),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
|
@ -489,7 +491,7 @@ function profiles_post(App $a) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($is_default) {
|
if ($is_default) {
|
||||||
$location = formatted_location(array("locality" => $locality, "region" => $region, "country-name" => $country_name));
|
$location = formatted_location(array("locality" => $locality, "region" => $region, "country-name" => $country_name));
|
||||||
|
|
||||||
q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` AND `uid` = %d",
|
q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` AND `uid` = %d",
|
||||||
|
|
|
@ -397,7 +397,7 @@ function settings_post(App $a) {
|
||||||
dbesc($password),
|
dbesc($password),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
if($r) {
|
if ($r) {
|
||||||
info( t('Password changed.') . EOL);
|
info( t('Password changed.') . EOL);
|
||||||
} else {
|
} else {
|
||||||
notice( t('Password update failed. Please try again.') . EOL);
|
notice( t('Password update failed. Please try again.') . EOL);
|
||||||
|
@ -602,8 +602,9 @@ function settings_post(App $a) {
|
||||||
dbesc($language),
|
dbesc($language),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
if($r)
|
if ($r) {
|
||||||
info( t('Settings updated.') . EOL);
|
info( t('Settings updated.') . EOL);
|
||||||
|
}
|
||||||
|
|
||||||
// clear session language
|
// clear session language
|
||||||
unset($_SESSION['language']);
|
unset($_SESSION['language']);
|
||||||
|
@ -622,7 +623,7 @@ function settings_post(App $a) {
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
if($name_change) {
|
if ($name_change) {
|
||||||
q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self`",
|
q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self`",
|
||||||
dbesc($username),
|
dbesc($username),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
|
|
|
@ -228,14 +228,14 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
||||||
if($width > 640 || $height > 640) {
|
if($width > 640 || $height > 640) {
|
||||||
$ph->scaleImage(640);
|
$ph->scaleImage(640);
|
||||||
$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, t('Wall Photos'), 1, 0, $defperm);
|
$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, t('Wall Photos'), 1, 0, $defperm);
|
||||||
if($r)
|
if ($r)
|
||||||
$smallest = 1;
|
$smallest = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($width > 320 || $height > 320) {
|
if ($width > 320 || $height > 320) {
|
||||||
$ph->scaleImage(320);
|
$ph->scaleImage(320);
|
||||||
$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, t('Wall Photos'), 2, 0, $defperm);
|
$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, t('Wall Photos'), 2, 0, $defperm);
|
||||||
if($r AND ($smallest == 0))
|
if ($r AND ($smallest == 0))
|
||||||
$smallest = 2;
|
$smallest = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
||||||
if (!$desktopmode) {
|
if (!$desktopmode) {
|
||||||
|
|
||||||
$r = q("SELECT `id`, `datasize`, `width`, `height`, `type` FROM `photo` WHERE `resource-id` = '%s' ORDER BY `width` DESC LIMIT 1", $hash);
|
$r = q("SELECT `id`, `datasize`, `width`, `height`, `type` FROM `photo` WHERE `resource-id` = '%s' ORDER BY `width` DESC LIMIT 1", $hash);
|
||||||
if (!$r){
|
if (!dbm::is_result($r)) {
|
||||||
if ($r_json) {
|
if ($r_json) {
|
||||||
echo json_encode(array('error'=>''));
|
echo json_encode(array('error'=>''));
|
||||||
killme();
|
killme();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user