Esempio n. 1
0
     if (Permission::sufficient('developer')) {
         $reserve_as = Posts::validatePostAs();
         if (isset($reserve_as)) {
             $User = Users::get($reserve_as, 'name');
             if (empty($User)) {
                 Response::fail('User does not exist');
             }
             if (!Permission::sufficient('member', $User->role) && !isset($_POST['screwit'])) {
                 Response::fail('User does not have permission to reserve posts, continue anyway?', array('retry' => true));
             }
             $update['reserved_by'] = $User->id;
         }
     }
     $update['reserved_at'] = date('c');
     if (Permission::sufficient('developer')) {
         $reserved_at = Posts::validateReservedAt();
         if (isset($reserved_at)) {
             $update['reserved_at'] = date('c', $reserved_at);
         }
     }
 }
 if (empty($update) || !$Database->where('id', $Post->id)->update("{$type}s", $update)) {
     Response::fail('Nothing has been changed<br>If you tried to do something, then this is actually an error, which you should <a class="send-feedback">tell us</a> about.');
 }
 if (!empty($overdue)) {
     Logs::action('res_overtake', array_merge(array('id' => $Post->id, 'type' => $type), $overdue));
 }
 if (!empty($update['reserved_by'])) {
     Posts::clearTransferAttempts($Post, $type, 'snatch');
 } else {
     if (!empty($Post->reserved_by)) {