Some more "q" calls handled
This commit is contained in:
parent
fdf47ef88f
commit
56f033fa95
2 changed files with 4 additions and 23 deletions
|
@ -3727,15 +3727,8 @@ function api_direct_messages_destroy($type)
|
||||||
// add parent-uri to sql command if specified by calling app
|
// add parent-uri to sql command if specified by calling app
|
||||||
$sql_extra = ($parenturi != "" ? " AND `parent-uri` = '" . DBA::escape($parenturi) . "'" : "");
|
$sql_extra = ($parenturi != "" ? " AND `parent-uri` = '" . DBA::escape($parenturi) . "'" : "");
|
||||||
|
|
||||||
// get data of the specified message id
|
|
||||||
$r = q(
|
|
||||||
"SELECT `id` FROM `mail` WHERE `uid` = %d AND `id` = %d" . $sql_extra,
|
|
||||||
intval($uid),
|
|
||||||
intval($id)
|
|
||||||
);
|
|
||||||
|
|
||||||
// error message if specified id is not in database
|
// error message if specified id is not in database
|
||||||
if (!DBA::isResult($r)) {
|
if (!DBA::exists('mail', ["`uid` = ? AND `id` = ? " . $sql_extra, $uid, $id])) {
|
||||||
if ($verbose == "true") {
|
if ($verbose == "true") {
|
||||||
$answer = ['result' => 'error', 'message' => 'message id not in database'];
|
$answer = ['result' => 'error', 'message' => 'message id not in database'];
|
||||||
return api_format_data("direct_messages_delete", $type, ['$result' => $answer]);
|
return api_format_data("direct_messages_delete", $type, ['$result' => $answer]);
|
||||||
|
@ -3745,11 +3738,7 @@ function api_direct_messages_destroy($type)
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete message
|
// delete message
|
||||||
$result = q(
|
$result = DBA::delete('mail', ["`uid` = ? AND `id` = ? " . $sql_extra, $uid, $id]);
|
||||||
"DELETE FROM `mail` WHERE `uid` = %d AND `id` = %d" . $sql_extra,
|
|
||||||
intval($uid),
|
|
||||||
intval($id)
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($verbose == "true") {
|
if ($verbose == "true") {
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
|
|
@ -1101,11 +1101,7 @@ function photos_content(App $a)
|
||||||
// Display one photo
|
// Display one photo
|
||||||
if ($datatype === 'image') {
|
if ($datatype === 'image') {
|
||||||
// fetch image, item containing image, then comments
|
// fetch image, item containing image, then comments
|
||||||
$ph = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'
|
$ph = Photo::selectToArray([], ["`uid` = ? AND `resource-id` = ? " . $sql_extra, $owner_uid, $datum], ['order' => ['scale' => true]]);
|
||||||
$sql_extra ORDER BY `scale` ASC ",
|
|
||||||
intval($owner_uid),
|
|
||||||
DBA::escape($datum)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!DBA::isResult($ph)) {
|
if (!DBA::isResult($ph)) {
|
||||||
if (DBA::exists('photo', ['resource-id' => $datum, 'uid' => $owner_uid])) {
|
if (DBA::exists('photo', ['resource-id' => $datum, 'uid' => $owner_uid])) {
|
||||||
|
@ -1149,11 +1145,7 @@ function photos_content(App $a)
|
||||||
$order = 'DESC';
|
$order = 'DESC';
|
||||||
}
|
}
|
||||||
|
|
||||||
$prvnxt = q("SELECT `resource-id` FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `scale` = 0
|
$prvnxt = Photo::selectToArray(['resource-id'], ["`album` = ? AND `uid` = ? AND `scale` = ?" . $sql_extra, $ph[0]['album'], $owner_uid, 0]);
|
||||||
$sql_extra ORDER BY `created` $order ",
|
|
||||||
DBA::escape($ph[0]['album']),
|
|
||||||
intval($owner_uid)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (DBA::isResult($prvnxt)) {
|
if (DBA::isResult($prvnxt)) {
|
||||||
$prv = null;
|
$prv = null;
|
||||||
|
|
Loading…
Reference in a new issue