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


PHP upload::set_filename方法代码示例

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


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

示例1: actionAddProduct


//.........这里部分代码省略.........
         $chk_current_qty = zen_get_products_stock($_POST['products_id']);
         $this->flag_duplicate_msgs_set = FALSE;
         if (STOCK_ALLOW_CHECKOUT == 'false' && $cart_qty + $new_qty > $chk_current_qty) {
             $new_qty = $chk_current_qty;
             $messageStack->add_session('shopping_cart', ($this->display_debug_messages ? 'C: FUNCTION ' . __FUNCTION__ . ': ' : '') . WARNING_PRODUCT_QUANTITY_ADJUSTED . zen_get_products_name($_POST['products_id']), 'caution');
             $this->flag_duplicate_msgs_set = TRUE;
         }
         // eof: adjust new quantity to be same as current in stock
         if ($add_max == 1 and $cart_qty == 1) {
             // do not add
             $new_qty = 0;
             $adjust_max = 'true';
         } else {
             // bof: adjust new quantity to be same as current in stock
             if (STOCK_ALLOW_CHECKOUT == 'false' && $new_qty + $cart_qty > $chk_current_qty) {
                 $adjust_new_qty = 'true';
                 $alter_qty = $chk_current_qty - $cart_qty;
                 $new_qty = $alter_qty > 0 ? $alter_qty : 0;
                 if (!$this->flag_duplicate_msgs_set) {
                     $messageStack->add_session('shopping_cart', ($this->display_debug_messages ? 'D: FUNCTION ' . __FUNCTION__ . ': ' : '') . WARNING_PRODUCT_QUANTITY_ADJUSTED . zen_get_products_name($_POST['products_id']), 'caution');
                 }
             }
             // eof: adjust new quantity to be same as current in stock
             // adjust quantity if needed
             if ($new_qty + $cart_qty > $add_max and $add_max != 0) {
                 $adjust_max = 'true';
                 $new_qty = $add_max - $cart_qty;
             }
         }
         if (zen_get_products_quantity_order_max($_POST['products_id']) == 1 and $this->in_cart_mixed($_POST['products_id']) == 1) {
             // do not add
         } else {
             // process normally
             // bof: set error message
             if ($the_list != '') {
                 $messageStack->add('product_info', ERROR_CORRECTIONS_HEADING . $the_list, 'caution');
             } else {
                 // process normally
                 // iii 030813 added: File uploading: save uploaded files with unique file names
                 $real_ids = isset($_POST['id']) ? $_POST['id'] : "";
                 if (isset($_GET['number_of_uploads']) && $_GET['number_of_uploads'] > 0) {
                     /**
                      * Need the upload class for attribute type that allows user uploads.
                      *
                      */
                     include DIR_WS_CLASSES . 'upload.php';
                     for ($i = 1, $n = $_GET['number_of_uploads']; $i <= $n; $i++) {
                         if (zen_not_null($_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]]) and $_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] != 'none') {
                             $products_options_file = new upload('id');
                             $products_options_file->set_destination(DIR_FS_UPLOADS);
                             $products_options_file->set_output_messages('session');
                             if ($products_options_file->parse(TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i])) {
                                 $products_image_extension = substr($products_options_file->filename, strrpos($products_options_file->filename, '.'));
                                 if ($_SESSION['customer_id']) {
                                     $db->Execute("insert into " . TABLE_FILES_UPLOADED . " (sesskey, customers_id, files_uploaded_name) values('" . zen_session_id() . "', '" . $_SESSION['customer_id'] . "', '" . zen_db_input($products_options_file->filename) . "')");
                                 } else {
                                     $db->Execute("insert into " . TABLE_FILES_UPLOADED . " (sesskey, files_uploaded_name) values('" . zen_session_id() . "', '" . zen_db_input($products_options_file->filename) . "')");
                                 }
                                 $insert_id = $db->Insert_ID();
                                 $real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $insert_id . ". " . $products_options_file->filename;
                                 $products_options_file->set_filename("{$insert_id}" . $products_image_extension);
                                 if (!$products_options_file->save()) {
                                     break;
                                 }
                             } else {
                                 break;
                             }
                         } else {
                             // No file uploaded -- use previous value
                             $real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $_POST[TEXT_PREFIX . UPLOAD_PREFIX . $i];
                         }
                     }
                 }
                 $this->add_cart($_POST['products_id'], $this->get_quantity(zen_get_uprid($_POST['products_id'], $real_ids)) + $new_qty, $real_ids);
                 // iii 030813 end of changes.
             }
             // eof: set error message
         }
         // eof: quantity maximum = 1
         if ($adjust_max == 'true') {
             $messageStack->add_session('shopping_cart', ERROR_MAXIMUM_QTY . zen_get_products_name($_POST['products_id']), 'caution');
             if ($this->display_debug_messages) {
                 $messageStack->add_session('header', 'E: FUNCTION ' . __FUNCTION__ . '<br>' . ERROR_MAXIMUM_QTY . zen_get_products_name($_POST['products_id']), 'caution');
             }
         }
     }
     if ($the_list == '') {
         // no errors
         // display message if all is good and not on shopping_cart page
         if (DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART && $messageStack->size('shopping_cart') == 0) {
             $messageStack->add_session('header', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . SUCCESS_ADDED_TO_CART_PRODUCT, 'success');
             zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
         } else {
             zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
         }
     } else {
         // errors found with attributes - perhaps display an additional message here, using an observer class to add to the messageStack
         $this->notify('NOTIFIER_CART_OPTIONAL_ATTRIBUTE_ERROR_MESSAGE_HOOK', $_POST, $the_list);
     }
 }
开发者ID:jeking928,项目名称:Dual-Pricing-2.1.6,代码行数:101,代码来源:shopping_cart.php

示例2: Copyright

  Copyright (c) 2010 osCommerce

  Released under the GNU General Public License
*/
require 'includes/application_top.php';
$action = isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '';
if (tep_not_null($action)) {
    switch ($action) {
        case 'save':
            $error = false;
            $store_logo = new upload('store_logo');
            $store_logo->set_extensions('png');
            $store_logo->set_destination(DIR_FS_CATALOG_IMAGES);
            if ($store_logo->parse()) {
                $store_logo->set_filename('store_logo.png');
                if ($store_logo->save()) {
                    $messageStack->add_session(SUCCESS_LOGO_UPDATED, 'success');
                } else {
                    $error = true;
                }
            } else {
                $error = true;
            }
            if ($error == false) {
                tep_redirect(tep_href_link(FILENAME_STORE_LOGO));
            }
            break;
    }
}
if (!tep_is_writable(DIR_FS_CATALOG_IMAGES)) {
开发者ID:Sibzsolutions,项目名称:Savostore,代码行数:30,代码来源:store_logo.php

示例3: upload

 if (isset($_POST['number_of_uploads']) && is_numeric($_POST['number_of_uploads']) && $_POST['number_of_uploads'] > 0) {
     require_once 'includes/classes/class_upload.php';
     for ($i = 1; $i <= $_POST['number_of_uploads']; $i++) {
         if (oos_is_not_null($_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]]) and $_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] != 'none') {
             $products_options_file = new upload('id');
             $products_options_file->set_destination(OOS_UPLOADS);
             $files_uploadedtable = $oostable['files_uploaded'];
             if ($products_options_file->parse(TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i])) {
                 if (isset($_SESSION['customer_id'])) {
                     $dbconn->Execute("INSERT INTO " . $files_uploadedtable . " (sesskey, customers_id, files_uploaded_name) VALUES ('" . oos_session_id() . "', '" . intval($_SESSION['customer_id']) . "', '" . oos_db_input($products_options_file->filename) . "')");
                 } else {
                     $dbconn->Execute("INSERT INTO " . $files_uploadedtable . " (sesskey, files_uploaded_name) VALUES ('" . oos_session_id() . "', '" . oos_db_input($products_options_file->filename) . "')");
                 }
                 $insert_id = $dbconn->Insert_ID();
                 $real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $insert_id . ". " . $products_options_file->filename;
                 $products_options_file->set_filename("{$insert_id}" . $products_options_file->filename);
                 if (!$products_options_file->save()) {
                     break 2;
                 }
             } else {
                 break 2;
             }
         } else {
             // No file uploaded -- use previous value
             $real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $_POST[TEXT_PREFIX . UPLOAD_PREFIX . $i];
         }
     }
 }
 // File_upload end
 if (isset($_REQUEST['button']['wishlist'])) {
     if (!isset($_SESSION['customer_id'])) {
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:31,代码来源:oos_cart_actions.php

示例4: actionAddProduct

 /**
  * Method to handle cart Action - add product
  *
  * @param string forward destination
  * @param url parameters
  */
 public function actionAddProduct($goto, $parameters)
 {
     if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) {
         // verify attributes and quantity first
         $the_list = '';
         $adjust_max = 'false';
         if (isset($_POST['id'])) {
             foreach ($_POST['id'] as $key => $value) {
                 $check = zen_get_attributes_valid($_POST['products_id'], $key, $value);
                 if ($check == false) {
                     $the_list .= TEXT_ERROR_OPTION_FOR . '<span class="alertBlack">' . zen_options_name($key) . '</span>' . TEXT_INVALID_SELECTION . '<span class="alertBlack">' . (zen_values_name($value) == 'TEXT' ? TEXT_INVALID_USER_INPUT : zen_values_name($value)) . '</span>' . '<br />';
                 }
             }
         }
         // verify qty to add
         $add_max = zen_get_products_quantity_order_max($_POST['products_id']);
         $cart_qty = $this->in_cart_mixed($_POST['products_id']);
         $new_qty = $_POST['cart_quantity'];
         $new_qty = $this->adjust_quantity($new_qty, $_POST['products_id'], 'shopping_cart');
         if ($add_max == 1 and $cart_qty == 1) {
             // do not add
             $new_qty = 0;
             $adjust_max = 'true';
         } else {
             // adjust quantity if needed
             if ($new_qty + $cart_qty > $add_max and $add_max != 0) {
                 $adjust_max = 'true';
                 $new_qty = $add_max - $cart_qty;
             }
         }
         if (zen_get_products_quantity_order_max($_POST['products_id']) == 1 and $this->in_cart_mixed($_POST['products_id']) == 1) {
             // do not add
         } else {
             // process normally
             // bof: set error message
             if ($the_list != '') {
                 $this->getMessageStack()->add('product_info', ERROR_CORRECTIONS_HEADING . $the_list, 'caution');
             } else {
                 // process normally
                 // iii 030813 added: File uploading: save uploaded files with unique file names
                 $real_ids = isset($_POST['id']) ? $_POST['id'] : "";
                 if (isset($_GET['number_of_uploads']) && $_GET['number_of_uploads'] > 0) {
                     /**
                      * Need the upload class for attribute type that allows user uploads.
                      *
                      */
                     include DIR_WS_CLASSES . 'upload.php';
                     for ($i = 1, $n = $_GET['number_of_uploads']; $i <= $n; $i++) {
                         if (zen_not_null($_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]]) and $_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] != 'none') {
                             $products_options_file = new \upload('id');
                             $products_options_file->set_destination(DIR_FS_UPLOADS);
                             $products_options_file->set_output_messages('session');
                             if ($products_options_file->parse(TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i])) {
                                 $products_image_extension = substr($products_options_file->filename, strrpos($products_options_file->filename, '.'));
                                 if ($this->getSessionVar('customer_id')) {
                                     $this->getDb()->Execute("insert into %table.files_uploaded% (sesskey, customers_id, files_uploaded_name) values('" . zen_session_id() . "', '" . $this->getSessionVar('customer_id') . "', '" . addslashes($products_options_file->filename) . "')");
                                 } else {
                                     $this->getDb()->Execute("insert into %table.files_uploaded% (sesskey, files_uploaded_name) values('" . zen_session_id() . "', '" . addslashes($products_options_file->filename) . "')");
                                 }
                                 $insert_id = $this->getDb()->Insert_ID();
                                 $real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $insert_id . ". " . $products_options_file->filename;
                                 $products_options_file->set_filename("{$insert_id}" . $products_image_extension);
                                 if (!$products_options_file->save()) {
                                     break;
                                 }
                             } else {
                                 break;
                             }
                         } else {
                             // No file uploaded -- use previous value
                             $real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $_POST[TEXT_PREFIX . UPLOAD_PREFIX . $i];
                         }
                     }
                 }
                 $this->add_cart($_POST['products_id'], $this->get_quantity(zen_get_uprid($_POST['products_id'], $real_ids)) + $new_qty, $real_ids);
                 // iii 030813 end of changes.
             }
             // eof: set error message
         }
         // eof: quantity maximum = 1
         if ($adjust_max == 'true') {
             $this->getMessageStack()->add_session('shopping_cart', ERROR_MAXIMUM_QTY . zen_get_products_name($_POST['products_id']), 'caution');
         }
     }
     if ($the_list == '') {
         // no errors
         // display message if all is good and not on shopping_cart page
         if (DISPLAY_CART == 'false' && $this->getMainPage() != 'shopping_cart') {
             $this->getMessageStack()->add_session('header', SUCCESS_ADDED_TO_CART_PRODUCT, 'success');
         }
         zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
     } else {
         // errors - display popup message
     }
//.........这里部分代码省略.........
开发者ID:zenmagick,项目名称:zenmagick,代码行数:101,代码来源:ShoppingCart.php

示例5: intval

        $query = "SELECT customers_image\n                  FROM {$customerstable}\n                  WHERE customers_id = '" . intval($_SESSION['customer_id']) . "'";
        $customers_image = $dbconn->GetOne($query);
        @unlink(OOS_ABSOLUTE_PATH . OOS_IMAGES . OOS_CUSTOMERS_IMAGES . $customers_image);
        $customerstable = $oostable['customers'];
        $query = "UPDATE {$customerstable}" . " SET customers_image = ?" . " WHERE customers_id = ?";
        $result =& $dbconn->Execute($query, array('', (int) $_SESSION['customer_id']));
    }
    require_once 'includes/classes/class_upload.php';
    if (oos_is_not_null($_FILES['id']['tmp_name']) and $_FILES['id']['tmp_name'] != 'none') {
        $customers_image_file = new upload('id');
        $customers_image_file->set_destination(OOS_ABSOLUTE_PATH . OOS_IMAGES . OOS_CUSTOMERS_IMAGES);
        if ($customers_image_file->parse()) {
            if (isset($_SESSION['customer_id'])) {
                $extension = oos_get_extension($_FILES['id']['name']);
                $picture_tempname = oos_get_random_picture_name(26, $extension);
                $customers_image_file->set_filename($picture_tempname);
                $customerstable = $oostable['customers'];
                $query = "UPDATE {$customerstable}" . " SET customers_image = ?" . " WHERE customers_id = ?";
                $result =& $dbconn->Execute($query, array((string) $picture_tempname, (int) $_SESSION['customer_id']));
                $customers_image_file->save();
            }
        }
    }
}
require 'includes/languages/' . $sLanguage . '/user_customers_image.php';
$customerstable = $oostable['customers'];
$address_bookstable = $oostable['address_book'];
$customers_infotable = $oostable['customers_info'];
$sql = "SELECT c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_image,\n               a.entry_city, a.entry_country_id, ci.customers_info_date_account_created AS date_account_created\n        FROM {$customerstable} c,\n             {$address_bookstable} a,\n             {$customers_infotable} ci\n        WHERE c.customers_id = '" . intval($_SESSION['customer_id']) . "'\n          AND a.customers_id = c.customers_id\n          AND ci.customers_info_id = c.customers_id\n          AND a.address_book_id = '" . intval($_SESSION['customer_default_address_id']) . "'";
$myworld = $dbconn->GetRow($sql);
if ($myworld['customers_gender'] == 'm') {
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:31,代码来源:user_customers_image.php

示例6: isset

<?php

require 'includes/application_top.php';
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (zen_not_null($action)) {
    if ($logo_image = new upload('logoimg')) {
        $logo_image->set_destination(DIR_FS_CATALOG_TEMPLATES . $template_dir . '/images');
        $logo_image->parse();
        if (in_array(substr(strtolower($logo_image->filename), -3, 3), array('gif', 'jpg'))) {
            $logo_image->set_filename('logo.gif');
            if ($logo_image->save()) {
                if (copy(DIR_FS_CATALOG_TEMPLATES . $template_dir . '/images/logo.gif', DIR_FS_ADMIN . 'images/logo.gif')) {
                    zen_redirect(zen_href_link(FILENAME_SETLOGO));
                }
            }
        } else {
            $messageStack->add(MESSAGE_SETLOGO_ERROR, 'error');
        }
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo CHARSET;
?>
" />
<title><?php 
echo TITLE;
?>
开发者ID:happyxlq,项目名称:zencart_svn,代码行数:31,代码来源:setlogo.php

示例7: actionAJAXAddProduct

 function actionAJAXAddProduct()
 {
     global $messageStack, $db;
     if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) {
         // verify attributes and quantity first
         $the_list = '';
         $adjust_max = 'false';
         if (isset($_POST['id'])) {
             foreach ($_POST['id'] as $key => $value) {
                 $check = zen_get_attributes_valid($_POST['products_id'], $key, $value);
                 if ($check == false) {
                     $the_list .= TEXT_ERROR_OPTION_FOR . '<span class="alertBlack">' . zen_options_name($key) . '</span>' . TEXT_INVALID_SELECTION . '<span class="alertBlack">' . (zen_values_name($value) == 'TEXT' ? TEXT_INVALID_USER_INPUT : zen_values_name($value)) . '</span>' . '<br />';
                 }
             }
         }
         // verify qty to add
         //          $real_ids = $_POST['id'];
         //die('I see Add to Cart: ' . $_POST['products_id'] . 'real id ' . zen_get_uprid($_POST['products_id'], $real_ids) . ' add qty: ' . $add_max . ' - cart qty: ' . $cart_qty . ' - newqty: ' . $new_qty);
         $add_max = zen_get_products_quantity_order_max($_POST['products_id']);
         $cart_qty = $this->in_cart_mixed($_POST['products_id']);
         $new_qty = $_POST['cart_quantity'];
         if ($new_qty > 400000) {
             $new_qty = 400000;
         }
         //echo 'I SEE actionAddProduct: ' . $_POST['products_id'] . '<br>';
         $new_qty = $this->adjust_quantity($new_qty, $_POST['products_id'], 'shopping_cart');
         if ($add_max == 1 and $cart_qty == 1) {
             // do not add
             $new_qty = 0;
             $adjust_max = 'true';
         } else {
             // adjust quantity if needed
             if ($new_qty + $cart_qty > $add_max and $add_max != 0) {
                 $adjust_max = 'true';
                 $new_qty = $add_max - $cart_qty;
             }
         }
         if (zen_get_products_quantity_order_max($_POST['products_id']) == 1 and $this->in_cart_mixed($_POST['products_id']) == 1) {
             // do not add
         } else {
             // process normally
             // bof: set error message
             if ($the_list != '') {
                 $messageStack->add('product_info', ERROR_CORRECTIONS_HEADING . $the_list, 'caution');
                 //          $messageStack->add('header', 'REMOVE ME IN SHOPPING CART CLASS BEFORE RELEASE<br/><BR />' . ERROR_CORRECTIONS_HEADING . $the_list, 'error');
             } else {
                 // process normally
                 // iii 030813 added: File uploading: save uploaded files with unique file names
                 $real_ids = isset($_POST['id']) ? $_POST['id'] : "";
                 if (isset($_GET['number_of_uploads']) && $_GET['number_of_uploads'] > 0) {
                     /**
                      * Need the upload class for attribute type that allows user uploads.
                      *
                      */
                     include DIR_WS_CLASSES . 'upload.php';
                     for ($i = 1, $n = $_GET['number_of_uploads']; $i <= $n; $i++) {
                         if (zen_not_null($_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]]) and $_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] != 'none') {
                             $products_options_file = new upload('id');
                             $products_options_file->set_destination(DIR_FS_UPLOADS);
                             $products_options_file->set_output_messages('session');
                             if ($products_options_file->parse(TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i])) {
                                 $products_image_extension = substr($products_options_file->filename, strrpos($products_options_file->filename, '.'));
                                 if ($_SESSION['customer_id']) {
                                     $db->Execute("insert into " . TABLE_FILES_UPLOADED . " (sesskey, customers_id, files_uploaded_name) values('" . zen_session_id() . "', '" . $_SESSION['customer_id'] . "', '" . zen_db_input($products_options_file->filename) . "')");
                                 } else {
                                     $db->Execute("insert into " . TABLE_FILES_UPLOADED . " (sesskey, files_uploaded_name) values('" . zen_session_id() . "', '" . zen_db_input($products_options_file->filename) . "')");
                                 }
                                 $insert_id = $db->Insert_ID();
                                 $real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $insert_id . ". " . $products_options_file->filename;
                                 $products_options_file->set_filename("{$insert_id}" . $products_image_extension);
                                 if (!$products_options_file->save()) {
                                     break;
                                 }
                             } else {
                                 break;
                             }
                         } else {
                             // No file uploaded -- use previous value
                             $real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $_POST[TEXT_PREFIX . UPLOAD_PREFIX . $i];
                         }
                     }
                 }
                 $this->add_cart($_POST['products_id'], $this->get_quantity(zen_get_uprid($_POST['products_id'], $real_ids)) + $new_qty, $real_ids);
                 // iii 030813 end of changes.
             }
             // eof: set error message
         }
         // eof: quantity maximum = 1
         if ($adjust_max == 'true') {
             //        $messageStack->add_session('shopping_cart', ERROR_MAXIMUM_QTY . ' B: - ' . zen_get_products_name($_POST['products_id']), 'caution');
             $messageStack->add_session('shopping_cart', ERROR_MAXIMUM_QTY . zen_get_products_name($_POST['products_id']), 'caution');
         }
     }
 }
