Ejemplo n.º 1
0
 public function action_searchPhotos($text)
 {
     $photos = new Model_Photo();
     $allPhotos = [];
     $this->view = new View("photos/searchPhotos");
     foreach ($photos->getAll() as $photo) {
         $p = new Model_Photo();
         $p->get($photo['_id']);
         if ($p->loaded && isset($p->bigPath) && isset($p->smallPath) && file_exists("assets/uploads/" . $p->bigPath) && file_exists("assets/uploads/" . $p->smallPath) && stripos(strtolower($p->title), strtolower($text)) !== false) {
             if (isset($p->autorUser)) {
                 $autor = new Model_User();
                 $autor->get($p->autorUser);
                 $p->autor = $autor->username;
                 if ($p->tryb == "private" && (!$this->user || $autor->username != $this->user->username)) {
                     continue;
                 }
             }
             $allPhotos[] = $p;
         }
     }
     $this->view->passData('photos', $allPhotos);
 }
Ejemplo n.º 2
0
 public function action_rememberedPhotos()
 {
     $this->content = new View("photos/remembered");
     $photos = new Model_Photo();
     $allPhotos = [];
     foreach ($photos->getAll() as $photo) {
         $p = new Model_Photo();
         $p->get($photo['_id']);
         if ($p->loaded && isset($p->bigPath) && isset($p->smallPath) && file_exists("assets/uploads/" . $p->bigPath) && file_exists("assets/uploads/" . $p->smallPath)) {
             if (isset($p->autorUser)) {
                 $autor = new Model_User();
                 $autor->get($p->autorUser);
                 $p->autor = $autor->username;
                 if ($p->tryb == "private" && (!$this->user || $autor->username != $this->user->username)) {
                     continue;
                 }
             }
             if (Session::get("remember_photo_" . $p->_id->{'$id'}, false)) {
                 $allPhotos[] = $p;
             }
         }
     }
     $this->content->passData('photos', $allPhotos);
 }