/** * Delegates requested action to appropriate method. * * @param int $id Queue item id. * @param string $action Requested action. * * @return \Symfony\Component\HttpFoundation\Response */ public function item_action($id, $action) { $this->load_item($id); if (!$this->check_auth($action)) { return $this->helper->needs_auth(); } $this->display->assign_global_vars(); $this->generate_navigation('queue'); $valid_action = false; $check_actions = array('in_progress', 'no_progress', 'tested', 'not_tested', 'rebuild'); if (in_array($action, $check_actions) && !check_link_hash($this->request->variable('hash', ''), 'queue_action')) { return $this->helper->error('PAGE_REQUEST_INVALID'); } // Only allow these actions to run if the queue item is still open. if ($this->queue->queue_status > 0) { $valid_action = true; switch ($action) { case 'in_progress': $this->queue->in_progress(); break; case 'no_progress': $this->queue->no_progress(); break; case 'tested': $this->queue->change_tested_mark(true); break; case 'not_tested': $this->queue->change_tested_mark(false); break; case 'move': $this->move(); break; case 'allow_author_repack': return $this->allow_author_repack(); break; case 'approve': return $this->approve(); break; case 'deny': return $this->deny(); break; default: $valid_action = false; } } switch ($action) { case 'rebuild': $this->queue->update_first_queue_post(); break; case 'reply': case 'quote': case 'edit': case 'quick_edit': case 'delete': case 'undelete': return $this->posting($action); break; default: if (!$valid_action) { return $this->helper->error('INVALID_ACTION', 404); } } redirect($this->queue->get_url()); }