Esempio n. 1
0
 public function reportAction()
 {
     $auth = Zend_Auth::getInstance();
     $request = $this->getRequest();
     Ml_Model_Abuse::form();
     $abuse = Ml_Model_Abuse::getInstance();
     $form = $abuse->form();
     if ($request->isPost() && $form->isValid($request->getPost())) {
         $abuse->insert(array("referer" => $form->getValue("abuse_reference"), "description" => $form->getValue("abuse_description"), "byUid" => $auth->getIdentity(), "byAddr" => $_SERVER['REMOTE_ADDR']));
         $this->view->reportDone = true;
     }
     $this->view->abuseForm = $form;
 }
Esempio n. 2
0
 public function getAction()
 {
     $service = new Ml_Model_Service();
     $abuse = Ml_Model_Abuse::getInstance();
     $abusesNum = $abuse->getTotal();
     $service->putString("Number of abuses waiting for solution: {$abusesNum}\n\n");
     if ($abusesNum == 1) {
         $id = "";
     } else {
         $id = $service->getInput("Abuse ID (enter to unsolved oldest)? ");
     }
     if ($id == "" && $abusesNum == 0) {
         die;
     }
     if (empty($id)) {
         $data = $abuse->getLastOpen();
     } else {
         $data = $abuse->getById($id);
     }
     if (empty($data)) {
         die("Nothing to solve.\n");
     }
     $service->putString(print_r($data, true));
     $isSolved = $service->getInput("Change solution status (unsolved/solved/notabuse)? ");
     switch ($isSolved) {
         case "unsolved":
         case "solved":
         case "notabuse":
             break;
         default:
             die("Status not changed.\n");
             break;
     }
     $abuse->updateStatus($data['id'], $isSolved);
     $service->putString("Status changed to {$isSolved}\n");
 }