function new_user($data) { $data['status'] = 1; $data['time_added'] = time(); $data['date_added'] = TimeTools::get_time_id(date('Y-m-d')); $check = Operations::get_instance()->init($data, 'users'); Operations::get_instance()->init(array('user_id' => $check, 'time_added' => time(), 'date_added' => TimeTools::get_time_id(date('Y-m-d'))), 'users_img'); }
private function img_upload($clinic_id) { if (Login::get_instance()->check_login() == 'valid') { $user_data = Register::get_instance()->get_current_user(); if ($user_data['status'] != 10) { exit; } $foo = new Upload($_FILES['clinic_img']); if ($foo->uploaded) { $this->del($clinic_id); $ds = DIRECTORY_SEPARATOR; $storeFolder = '..' . $ds . 'views' . $ds . 'clinics_img'; $targetPath = dirname(__FILE__) . $ds . $storeFolder . $ds; $targetName = $clinic_id . '_' . md5(rand(1, 5000000000)); while (file_exists($targetName)) { $targetName = $clinic_id . '_' . md5(rand(1, 5000000000)); } $targetFile = $targetPath . $targetName . '.jpeg'; $foo->file_new_name_body = $targetName; $foo->image_resize = true; $foo->image_convert = 'jpeg'; $foo->image_x = 1024; $foo->image_y = 768; $foo->image_ratio_crop = false; //$foo->image_ratio_y = true; $foo->Process($targetPath); if ($foo->processed) { $foo->Clean(); Operations::get_instance()->init(array('img_name' => $targetName . '.jpeg', 'clinic_id' => $clinic_id, 'time_added' => time(), 'date_added' => TimeTools::get_time_id(date('Y-m-d'))), 'clinics_img', 'update'); } } } }
private function procces_img($user_id, $ad_id) { // if (Login::get_instance()->check_login() == 'valid') { $ds = DIRECTORY_SEPARATOR; $storeFolder = '..' . $ds . 'views' . $ds . 'temp_img'; $newFolder = '..' . $ds . 'views' . $ds . 'ads_img'; $targetPath = dirname(__FILE__) . $ds . $storeFolder . $ds; $newPath = dirname(__FILE__) . $ds . $newFolder . $ds; $images = glob($targetPath . $user_id . "_*.jpeg"); foreach ($images as $img) { $new_name = $ad_id . '_' . md5(rand(1, 5000000000)) . '.jpeg'; while (file_exists($newPath . $new_name)) { $new_name = $ad_id . '_' . md5(rand(1, 5000000000)) . '.jpeg'; } rename($img, $newPath . $new_name); Operations::get_instance()->init(array('ad_id' => $ad_id, 'img_name' => $new_name, 'time_added' => time(), 'date_added' => TimeTools::get_time_id(date('Y-m-d'))), 'ads_img'); } } }
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'); } } } } } }