Esempio n. 1
0
 public function deleteAction()
 {
     $registry = Zend_Registry::getInstance();
     $service = new Ml_Model_Service();
     $timecheck = new Ml_Model_Timecheck();
     $share = Ml_Model_Share::getInstance();
     $people = Ml_Model_People::getInstance();
     $service->putString("WARNING!\n========\n");
     $service->requestConfirmAction("Delete share");
     $timecheck->reset();
     $shareId = $service->getInput("Delete share of ID?");
     $timecheck->check(60);
     $timecheck->reset();
     $shareInfo = $share->getById($shareId);
     if (!is_array($shareInfo)) {
         die("Share not found.\n");
     }
     $service->putString(print_r($shareInfo, true));
     $userInfo = $people->getById($shareInfo['byUid']);
     $service->putString("By user alias: " . $userInfo['alias'] . "\n");
     $service->requestConfirmAction("Delete this share");
     $share->deleteShare($shareInfo, $userInfo);
     echo "Share deleted!\n";
 }
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");
 }
Esempio n. 3
0
 public function deleteAction()
 {
     $registry = Zend_Registry::getInstance();
     $service = new Ml_Model_Service();
     $timecheck = new Ml_Model_Timecheck();
     $people = Ml_Model_People::getInstance();
     $peopleDelete = Ml_Model_PeopleDelete::getInstance();
     $service->putString("WARNING!\n========\n");
     $service->putString("DON'T type the user data. Use COPY/PASTE.\n");
     $service->requestConfirmAction("Delete user");
     $timecheck->reset();
     $enteredUserId = $service->getInput("Delete User of id: ");
     $timecheck->check(60);
     $timecheck->reset();
     $enteredUserAlias = $service->getInput("Delete User of alias: ");
     $timecheck->check(40);
     $userInfo = $people->getById($enteredUserId);
     if (!is_array($userInfo)) {
         die("User Not Found by ID.\n");
     }
     if ($userInfo['id'] != $enteredUserId) {
         throw new Exception("Wrong ID retrieved?");
     }
     if ($userInfo['alias'] != $enteredUserAlias) {
         die("Alias does NOT match user id. Please, be careful.\n");
     }
     $service->putString("USER INFORMATION\n=================\n");
     $service->putString(print_r($userInfo, true));
     $timecheck->reset();
     $service->requestConfirmAction("Please DO confirm alias, email, name and id.\n\nDelete this user");
     $service->requestConfirmAction("Confirm");
     $timecheck->check(180);
     $service->putString("Sleeping for three seconds.\nAfter that, deleting the user. Use ^C to cancel\n");
     sleep(3);
     $registry->set("canDeleteAccount", true);
     $peopleDelete->deleteAccount($userInfo, sha1(serialize($userInfo)));
     echo "User account deleted.\n";
 }
Esempio n. 4
0
 public function apisignedrequestAction()
 {
     $service = new Ml_Model_Service();
     $this->_helper->loadOauthstore->setinstance();
     require EXTERNAL_LIBRARY_PATH . '/oauth-php/library/OAuthRequester.php';
     $userId = $service->getInput("User ID");
     $requestUri = $service->getInput("Request URI");
     $httpMethod = $service->getInput("HTTP Method");
     // Parameters, appended to the request depending on the request method.
     // Will become the POST body or the GET query string.
     $numOfParams = $service->getInput("Number of params");
     $params = array();
     for ($n = 0; $n < $numOfParams; $n++) {
         $param = $service->getInput("Param");
         $value = $service->getInput("Value");
         $params[$param] = $value;
     }
     // Obtain a request object for the request we want to make
     $req = new OAuthRequester($requestUri, $httpMethod, $params);
     try {
         // Sign the request, perform a curl request and return the results,
         //throws OAuthException exception on an error
         $result = $req->doRequest($userId);
         //$result is an array with the content:
         //array ('code'=>int, 'headers'=>array(), 'body'=>string)
         print_r($result);
     } catch (Exception $e) {
         print_r($e->getMessage());
     }
 }