Ejemplo n.º 1
0
 public function index()
 {
     //session_start();
     //Login::get_instance()->logout();
     /* $file = fopen(__dir__ . "/temp.txt", "r");
               while (!feof($file)) {
               $line = fgets($file);
               $time = time();
               $date = TimeTools::get_time_id(date('Y-m-d'));
               $table = db::$tables['pets'];
               $query = "INSERT INTO $table VALUES(null,'$line','2','4','$time','$date')";
               $stmt = db::getInstance()->query($query);
               # do same stuff with the $line
               }
               fclose($file);
     
               /* $xml = simplexml_load_file(__SITE_PATH . '/controller/egypt.xml');
               foreach ($xml->children() as $opt) {
               $att = $opt->attributes();
               $city = $att['label'];
               $table = db::$tables['cities'];
               $query = "INSERT INTO $table VALUES(null,'$city',3,'')";
               $stmt = db::getInstance()->query($query);
               $city_id = db::getInstance()->insertId();
               foreach ($opt->children() as $reg) {
               $reg = trim($reg);
               $table = db::$tables['regions'];
               $query = "INSERT INTO $table VALUES(null,'$reg','$city_id','3')";
               $stmt = db::getInstance()->query($query);
               }
               } // end foreach */
     $settings = array();
     $search = 0;
     if ($_GET) {
         if (isset($_GET['pt']) && is_numeric($_GET['pt'])) {
             $settings['pet_id'] = intval($_GET['pt']);
         }
         if (isset($_GET['c']) && is_numeric($_GET['c'])) {
             $settings['cat_id'] = intval($_GET['c']);
         }
         if (isset($_GET['ty']) && is_numeric($_GET['ty'])) {
             $settings['type'] = intval($_GET['ty']);
         }
         if (isset($_GET['p']) && is_numeric($_GET['p'])) {
             $settings['page'] = intval($_GET['p']);
         }
         if (isset($_GET['search_country']) && is_numeric($_GET['search_country'])) {
             $settings['country'] = intval($_GET['search_country']);
         }
         if (isset($_GET['search_city']) && is_numeric($_GET['search_city'])) {
             $settings['city'] = intval($_GET['search_city']);
         }
         if (isset($_GET['search_region']) && is_numeric($_GET['search_region'])) {
             $settings['region'] = intval($_GET['search_region']);
         }
         if (isset($_GET['words']) && !empty($_GET['words'])) {
             $settings['words'] = addslashes($_GET['words']);
         }
         if (isset($_GET['search_for']) && !empty($_GET['search_for'])) {
             $search = intval($_GET['search_for']);
         }
     }
     $settings['status'] = 1;
     $this->registry->template->settings = $settings;
     $this->registry->template->settings['search'] = $search;
     if ($search == 2) {
         $ads = ads::load_clinics($settings, 1);
     } else {
         $ads = ads::load_ads(1, $settings, 1);
     }
     $this->registry->template->ads = $ads['ads'];
     if ($ads['count'] > 18) {
         $this->registry->template->pagination = ads::pagination(ceil($ads['count'] / 18));
     }
     $this->registry->template->title = 'Home | Pets Services';
     $this->registry->template->search = $search;
     if ($_SESSION['d'] == 'abdouhabibi2080') {
         $this->registry->template->show('index');
         exit;
     } else {
         if ($_GET['d'] == 'abdouhabibi2080') {
             $_SESSION['d'] = 'abdouhabibi2080';
             $this->registry->template->show('index');
             exit;
         }
     }
     $this->registry->template->show('index');
 }