Advertisement
Guest User

php

a guest
Jun 21st, 2014
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.26 KB | None | 0 0
  1. public function editAction($id)
  2.     {
  3.         $request = $this->request;
  4.         if (!$request->isPost()) {
  5.  
  6.             $id = $this->filter->sanitize($id, array("int"));
  7.  
  8.             $objects = Objects::findFirst('id="' . $id . '"');
  9.             if (!$objects) {
  10.                 $this->flash->error("Object was not found");
  11.                 return $this->forward("objects/index");
  12.             }
  13.             $this->view->setVar("objects", $objects);
  14.             $this->view->setVar("id", $objects->id);
  15. .
  16. .
  17. .
  18. }
  19.  
  20.  public function saveAction()
  21.     {
  22.         $request = $this->request;
  23.         if (!$request->isPost()) {
  24.             return $this->forward("objects/index");
  25.         }
  26.  
  27.         $id = $request->getPost("id", "int");
  28.         $objects = Objects::findFirst("id='$id'");
  29.         if ($objects == false) {
  30.             $this->flash->error("objects does not exist ".$id);
  31.             return $this->forward("objects/index");
  32.         }
  33.  
  34.  
  35.          $descriptiontest = $request->getPost("description", "striptags");
  36.          if(strlen($descriptiontest)<'300') {
  37.             $this->flash->error('<b>Long description</b>  
  38.                 must be longer than 300 characters!' );
  39.  
  40.             return $this->forward("objects/edit/".$id);
  41.          }
  42. .
  43. .
  44. .
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement