当前位置: 首页>>代码示例>>PHP>>正文


PHP upload::set_destination方法代码示例

本文整理汇总了PHP中upload::set_destination方法的典型用法代码示例。如果您正苦于以下问题:PHP upload::set_destination方法的具体用法?PHP upload::set_destination怎么用?PHP upload::set_destination使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在upload的用法示例。


在下文中一共展示了upload::set_destination方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

 function get_upload_file($fld)
 {
     global $UploadCache;
     if (!isset($UploadCache)) {
         $UploadCache = array();
     }
     if (!isset($UploadCache[$fld])) {
         $model_image_obj = new upload($fld);
         $model_image_obj->set_destination(DIR_FS_CATALOG_IMAGES);
         $UploadCache[$fld] = $model_image_obj->parse() && $model_image_obj->save() ? $model_image_obj->filename : '';
     }
     //echo 'get_upload_file('.$fld.")=".$UploadCache[$fld]."\n";
     return $UploadCache[$fld];
 }
开发者ID:rrecurse,项目名称:IntenseCart,代码行数:14,代码来源:gift_certs.php

示例2: mkdir

 function put_logo_image($action = '')
 {
     $newname = DIR_FS_CATALOG . 'images/' . $this->store_id . '_images';
     if (!is_dir($newname)) {
         mkdir($newname);
     }
     $allowed_files_types = array('gif', 'jpg', 'png');
     if (is_dir($newname)) {
         $store_logo_image = new upload($this->store_logo);
         $store_logo_image->set_destination($newname);
         $store_logo_image->set_extensions($allowed_files_types);
         $parsed = $store_logo_image->parse();
         if (!$parsed && $action == '') {
             if (copy(DIR_FS_CATALOG . 'images/store_images/default/default_store_logo.gif', $newname . '/default_store_logo.gif')) {
                 smn_db_query("update " . TABLE_STORE_MAIN . " set store_image = 'default_store_logo.gif' where store_id = '" . (int) $this->store_id . "'");
             }
         } else {
             if ($store_logo_image->file['size'] > MAX_IMAGE_FILE_SIZE && $parsed) {
                 if (copy(DIR_FS_CATALOG . 'images/store_images/default/default_store_logo.gif', $newname . '/default_store_logo.gif')) {
                     smn_db_query("update " . TABLE_STORE_MAIN . " set store_image = 'default_store_logo.gif' where store_id = '" . (int) $this->store_id . "'");
                 }
                 return sprintf(ERROR_IMAGE_FILE_SIZE_EXCEED, MAX_IMAGE_FILE_SIZE);
             } elseif ($parsed) {
                 $ext = substr($store_logo_image->filename, -4);
                 $store_logo_image->set_filename('logo' . $ext);
                 $saved = $store_logo_image->save();
                 if ($saved) {
                     smn_db_query("update " . TABLE_STORE_MAIN . " set store_image = '" . $store_logo_image->filename . "' where store_id = '" . (int) $this->store_id . "'");
                 } elseif ($action == '') {
                     $this->store_logo_image_name = '';
                     if (copy(DIR_FS_CATALOG . 'images/store_images/default/default_store_logo.gif', $newname . '/default_store_logo.gif')) {
                         smn_db_query("update " . TABLE_STORE_MAIN . " set store_image = 'default_store_logo.gif' where store_id = '" . (int) $this->store_id . "'");
                     }
                 }
             }
         }
     } else {
         return ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST;
     }
     return '';
 }
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:41,代码来源:store.php

示例3: upload

 function upload()
 {
     $logo_image = new upload('logo_image');
     if ($logo_image->exists()) {
         self::deleteLogo('originals');
         $img_type = substr($_FILES['logo_image']['name'], strrpos($_FILES['logo_image']['name'], '.') + 1);
         $original = DIR_FS_CATALOG . DIR_WS_IMAGES . 'logo_originals.' . $img_type;
         $logo_image->set_destination(realpath(DIR_FS_CATALOG . 'images/'));
         if ($logo_image->parse() && $logo_image->save()) {
             copy(DIR_FS_CATALOG . 'images/' . $logo_image->filename, $original);
             @unlink(DIR_FS_CATALOG . 'images/' . $logo_image->filename);
             $osC_DirectoryListing = new osC_DirectoryListing('../templates');
             $osC_DirectoryListing->setIncludeDirectories(true);
             $osC_DirectoryListing->setIncludeFiles(false);
             $osC_DirectoryListing->setExcludeEntries('system');
             $templates = $osC_DirectoryListing->getFiles();
             foreach ($templates as $template) {
                 $code = $template['name'];
                 if (file_exists('../templates/' . $code . '/template.php')) {
                     include '../templates/' . $code . '/template.php';
                     $class = 'osC_Template_' . $code;
                     self::deleteLogo($code);
                     if (class_exists($class)) {
                         $module = new $class();
                         $logo_height = $module->getLogoHeight();
                         $logo_width = $module->getLogoWidth();
                         $dest_image = DIR_FS_CATALOG . DIR_WS_IMAGES . 'logo_' . $code . '.' . $img_type;
                         osc_gd_resize($original, $dest_image, $logo_width, $logo_height);
                     }
                 }
             }
             return true;
         }
     }
     return false;
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:36,代码来源:logo_upload.php

示例4: array

          if (USE_CACHE == 'true') {
            smn_reset_cache_block('categories');
            smn_reset_cache_block('also_purchased');
          }
        }
        smn_redirect(html_entity_decode(smn_href_link(FILENAME_STORE_PRODUCT_CATEGORIES, 'cPath=' . $categories_id . '&ID='.$store_id.'&pID=' . $products_id)));
        break;
      case 'new_product_preview':
          if (! checkVoucherPermissions($store_id, $_POST['products_model'])) {
            $messageStack->add(ERROR_VENDORS_CANT_ADD_VOUCHERS, 'error');
            $allow_insert = 'false';
          } else {
            // copy image only if modified
            $allowed_files_types = array('gif', 'jpg', 'jpeg', 'png');
            $products_image = new upload('products_image');
            $products_image->set_destination(DIR_FS_CATALOG_IMAGES);
            $products_image->set_extensions($allowed_files_types);  
            if ($products_image->parse() && $products_image->save()) {
              $products_image_name = $products_image->filename;
            } else {
              $products_image_name = (isset($_POST['products_previous_image']) ? $_POST['products_previous_image'] : '');
            }
          }
        break;
    }
  }
