mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Admins/Screenshots
* allow empty captions on edit * set date of reputation reward to time of upload not approve
This commit is contained in:
@@ -1141,11 +1141,11 @@ class AjaxHandler
|
|||||||
// resp: ''
|
// resp: ''
|
||||||
private function admin_handleSSEditalt()
|
private function admin_handleSSEditalt()
|
||||||
{
|
{
|
||||||
if (!$this->get('id') || !$this->post('alt'))
|
if (!$this->get('id') || $this->post('alt') === null)
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
// doesn't need to be htmlEscaped, ths javascript does that
|
// doesn't need to be htmlEscaped, ths javascript does that
|
||||||
DB::Aowow()->query('UPDATE ?_screenshots SET caption = ? WHERE id = ?d', $this->post('alt'), $this->get('id'));
|
DB::Aowow()->query('UPDATE ?_screenshots SET caption = ? WHERE id = ?d', trim($this->post('alt')), $this->get('id'));
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -1167,7 +1167,7 @@ class AjaxHandler
|
|||||||
foreach ($ids as $id)
|
foreach ($ids as $id)
|
||||||
{
|
{
|
||||||
// must not be already approved
|
// must not be already approved
|
||||||
if ($_ = DB::Aowow()->selectCell('SELECT userIdOwner FROM ?_screenshots WHERE (status & ?d) = 0 AND id = ?d', CC_FLAG_APPROVED, $id))
|
if ($_ = DB::Aowow()->selectRow('SELECT userIdOwner, date FROM ?_screenshots WHERE (status & ?d) = 0 AND id = ?d', CC_FLAG_APPROVED, $id))
|
||||||
{
|
{
|
||||||
// should also error-log
|
// should also error-log
|
||||||
if (!file_exists(sprintf($path, 'pending', $id)))
|
if (!file_exists(sprintf($path, 'pending', $id)))
|
||||||
@@ -1209,7 +1209,7 @@ class AjaxHandler
|
|||||||
|
|
||||||
// set as approved in DB and gain rep (once!)
|
// set as approved in DB and gain rep (once!)
|
||||||
DB::Aowow()->query('UPDATE ?_screenshots SET status = ?d, userIdApprove = ?d WHERE id = ?d', CC_FLAG_APPROVED, User::$id, $id);
|
DB::Aowow()->query('UPDATE ?_screenshots SET status = ?d, userIdApprove = ?d WHERE id = ?d', CC_FLAG_APPROVED, User::$id, $id);
|
||||||
Util::gainSiteReputation($_, SITEREP_ACTION_UPLOAD, ['id' => $id, 'what' => 1]);
|
Util::gainSiteReputation($_['userIdOwner'], SITEREP_ACTION_UPLOAD, ['id' => $id, 'what' => 1, 'date' => $_['date']]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1477,7 +1477,7 @@ class Util
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
$x['sourceA'] = $miscData['id']; // screenshotId or videoId
|
$x['sourceA'] = $miscData['id']; // screenshotId or videoId
|
||||||
$x['sourceB'] = $miscData['what']; // screenshot or video
|
$x['sourceB'] = $miscData['what']; // screenshot:1 or video:NYD
|
||||||
$x['amount'] = CFG_REP_REWARD_UPLOAD;
|
$x['amount'] = CFG_REP_REWARD_UPLOAD;
|
||||||
break;
|
break;
|
||||||
case SITEREP_ACTION_GOOD_REPORT: // NYI
|
case SITEREP_ACTION_GOOD_REPORT: // NYI
|
||||||
@@ -1508,7 +1508,7 @@ class Util
|
|||||||
$x = array_merge($x, array(
|
$x = array_merge($x, array(
|
||||||
'userId' => $user,
|
'userId' => $user,
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
'date' => time()
|
'date' => !empty($miscData['date']) ? $miscData['date'] : time()
|
||||||
));
|
));
|
||||||
|
|
||||||
return DB::Aowow()->query('INSERT IGNORE INTO ?_account_reputation (?#) VALUES (?a)', array_keys($x), array_values($x));
|
return DB::Aowow()->query('INSERT IGNORE INTO ?_account_reputation (?#) VALUES (?a)', array_keys($x), array_values($x));
|
||||||
|
|||||||
Reference in New Issue
Block a user