Ejemplo n.º 1
0
 public function view()
 {
     if ($_GET['id'] && is_numeric($_GET['id'])) {
         $clinic = ads::load_clinics(array('id' => intval($_GET['id'])));
         $user_data = Register::get_instance()->get_current_user();
         if ($clinic[0]['status'] == 1 || $clinic[0]['user_id'] == $user_data['id'] || $user_data['status'] == 10) {
             if ($clinic[0]['user_id'] == $user_data['id'] || $user_data['status'] == 10) {
                 $this->registry->template->edit = 1;
             } else {
                 $this->registry->template->edit = 0;
             }
             $clinic[0]['phone1'] = substr($clinic[0]['phone1'], 1);
             $clinic[0]['phone2'] = substr($clinic[0]['phone2'], 1);
             $clinic[0]['phone3'] = substr($clinic[0]['phone3'], 1);
             $this->registry->template->clinic = $clinic[0];
             $this->registry->template->title = 'Pets | ' . $clinic[0]['name'];
             $this->registry->template->show('view_clinic');
         } else {
             header("Location: /index");
         }
     } else {
         header("Location: /index");
     }
 }
Ejemplo n.º 2
0
 public function search_cp()
 {
     if (Login::get_instance()->check_login() == 'valid') {
         $user_data = Register::get_instance()->get_current_user();
         if ($user_data['status'] != 10) {
             exit;
         }
         if ($_POST) {
             if ($_POST['type'] == 'users') {
                 if (is_numeric($_POST['value'])) {
                     $settings['id'] = intval($_POST['value']);
                 } else {
                     if (Validation::email($_POST['value'])) {
                         $settings['email'] = addslashes($_POST['value']);
                     } else {
                         echo '';
                         exit;
                     }
                 }
                 $users = Register::get_instance()->get_user($settings);
                 echo empty($users) ? '' : Temp::users_container_rows($users);
             } else {
                 if ($_POST['type'] == 'ads') {
                     if (is_numeric($_POST['value'])) {
                         $settings['id'] = intval($_POST['value']);
                     } else {
                         $settings['words'] = addslashes($_POST['value']);
                     }
                     if (empty($_POST['value'])) {
                         echo '';
                         exit;
                     }
                     $settings['limit'] = 'no';
                     $ads = ads::load_ads(0, $settings);
                     echo empty($ads) ? '' : Temp::ad_container_rows($ads);
                 } else {
                     if ($_POST['type'] == 'clinics') {
                         if (is_numeric($_POST['value'])) {
                             $settings['id'] = intval($_POST['value']);
                         } else {
                             $settings['words'] = addslashes($_POST['value']);
                         }
                         if (empty($_POST['value'])) {
                             echo '';
                             exit;
                         }
                         $settings['limit'] = 'no';
                         $clinics = ads::load_clinics($settings);
                         echo empty($clinics) ? '' : Temp::ad_container_rows($clinics, 2);
                     }
                 }
             }
         }
     }
 }