Exemplo n.º 1
0
 /**
  * 
  * Logout user session
  */
 public function action_logout()
 {
     Auth::instance()->logout(TRUE);
     if (Valid::URL($this->request->referrer()) and strpos($this->request->referrer(), 'oc-panel') === FALSE) {
         $redir = $this->request->referrer();
     } else {
         $redir = Route::url('oc-panel', array('controller' => 'auth', 'action' => 'login'));
     }
     $this->redirect($redir);
 }
Exemplo n.º 2
0
 private function process_image($ad, $image, $num)
 {
     //from URL
     if (Valid::URL($image)) {
         //download it, if takes more than 10 seconds...bad deal!
         $image_content = Core::curl_get_contents($image);
         //store if retrieved
         if ($image_content !== FALSE) {
             $file = DOCROOT . 'images/import_' . $ad->id_ad . '_' . $num . '.jpg';
             if (!File::write($file, $image_content)) {
                 return FALSE;
             }
         } else {
             return FALSE;
         }
     } elseif (file_exists(DOCROOT . $image)) {
         $file = DOCROOT . $image;
     }
     try {
         $is_image = getimagesize($file);
     } catch (Exception $e) {
         $is_image = FALSE;
     }
     //only if its image will be returned
     return $is_image !== FALSE ? $ad->save_image_file($file, $num) : FALSE;
 }