开发者ID:andychang88,项目名称:daddy-store.com,代码行数:94,代码来源:shopping_cart.php

示例8: isset

 $htmlcontent = isset($_POST['htmlcontent']) ? urldecode($_POST['htmlcontent']) : '';
 $sort_order = isset($_POST['sort_order']) ? $_POST['sort_order'] : '';
 if (tep_not_null($products_id)) {
     if ($path != '') {
         $path = $path . '/';
     }
     $products_image = new upload('products_large_image');
     $products_image->set_destination(DIR_FS_CATALOG_IMAGES . $path);
     if ($products_image->parse()) {
         $pif = $path . $products_image->filename;
         $status_change = '0_@_';
         //if image exists with same filename then append random number
         if (file_exists(DIR_FS_CATALOG_IMAGES . $pif)) {
             $a = mt_rand(100000, 999999);
             $pif = $path . 'l_' . $a . '_' . $products_image->filename;
             $products_image->set_filename('l_' . $a . '_' . $products_image->filename);
         }
         if ($products_image->save()) {
             if (tep_not_null($products_image_id)) {
                 //existing large Image
                 $sql_data_array = array('image' => tep_db_prepare_input($pif), 'sort_order' => tep_db_input($sort_order), 'htmlcontent' => tep_db_input($htmlcontent));
                 tep_db_perform(TABLE_PRODUCTS_IMAGES, $sql_data_array, 'update', "id= '" . (int) $products_image_id . "'");
                 $lastInsertedId = 0;
             } else {
                 //new large Image
                 tep_db_query("insert into " . TABLE_PRODUCTS_IMAGES . " (products_id, image, htmlcontent, sort_order) values ('" . (int) $products_id . "', '" . tep_db_input($pif) . "', '" . tep_db_input($htmlcontent) . "', '" . tep_db_input($sort_order) . "')");
                 $lastInsertedId = tep_db_insert_id();
             }
             $status_change = $pif . '_@_' . $lastInsertedId . '_@_';
         } else {
             $status_change = '0_@_0_@_';
开发者ID:othreed,项目名称:osCommerce-234-bootstrap-wADDONS,代码行数:31,代码来源:aas.php

示例9: upload

         include DIR_WS_CLASSES . 'upload.php';
         for ($i = 1, $n = $_GET['number_of_uploads']; $i <= $n; $i++) {
             if (zen_not_null($_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]]) and $_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] != 'none') {
                 $products_options_file = new upload('id');
                 $products_options_file->set_destination(DIR_FS_UPLOADS);
                 $products_options_file->set_output_messages('session');
                 if ($products_options_file->parse(TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i])) {
                     $products_image_extension = substr($products_options_file->filename, strrpos($products_options_file->filename, '.'));
                     if ($_SESSION['customer_id']) {
                         $db->Execute("insert into " . TABLE_FILES_UPLOADED . " (sesskey, customers_id, files_uploaded_name) values('" . zen_session_id() . "', '" . $_SESSION['customer_id'] . "', '" . zen_db_input($products_options_file->filename) . "')");
                     } else {
                         $db->Execute("insert into " . TABLE_FILES_UPLOADED . " (sesskey, files_uploaded_name) values('" . zen_session_id() . "', '" . zen_db_input($products_options_file->filename) . "')");
                     }
                     $insert_id = $db->Insert_ID();
                     $real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $insert_id . ". " . $products_options_file->filename;
                     $products_options_file->set_filename("{$insert_id}" . $products_image_extension);
                     if (!$products_options_file->save()) {
                         break;
                     }
                 } else {
                     break;
                 }
             } else {
                 // No file uploaded -- use previous value
                 $real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $_POST[TEXT_PREFIX . UPLOAD_PREFIX . $i];
             }
         }
     }
     $_SESSION['cart']->add_cart($_POST['products_id'], $_SESSION['cart']->get_quantity(zen_get_uprid($_POST['products_id'], $real_ids)) + $new_qty, $real_ids);
     // iii 030813 end of changes.
 }
