Example #1
0
 public function setImageAttribute($value)
 {
     if ($value instanceof UploadedFile) {
         $this->attributes['image'] = upload_image($value, static::$path, 'post.uploaded');
     } else {
         $this->attributes['image'] = $value;
     }
 }
Example #2
0
 public function insert_restaurant()
 {
     $requested_mod = $this->uri->segment(2);
     if (!$this->acl->hasPermission($requested_mod)) {
         redirect('admin/dashboard');
     }
     if (!empty($_POST)) {
         $insert_data['sb_hotel_id'] = $this->input->post('sb_hotel_id');
         $insert_data['sb_hotel_restaurant_name'] = $this->input->post('sb_rest_name');
         $insert_data['sb_hotel_restaurant_details'] = $this->input->post('sb_rest_desc');
         if (array_key_exists("add", $_POST)) {
             if (!empty($_FILES['sb_rest_img']['name'])) {
                 $folderName = RESTAURANT_PIC;
                 $pic1 = upload_image($folderName, "sb_rest_img");
                 if ($pic1 != 0) {
                     $insert_data['sb_rest_image'] = $pic1;
                 }
             }
             $r = $this->Restaurant_model->insert_rest($insert_data);
             if ($r > 0) {
                 $this->data['title'] = 'Available Restaurants List';
                 $this->session->set_flashdata('message', 'New Restaurants added successfully.');
                 //$this->template->load('page_tpl','restaurant_list_view',$this->data);
             } else {
                 $this->data['title'] = 'Available Restaurants List';
                 $this->session->set_flashdata('message', 'Some error occured.. Try Again');
                 //$this->template->load('page_tpl','restaurant_list_view',$this->data);
             }
         } elseif (array_key_exists("edit", $_POST)) {
             $insert_data1['sb_hotel_restaurant_name'] = $this->input->post('sb_rest_name');
             $insert_data1['sb_hotel_restaurant_details'] = $this->input->post('sb_rest_desc');
             $sb_hotel_restaurant_id = $this->input->post('sb_hotel_restaurant_id');
             if ($_FILES['sb_rest_img']['name'] != '') {
                 $this->unlink_images($sb_hotel_restaurant_id, $insert_data['sb_hotel_id']);
                 $folderName = RESTAURANT_PIC;
                 $pic1 = upload_image($folderName, "sb_rest_img");
                 if ($pic1 != 0) {
                     $insert_data1['sb_rest_image'] = $pic1;
                 }
             }
             $r = $this->Restaurant_model->update_rest($insert_data1, $sb_hotel_restaurant_id, $insert_data['sb_hotel_id']);
             if ($r > 0) {
                 $this->data['title'] = 'Available Restaurants List';
                 $this->session->set_flashdata('message', 'Restaurants Editted successfully.');
                 //$this->template->load('page_tpl','restaurant_list_view',$this->data);
             } else {
                 $this->data['title'] = 'Available Restaurants List';
                 $this->session->set_flashdata('message', 'Some error occured.. Try Again');
                 //$this->template->load('page_tpl','restaurant_list_view',$this->data);
             }
         }
     } else {
         $this->data['title'] = 'Available Restaurants List';
         $this->session->set_flashdata('message', 'Image type not valid');
         //$this->template->load('page_tpl','restaurant_list_view',$this->data);
     }
     redirect('admin/Restaurants');
 }
 public function uploadPic()
 {
     //include('inc/s3_config.php');
     //$bucket = 'akshaytestbucket';
     $old_pic_name = $this->input->post('pic_name');
     $sb_hotel_user_id = $this->session->userdata('logged_in_user')->sb_hotel_user_id;
     if (!empty($_FILES['sb_hotel_user_pic']['name'])) {
         // $tempFile = $_FILES['sb_hotel_user_pic']['tmp_name'];
         // $ext = $this->getExtension($_FILES['sb_hotel_user_pic']['name']);
         // $fileName = $sb_hotel_user_id."_profilepic_".time().".".$ext;
         // $targetFile = $targetPath . $fileName ;
         // if($s3->putObjectFile($tempFile, BUCKET, $fileName, S3::ACL_PUBLIC_READ) )
         //          {
         //          	if($old_pic_name !="")
         //          		$result = $s3->deleteObject(BUCKET,$old_pic_name);
         //          	$edit= array(
         // 		'sb_hotel_user_pic'=>$fileName
         // 	);
         // 	$this->uploadprofilepic_model->uploadPic($edit,$sb_hotel_user_id);
         //          }
         //$folderName=HOTEL_USER_PIC;
         $folderName = $sb_hotel_user_id . "_profilepic_";
         $pic1 = upload_image($folderName, "sb_hotel_user_pic");
         if ($pic1 != 0) {
             if ($old_pic_name != "") {
                 $one = delete_oldpic($old_pic_name);
             }
             $data["sb_hotel_user_pic"] = $pic1;
             $edit = array('sb_hotel_user_pic' => $pic1);
             $this->uploadprofilepic_model->uploadPic($edit, $sb_hotel_user_id);
         }
     }
     $this->session->userdata('logged_in_user')->sb_hotel_user_pic = $edit['sb_hotel_user_pic'];
     $this->session->set_flashdata('UPLOAD_PROFILEPIC_SUCCESS', UPLOAD_PROFILEPIC_SUCCESS);
     redirect('admin/uploadprofilepic');
 }
Example #4
0
<?php

require_once dirname(dirname(__FILE__)) . '/app.php';
need_login();
if ($_POST) {
    $update = array('email' => $_POST['email'], 'username' => $_POST['username'], 'realname' => $_POST['realname'], 'zipcode' => $_POST['zipcode'], 'address' => $_POST['address'], 'mobile' => $_POST['mobile'], 'gender' => $_POST['gender'], 'city_id' => $_POST['city_id'], 'qq' => $_POST['qq'], 'city_id' => $_POST['city_id']);
    $avatar = upload_image('upload_image', $login_user['avatar'], 'user');
    $update['avatar'] = $avatar;
    if ($_POST['password'] == $_POST['password2'] && $_POST['password']) {
        $update['password'] = $_POST['password'];
    }
    if (ZUser::Modify($login_user['id'], $update)) {
        Session::Set('notice', '修改账户设置成功');
        Utility::Redirect(WEB_ROOT . '/account/settings.php ');
    } else {
        Session::Set('error', '修改账户设置失败');
    }
}
$readonly['email'] = defined('UC_API') ? '' : 'readonly';
$readonly['username'] = defined('UC_API') ? 'readonly' : '';
include template('account_settings');
Example #5
0
<?php

