Exemple #1
0
 public function del($clinic_id)
 {
     if (Login::get_instance()->check_login() == 'valid') {
         $user_data = Register::get_instance()->get_current_user();
         if ($user_data['status'] != 10) {
             exit;
         }
         $ds = DIRECTORY_SEPARATOR;
         $storeFolder = '..' . $ds . 'views' . $ds . 'clinics_img';
         $targetPath = dirname(__FILE__) . $ds . $storeFolder . $ds;
         $images = glob($targetPath . $clinic_id . "_*.jpeg");
         foreach ($images as $image) {
             unlink($image);
         }
     }
 }
Exemple #2
0
 public function processad()
 {
     if (Login::get_instance()->check_login() == 'valid' && $_POST) {
         $errors['rt'] = array();
         $errors['md'] = array();
         $errors['lt'] = array();
         $ad_data = array();
         $user_data = Register::get_instance()->get_current_user();
         if (!empty($_POST['type']) && is_numeric($_POST['type'])) {
             $ad_data['type'] = intval($_POST['type']);
         } else {
             $errors['rt'][] = 'يجب اختيار نوع الاعلان';
         }
         if (!empty($_POST['pet']) && is_numeric($_POST['type'])) {
             $ad_data['pet_id'] = intval($_POST['pet']);
         } else {
             $errors['rt'][] = 'يجب اختيار نوع الحيوان';
         }
         if (!empty($_POST['title']) && trim($_POST['title']) != '') {
             $ad_data['title'] = addslashes($_POST['title']);
         } else {
             $errors['rt'][] = 'يجب ادخال عنوان للاعلان';
         }
         if (!empty($_POST['desc']) && trim($_POST['desc']) != '') {
             $ad_data['desc'] = addslashes($_POST['desc']);
         } else {
             $errors['md'][] = 'يجب ادخال معلومات الاعلان';
         }
         if (!empty($_POST['price']) && is_numeric($_POST['price'])) {
             $ad_data['price'] = $_POST['price'];
         } else {
             $errors['md'][] = 'يجب كتابة سعر';
         }
         if (!empty($_POST['currency']) && is_numeric($_POST['currency'])) {
             $ad_data['currency'] = intval($_POST['currency']);
         } else {
             $errors['md'][] = 'يجب اختيار العملة';
         }
         if (!empty($_POST['country'])) {
             $ad_data['country'] = intval($_POST['country']);
         } else {
             $errors['lt'][] = 'يجب اختيار الدولة';
             goto a;
         }
         if (!empty($_POST['city'])) {
             $ad_data['city'] = intval($_POST['city']);
         } else {
             $errors['lt'][] = 'يجب اختيار المدينة';
             goto a;
         }
         if (!empty($_POST['region'])) {
             $ad_data['region'] = intval($_POST['region']);
         } else {
             $errors['lt'] = 'يجب اختيار المنطقة';
         }
         $ad_data['cat_id'] = intval($_POST['cat']);
         $ad_data['user_id'] = $user_data['id'];
         $ad_data['time_added'] = time();
         $ad_data['date_added'] = TimeTools::get_time_id(date('Y-m-d'));
         a:
         if ($_POST['id'] != 'null') {
             if ($user_data['status'] != 10) {
                 $ad_data['status'] = 0;
             }
             $op = 'update';
             if (is_numeric($_POST['id'])) {
                 $ad_data['id'] = intval($_POST['id']);
             } else {
                 $errors['rt'][] = 'خطأ فى اضافة الاعلان';
             }
             $img_check = $this->check_img($ad_data['user_id'], $ad_data['id']);
             $type = 'edit';
         } else {
             $op = 'insert';
             $img_check = $this->check_img($ad_data['user_id'], 'null');
             $type = 'add';
         }
         if ($img_check !== true && empty($errors['rt'])) {
             $errors['rt'][] = $img_check;
         }
         if (empty($errors['rt']) && empty($errors['md']) && empty($errors['lt'])) {
             if ($op == 'insert') {
                 $ad_id = Operations::get_instance()->init($ad_data, 'ads');
             } else {
                 $ad_id = $ad_data['id'];
                 Operations::get_instance()->init($ad_data, 'ads', 'update');
             }
             $this->procces_img($ad_data['user_id'], $ad_id);
             echo json_encode(array('operation' => 1, 'type' => $type));
         } else {
             echo json_encode(array('operation' => 2, 'errors' => $errors));
         }
     }
 }
Exemple #3
0
">اتصل بنا</a></div>
        </li>

        <?php 
if (Login::get_instance()->check_login() == 'valid') {
    ?>
            <li>
                <div class="icon account"></div>
                <div class="text"><a href="/user"> الملف الشخصى</a></div>
            </li>    
            <li>
                <div class="icon signout"></div>
                <div class="text"><a href="/index/logout"> خروج</a></div>
            </li>
            <?php 
    $user = Register::get_instance()->get_current_user();
    if ($user['status'] == 10) {
        ?>
                <li>
                    <div class="icon cp"></div>
                    <div class="text"><a href="/index/petscp"> لوحة التحكم</a></div>
                </li>
                <li>
                    <div class="icon vet"></div>
                    <div class="text"> <a href="<?php 
        echo READ_ONLY . '/clinics/add';
        ?>
">اضافة عيادة</a></div>
                </li>
            <?php 
    }
Exemple #4
0
 public function handle()
 {
     if (Login::get_instance()->check_login() == 'valid') {
         $user_data = Register::get_instance()->get_current_user();
         if ($user_data['status'] != 10) {
             exit;
         }
         if (is_array($_POST['users']) && is_numeric($_GET['t']) && $_GET['ty'] == 'users') {
             if ($_GET['t'] == 1) {
                 $status = 1;
             } else {
                 $status = 2;
             }
             foreach ($_POST['users'] as $id) {
                 Operations::get_instance()->init(array('id' => intval($id), 'status' => $status), 'users', 'update');
             }
         } else {
             if (is_array($_POST['ads']) && is_numeric($_GET['t']) && $_GET['ty'] == 'ads') {
                 if ($_GET['t'] == 1) {
                     $status = 1;
                 } else {
                     $status = 2;
                 }
                 foreach ($_POST['ads'] as $id) {
                     Operations::get_instance()->init(array('id' => intval($id), 'status' => $status), 'ads', 'update');
                 }
             } else {
                 if (is_array($_POST['clinics']) && is_numeric($_GET['t']) && $_GET['ty'] == 'clinics') {
                     if ($_GET['t'] == 1) {
                         $status = 1;
                     } else {
                         $status = 2;
                     }
                     foreach ($_POST['clinics'] as $id) {
                         Operations::get_instance()->init(array('id' => intval($id), 'status' => $status), 'clinics', 'update');
                     }
                 }
             }
         }
     }
 }