// check if the catalog image directory exists
  if (is_dir(DIR_FS_CATALOG_IMAGES)) {
    if (!is_writeable(DIR_FS_CATALOG_IMAGES)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error');
  } else {
    $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error');
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:31,代码来源:store_product_categories.php

示例5: upload

 $banners_open_new_windows = zen_db_prepare_input($_POST['banners_open_new_windows']);
 $banners_on_ssl = zen_db_prepare_input($_POST['banners_on_ssl']);
 $banners_sort_order = zen_db_prepare_input($_POST['banners_sort_order']);
 $banner_error = false;
 if (empty($banners_title)) {
     $messageStack->add(ERROR_BANNER_TITLE_REQUIRED, 'error');
     $banner_error = true;
 }
 if (empty($banners_group)) {
     $messageStack->add(ERROR_BANNER_GROUP_REQUIRED, 'error');
     $banner_error = true;
 }
 if (empty($banners_html_text)) {
     if (empty($banners_image_local)) {
         $banners_image = new upload('banners_image');
         $banners_image->set_destination(DIR_FS_CATALOG_IMAGES . $banners_image_target);
         if ($banners_image->parse() == false || $banners_image->save() == false) {
             $messageStack->add(ERROR_BANNER_IMAGE_REQUIRED, 'error');
             $banner_error = true;
         }
     }
 }
 if ($banner_error == false) {
     $db_image_location = zen_not_null($banners_image_local) ? $banners_image_local : $banners_image_target . $banners_image->filename;
     $sql_data_array = array('banners_title' => $banners_title, 'banners_url' => $banners_url, 'banners_image' => $db_image_location, 'banners_group' => $banners_group, 'banners_html_text' => $banners_html_text, 'status' => $status, 'banners_open_new_windows' => $banners_open_new_windows, 'banners_on_ssl' => $banners_on_ssl, 'banners_sort_order' => (int) $banners_sort_order);
     if ($action == 'insert') {
         $insert_sql_data = array('date_added' => 'now()', 'status' => '1');
         $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
         zen_db_perform(TABLE_BANNERS, $sql_data_array);
         $banners_id = zen_db_insert_id();
         $messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success');
开发者ID:wwxgitcat,项目名称:zencart_v1.0,代码行数:31,代码来源:banner_manager.php

示例6: upload

 $attributes_price_letters = zen_db_prepare_input($_POST['attributes_price_letters']);
 $attributes_price_letters_free = zen_db_prepare_input($_POST['attributes_price_letters_free']);
 $attributes_required = zen_db_prepare_input($_POST['attributes_required']);
 $attribute_id = zen_db_prepare_input($_POST['attribute_id']);
 // edit
 // attributes images
 // when set to none remove from database
 if (isset($_POST['attributes_image']) && zen_not_null($_POST['attributes_image']) && $_POST['attributes_image'] != 'none') {
     $attributes_image = zen_db_prepare_input($_POST['attributes_image']);
     $attributes_image_none = false;
 } else {
     $attributes_image = '';
     $attributes_image_none = true;
 }
 $attributes_image = new upload('attributes_image');
 $attributes_image->set_destination(DIR_FS_CATALOG_IMAGES . $_POST['img_dir']);
 if ($attributes_image->parse() && $attributes_image->save($_POST['overwrite'])) {
     $attributes_image_name = $attributes_image->filename != 'none' ? $_POST['img_dir'] . $attributes_image->filename : '';
 } else {
     $attributes_image_name = (isset($_POST['attributes_previous_image']) and $_POST['attributes_image'] != 'none') ? $_POST['attributes_previous_image'] : '';
 }
 if ($_POST['image_delete'] == 1) {
     $attributes_image_name = '';
 }
 // turned off until working
 $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . "\n                        set attributes_image = '" . zen_db_input($attributes_image_name) . "'\n                        where products_attributes_id = '" . (int) $attribute_id . "'");
 $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . "\n                          set products_id = '" . (int) $products_id . "',\n                              options_id = '" . (int) $options_id . "',\n                              options_values_id = '" . (int) $values_id . "',\n                              options_values_price = '" . zen_db_input($value_price) . "',\n                              price_prefix = '" . zen_db_input($price_prefix) . "',\n                              products_options_sort_order = '" . zen_db_input($products_options_sort_order) . "',\n                              product_attribute_is_free = '" . zen_db_input($product_attribute_is_free) . "',\n                              products_attributes_weight = '" . zen_db_input($products_attributes_weight) . "',\n                              products_attributes_weight_prefix = '" . zen_db_input($products_attributes_weight_prefix) . "',\n                              attributes_display_only = '" . zen_db_input($attributes_display_only) . "',\n                              attributes_default = '" . zen_db_input($attributes_default) . "',\n                              attributes_discounted = '" . zen_db_input($attributes_discounted) . "',\n                              attributes_price_base_included = '" . zen_db_input($attributes_price_base_included) . "',\n                              attributes_price_onetime = '" . zen_db_input($attributes_price_onetime) . "',\n                              attributes_price_factor = '" . zen_db_input($attributes_price_factor) . "',\n                              attributes_price_factor_offset = '" . zen_db_input($attributes_price_factor_offset) . "',\n                              attributes_price_factor_onetime = '" . zen_db_input($attributes_price_factor_onetime) . "',\n                              attributes_price_factor_onetime_offset = '" . zen_db_input($attributes_price_factor_onetime_offset) . "',\n                              attributes_qty_prices = '" . zen_db_input($attributes_qty_prices) . "',\n                              attributes_qty_prices_onetime = '" . zen_db_input($attributes_qty_prices_onetime) . "',\n                              attributes_price_words = '" . zen_db_input($attributes_price_words) . "',\n                              attributes_price_words_free = '" . zen_db_input($attributes_price_words_free) . "',\n                              attributes_price_letters = '" . zen_db_input($attributes_price_letters) . "',\n                              attributes_price_letters_free = '" . zen_db_input($attributes_price_letters_free) . "',\n                              attributes_required = '" . zen_db_input($attributes_required) . "'\n                          where products_attributes_id = '" . (int) $attribute_id . "'");
 if (DOWNLOAD_ENABLED == 'true') {
     $products_attributes_filename = zen_db_prepare_input($_POST['products_attributes_filename']);
     $products_attributes_maxdays = zen_db_prepare_input($_POST['products_attributes_maxdays']);
     $products_attributes_maxcount = zen_db_prepare_input($_POST['products_attributes_maxcount']);
开发者ID:quangn92,项目名称:visualyou,代码行数:31,代码来源:attributes_controller.php

示例7: array

     $insert_sql_data = array('date_added' => 'now()');
     $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
     zen_db_perform(TABLE_MANUFACTURERS, $sql_data_array);
     $manufacturers_id = zen_db_insert_id();
 } elseif ($action == 'save') {
     $update_sql_data = array('last_modified' => 'now()');
     $sql_data_array = array_merge($sql_data_array, $update_sql_data);
     zen_db_perform(TABLE_MANUFACTURERS, $sql_data_array, 'update', "manufacturers_id = '" . (int) $manufacturers_id . "'");
 }
 if ($_POST['manufacturers_image_manual'] != '') {
     // add image manually
     $manufacturers_image_name = zen_db_input($_POST['img_dir'] . $_POST['manufacturers_image_manual']);
     $db->Execute("update " . TABLE_MANUFACTURERS . "\n                      set manufacturers_image = '" . $manufacturers_image_name . "'\n                      where manufacturers_id = '" . (int) $manufacturers_id . "'");
 } else {
     $manufacturers_image = new upload('manufacturers_image');
     $manufacturers_image->set_destination(DIR_FS_CATALOG_IMAGES . $_POST['img_dir']);
     if ($manufacturers_image->parse() && $manufacturers_image->save()) {
         // remove image from database if none
         if ($manufacturers_image->filename != 'none') {
             $db->Execute("update " . TABLE_MANUFACTURERS . "\n                          set manufacturers_image = '" . zen_db_input($_POST['img_dir'] . $manufacturers_image->filename) . "'\n                          where manufacturers_id = '" . (int) $manufacturers_id . "'");
         } else {
             $db->Execute("update " . TABLE_MANUFACTURERS . "\n                          set manufacturers_image = ''\n                          where manufacturers_id = '" . (int) $manufacturers_id . "'");
         }
     }
 }
 $languages = zen_get_languages();
 for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
     $manufacturers_url_array = $_POST['manufacturers_url'];
     $language_id = $languages[$i]['id'];
     $sql_data_array = array('manufacturers_url' => zen_db_prepare_input($manufacturers_url_array[$language_id]));
     if ($action == 'insert') {
开发者ID:zenmagick,项目名称:zencart,代码行数:31,代码来源:manufacturers.php

示例8: save

 public static function save($id = null, $data)
 {
     global $osC_Database, $osC_Language, $osC_Image;
     $error = false;
     $osC_Database->startTransaction();
     if (is_numeric($id)) {
         $Qproduct = $osC_Database->query('update :table_products set products_quantity = :products_quantity, products_price = :products_price, products_model = :products_model, products_weight = :products_weight, products_weight_class = :products_weight_class, products_status = :products_status, products_tax_class_id = :products_tax_class_id, products_last_modified = now() where products_id = :products_id');
         $Qproduct->bindInt(':products_id', $id);
     } else {
         $Qproduct = $osC_Database->query('insert into :table_products (products_quantity, products_price, products_model, products_weight, products_weight_class, products_status, products_tax_class_id, products_date_added) values (:products_quantity, :products_price, :products_model, :products_weight, :products_weight_class, :products_status, :products_tax_class_id, :products_date_added)');
         $Qproduct->bindRaw(':products_date_added', 'now()');
     }
     $Qproduct->bindTable(':table_products', TABLE_PRODUCTS);
     $Qproduct->bindInt(':products_quantity', $data['quantity']);
     $Qproduct->bindFloat(':products_price', $data['price']);
     $Qproduct->bindValue(':products_model', $data['model']);
     $Qproduct->bindFloat(':products_weight', $data['weight']);
     $Qproduct->bindInt(':products_weight_class', $data['weight_class']);
     $Qproduct->bindInt(':products_status', $data['status']);
     $Qproduct->bindInt(':products_tax_class_id', $data['tax_class_id']);
     //      $Qproduct->setLogging($_SESSION['module'], $id);
     $Qproduct->execute();
     if ($osC_Database->isError()) {
         $error = true;
     } else {
         if (is_numeric($id)) {
             $products_id = $id;
         } else {
             $products_id = $osC_Database->nextID();
         }
         $Qcategories = $osC_Database->query('delete from :table_products_to_categories where products_id = :products_id');
         $Qcategories->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
         $Qcategories->bindInt(':products_id', $products_id);
         //        $Qcategories->setLogging($_SESSION['module'], $products_id);
         $Qcategories->execute();
         if ($osC_Database->isError()) {
             $error = true;
         } else {
             if (isset($data['categories']) && !empty($data['categories'])) {
                 foreach ($data['categories'] as $category_id) {
                     $Qp2c = $osC_Database->query('insert into :table_products_to_categories (products_id, categories_id) values (:products_id, :categories_id)');
                     $Qp2c->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
                     $Qp2c->bindInt(':products_id', $products_id);
                     $Qp2c->bindInt(':categories_id', $category_id);
                     //              $Qp2c->setLogging($_SESSION['module'], $products_id);
                     $Qp2c->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
         }
     }
     if ($error === false) {
         $images = array();
         $products_image = new upload('products_image');
         $products_image->set_extensions(array('gif', 'jpg', 'jpeg', 'png'));
         if ($products_image->exists()) {
             $products_image->set_destination(realpath('../images/products/originals'));
             if ($products_image->parse() && $products_image->save()) {
                 $images[] = $products_image->filename;
             }
         }
         if (isset($data['localimages'])) {
             foreach ($data['localimages'] as $image) {
                 $image = basename($image);
                 if (file_exists('../images/products/_upload/' . $image)) {
                     copy('../images/products/_upload/' . $image, '../images/products/originals/' . $image);
                     @unlink('../images/products/_upload/' . $image);
                     $images[] = $image;
                 }
             }
         }
         $default_flag = 1;
         foreach ($images as $image) {
             $Qimage = $osC_Database->query('insert into :table_products_images (products_id, image, default_flag, sort_order, date_added) values (:products_id, :image, :default_flag, :sort_order, :date_added)');
             $Qimage->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
             $Qimage->bindInt(':products_id', $products_id);
             $Qimage->bindValue(':image', $image);
             $Qimage->bindInt(':default_flag', $default_flag);
             $Qimage->bindInt(':sort_order', 0);
             $Qimage->bindRaw(':date_added', 'now()');
             //          $Qimage->setLogging($_SESSION['module'], $products_id);
             $Qimage->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             } else {
                 foreach ($osC_Image->getGroups() as $group) {
                     if ($group['id'] != '1') {
                         $osC_Image->resize($image, $group['id']);
                     }
                 }
             }
             $default_flag = 0;
         }
     }
     if ($error === false) {
         foreach ($osC_Language->getAll() as $l) {
             if (is_numeric($id)) {
//.........这里部分代码省略.........
开发者ID:heshuai64,项目名称:gamestore,代码行数:101,代码来源:products.php

示例9: upload

 $expires_date = HTML::sanitize($_POST['expires_date']);
 $expires_impressions = HTML::sanitize($_POST['expires_impressions']);
 $date_scheduled = HTML::sanitize($_POST['date_scheduled']);
 $banner_error = false;
 if (empty($banners_title)) {
     $OSCOM_MessageStack->add(OSCOM::getDef('error_banner_title_required'), 'error');
     $banner_error = true;
 }
 if (empty($banners_group)) {
     $OSCOM_MessageStack->add(OSCOM::getDef('error_banner_group_required'), 'error');
     $banner_error = true;
 }
 if (empty($banners_html_text)) {
     if (empty($banners_image_local)) {
         $banners_image = new upload('banners_image');
         $banners_image->set_destination(OSCOM::getConfig('dir_root', 'Shop') . 'images/' . $banners_image_target);
         if ($banners_image->parse() == false || $banners_image->save() == false) {
             $banner_error = true;
         }
     }
 }
 if ($banner_error == false) {
     $db_image_location = tep_not_null($banners_image_local) ? $banners_image_local : $banners_image_target . $banners_image->filename;
     $sql_data_array = array('banners_title' => $banners_title, 'banners_url' => $banners_url, 'banners_image' => $db_image_location, 'banners_group' => $banners_group, 'banners_html_text' => $banners_html_text, 'expires_date' => 'null', 'expires_impressions' => 0, 'date_scheduled' => 'null');
     if ($action == 'insert') {
         $insert_sql_data = array('date_added' => 'now()', 'status' => '1');
         $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
         $OSCOM_Db->save('banners', $sql_data_array);
         $banners_id = $OSCOM_Db->lastInsertId();
         $OSCOM_MessageStack->add(OSCOM::getDef('success_banner_inserted'), 'success');
     } elseif ($action == 'update') {
开发者ID:haraldpdl,项目名称:oscommerce2,代码行数:31,代码来源:banner_manager.php

示例10: upload

         }
 */
 if ($affiliate_banners_image && $affiliate_banners_image != 'none' && is_uploaded_file($affiliate_banners_image)) {
     if (!is_writeable(DIR_FS_CATALOG_IMAGES . 'banners/' . $affiliate_banners_image_target)) {
         if (is_dir(DIR_FS_CATALOG_IMAGES . 'banners/' . $affiliate_banners_image_target)) {
             $messageStack->add(ERROR_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error');
         } else {
             $messageStack->add(ERROR_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error');
         }
         $affiliate_banner_error = true;
     }
 }
 if (empty($affiliate_html_text)) {
     if (empty($affiliate_banners_image_local)) {
         $affiliate_banners_image = new upload('affiliate_banners_image');
         $affiliate_banners_image->set_destination(DIR_FS_CATALOG_IMAGES . 'banners/' . $affiliate_banners_image_target);
         if ($affiliate_banners_image->parse() == false || $affiliate_banners_image->save() == false) {
             $affiliate_banner_error = true;
         }
     }
 }
 if ($affiliate_banner_error == false) {
     //if (empty($affiliate_html_text)) {
     //if ( ($affiliate_banners_image) && ($affiliate_banners_image != 'none') && (is_uploaded_file($affiliate_banners_image)) ) {
     //  $image_location = DIR_FS_CATALOG_IMAGES . 'banners/' . $affiliate_banners_image_target . $affiliate_banners_image_name;
     //  copy($affiliate_banners_image, $image_location);
     //}
     $db_image_location = !empty($affiliate_banners_image_local) ? $affiliate_banners_image_local : $affiliate_banners_image_target . $affiliate_banners_image->filename;
     //}
     if (!$affiliate_products_id) {
         $affiliate_products_id = "0";
开发者ID:digideskio,项目名称:oscmax2,代码行数:31,代码来源:affiliate_banners.php

示例11: array

     // Update existing large product images
     if (preg_match('/^products_image_large_([0-9]+)$/', $key, $matches)) {
         $pi_sort_order++;
         $sql_data_array = array('htmlcontent' => tep_db_prepare_input($HTTP_POST_VARS['products_image_htmlcontent_' . $matches[1]]), 'sort_order' => $pi_sort_order);
         $t = new upload($key);
         $t->set_destination(DIR_FS_CATALOG_IMAGES);
         if ($t->parse() && $t->save()) {
             $sql_data_array['image'] = tep_db_prepare_input($t->filename);
         }
         tep_db_perform(TABLE_PRODUCTS_IMAGES, $sql_data_array, 'update', "products_id = '" . (int) $products_id . "' and id = '" . (int) $matches[1] . "'");
         $piArray[] = (int) $matches[1];
     } elseif (preg_match('/^products_image_large_new_([0-9]+)$/', $key, $matches)) {
         // Insert new large product images
         $sql_data_array = array('products_id' => (int) $products_id, 'htmlcontent' => tep_db_prepare_input($HTTP_POST_VARS['products_image_htmlcontent_new_' . $matches[1]]));
         $t = new upload($key);
         $t->set_destination(DIR_FS_CATALOG_IMAGES);
         if ($t->parse() && $t->save()) {
             $pi_sort_order++;
             $sql_data_array['image'] = tep_db_prepare_input($t->filename);
             $sql_data_array['sort_order'] = $pi_sort_order;
             tep_db_perform(TABLE_PRODUCTS_IMAGES, $sql_data_array);
             $piArray[] = tep_db_insert_id();
         }
     }
 }
 $product_images_query = tep_db_query("select image from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int) $products_id . "' and id not in (" . implode(',', $piArray) . ")");
 if (tep_db_num_rows($product_images_query)) {
     while ($product_images = tep_db_fetch_array($product_images_query)) {
         $duplicate_image_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_IMAGES . " where image = '" . tep_db_input($product_images['image']) . "'");
         $duplicate_image = tep_db_fetch_array($duplicate_image_query);
         if ($duplicate_image['total'] < 2) {
开发者ID:Sibzsolutions,项目名称:Savostore,代码行数:31,代码来源:categories.php

示例12: uploadImage

 function uploadImage()
 {
     global $toC_Json, $osC_Database;
     $osC_Image = new osC_Image_Admin();
     if (is_array($_FILES)) {
         $products_image = array_keys($_FILES);
         $products_image = $products_image[0];
     }
     if (isset($_REQUEST['products_id'])) {
         $products_image = new upload($products_image);
         if ($products_image->exists()) {
             $products_image->set_destination(realpath('../images/products/originals'));
             if ($products_image->parse() && $products_image->save()) {
                 $default_flag = 1;
                 $Qcheck = $osC_Database->query('select id from :table_products_images where products_id = :products_id and default_flag = :default_flag limit 1');
                 $Qcheck->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
                 $Qcheck->bindInt(':products_id', $_REQUEST['products_id']);
                 $Qcheck->bindInt(':default_flag', 1);
                 $Qcheck->execute();
                 if ($Qcheck->numberOfRows() === 1) {
                     $default_flag = 0;
                 }
                 $Qimage = $osC_Database->query('insert into :table_products_images (products_id, image, default_flag, sort_order, date_added) values (:products_id, :image, :default_flag, :sort_order, :date_added)');
                 $Qimage->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
                 $Qimage->bindInt(':products_id', $_REQUEST['products_id']);
                 $Qimage->bindValue(':image', $products_image->filename);
                 $Qimage->bindInt(':default_flag', $default_flag);
                 $Qimage->bindInt(':sort_order', 0);
                 $Qimage->bindRaw(':date_added', 'now()');
                 $Qimage->setLogging($_SESSION['module'], $_REQUEST['products_id']);
                 $Qimage->execute();
                 foreach ($osC_Image->getGroups() as $group) {
                     if ($group['id'] != '1') {
                         $osC_Image->resize($products_image->filename, $group['id']);
                     }
                 }
             }
         }
     }
     header('Content-Type: text/html');
     $response['success'] = true;
     $response['feedback'] = $osC_Language->get('ms_success_action_performed');
     echo $toC_Json->encode($response);
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:44,代码来源:products.php

示例13: elseif

             if ($export_info['status'] === false) {
                 $messageStack->add($export_info['message']);
             } else {
                 $messageStack->add_session(sprintf(DBIO_MGR_EXPORT_SUCCESSFUL, $_POST['handler'], $export_info['export_filename'], $export_info['stats']['record_count']), 'success');
                 $_SESSION['dbio_vars'] = $_POST;
                 $_SESSION['dbio_last_export'] = $export_info;
                 zen_redirect(zen_href_link(FILENAME_DBIO_MANAGER, zen_get_all_get_params(array('action'))));
             }
         }
     } elseif (isset($_POST['upload_button'])) {
         if (!zen_not_null($_FILES['upload_filename']['name'])) {
             $messageStack->add(ERROR_NO_FILE_TO_UPLOAD);
         } else {
             $upload = new upload('upload_filename');
             $upload->set_extensions(explode(',', DBIO_SUPPORTED_FILE_EXTENSIONS));
             $upload->set_destination(DIR_FS_DBIO);
             if ($upload->parse()) {
                 $upload->save();
             }
             zen_redirect(zen_href_link(FILENAME_DBIO_MANAGER, zen_get_all_get_params(array('action'))));
         }
     } else {
         zen_redirect(zen_href_link(FILENAME_DBIO_MANAGER, zen_get_all_get_params(array('action'))));
     }
     break;
 case 'file':
     if (!(isset($_POST['file_action']) && isset($_POST['filename_hash']) && isset($dbio_files[$_POST['filename_hash']]) || isset($_POST['delete_button']) && isset($_POST['delete_hash']))) {
         $messageStack->add_session(DBIO_FORM_SUBMISSION_ERROR);
     } elseif (isset($_POST['delete_button'])) {
         if (is_array($_POST['delete_hash'])) {
             foreach ($_POST['delete_hash'] as $delete_hash => $delete_value) {
开发者ID:lat9,项目名称:dbio,代码行数:31,代码来源:dbio_manager.php

示例14: save

 public static function save($id = null, $data)
 {
     global $lC_Database, $lC_Language, $lC_Image, $lC_CategoryTree;
     $error = false;
     $lC_Database->startTransaction();
     if (is_numeric($id)) {
         $Qproduct = $lC_Database->query('update :table_products set parent_id = :parent_id, products_quantity = :products_quantity, products_cost = :products_cost, products_price = :products_price, products_msrp = :products_msrp, products_model = :products_model, products_sku = :products_sku, products_weight = :products_weight, products_weight_class = :products_weight_class, products_status = :products_status, groups_pricing_enable = :groups_pricing_enable, qpb_pricing_enable = :qpb_pricing_enable, specials_pricing_enable = :specials_pricing_enable, products_tax_class_id = :products_tax_class_id, products_last_modified = now(), products_sort_order = :products_sort_order where products_id = :products_id');
         $Qproduct->bindInt(':products_id', $id);
     } else {
         $Qproduct = $lC_Database->query('insert into :table_products (parent_id, products_quantity, products_cost, products_price, products_msrp, products_model, products_sku, products_weight, products_weight_class, products_status, products_tax_class_id, products_ordered, products_date_added, groups_pricing_enable, qpb_pricing_enable, specials_pricing_enable, products_sort_order) values (:parent_id, :products_quantity, :products_cost, :products_price, :products_msrp, :products_model, :products_sku, :products_weight, :products_weight_class, :products_status, :products_tax_class_id, :products_ordered, :products_date_added, :groups_pricing_enable, :qpb_pricing_enable, :specials_pricing_enable, :products_sort_order)');
         $Qproduct->bindRaw(':products_date_added', 'now()');
         $Qproduct->bindInt(':products_ordered', $data['products_ordered']);
     }
     // set parent status
     if (isset($_POST['products_status']) && $_POST['products_status'] == 'active') {
         $data['status'] = 1;
     }
     if (isset($_POST['products_status']) && $_POST['products_status'] == 'inactive') {
         $data['status'] = -1;
     }
     if (isset($_POST['products_status']) && $_POST['products_status'] == 'recurring') {
         $data['status'] = 0;
     }
     $Qproduct->bindTable(':table_products', TABLE_PRODUCTS);
     $Qproduct->bindInt(':parent_id', $data['parent_id']);
     $Qproduct->bindInt(':products_quantity', $data['quantity']);
     $Qproduct->bindFloat(':products_cost', $data['cost']);
     $Qproduct->bindFloat(':products_price', $data['price']);
     $Qproduct->bindFloat(':products_msrp', $data['msrp']);
     $Qproduct->bindValue(':products_model', $data['model']);
     $Qproduct->bindValue(':products_sku', $data['sku']);
     $Qproduct->bindFloat(':products_weight', $data['weight']);
     $Qproduct->bindInt(':products_weight_class', $data['weight_class']);
     $Qproduct->bindInt(':products_tax_class_id', $data['tax_class_id']);
     $Qproduct->bindInt(':products_status', $data['status']);
     $Qproduct->bindInt(':groups_pricing_enable', $data['groups_pricing_switch']);
     $Qproduct->bindInt(':qpb_pricing_enable', $data['qpb_pricing_switch']);
     $Qproduct->bindInt(':specials_pricing_enable', $data['specials_pricing_switch']);
     $Qproduct->bindInt(':products_sort_order', $data['products_sort_order']);
     $Qproduct->setLogging($_SESSION['module'], $id);
     $Qproduct->execute();
     if (is_numeric($id)) {
         $products_id = $id;
     } else {
         $products_id = $lC_Database->nextID();
     }
     // products to categories
     if ($lC_Database->isError()) {
         $error = true;
     } else {
         $Qcategories = $lC_Database->query('delete from :table_products_to_categories where products_id = :products_id');
         $Qcategories->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
         $Qcategories->bindInt(':products_id', $products_id);
         $Qcategories->setLogging($_SESSION['module'], $products_id);
         $Qcategories->execute();
         if ($lC_Database->isError()) {
             $error = true;
         } else {
             if (isset($data['categories']) && !empty($data['categories'])) {
                 foreach ($data['categories'] as $category_id) {
                     $Qp2c = $lC_Database->query('insert into :table_products_to_categories (products_id, categories_id) values (:products_id, :categories_id)');
                     $Qp2c->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
                     $Qp2c->bindInt(':products_id', $products_id);
                     $Qp2c->bindInt(':categories_id', $category_id);
                     $Qp2c->setLogging($_SESSION['module'], $products_id);
                     $Qp2c->execute();
                     if ($lC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
         }
     }
     // product images
     if ($error === false) {
         $images = array();
         $products_image = new upload('products_image');
         $products_image->set_extensions(array('gif', 'jpg', 'jpeg', 'png'));
         if ($products_image->exists()) {
             $products_image->set_destination(realpath('../images/products/originals'));
             if ($products_image->parse() && $products_image->save()) {
                 $images[] = $products_image->filename;
             }
         }
         if (isset($data['localimages'])) {
             foreach ($data['localimages'] as $image) {
                 $image = basename($image);
                 if (@file_exists('../images/products/_upload/' . $image)) {
                     copy('../images/products/_upload/' . $image, '../images/products/originals/' . $image);
                     @unlink('../images/products/_upload/' . $image);
                     $images[] = $image;
                 }
             }
         }
         $default_flag = 1;
         foreach ($images as $image) {
             $Qimage = $lC_Database->query('insert into :table_products_images (products_id, image, default_flag, sort_order, date_added) values (:products_id, :image, :default_flag, :sort_order, :date_added)');
             $Qimage->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
             $Qimage->bindInt(':products_id', $products_id);
//.........这里部分代码省略.........
开发者ID:abhiesa-tolexo,项目名称:loaded7,代码行数:101,代码来源:products.php

示例15: array

     }
     // EOF: MOD for Categories Description 1.5
     if ($action == 'insert_category') {
         $insert_sql_data = array('categories_id' => $categories_id, 'language_id' => $languages[$i]['id']);
         $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
         tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array);
     } elseif ($action == 'update_category') {
         tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', "categories_id = '" . (int) $categories_id . "' and language_id = '" . (int) $languages[$i]['id'] . "'");
     }
 }
 // BOF: MOD for Categories Description 1.5
 //OLD-    if ($categories_image = new upload('categories_image', DIR_FS_CATALOG_IMAGES)) {
 //          tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . //tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'");
 // copy image only if modified
 $categories_image = new upload('categories_image');
 $categories_image->set_destination(DIR_FS_CATALOG_IMAGES . CATEGORY_IMAGES_DIR);
 if ($categories_image->parse() && $categories_image->save()) {
     $categories_image_name = $categories_image->filename;
     // BOF Image Resize
     require_once 'includes/functions/image_resize.php';
     image_resize(DIR_FS_CATALOG_IMAGES . CATEGORY_IMAGES_DIR . $categories_image->filename, SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT, SUBCATEGORY_IMAGE_COMPRESSION);
     // EOF Image Resize
 } else {
     $categories_image_name = $_POST['categories_previous_image'];
 }
 tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . $categories_image_name . "' where categories_id = '" . tep_db_input($categories_id) . "'");
 if (USE_CACHE == 'true') {
     tep_reset_cache_block('categories');
     tep_reset_cache_block('also_purchased');
 }
 tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));
开发者ID:digideskio,项目名称:oscmax2,代码行数:31,代码来源:categories.php


注:本文中的upload::set_destination方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。