if (isset($_POST['male_name'])) {
    include_once "../functions.php";
    include "../header_db.php";
    include "upload.php";
    $id = $_POST['id'];
    //echo $_POST['male_dob'];
    include_once "addslashes_to_POST.php";
    $location = "../images/" . $id;
    $image_name = upload_image($_FILES, $location);
    $has_partner = 0;
    if (isset($_POST['female_name'])) {
        $has_partner = 1;
    }
    $sql = "UPDATE s_male SET Name = " . build_value_type($_POST['male_name']) . ", DOB = " . build_value_type($_POST['male_dob']) . ", Email = " . build_value_type($_POST['male_email_id']) . ", Mobile = " . build_value_type($_POST['male_mobile']) . ", Blood_Group = " . build_value_type($_POST['male_blood_group']) . ", Occupation = " . build_value_type($_POST['male_occupation']) . ", off_addr1 = " . build_value_type($_POST['male_off_addr1']) . ", off_addr_area = " . build_value_type($_POST['male_off_area']) . ", off_addr_pin = " . build_value_type((int) $_POST['male_off_pincode']) . ", Office_phone = " . build_value_type($_POST['male_off_phone']) . ", has_partner = " . $has_partner . " WHERE id = " . $_POST['id'] . ";";
    $sql .= "UPDATE s_common SET DOM = " . build_value_type($_POST['comm_wedding_date']) . ", res_addr1 = " . build_value_type($_POST['comm_res_addr1']) . ", res_addr_area = " . build_value_type($_POST['comm_res_area']) . ", res_addr_pin = " . build_value_type((int) $_POST['comm_res_pincode']) . ", Residence_Phone = " . build_value_type($_POST['comm_res_phone']) . " WHERE id = " . $_POST['id'] . ";";
    $sql .= "UPDATE s_female SET Name = " . build_value_type($_POST['female_name']) . ", DOB = " . build_value_type($_POST['female_dob']) . ", Email = " . build_value_type($_POST['female_email_id']) . ", Mobile = " . build_value_type($_POST['female_mobile']) . ", Blood_Group = " . build_value_type($_POST['female_blood_group']) . ", Occupation = " . build_value_type($_POST['female_occupation']) . ", has_partner = " . $has_partner . " WHERE id = " . ($_POST['id'] + 1) . ";";
    $no_of_kids = (int) $_POST['no_of_kids'];
    if ($no_of_kids > 0) {
        $kids_start_id = $_POST['kid_id'];
        for ($i = 0; $i < $no_of_kids; $i++) {
            $sql .= "UPDATE s_kids SET Name = " . build_value_type($_POST['kid_name' . $i]) . ", DOB = " . build_value_type($_POST['kid_dob' . $i]) . ", Email = " . build_value_type($_POST['kid_email_id' . $i]) . ", Mobile = " . build_value_type($_POST['kid_mobile_no' . $i]) . ", Blood_Group = " . build_value_type($_POST['kid_blood_group' . $i]) . " WHERE id = " . $kids_start_id . ";";
            $kids_start_id++;
        }
    }
    if (mysqli_multi_query($connection, $sql)) {
        mysqli_close($connection);
        header("Location:index.php");
    }
}
Example #6
0
 public function update()
 {
     $id = isset($_POST['id']) ? intval($_POST['id']) : 0;
     $data = $_POST;
     $data['id'] = $id;
     $data['is_complete'] = isset($data['is_complete']) ? SERIES_STATUS_COMPLETE : SERIES_STATUS_ONGOING;
     $obj = $this->Series_model->getById($id);
     $data['thumbnail'] = $obj['thumbnail'];
     $message = $this->validate($data, TRUE);
     if (!empty($message)) {
         set_flash_error($message);
     }
     $listGenre = $this->Genre_model->getAll();
     $defaultGenre = isset($data['genre']) ? $data['genre'] : array();
     $genreSelectbox = selectBox($listGenre, array('Name' => 'genre[]', 'multiple' => 'multiple', 'size' => 10, 'Selected' => $defaultGenre));
     $data['genreSelectbox'] = $genreSelectbox;
     $statusSelectbox = selectBox($this->_config['status'], array('Name' => 'status', 'Selected' => $data['status']));
     $data['statusSelectbox'] = $statusSelectbox;
     $countrySelectbox = selectBox($this->_config['countries'], array('Name' => 'country', 'Selected' => $data['country']));
     $data['countrySelectbox'] = $countrySelectbox;
     $typeSelectbox = selectBox($this->_config['video_type'], array('Name' => 'type', 'Selected' => $data['type']));
     $data['typeSelectbox'] = $typeSelectbox;
     if (!has_error()) {
         $canUpdate = FALSE;
         if (!empty($_FILES) && !empty($_FILES['thumbnail']['tmp_name'])) {
             $result = upload_image($_FILES, SERIE_IMAGE_THUMBNAIL_PATH);
             if ($result['error'] != 0) {
                 $this->layout->title('Edit video');
                 $this->layout->view('admin_series/edit', $data);
             } else {
                 $data['thumbnail'] = $result['fileName'];
                 $this->_deleteImage($id);
                 $canUpdate = TRUE;
             }
         } else {
             $canUpdate = TRUE;
         }
         if ($canUpdate) {
             $id = $this->Series_model->update($id, $data);
             $this->Series_Genre_model->deleteBySeriesId($id);
             if ($data['genre']) {
                 foreach ($data['genre'] as $genreId) {
                     $seriesGenreData = array();
                     $seriesGenreData['genre_id'] = $genreId;
                     $seriesGenreData['series_id'] = $id;
                     $this->Series_Genre_model->insert($seriesGenreData);
                 }
             }
             $url = base_url() . 'admin_series/index';
             set_flash_message($this->lang->line('admin.series.updated'));
             redirect($url);
         }
     } else {
         $this->layout->title('Edit series');
         $this->layout->view('admin_series/edit', $data);
     }
 }