开发者ID:badarac,项目名称:stock_by_attribute_1.5.4,代码行数:31,代码来源:stock_by_attributes.php

示例10: 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

示例11: switch

    }
    return $cfgValue;
}
if (smn_not_null($action)) {
    switch ($action) {
        case 'save':
            $cID = smn_db_prepare_input($_GET['cID']);
            if ($_GET['store_logo'] == 'true') {
                // copy image
                $allowed_files_types = array('gif', 'jpg', 'jpeg', 'png');
                $store_logo_image = new upload('configuration_value');
                $store_logo_image->set_destination(DIR_FS_CATALOG_IMAGES);
                $store_logo_image->set_extensions($allowed_files_types);
                $parsed = $store_logo_image->parse();
                $ext = substr($store_logo_image->filename, -4);
                $store_logo_image->set_filename('logo' . $ext);
                $saved = $store_logo_image->save();
                if ($parsed && $saved) {
                    $store_logo_image_name = $store_logo_image->filename;
                    smn_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . $store_logo_image_name . "', last_modified = now() where configuration_id = '" . (int) $cID . "'");
                }
            } elseif ($_GET['store_type'] == 'true') {
                $group_count_query = smn_db_query("select count(*) as total from " . TABLE_STORE_TYPES);
                $group_count = smn_db_fetch_array($group_count_query);
                $count = (int) $group_count['total'] + 1 - 1;
                $sql_data_array = array('store_types_name' => smn_db_prepare_input($_POST['configuration_value']));
                smn_db_perform(TABLE_STORE_TYPES, $sql_data_array, 'insert');
                smn_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . $count . "', last_modified = now() where configuration_id = '" . (int) $cID . "'");
            } else {
                $configuration_value = smn_db_prepare_input($_POST['configuration_value']);
                smn_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . smn_db_input($configuration_value) . "', last_modified = now() where configuration_id = '" . (int) $cID . "'");
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:31,代码来源:configuration.php


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