Browse Source

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>
pull/3112/head
Roland Häder 4 years ago
committed by Roland Haeder
parent
commit
63e4750b4a
No known key found for this signature in database GPG Key ID: B72F8185C6C7BD78
6 changed files with 38 additions and 26 deletions
  1. +11
    -7
      mod/contacts.php
  2. +11
    -7
      mod/crepair.php
  3. +2
    -1
      mod/message.php
  4. +6
    -4
      mod/profiles.php
  5. +4
    -3
      mod/settings.php
  6. +4
    -4
      mod/wall_upload.php

+ 11
- 7
mod/contacts.php View File

@ -136,8 +136,7 @@ function contacts_batch_actions(App $a) {
if (x($_SESSION,'return_url')) {
goaway('' . $_SESSION['return_url']);
}
else {
} else {
goaway('contacts');
}
@ -194,8 +193,10 @@ function contacts_post(App $a) {
$ffi_keyword_blacklist = escape_tags(trim($_POST['ffi_keyword_blacklist']));
$priority = intval($_POST['poll']);
if($priority > 5 || $priority < 0)
if ($priority > 5 || $priority < 0) {
$priority = 0;
}
$info = escape_tags(trim($_POST['info']));
@ -212,17 +213,20 @@ function contacts_post(App $a) {
intval($contact_id),
intval(local_user())
);
if($r)
if ($r) {
info( t('Contact updated.') . EOL);
else
} else {
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(local_user())
);
if($r && dbm::is_result($r))
if (dbm::is_result($r)) {
$a->data['contact'] = $r[0];
}
return;


+ 11
- 7
mod/crepair.php View File

@ -20,10 +20,11 @@ function crepair_init(App $a) {
}
}
if(! x($a->page,'aside'))
if (! x($a->page,'aside')) {
$a->page['aside'] = '';
}
if($contact_id) {
if ($contact_id) {
$a->data['contact'] = $r[0];
$contact = $r[0];
profile_load($a, "", 0, get_contact_details_by_url($contact["url"]));
@ -35,9 +36,12 @@ function crepair_post(App $a) {
return;
}
// Init $r here if $cid is not set
$r = false;
$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())
@ -78,18 +82,18 @@ function crepair_post(App $a) {
local_user()
);
if($photo) {
if ($photo) {
logger('mod-crepair: updating photo from ' . $photo);
require_once("include/Photo.php");
update_contact_avatar($photo,local_user(),$contact['id']);
}
if($r)
if ($r) {
info( t('Contact settings applied.') . EOL);
else
} else {
notice( t('Contact update failed.') . EOL);
}
return;
}


+ 2
- 1
mod/message.php View File

@ -251,8 +251,9 @@ function message_content(App $a) {
// );
//}
if($r)
if ($r) {
info( t('Conversation removed.') . EOL );
}
}
//goaway(App::get_baseurl(true) . '/message' );
goaway($_SESSION['return_url']);


+ 6
- 4
mod/profiles.php View File

@ -34,8 +34,9 @@ function profiles_init(App $a) {
intval($a->argv[2]),
intval(local_user())
);
if($r)
if ($r) {
info(t('Profile deleted.').EOL);
}
goaway('profiles');
return; // NOTREACHED
@ -473,11 +474,12 @@ function profiles_post(App $a) {
intval(local_user())
);
if($r)
if ($r) {
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",
dbesc($name),
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));
q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` AND `uid` = %d",


+ 4
- 3
mod/settings.php View File

@ -397,7 +397,7 @@ function settings_post(App $a) {
dbesc($password),
intval(local_user())
);
if($r) {
if ($r) {
info( t('Password changed.') . EOL);
} else {
notice( t('Password update failed. Please try again.') . EOL);
@ -602,8 +602,9 @@ function settings_post(App $a) {
dbesc($language),
intval(local_user())
);
if($r)
if ($r) {
info( t('Settings updated.') . EOL);
}
// clear session language
unset($_SESSION['language']);
@ -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`",
dbesc($username),
dbesc(datetime_convert()),


+ 4
- 4
mod/wall_upload.php View File

@ -228,14 +228,14 @@ function wall_upload_post(App $a, $desktopmode = true) {
if($width > 640 || $height > 640) {
$ph->scaleImage(640);
$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, t('Wall Photos'), 1, 0, $defperm);
if($r)
if ($r)
$smallest = 1;
}
if($width > 320 || $height > 320) {
if ($width > 320 || $height > 320) {
$ph->scaleImage(320);
$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, t('Wall Photos'), 2, 0, $defperm);
if($r AND ($smallest == 0))
if ($r AND ($smallest == 0))
$smallest = 2;
}
@ -244,7 +244,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
if (!$desktopmode) {
$r = q("SELECT `id`, `datasize`, `width`, `height`, `type` FROM `photo` WHERE `resource-id` = '%s' ORDER BY `width` DESC LIMIT 1", $hash);
if (!$r){
if (!dbm::is_result($r)) {
if ($r_json) {
echo json_encode(array('error'=>''));
killme();


Loading…
Cancel
Save