Example #7
0
if ($_POST) {
    $team = $_POST;
    $insert = array('title', 'market_price', 'team_price', 'end_time', 'begin_time', 'expire_time', 'min_number', 'max_number', 'summary', 'notice', 'conduser', 'per_number', 'buyonce', 'product', 'image', 'detail', 'userreview', 'systemreview', 'image1', 'image2', 'flv', 'card', 'bonus', 'mobile', 'address', 'fare', 'express', 'delivery', 'user_id', 'state', 'city_id', 'group_id', 'partner_id', 'team_type', 'sort_order', 'condbuy', 'farefree');
    $team['user_id'] = $login_user_id;
    $team['state'] = 'none';
    $team['begin_time'] = strtotime($team['begin_time']);
    $team['city_id'] = abs(intval($team['city_id']));
    $team['partner_id'] = abs(intval($partner_id));
    $team['sort_order'] = 0;
    $team['fare'] = abs(intval($team['fare']));
    $team['farefree'] = abs(intval($team['farefree']));
    $team['end_time'] = strtotime($team['end_time']);
    $team['expire_time'] = strtotime($team['expire_time']);
    $team['image'] = upload_image('upload_image', null, 'team', true);
    $team['image1'] = upload_image('upload_image1', null, 'team');
    $team['image2'] = upload_image('upload_image2', null, 'team');
    $table = new Table('team', $team);
    //team_type == goods
    if ($table->team_type == 'goods') {
        $table->min_number = 1;
    }
    $table->SetStrip('detail', 'systemreview', 'notice');
    if ($team_id = $table->insert($insert)) {
        Session::Set('notice', '新建项目成功, 请耐心等待审核!');
        Utility::Redirect(WEB_ROOT . "/biz/index.php");
    }
} else {
    $profile = Table::Fetch('leader', $login_user_id, 'user_id');
    //1
    $team = array();
    $team['user_id'] = $login_user_id;
Example #8
0
 protected function verify_image_upload()
 {
     $locale = fusion_get_locale();
     require_once INCLUDES . "infusions_include.php";
     if ($this->field_config['multiple']) {
         $target_folder = $this->field_config['path'];
         $target_width = $this->field_config['max_width'];
         $target_height = $this->field_config['max_height'];
         $max_size = $this->field_config['max_byte'];
         $delete_original = $this->field_config['delete_original'];
         $thumb1 = $this->field_config['thumbnail'];
         $thumb2 = $this->field_config['thumbnail2'];
         $thumb1_ratio = 1;
         $thumb1_folder = $this->field_config['path'] . $this->field_config['thumbnail_folder'] . "/";
         $thumb1_suffix = $this->field_config['thumbnail_suffix'];
         $thumb1_width = $this->field_config['thumbnail_w'];
         $thumb1_height = $this->field_config['thumbnail_h'];
         $thumb2_ratio = 0;
         $thumb2_folder = $this->field_config['path'] . $this->field_config['thumbnail_folder'] . "/";
         $thumb2_suffix = $this->field_config['thumbnail2_suffix'];
         $thumb2_width = $this->field_config['thumbnail2_w'];
         $thumb2_height = $this->field_config['thumbnail2_h'];
         $query = '';
         if (!empty($_FILES[$this->field_config['input_name']]['name']) && is_uploaded_file($_FILES[$this->field_config['input_name']]['tmp_name'][0]) && $this->safe()) {
             $result = array();
             for ($i = 0; $i <= count($_FILES[$this->field_config['input_name']]['name']) - 1; $i++) {
                 if (is_uploaded_file($_FILES[$this->field_config['input_name']]['tmp_name'][$i])) {
                     $image = $_FILES[$this->field_config['input_name']];
                     $target_name = $_FILES[$this->field_config['input_name']]['name'][$i];
                     if ($target_name != "" && !preg_match("/[^a-zA-Z0-9_-]/", $target_name)) {
                         $image_name = $target_name;
                     } else {
                         $image_name = stripfilename(substr($image['name'][$i], 0, strrpos($image['name'][$i], ".")));
                     }
                     $image_ext = strtolower(strrchr($image['name'][$i], "."));
                     $image_res = array();
                     if (filesize($image['tmp_name'][$i]) > 10 && @getimagesize($image['tmp_name'][$i])) {
                         $image_res = @getimagesize($image['tmp_name'][$i]);
                     }
                     $image_info = array("image" => FALSE, "image_name" => $image_name . $image_ext, "image_ext" => $image_ext, "image_size" => $image['size'], "image_width" => $image_res[0], "image_height" => $image_res[1], "thumb1" => FALSE, "thumb1_name" => "", "thumb2" => FALSE, "thumb2_name" => "", "error" => 0);
                     if ($image_ext == ".gif") {
                         $filetype = 1;
                     } elseif ($image_ext == ".jpg") {
                         $filetype = 2;
                     } elseif ($image_ext == ".png") {
                         $filetype = 3;
                     } else {
                         $filetype = FALSE;
                     }
                     if ($image['size'][$i] > $max_size) {
                         // Invalid file size
                         $image_info['error'] = 1;
                     } elseif (!$filetype || !verify_image($image['tmp_name'][$i])) {
                         // Unsupported image type
                         $image_info['error'] = 2;
                     } elseif ($image_res[0] > $target_width || $image_res[1] > $target_height) {
                         // Invalid image resolution
                         $image_info['error'] = 3;
                     } else {
                         if (!file_exists($target_folder)) {
                             mkdir($target_folder, 0755);
                         }
                         $image_name_full = filename_exists($target_folder, $image_name . $image_ext);
                         $image_name = substr($image_name_full, 0, strrpos($image_name_full, "."));
                         $image_info['image_name'] = $image_name_full;
                         $image_info['image'] = TRUE;
                         move_uploaded_file($image['tmp_name'][$i], $target_folder . $image_name_full);
                         if (function_exists("chmod")) {
                             chmod($target_folder . $image_name_full, 0755);
                         }
                         if ($query && !dbquery($query)) {
                             // Invalid query string
                             $image_info['error'] = 4;
                             if (file_exists($target_folder . $image_name_full)) {
                                 @unlink($target_folder . $image_name_full);
                             }
                         } elseif ($thumb1 || $thumb2) {
                             require_once INCLUDES . "photo_functions_include.php";
                             $noThumb = FALSE;
                             if ($thumb1) {
                                 if ($image_res[0] <= $thumb1_width && $image_res[1] <= $thumb1_height) {
                                     $noThumb = TRUE;
                                     $image_info['thumb1_name'] = $image_info['image_name'];
                                     $image_info['thumb1'] = TRUE;
                                 } else {
                                     if (!file_exists($thumb1_folder)) {
                                         mkdir($thumb1_folder, 0755, TRUE);
                                     }
                                     $image_name_t1 = filename_exists($thumb1_folder, $image_name . $thumb1_suffix . $image_ext);
                                     $image_info['thumb1_name'] = $image_name_t1;
                                     $image_info['thumb1'] = TRUE;
                                     if ($thumb1_ratio == 0) {
                                         createthumbnail($filetype, $target_folder . $image_name_full, $thumb1_folder . $image_name_t1, $thumb1_width, $thumb1_height);
                                     } else {
                                         createsquarethumbnail($filetype, $target_folder . $image_name_full, $thumb1_folder . $image_name_t1, $thumb1_width);
                                     }
                                 }
                             }
                             if ($thumb2) {
                                 if ($image_res[0] < $thumb2_width && $image_res[1] < $thumb2_height) {
                                     $noThumb = TRUE;
                                     $image_info['thumb2_name'] = $image_info['image_name'];
                                     $image_info['thumb2'] = TRUE;
                                 } else {
                                     if (!file_exists($thumb2_folder)) {
                                         mkdir($thumb2_folder, 0755, TRUE);
                                     }
                                     $image_name_t2 = filename_exists($thumb2_folder, $image_name . $thumb2_suffix . $image_ext);
                                     $image_info['thumb2_name'] = $image_name_t2;
                                     $image_info['thumb2'] = TRUE;
                                     if ($thumb2_ratio == 0) {
                                         createthumbnail($filetype, $target_folder . $image_name_full, $thumb2_folder . $image_name_t2, $thumb2_width, $thumb2_height);
                                     } else {
                                         createsquarethumbnail($filetype, $target_folder . $image_name_full, $thumb2_folder . $image_name_t2, $thumb2_width);
                                     }
                                 }
                             }
                             if ($delete_original && !$noThumb) {
                                 unlink($target_folder . $image_name_full);
                                 $image_info['image'] = FALSE;
                             }
                         }
                     }
                 } else {
                     $image_info = array("error" => 5);
                 }
                 if ($image_info['error'] != 0) {
                     $this->stop();
                     // return FALSE if possible
                     switch ($image_info['error']) {
                         case 1:
                             // Invalid file size
                             addNotice('danger', sprintf($locale['df_416'], parsebytesize($this->field_config['max_byte'])));
                             self::setInputError($this->field_name);
                             break;
                         case 2:
                             // Unsupported image type
                             addNotice('danger', sprintf($locale['df_417'], ".gif .jpg .png"));
                             self::setInputError($this->field_name);
                             break;
                         case 3:
                             // Invalid image resolution
                             addNotice('danger', sprintf($locale['df_421'], $this->field_config['max_width'], $this->field_config['max_height']));
                             self::setInputError($this->field_name);
                             break;
                         case 4:
                             // Invalid query string
                             addNotice('danger', $locale['df_422']);
                             self::setInputError($this->field_name);
                             break;
                         case 5:
                             // Image not uploaded
                             addNotice('danger', $locale['df_423']);
                             self::setInputError($this->field_name);
                             break;
                     }
                     $result[$i] = $image_info;
                 } else {
                     $result[$i] = $image_info;
                 }
             }
             // end for
             return $result;
         } else {
             return array();
         }
     } else {
         if (!empty($_FILES[$this->field_config['input_name']]['name']) && is_uploaded_file($_FILES[$this->field_config['input_name']]['tmp_name']) && $this->safe()) {
             $upload = upload_image($this->field_config['input_name'], $_FILES[$this->field_config['input_name']]['name'], $this->field_config['path'], $this->field_config['max_width'], $this->field_config['max_height'], $this->field_config['max_byte'], $this->field_config['delete_original'], $this->field_config['thumbnail'], $this->field_config['thumbnail2'], 1, $this->field_config['path'] . $this->field_config['thumbnail_folder'] . "/", $this->field_config['thumbnail_suffix'], $this->field_config['thumbnail_w'], $this->field_config['thumbnail_h'], 0, $this->field_config['path'] . $this->field_config['thumbnail_folder'] . "/", $this->field_config['thumbnail2_suffix'], $this->field_config['thumbnail2_w'], $this->field_config['thumbnail2_h']);
             if ($upload['error'] != 0) {
                 $this->stop();
                 switch ($upload['error']) {
                     case 1:
                         // Invalid file size
                         addNotice('danger', sprintf($locale['df_416'], parsebytesize($this->field_config['max_byte'])));
                         self::setInputError($this->field_name);
                         break;
                     case 2:
                         // Unsupported image type
                         addNotice('danger', sprintf($locale['df_417'], ".gif .jpg .png"));
                         self::setInputError($this->field_name);
                         break;
                     case 3:
                         // Invalid image resolution
                         addNotice('danger', sprintf($locale['df_421'], $this->field_config['max_width'], $this->field_config['max_height']));
                         self::setInputError($this->field_name);
                         break;
                     case 4:
                         // Invalid query string
                         addNotice('danger', $locale['df_422']);
                         self::setInputError($this->field_name);
                         break;
                     case 5:
                         // Image not uploaded
                         addNotice('danger', $locale['df_423']);
                         self::setInputError($this->field_name);
                         break;
                 }
                 return $upload;
             } else {
                 return $upload;
             }
         } else {
             return array();
         }
     }
 }
Example #9
0
 public function edit_hotel_action($hotel_id)
 {
     $data = $this->input->post();
     $requested_mod = 'hotel';
     if (!$this->acl->hasPermission($requested_mod)) {
         redirect('admin/dashboard');
     }
     $this->validation_rules = array(array('field' => 'sb_hotel_country', 'label' => 'Country', 'rules' => 'required', 'class' => 'text-danger'), array('field' => 'sb_hotel_state', 'label' => 'State', 'rules' => 'required', 'class' => 'text-danger'), array('field' => 'sb_hotel_city', 'label' => 'City', 'rules' => 'required', 'class' => 'text-danger'), array('field' => 'sb_hotel_address', 'label' => 'Address', 'rules' => 'required', 'class' => 'text-danger'), array('field' => 'sb_hotel_zipcode', 'label' => 'Postal Code', 'rules' => 'required', 'class' => 'text-danger'), array('field' => 'sb_hotel_owner', 'label' => 'Hotel Owner', 'rules' => 'required', 'class' => 'text-danger'), array('field' => 'sb_hotel_website', 'label' => 'Hotel Website', 'rules' => 'required|prep_url', 'class' => 'text-danger'), array('field' => 'sb_hotel_email', 'label' => 'Hotel Email', 'rules' => 'required|valid_email', 'class' => 'text-danger'));
     $this->form_validation->set_error_delimiters('<div class="text-danger">', '</div>');
     $this->form_validation->set_rules($this->validation_rules);
     if ($this->form_validation->run() == FALSE) {
         $this->data['action'] = "admin/hotel/edit_hotel_action/{$hotel_id}";
         $this->data['countrylist'] = getCountryList();
         $this->data['languagelist'] = getAllLanguages();
         $this->data['hoteldata'] = $this->Hotel_model->get_hotel_data($hotel_id);
         $this->template->load('page_tpl', 'create_hotel', $this->data);
     } else {
         $this->data['hoteldata'] = $this->Hotel_model->get_hotel_data($hotel_id);
         $data["sb_hotel_pic"] = $this->data['hoteldata']['sb_hotel_pic'];
         if (!empty($_FILES['sb_hotel_pic']['name'])) {
             $folderName = HOTEL_PIC;
             $pic1 = upload_image($folderName, "sb_hotel_pic");
             if ($pic1 != 0) {
                 $data["sb_hotel_pic"] = $pic1;
             }
         }
         $hoteldata = array('sb_hotel_category' => $data['sb_hotel_category'], 'sb_hotel_star' => $data['sb_hotel_star'], 'sb_hotel_email' => $data['sb_hotel_email'], 'sb_hotel_website' => $data['sb_hotel_website'], 'sb_hotel_owner' => $data['sb_hotel_owner'], 'sb_hotel_country' => $data['sb_hotel_country'], 'sb_hotel_state' => $data['sb_hotel_state'], 'sb_hotel_city' => $data['sb_hotel_city'], 'sb_hotel_address' => $data['sb_hotel_address'], 'sb_hotel_zipcode' => $data['sb_hotel_zipcode'], 'sb_hotel_pic' => $data['sb_hotel_pic'], 'sb_property_built_month' => $data['sb_property_built_month'], 'sb_property_built_year' => $data['sb_property_built_year'], 'sb_property_open_year' => $data['sb_property_open_year']);
         $result = $this->Hotel_model->edit_hotel($hoteldata, $hotel_id);
         if ($result == '1') {
             $languageresult = $this->Hotel_model->set_hotel_languages($hotel_id, $data['sb_languages']);
             $this->session->set_flashdata('category_success', HOTEL_UPDATION_SUCCESS);
             redirect("admin/hotel/edit_hotel/{$hotel_id}");
         } else {
             $this->session->set_flashdata('category_error', HOTEL_UPDATION_FAIL);
             redirect("admin/hotel/edit_hotel/{$hotel_id}");
         }
     }
 }
<?php

require_once "../../../../maincore.php";
require_once INCLUDES . "infusions_include.php";
require_once INFUSIONS . "al_catalog/infusion_db.php";
if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
    $upload_dir = AL_CATALOG_DIR . "uploads/";
    header('Content-Type: application/json');
    $uploaded = upload_image("file", "", $upload_dir, $catalog_settings['photo_max_width'], $catalog_settings['photo_max_height'], $catalog_settings['max_photo_size'], false, true, true, 0, $upload_dir, "_t1", $catalog_settings['cat_thumb_width'], $catalog_settings['cat_thumb_height'], 0, $upload_dir, "_t2", $catalog_settings['item_thumb_width'], $catalog_settings['item_thumb_height']);
    if ($uploaded['error'] == 0) {
        $insert = dbquery("INSERT INTO " . DB_AL_CATALOG_IMAGES . " (ctg_image_file,ctg_image_thumb,ctg_image_thumb_item) VALUES ('" . $uploaded['image_name'] . "','" . $uploaded['thumb1_name'] . "','" . $uploaded['thumb2_name'] . "')");
        $id = mysql_insert_id();
        die('{"jsonrpc" : "2.0", "thumb" : "' . $uploaded['thumb1_name'] . '", "id" : "' . $id . '"}');
    } else {
        die('{"jsonrpc" : "2.0", "result" : "' . $uploaded['error'] . '"}');
    }
}
if (isset($_POST['action']) && $_POST['action'] == "delete_image" && isset($_POST['image_id']) && isnum($_POST['image_id'])) {
    $img_result = dbquery("SELECT * FROM " . DB_AL_CATALOG_IMAGES . " WHERE ctg_image_id='" . $_POST['image_id'] . "'");
    if (dbrows($img_result)) {
        $img_data = dbarray($img_result);
        if (file_exists(AL_CATALOG_DIR . "uploads/" . $img_data['ctg_image_file'])) {
            unlink(AL_CATALOG_DIR . "uploads/" . $img_data['ctg_image_file']);
        }
        if (file_exists(AL_CATALOG_DIR . "uploads/" . $img_data['ctg_image_thumb'])) {
            unlink(AL_CATALOG_DIR . "uploads/" . $img_data['ctg_image_thumb']);
        }
        $del = dbquery("DELETE FROM " . DB_AL_CATALOG_IMAGES . " WHERE ctg_image_id='" . $_POST['image_id'] . "'");
    }
    header('Content-Type: application/json');
    echo json_encode(array('status' => 'ok'));
Example #11
0
    Session::Set('error', '无权操作');
    redirect(WEB_ROOT . '/biz/index.php');
}
$team = Table::Fetch('team', $id);
if ($_POST) {
    $insert = array('title', 'market_price', 'team_price', 'end_time', 'begin_time', 'expire_time', 'min_number', 'max_number', 'summary', 'notice', 'per_number', 'product', 'image', 'detail', 'userreview', 'systemreview', 'image1', 'image2', 'flv', 'card', 'conduser', 'buyonce', 'bonus', 'delivery', 'mobile', 'address', 'fare', 'express', 'credit', 'user_id', 'city_id', 'group_id', 'partner_id', 'team_type');
    $table = new Table('team', $_POST);
    $table->SetStrip('detail', 'systemreview', 'notice');
    $table->begin_time = strtotime($_POST['begin_time']);
    $table->city_id = abs(intval($table->city_id));
    $table->partner_id = abs(intval($partner_id));
    $table->end_time = strtotime($_POST['end_time']);
    $table->expire_time = strtotime($_POST['expire_time']);
    $table->image = upload_image('upload_image', $team['image'], 'team', true);
    $table->image1 = upload_image('upload_image1', $team['image1'], 'team');
    $table->image2 = upload_image('upload_image2', $team['image2'], 'team');
    //team_type == goods
    if ($table->team_type == 'goods') {
        $table->min_number = 1;
    }
    $error_tip = array();
    if (!$error_tip) {
        if ($table->update($insert)) {
            print $table->title;
            $field = strtoupper($table->conduser) == 'Y' ? null : 'quantity';
            $now_number = Table::Count('order', array('team_id' => $table->id, 'state' => 'pay'), $field);
            $need_update = array('now_number' => $now_number);
            /* 增加了总数,未卖完状态 */
            if ($table->max_number > $table->now_number) {
                $need_update['close_time'] = 0;
            }
Example #12
0
         $todaypost = $todaypost[0]['todayposts'];
         $new_todaypost = $todaypost + 1;
         $thread_info = $db->fetch_all("SELECT subject,replies FROM `" . DB_PRE . "forum_thread` WHERE tid = '" . $_GET['tid'] . "'");
         $lastpost = $_GET['tid'] . "\t" . $thread_info[0]['subject'] . "\t" . $postinfo['date'] . "\t" . $postinfo['author'];
         if (strtoupper($dbcharset) == 'GBK') {
             $lastpost = mb_convert_encoding($lastpost, 'GBK', 'UTF-8');
         }
         $db->query("UPDATE `" . DB_PRE . "forum_forum` SET `lastpost` = '" . $lastpost . "',`todayposts` = '" . $new_todaypost . "' WHERE fid = '" . $_GET['fid'] . "'");
         $new_replies = $thread_info[0]['replies'] + 1;
         $db->query("UPDATE `" . DB_PRE . "forum_thread` SET `replies` = '" . $new_replies . "',`lastpost` = '" . $postinfo['date'] . "',`lastposter` = '" . $postinfo['author'] . "' WHERE tid = '" . $_GET['tid'] . "'");
         //处理上传的图片
         if ($_GET['img'] == '1') {
             if ($postinfo['ftpimgname'] == '') {
                 upload_image($_FILES, $_GET['tid'], $pid, $postinfo['authorid'], true);
             } else {
                 upload_image($_FILES, $_GET['tid'], $pid, $postinfo['authorid'], true, $postinfo['ftpimgname']);
             }
         }
         //如果是需要审核的帖子则插入待审核表中
         if ($postinfo['verify'] == '-2') {
             $db->query("INSERT INTO `" . DB_PRE . "common_moderate` (`id`,`idtype`,`status`,`dateline`) VALUES ('" . $pid . "','pid','0','" . $postinfo['date'] . "')");
         }
         $code = '200';
         $data_array[0] = array('result' => 'reply succ');
     } else {
         $code = '500';
         $data_array[0] = array('result' => 'reply failed');
     }
     break;
 case 'smiley':
     $sql = $topic->getSql('smiley');
Example #13
0
File: edit.php Project: noikiy/mdwp
$id = abs(intval($_GET['id']));
$store = Table::Fetch('store', $id);

if ( $_POST && $id==$_POST['id'] && $store) {
	$table = new Table('store', $_POST);
	$table->SetStrip('location', 'other');
	$table->region = abs(intval($table->region));
	$table->city_id = abs(intval($table->city_id));
	$table->open = (strtoupper($table->open)=='Y') ? 'Y' : 'N';
	
	$table->store_logo = upload_image('store_logo',$store['store_logo'],'team');
	$table->store_bg = upload_image('store_bg',$store['store_bg'],'team');
	$table->store_banner = upload_image('store_banner',$store['store_banner'],'team');
	$table->store_small_logo = upload_image('store_small_logo',$store['store_small_logo'],'team');
	$table->image = upload_image('image',$store['image'],'team');
	
	$up_array = array(
			'name', 'brand', 'city_id', 'longlat', 'region', 'partner_id',
		'type', 'telphone', 'address', 'create_time', 'businesszone',
		'location', 'other', 'open', 'longlat','head', 'contact','jtxl','yysj','mcard_bizer_no',
		'store_logo','store_bg','store_banner','store_small_logo','car_yh','image'
			);

	$flag = $table->update( $up_array );
	if ( $flag ) {
		Session::Set('notice', '修改门店信息成功');
		redirect( WEB_ROOT . "/manage/store/edit.php?id={$id}");
	}
	Session::Set('error', '修改门店信息失败');
	$store = $_POST;
Example #14
0
            $_POST[$k] = mb_convert_encoding($v, 'GBK', 'UTF-8');
        }
    }
}
if ($_POST['form_submit'] == 'ok') {
    $shop_name = trim($_POST['shop_name']);
    $shop_info = trim($_POST['shop_info']);
    $shop_phone = trim($_POST['shop_phone']);
    $shop_address = trim($_POST['shop_address']);
    $shop_website = trim($_POST['shop_website']);
    $shop_lat = trim($_POST['shop_lat']);
    $shop_lng = trim($_POST['shop_lng']);
    $class = trim($_POST['class']);
    $fuwu = trim($_POST['fuwu']);
    $huanjing = trim($_POST['huanjing']);
    $pic_array = upload_image($_FILES);
    if ($pic_array) {
        $shop_pic = $pic_array[0][0];
    } else {
        $shop_pic = $data_array[0]['shop_pic'] ? $data_array[0]['shop_pic'] : '';
    }
    if ($_GET['shop_id'] != '') {
        $insert_sql = "UPDATE `" . DB_PRE . "common_shoplist` SET `shop_name` = '" . $shop_name . "', `shop_pic` = '" . $shop_pic . "', `shop_info` = '" . $shop_info . "', `shop_name` = '" . $shop_name . "', `shop_phone` = '" . $shop_phone . "', `shop_address` = '" . $shop_address . "', `shop_website` = '" . $shop_website . "', `shop_lat` = '" . $shop_lat . "', `shop_lng` = '" . $shop_lng . "', `class` = '" . $class . "', `fuwu` = '" . $fuwu . "', `huanjing` = '" . $huanjing . "' WHERE `shop_id` =" . $_GET['shop_id'];
    } else {
        $insert_sql = "INSERT INTO `" . DB_PRE . "common_shoplist` (`shop_id`, `shop_name`, `shop_pic`, `shop_info`, `shop_phone`, `shop_address`, `shop_website`, `shop_lat`, `shop_lng`, `class`, `fuwu`, `huanjing`) VALUES (NULL, '" . $shop_name . "', '" . $shop_pic . "', '" . $shop_info . "', '" . $shop_phone . "', '" . $shop_address . "', '" . $shop_website . "', '" . $shop_lat . "', '" . $shop_lng . "', '" . $class . "', '" . $fuwu . "', '" . $huanjing . "')";
    }
    $result = $db->query($insert_sql);
    if ($result) {
        if ($_GET['shop_id'] != '') {
            echo '<script>alert("编辑成功");history.back();</script>';
        } else {
Example #15
0
         } else {
             header("Location: ../index.php?view=list-news&stt=fail");
         }
         break;
     default:
         if (isset($_POST['title']) && isset($_FILES['file']['name']) && isset($_POST['tomtat']) && isset($_POST['content']) && isset($_POST['cat_id']) && isset($_POST['hotnews']) && isset($_POST['featured'])) {
             $title = $_POST['title'];
             $tomtat = $_POST['tomtat'];
             $content = $_POST['content'];
             $cat_id = $_POST['cat_id'];
             $hotnews = $_POST['hotnews'];
             $featured = $_POST['featured'];
             // rename file image
             $temp_name = explode(".", $_FILES["file"]["name"]);
             $newfilename = microtime() . "." . end($temp_name);
             if (upload_image($_FILES['file'], $newfilename)) {
                 if ($news_obj->insertNews($title, $newfilename, $tomtat, $content, $cat_id, $hotnews, $featured)) {
                     header("Location: ../index.php?view=list-news&stt=success");
                 } else {
                     header("Location: ../index.php?view=form-news&stt=fail");
                 }
             } else {
                 if ($news_obj->insertNews($title, '', $tomtat, $content, $cat_id, $hotnews, $featured)) {
                     header("Location: ../index.php?view=form-news&stt=success");
                 } else {
                     header("Location: ../index.php?view=form-news&stt=fail");
                 }
             }
         }
         break;
 }
Example #16
0
		<!-- header -->
    	<div class="header">
        	<h1>Créer une nouvelle équipe</h1>
	    </div>
		<!-- content -->
        <div class="content" id="page">
        <?php 
// Message à afficher en fin de page
$message = null;
// Accessible uniquement si le user est log
if (isset($_SESSION['username'])) {
    // Accessible uniquement si le user est admin
    if (isset($_SESSION['admin']) && $_SESSION['admin'] == $is_admin) {
        // S'exécute uniquement si le user a posté le résultats des matchs
        if (isset($_POST['envoi']) && $_POST['envoi'] == 'yes') {
            $saved_image = upload_image($_POST['image_equipe']);
            if ($saved_image != 1) {
                creer_nouvelle_equipe($_POST['nom_equipe'], $saved_image);
            }
        }
        ?>
					<table class="table table-striped table-bordered table-hover">  
						<thead>  
						  <tr>  
							<th class="left">Nom equipe</th>  
							<th class="text-right">Image equipe</th> 			
						  </tr>  
						</thead> 
						
						<tbody> 
						<form action="admin_creer_equipe.php" method="post">
Example #17
0
<?php

//// UPLOAD IMAGE FUNCTION ///////////////////
echo "hello";
echo upload_image($_FILES['image']);
function upload_image($file)
{
    $image_folder = $_SERVER['DOCUMENT_ROOT'] . "upload/";
    $e_allowedExt = array("gif", "jpeg", "jpg", "png");
    $e_bits = explode('.', $file['name']);
    $e_ext = strtolower(array_pop($e_bits));
    $e_allowed = "no";
    if (!in_array($e_ext, $e_allowedExt)) {
        //error message - bad filetype.
        #header("location:edit-images.php?id=$id&error=filetype") or die();
    } else {
        $e_img_target_path = $image_folder . "temp/" . basename($file['name']);
        if (move_uploaded_file($file['tmp_name'], $e_img_target_path)) {
            //sucess don't give errors.
        } else {
            //error message - couldn't upload image
            #header("location:edit-images.php?id=$id&error=upload");
        }
        ////END ORIGINAL IMAGE UPLOAD AND BEGIN THUMBNAIL UPLOAD
        ////////////////
        ////////////////
        //LARGE THUMBNAIL
        $e_file = basename($file['name']);
        $e_file_info = getimagesize($image_folder . "temp/" . $e_file);
        $e_width = $e_file_info[0];
        $e_height = $e_file_info[1];
        case 'get_markers_by_category':
            get_markers_by_category($_REQUEST['id_categoria']);
            break;
        case 'add_post':
            add_post($_REQUEST['id_user'], $_REQUEST['post_title'], $_REQUEST['post_content']);
            break;
        case 'get_post':
            get_post($_REQUEST['id_post']);
            break;
        case 'get_comments':
            get_comments($_REQUEST['id_post']);
            break;
        case 'comment_post':
            comment_post($_REQUEST['id_post'], $_REQUEST['username'], $_REQUEST['id_user'], $_REQUEST['comment']);
            break;
        case 'qualify':
            qualify($_REQUEST['id_usuario'], $_REQUEST['qualification']);
            break;
        case 'get_average':
            get_average();
            break;
        case 'upload_image':
            upload_image($_FILES, $_REQUEST['id_user'], $_REQUEST['id_post']);
            break;
        case 'get_image':
            get_image($_REQUEST['filename']);
            break;
    }
} else {
    echo 'No se ha realizado solicitud http alguna.';
}
Example #19
0
<?php

require_once dirname(dirname(dirname(__FILE__))) . '/app.php';
need_manager();
need_auth('market');
$id = abs(intval($_REQUEST['id']));
$goods = Table::Fetch('goods', $id);
$table = new Table('goods', $_POST);
$table->letter = strtoupper($table->letter);
$uarray = array('title', 'number', 'image', 'score', 'per_number', 'display', 'sort_order', 'time');
$table->display = strtoupper($table->display) == 'Y' ? 'Y' : 'N';
$table->image = upload_image('upload_image', $goods['image'], 'team');
$table->time = time();
if (!$_POST['title'] || !$_POST['score']) {
    Session::Set('error', '商品标题、兑换积分不能为空');
    redirect(null);
}
if ($goods) {
    if ($flag = $table->update($uarray)) {
        Session::Set('notice', '编辑商品成功');
    } else {
        Session::Set('error', '编辑商品失败');
    }
} else {
    if ($flag = $table->insert($uarray)) {
        Session::Set('notice', '新建商品成功');
    } else {
        Session::Set('error', '新建商品失败');
    }
}
redirect(null);
Example #20
0
 protected function uploadImage($options = array())
 {
     if (IS_POST) {
         $file = PUT('file');
         if (!empty($file) && is_file($file)) {
             unlink($file);
         }
         if (PUT('upload', false)) {
             $cfg = array_merge(array('path' => strtolower(CONTROLLER_NAME), 'key' => 'file', 'size' => 3, 'thumb' => false), $options);
             $res = upload_image($cfg['path'], $cfg['key'], $cfg['size']);
             if ($res['success']) {
                 if ($cfg['thumb']) {
                     $image = new \Think\Image();
                     $image->open($res['image']);
                     $w = $data['w'];
                     $h = $data['h'];
                     if (is_array($cfg['thumb'])) {
                         $w = $cfg['thumb'][0];
                         $h = $cfg['thumb'][1];
                     }
                     $image->thumb($w, $h, $image::IMAGE_THUMB_CENTER)->save($res['image']);
                 }
                 $this->success($res['image']);
             } else {
                 $this->error($res['msg']);
             }
         }
     }
 }
Example #21
0
     $download_image_thumb = "";
 } elseif (!empty($_FILES['download_image']['name']) && is_uploaded_file($_FILES['download_image']['tmp_name'])) {
     require_once INCLUDES . "infusions_include.php";
     // Name of $_FILE key which holds the uploaded image
     $image = "download_image";
     // Left blank to use the image name as it is
     $name = $_FILES['download_image']['name'];
     // Upload folder
     $folder = DOWNLOADS . "images/";
     // Maximum image width in pixels
     $width = $settings['download_screen_max_w'];
     // Maximum image height in pixels
     $height = $settings['download_screen_max_w'];
     // Maximum file size in bytes
     $size = $settings['download_screen_max_b'];
     $upload = upload_image($image, $name, $folder, $width, $height, $size, false, true, false, 1, $folder, "_thumb", $settings['download_thumb_max_w'], $settings['download_thumb_max_h']);
     if ($upload['error'] != 0) {
         switch ($upload['error']) {
             case 1:
                 // Invalid file size
                 $error = 9;
                 break;
             case 2:
                 // Unsupported image type
                 $error = 10;
                 break;
             case 3:
                 // Invalid image resolution
                 $error = 11;
                 break;
             case 4:
function generate_article_preview($title, $article_tag, $tile_css)
{
    $icon_link = upload_image("preview");
    $preview = "<div class=\"row\" style=\"height:220px;\"><hr><div class=\"tile col-md-4 col-sm-6 col-xs-12\" style=\"width:375px;\">\n            <div class=\"tile {$tile_css}";
    $preview .= "\">";
    $preview .= "<h4 class=\"article-tag\">{$article_tag}</h4>";
    $preview .= "<a href=\"#\"><img src=\"{$icon_link}\" alt=\"img\" class=\"icon\"></a> <!--350px x 200px-->";
    $preview .= "<a href=\"#\"><p class=\"title\">{$title}</p></a>";
    $preview .= "</div> <!--tile second-column--></div> <!--column-->";
    //echo $preview;
    return $preview;
}
Example #23
0
 function post_image($source, $social_network)
 {
     switch ($social_network) {
         case 'facebook':
             $this->fb->upload_image($source);
             break;
         case 'twitter':
             break;
         case 'google+':
             upload_image($action->link);
             break;
         default:
             break;
     }
     $files = get_file_from_dir($source);
     post_image();
     persist();
     move_to_old_dir($source . '/uploaded');
 }
         $empresasData2[$i] = array();
         //p($dada);
         foreach ($dada as $dada2_key => $dada2_val) {
             //$empresasData2[$i][$dada2_key] = mb_convert_encoding($dada2_val, "UTF-8", "HTML-ENTITIES");
             //p($dada2);
             $response['arrayContent'][$i][$dada2_key] = encode_tojson($dada2_val);
         }
         $response['arrayContent'][$i] = json_encode($response['arrayContent'][$i]);
     }
     $response['content']['mgs'] = encode_tojson($type . '_updated');
     $response['content']['hasArray'] = encode_tojson($i);
 }
 if (@$_POST['action'] == 'upload_perfil') {
     $_POST['usuarios_id'];
     //subir imagen del perro
     $image_name = upload_image('fileUpload', str_replace('.png', '', $_POST['usuario_foto']));
     db_update('usuarios', array('foto' => $image_name), array('id' => $_POST['usuarios_id']));
     $response['content']['mgs'] = 'imagen cargada correctamente';
 }
 if (@$_POST['action'] == 'get_updates') {
     $_POST['serverupdate'];
     $_POST['table'];
     $type = cleanQuery($_POST['table']);
     $where = array('serverupdate > ' => $_POST['serverupdate']);
     /*if($type == 'respuestas_usuarios' || $type == 'notificaciones' || $type == 'videos_usuarios_empresas'){
           $where['usuarios_id'] = $_POST['usuarios_id'];
       }*/
     $empresasData2 = array();
     $empresasData = get($type, '*', $where);
     $i = 0;
     if (!empty($empresasData)) {
Example #25
0
     echo '<img src="/images/img/back.gif" alt="image" /> <a href="load.php?act=editdown&amp;id=' . $id . '">Вернуться</a><br />';
     break;
     ############################################################################################
     ##                                   Загрузка скриншота                                   ##
     ############################################################################################
 ############################################################################################
 ##                                   Загрузка скриншота                                   ##
 ############################################################################################
 case 'loadscreen':
     show_title('Загрузка скриншота');
     $down = DB::run()->queryFetch("SELECT `downs`.*, `cats`.* FROM `downs` LEFT JOIN `cats` ON `downs`.`downs_cats_id`=`cats`.`cats_id` WHERE `downs_id`=? LIMIT 1;", array($id));
     if (!empty($down)) {
         if (empty($down['downs_screen'])) {
             if (is_uploaded_file($_FILES['screen']['tmp_name'])) {
                 // ------------------------------------------------------//
                 $handle = upload_image($_FILES['screen'], $config['screenupload'], $config['screenupsize'], $down['downs_link']);
                 if ($handle) {
                     $folder = $down['folder'] ? $down['folder'] . '/' : '';
                     $handle->process(BASEDIR . '/load/screen/' . $folder);
                     if ($handle->processed) {
                         DB::run()->query("UPDATE `downs` SET `downs_screen`=? WHERE `downs_id`=?;", array($handle->file_dst_name, $id));
                         $handle->clean();
                         $_SESSION['note'] = 'Скриншот успешно загружен!';
                         redirect("load.php?act=editdown&id={$id}");
                     } else {
                         show_error($handle->error);
                     }
                 } else {
                     show_error('Ошибка! Не удалось загрузить скриншот!');
                 }
             } else {
Example #26
0
function API_EditBrand($post)
{
    /* 加载后台主操作函数 */
    require_once ROOT_PATH . ADMIN_PATH . '/includes/lib_main.php';
    require_once ROOT_PATH . ADMIN_PATH . '/includes/cls_exchange.php';
    require_once ROOT_PATH . 'includes/cls_image.php';
    /* 检查权限 */
    admin_privilege('brand_manage');
    $is_show = isset($_POST['is_show']) ? 1 : 0;
    $brand_id = !empty($_POST['brand_id']) ? intval($_POST['brand_id']) : 0;
    /*检查品牌名是否重复*/
    $exc = new exchange($GLOBALS['ecs']->table("brand"), $GLOBALS['db'], 'brand_id', 'brand_name');
    $is_only = $exc->is_only('brand_name', $_POST['brand_name'], '', '');
    if (!$is_only) {
        client_show_message(301);
    }
    $param = "brand_name = '{$_POST['brand_name']}', site_url='{$_POST['site_url']}', brand_desc='{$_POST['brand_desc']}', is_show='{$is_show}', sort_order='{$_POST['sort_order']}' ";
    /* 处理图片 */
    $img_name = upload_image($_POST['brand_logo'], 'brandlogo');
    if ($img_name !== false) {
        $param .= " ,brand_logo = '" . basename($img_name) . "' ";
    }
    /* 更新数据 */
    if ($exc->edit($param, $brand_id, '')) {
        /* 清除缓存 */
        clear_cache_files();
        admin_log($_POST['brand_name'], 'edit', 'brand');
        client_show_message(0, true);
    } else {
        client_show_message(302);
    }
}
Example #27
0
<?php

require_once dirname(dirname(dirname(__FILE__))) . '/app.php';
need_manager();
need_auth('market');
if ($_POST) {
    $table = new Table('partner', $_POST);
    $table->SetStrip('location', 'other');
    $table->create_time = time();
    $table->user_id = $login_user_id;
    $table->password = ZPartner::GenPassword($table->password);
    $table->group_id = abs(intval($table->group_id));
    $table->city_id = abs(intval($table->city_id));
    $table->open = strtoupper($table->open) == 'Y' ? 'Y' : 'N';
    $table->display = strtoupper($table->display) == 'Y' ? 'Y' : 'N';
    $table->image = upload_image('upload_image', null, 'team', true);
    $table->image1 = upload_image('upload_image1', null, 'team');
    $table->image2 = upload_image('upload_image2', null, 'team');
    $table->insert(array('username', 'user_id', 'city_id', 'title', 'group_id', 'bank_name', 'bank_user', 'bank_no', 'create_time', 'location', 'other', 'homepage', 'contact', 'mobile', 'phone', 'password', 'address', 'open', 'display', 'image', 'image1', 'image2', 'longlat'));
    $partner = DB::GetTableRow('partner', array('username' => $username, 'password' => $password));
    // 更新商户支付信息
    if ($login_partner) {
        $table = new Table('partner_pay', $_POST);
        $table->SetPk('id', $partner['id']);
        $insert = array('id', 'tenpaymid', 'tenpaysec', 'alipaymid', 'alipaysec');
        $flag = $table->insert($insert);
    }
    Session::Set('notice', '新建商户成功');
    Utility::Redirect(WEB_ROOT . '/manage/partner/index.php');
}
include template('manage_partner_create');
Example #28
0
File: edit.php Project: noikiy/mdwp
$partner = Table::Fetch('partner', $id);

if ( $_POST && $id==$_POST['id'] && $partner) {
	$table = new Table('partner', $_POST);
	$table->SetStrip('location', 'other', 'psjjs');
	$table->group_id = abs(intval($table->group_id));
	$table->city_id = abs(intval($table->city_id));
	$table->open = (strtoupper($table->open)=='Y') ? 'Y' : 'N';
	$table->display = (strtoupper($table->display)=='Y') ? 'Y' : 'N';
	$table->image = upload_image('upload_image', $partner['image'], 'team', true);
	$table->image1 = upload_image('upload_image1', $partner['image1'], 'team');
	$table->image2 = upload_image('upload_image2', $partner['image2'], 'team');
	$table->image3 = upload_image('upload_image3', $partner['image3'], 'team');
	$table->image4 = upload_image('upload_image4', $partner['image4'], 'team');
	$table->image5 = upload_image('upload_image5', $partner['image5'], 'team');
	$table->image6 = upload_image('upload_image6', $partner['image6'], 'team');

	$up_array = array(
			'username', 'pass','title','yysj','skfs','jtxl', 'bank_name','bank_user_xm',  'bank_user', 'bank_no',
			'location', 'other','psjjs','homepage', 'contact', 'mobile', 'phone',
			'address', 'group_id', 'open', 'city_id', 'display','cycle_calculate',
			'image', 'image1', 'image2','image3','image4','image5','image6', 'longlat', 'head','sel1','sel2','sel3',
			);

	if ($table->password ) {
		$table->password = ZPartner::GenPassword($table->password);
		$up_array[] = 'password';
	}
	
	
	
Example #29
0
File: edit.php Project: noikiy/mdwp
	$team['city_id'] = abs(intval($team['city_id']));
	
	$team['dptpl_id'] = abs(intval($team['dptpl_id']));
	
	$team['sort_order'] = abs(intval($team['sort_order']));
	$team['fare'] = abs(intval($team['fare']));
	$team['farefree'] = intval($team['farefree']);
	$team['pre_number'] = abs(intval($team['pre_number']));
	$team['end_time'] = strtotime($team['end_time']);
	$team['expire_time'] = strtotime($team['expire_time']);
	$team['r_score'] = abs(floatval($team['r_score']));
	$team['r_number'] = abs(intval($team['r_number']));
	$team['r_satisfaction'] = abs(intval($team['r_satisfaction']));
	$team['image'] = upload_image('upload_image',$eteam['image'],'team',true);
	$team['image1'] = upload_image('upload_image1',$eteam['image1'],'team');
	$team['image2'] = upload_image('upload_image2',$eteam['image2'],'team');
	
	
	
	/* 序列化选取的城市 */
	if (!empty($team['city_ids'])) {
		if(in_array(0, $team['city_ids'])) {
			$team['city_id'] = 0; $team['city_ids'] = '@0@';
		}
		else {
			$team['city_id'] = abs(intval($team['city_ids'][0]));
			$team['city_ids'] = '@'.implode('@', $team['city_ids']).'@';
		}
	}else {
		Session::Set('notice', '请选择项目发布的城市');
		include template('manage_team_edit');
Example #30
0
<?php

require_once dirname(dirname(dirname(__FILE__))) . '/app.php';
need_manager();
need_auth('market');
$id = abs(intval($_GET['id']));
$partner = Table::Fetch('partner', $id);
if ($_POST && $id == $_POST['id'] && $partner) {
    $table = new Table('partner', $_POST);
    $table->SetStrip('location', 'other');
    $table->group_id = abs(intval($table->group_id));
    $table->city_id = abs(intval($table->city_id));
    $table->open = strtoupper($table->open) == 'Y' ? 'Y' : 'N';
    $table->display = strtoupper($table->display) == 'Y' ? 'Y' : 'N';
    $table->image = upload_image('upload_image', $partner['image'], 'team', true);
    $table->image1 = upload_image('upload_image1', $partner['image1'], 'team');
    $table->image2 = upload_image('upload_image2', $partner['image2'], 'team');
    $up_array = array('username', 'title', 'bank_name', 'bank_user', 'bank_no', 'location', 'other', 'homepage', 'contact', 'mobile', 'phone', 'address', 'group_id', 'open', 'city_id', 'display', 'image', 'image1', 'image2', 'longlat', 'head', 'open_time', 'traffic_info');
    if ($table->password) {
        $table->password = ZPartner::GenPassword($table->password);
        $up_array[] = 'password';
    }
    $flag = $table->update($up_array);
    if ($flag) {
        Session::Set('notice', '修改商户信息成功');
        redirect(WEB_ROOT . "/manage/partner/edit.php?id={$id}");
    }
    Session::Set('error', '修改商户信息失败');
    $partner = $_POST;
}
include template('manage_partner_edit');