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


PHP Validate::isUnsignedId方法代码示例

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


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

示例1: postProcess

 public function postProcess()
 {
     ${"GLOBALS"}["blpimnned"] = "id_order_seller";
     $dbodbxes = "id_order";
     ${${"GLOBALS"}["qusrvgm"]} = (int) Tools::getValue("id_order");
     if (!$this->context->customer->isLogged() && !Tools::getValue("secure_key")) {
         Tools::redirect("index.php?controller=authentication&back=my-account");
     }
     ${"GLOBALS"}["tvasln"] = "id_order";
     $jpdhpfqcj = "id_order";
     if (!(int) Configuration::get("PS_INVOICE")) {
         die(Tools::displayError("Invoices are disabled in this shop."));
     }
     if (isset(${${"GLOBALS"}["qusrvgm"]}) && Validate::isUnsignedId(${$dbodbxes})) {
         ${${"GLOBALS"}["ymjzko"]} = new Order(${$jpdhpfqcj});
     }
     if (!isset(${${"GLOBALS"}["ymjzko"]}) || !Validate::isLoadedObject(${${"GLOBALS"}["ymjzko"]})) {
         die(Tools::displayError("Invoice not found"));
     }
     ${${"GLOBALS"}["vewtbt"]} = AgileSellerManager::getObjectOwnerID("order", ${${"GLOBALS"}["tvasln"]});
     ${${"GLOBALS"}["sokafjqdei"]} = AgileSellerManager::getLinkedSellerID($this->context->customer->id);
     if (${${"GLOBALS"}["blpimnned"]} != ${${"GLOBALS"}["sokafjqdei"]}) {
         die(Tools::displayError("You do not have permission to see this invoice"));
     }
     if (Tools::isSubmit("secure_key") && $order->secure_key != Tools::getValue("secure_key")) {
         die(Tools::displayError("You do not have permission to see this invoice"));
     }
     if (!OrderState::invoiceAvailable($order->getCurrentState()) && !$order->invoice_number) {
         die(Tools::displayError("No invoice available"));
     }
     $this->order = ${${"GLOBALS"}["ymjzko"]};
 }
开发者ID:sho5kubota,项目名称:guidingyou2,代码行数:32,代码来源:sellerpdfinvoice.php

示例2: addTags

    /**
     * Add several tags in database and link it to a product
     *
     * @param integer $id_lang Language id
     * @param integer $id_product Product id to link tags with
     * @param string $string Tags separated by commas
     *
     * @return boolean Operation success
     */
    public static function addTags($id_lang, $id_product, $string)
    {
        if (!Validate::isUnsignedId($id_lang) or Validate::isTagsList($string)) {
            Tools::displayError();
        }
        $tmpTab = array_unique(array_map('trim', explode(',', $string)));
        $list = array();
        foreach ($tmpTab as $tag) {
            if (!Validate::isGenericName($tag)) {
                return false;
            }
            $tagObj = new Tag(NULL, trim($tag), intval($id_lang));
            /* Tag does not exist in database */
            if (!Validate::isLoadedObject($tagObj)) {
                $tagObj->name = trim($tag);
                $tagObj->id_lang = intval($id_lang);
                $tagObj->add();
            }
            if (!in_array($tagObj->id, $list)) {
                $list[] = $tagObj->id;
            }
        }
        $data = '';
        foreach ($list as $tag) {
            $data .= '(' . intval($tag) . ',' . intval($id_product) . '),';
        }
        $data = rtrim($data, ',');
        if (!Validate::isValuesList($list)) {
            Tools::displayError();
        }
        return Db::getInstance()->Execute('
		INSERT INTO `' . _DB_PREFIX_ . 'product_tag` (`id_tag`, `id_product`) 
		VALUES ' . $data);
    }
开发者ID:raulgimenez,项目名称:dreamongraphics_shop,代码行数:43,代码来源:Tag.php

示例3: init

 /**
  * Initialize category controller
  * @see FrontController::init()
  */
 public function init()
 {
     // Get category ID
     $id_category = (int) Tools::getValue('id_category');
     if (!$id_category || !Validate::isUnsignedId($id_category)) {
         $this->errors[] = Tools::displayError('Missing category ID');
     }
     // Instantiate category
     $this->category = new Category($id_category, $this->context->language->id);
     parent::init();
     if (!$this->ajax) {
         //check if the category is active and return 404 error if is disable.
         if (!$this->category->active) {
             header('HTTP/1.1 404 Not Found');
             header('Status: 404 Not Found');
         }
         //check if category can be accessible by current customer and return 403 if not
         if (!$this->category->checkAccess($this->context->customer->id)) {
             header('HTTP/1.1 403 Forbidden');
             header('Status: 403 Forbidden');
             $this->errors[] = Tools::displayError('You do not have access to this category.');
             $this->customer_access = false;
         }
     }
 }
开发者ID:Beattle,项目名称:perrino-shop,代码行数:29,代码来源:CategoryController.php

示例4: logHttpReferer

 public static function logHttpReferer()
 {
     global $cookie;
     if (!isset($cookie->id_connections) or !Validate::isUnsignedId($cookie->id_connections)) {
         return false;
     }
     if (!isset($_SERVER['HTTP_REFERER']) and !Configuration::get('TRACKING_DIRECT_TRAFFIC')) {
         return false;
     }
     $source = new ConnectionsSource();
     if (isset($_SERVER['HTTP_REFERER']) and Validate::isAbsoluteUrl($_SERVER['HTTP_REFERER'])) {
         if (preg_replace('/^www./', '', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST)) == preg_replace('/^www./', '', Tools::getHttpHost(false, false)) and !strncmp(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_PATH), parse_url('http://' . Tools::getHttpHost(false, false) . __PS_BASE_URI__, PHP_URL_PATH), strlen(__PS_BASE_URI__))) {
             return false;
         }
         if (Validate::isAbsoluteUrl(strval($_SERVER['HTTP_REFERER']))) {
             $source->http_referer = strval($_SERVER['HTTP_REFERER']);
             $source->keywords = trim(SearchEngine::getKeywords(strval($_SERVER['HTTP_REFERER'])));
             if (!Validate::isMessage($source->keywords)) {
                 return false;
             }
         }
     }
     $source->id_connections = intval($cookie->id_connections);
     $source->request_uri = Tools::getHttpHost(false, false);
     if (isset($_SERVER['REDIRECT_URL'])) {
         $source->request_uri .= strval($_SERVER['REDIRECT_URL']);
     } elseif (isset($_SERVER['REQUEST_URI'])) {
         $source->request_uri .= strval($_SERVER['REQUEST_URI']);
     }
     if (!Validate::isUrl($source->request_uri)) {
         unset($source->request_uri);
     }
     return $source->add();
 }
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:34,代码来源:ConnectionsSource.php

示例5: addTags

    /**
     * Add several tags in database and link it to a product
     *
     * @param integer $id_lang Language id
     * @param integer $id_product Product id to link tags with
     * @param string|array $tag_list List of tags, as array or as a string with comas
     * @return boolean Operation success
     */
    public static function addTags($id_lang, $id_product, $tag_list, $separator = ',')
    {
        if (!Validate::isUnsignedId($id_lang)) {
            return false;
        }
        if (!is_array($tag_list)) {
            $tag_list = array_filter(array_unique(array_map('trim', preg_split('#\\' . $separator . '#', $tag_list, null, PREG_SPLIT_NO_EMPTY))));
        }
        $list = array();
        foreach ($tag_list as $tag) {
            if (!Validate::isGenericName($tag)) {
                return false;
            }
            $tag_obj = new Tag(null, trim($tag), (int) $id_lang);
            /* Tag does not exist in database */
            if (!Validate::isLoadedObject($tag_obj)) {
                $tag_obj->name = trim($tag);
                $tag_obj->id_lang = (int) $id_lang;
                $tag_obj->add();
            }
            if (!in_array($tag_obj->id, $list)) {
                $list[] = $tag_obj->id;
            }
        }
        $data = '';
        foreach ($list as $tag) {
            $data .= '(' . (int) $tag . ',' . (int) $id_product . '),';
        }
        $data = rtrim($data, ',');
        return Db::getInstance()->execute('
		INSERT INTO `' . _DB_PREFIX_ . 'product_tag` (`id_tag`, `id_product`)
		VALUES ' . $data);
    }
开发者ID:jicheng17,项目名称:pengwine,代码行数:41,代码来源:Tag.php

示例6: processOrderStep

 function processOrderStep($params)
 {
     global $errors, $cart, $smarty, $order_pages_hook_stay;
     /* Manage discounts */
     if (intval(Tools::getValue('addDiscount')) == 1) {
         $discountName = Tools::getValue('discount_name');
         if (!Validate::isDiscountName($discountName)) {
             $errors[] = Tools::displayError('voucher name not valid');
         } else {
             $discount = new Discount(intval(Discount::getIdByName($discountName)));
             if (is_object($discount) and $discount->id) {
                 if ($tmpError = $cart->checkDiscountValidity($discount, $cart->getDiscounts(), $cart->getOrderTotalLC(), $cart->getProducts(), true)) {
                     $errors[] = $tmpError;
                 }
             } else {
                 $errors[] = Tools::displayError('voucher name not valid');
             }
             if (!sizeof($errors)) {
                 $cart->addDiscount(intval($discount->id));
             }
         }
         // Why do we need a redirect here? Copied from
         // original order.php source. Seems like
         // otherwize the cart display doesn't get
         // updated properly
         Tools::redirect('order.php?step=' . $params['step']);
     } elseif (intval(Tools::getValue('deleteDiscount')) == 1) {
         if (Validate::isUnsignedId($_GET['deleteDiscount'])) {
             $cart->deleteDiscount(intval($_GET['deleteDiscount']));
         }
         Tools::redirect('order.php?step=' . $params['step']);
     }
 }
开发者ID:redb,项目名称:prestashop,代码行数:33,代码来源:ordersummary.php

示例7: addTags

    /**
     * Add several tags in database and link it to a product
     *
     * @param integer $id_lang Language id
     * @param integer $id_product Product id to link tags with
     * @param string $string Tags separated by commas
     *
     * @return boolean Operation success
     */
    public static function addTags($id_lang, $id_product, $string)
    {
        if (!Validate::isUnsignedId($id_lang) or !Validate::isTagsList($string)) {
            return false;
        }
        $tmpTab = array_unique(array_map('trim', preg_split('/,/', $string, NULL, PREG_SPLIT_NO_EMPTY)));
        $list = array();
        foreach ($tmpTab as $tag) {
            if (empty($tag)) {
                continue;
            }
            if (!Validate::isGenericName($tag)) {
                return false;
            }
            $tagObj = new Tag(NULL, trim($tag), (int) $id_lang);
            /* Tag does not exist in database */
            if (!Validate::isLoadedObject($tagObj)) {
                $tagObj->name = trim($tag);
                $tagObj->id_lang = (int) $id_lang;
                $tagObj->add();
            }
            if (!in_array($tagObj->id, $list)) {
                $list[] = $tagObj->id;
            }
        }
        $data = '';
        foreach ($list as $tag) {
            $data .= '(' . (int) $tag . ',' . (int) $id_product . '),';
        }
        $data = rtrim($data, ',');
        return Db::getInstance()->Execute('
		INSERT INTO `' . _DB_PREFIX_ . 'product_tag` (`id_tag`, `id_product`) 
		VALUES ' . $data);
    }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:43,代码来源:Tag.php

示例8: delete

 public function delete()
 {
     if (!Validate::isUnsignedId($this->id)) {
         return false;
     }
     Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'customer_message` WHERE `id_customer_thread` = ' . (int) $this->id);
     return parent::delete();
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:8,代码来源:CustomerThread.php

示例9: getMailAlerts

 public static function getMailAlerts($id_customer, $id_lang, Shop $shop = null)
 {
     if (!Validate::isUnsignedId($id_customer) || !Validate::isUnsignedId($id_lang)) {
         die(Tools::displayError());
     }
     if (!$shop) {
         $shop = Context::getContext()->shop;
     }
     $customer = new Customer($id_customer);
     $products = MailAlert::getProducts($customer, $id_lang);
     $products_number = count($products);
     if (empty($products) === true || !$products_number) {
         return array();
     }
     for ($i = 0; $i < $products_number; ++$i) {
         $obj = new Product((int) $products[$i]['id_product'], false, (int) $id_lang);
         if (!Validate::isLoadedObject($obj)) {
             continue;
         }
         if (isset($products[$i]['id_product_attribute']) && Validate::isUnsignedInt($products[$i]['id_product_attribute'])) {
             $attributes = self::getProductAttributeCombination($products[$i]['id_product_attribute'], $id_lang);
             $products[$i]['attributes_small'] = '';
             if ($attributes) {
                 foreach ($attributes as $k => $row) {
                     $products[$i]['attributes_small'] .= $row['attribute_name'] . ', ';
                 }
             }
             $products[$i]['attributes_small'] = rtrim($products[$i]['attributes_small'], ', ');
             $products[$i]['id_shop'] = $shop->id;
             /* Get cover */
             $attrgrps = $obj->getAttributesGroups((int) $id_lang);
             foreach ($attrgrps as $attrgrp) {
                 if ($attrgrp['id_product_attribute'] == (int) $products[$i]['id_product_attribute'] && ($images = Product::_getAttributeImageAssociations((int) $attrgrp['id_product_attribute']))) {
                     $products[$i]['cover'] = $obj->id . '-' . array_pop($images);
                     break;
                 }
             }
         }
         if (!isset($products[$i]['cover']) || !$products[$i]['cover']) {
             $images = $obj->getImages((int) $id_lang);
             foreach ($images as $k => $image) {
                 if ($image['cover']) {
                     $products[$i]['cover'] = $obj->id . '-' . $image['id_image'];
                     break;
                 }
             }
         }
         if (!isset($products[$i]['cover'])) {
             $products[$i]['cover'] = Language::getIsoById($id_lang) . '-default';
         }
         $products[$i]['link'] = $obj->getLink();
         $products[$i]['link_rewrite'] = $obj->link_rewrite;
     }
     return $products;
 }
开发者ID:jicheng17,项目名称:pengwine,代码行数:55,代码来源:MailAlert.php

示例10: getByOrderId

    public static function getByOrderId($id_order)
    {
        if (!Validate::isUnsignedId($id_order)) {
            return false;
        }
        $result = Db::getInstance()->getRow('
		SELECT f.id_loyalty
		FROM `' . _DB_PREFIX_ . 'loyalty` f
		WHERE f.id_order = ' . (int) $id_order);
        return isset($result['id_loyalty']) ? $result['id_loyalty'] : false;
    }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:11,代码来源:LoyaltyModule.php

示例11: getAllByOrderId

    public static function getAllByOrderId($id_order)
    {
        if (!Validate::isUnsignedId($id_order)) {
            return false;
        }
        $result = Db::getInstance()->executeS('
		SELECT f.id_loyalty
		FROM `' . _DB_PREFIX_ . 'loyalty` f
		WHERE f.id_order = ' . (int) $id_order);
        return $result;
    }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:11,代码来源:LoyaltyModule.php

示例12: getFromCustomer

    public static function getFromCustomer($id_customer)
    {
        if (!Validate::isUnsignedId($id_customer)) {
            return false;
        }
        $result = Db::getInstance()->getRow('
		SELECT `id_guest`
		FROM `' . _DB_PREFIX_ . 'guest`
		WHERE `id_customer` = ' . (int) $id_customer);
        return $result['id_guest'];
    }
开发者ID:jpodracky,项目名称:dogs,代码行数:11,代码来源:Guest.php

示例13: postProcess

 public function postProcess()
 {
     global $currentIndex, $cookie;
     if (Tools::isSubmit('deleteorder_return_detail')) {
         if ($this->tabAccess['delete'] === '1') {
             if ($id_order_detail = (int) Tools::getValue('id_order_detail') and Validate::isUnsignedId($id_order_detail)) {
                 if ($id_order_return = (int) Tools::getValue('id_order_return') and Validate::isUnsignedId($id_order_return)) {
                     $orderReturn = new OrderReturn($id_order_return);
                     if (!Validate::isLoadedObject($orderReturn)) {
                         die(Tools::displayError());
                     }
                     if ((int) $orderReturn->countProduct() > 1) {
                         if (OrderReturn::deleteOrderReturnDetail($id_order_return, $id_order_detail, (int) Tools::getValue('id_customization', 0))) {
                             Tools::redirectAdmin($currentIndex . '&conf=4token=' . $this->token);
                         } else {
                             $this->_errors[] = Tools::displayError('An error occurred while deleting an order return detail.');
                         }
                     } else {
                         $this->_errors[] = Tools::displayError('You need at least one product.');
                     }
                 } else {
                     $this->_errors[] = Tools::displayError('The order return is invalid.');
                 }
             } else {
                 $this->_errors[] = Tools::displayError('The order return detail is invalid.');
             }
         } else {
             $this->_errors[] = Tools::displayError('You do not have permission to delete here.');
         }
     } elseif (Tools::isSubmit('submitAddorder_return')) {
         if ($this->tabAccess['edit'] === '1') {
             if ($id_order_return = (int) Tools::getValue('id_order_return') and Validate::isUnsignedId($id_order_return)) {
                 $orderReturn = new OrderReturn($id_order_return);
                 $order = new Order($orderReturn->id_order);
                 $customer = new Customer($orderReturn->id_customer);
                 $orderReturn->state = (int) Tools::getValue('state');
                 if ($orderReturn->save()) {
                     $orderReturnState = new OrderReturnState($orderReturn->state);
                     $vars = array('{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{id_order_return}' => $id_order_return, '{order_name}' => sprintf("#%06d", (int) $order->id), '{state_order_return}' => isset($orderReturnState->name[(int) $order->id_lang]) ? $orderReturnState->name[(int) $order->id_lang] : $orderReturnState->name[(int) _PS_LANG_DEFAULT_]);
                     Mail::Send((int) $order->id_lang, 'order_return_state', Mail::l('Your order return state has changed', (int) $order->id_lang), $vars, $customer->email, $customer->firstname . ' ' . $customer->lastname, NULL, NULL, NULL, NULL, _PS_MAIL_DIR_, true);
                     Tools::redirectAdmin($currentIndex . '&conf=4&token=' . $this->token);
                 }
             } else {
                 $this->_errors[] = Tools::displayError('No order return ID.');
             }
         } else {
             $this->_errors[] = Tools::displayError('You do not have permission to edit here.');
         }
     }
     parent::postProcess();
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:51,代码来源:AdminReturn.php

示例14: postProcess

 public function postProcess()
 {
     global $currentIndex, $cookie;
     if (Tools::isSubmit('deleteorder_return_detail')) {
         if ($this->tabAccess['delete'] === '1') {
             if ($id_order_detail = intval(Tools::getValue('id_order_detail')) and Validate::isUnsignedId($id_order_detail)) {
                 if ($id_order_return = intval(Tools::getValue('id_order_return')) and Validate::isUnsignedId($id_order_return)) {
                     $orderReturn = new OrderReturn($id_order_return);
                     if (!Validate::isLoadedObject($orderReturn)) {
                         die(Tools::displayError());
                     }
                     if (intval($orderReturn->countProduct()) > 1) {
                         if (OrderReturn::deleteOrderReturnDetail($id_order_return, $id_order_detail, intval(Tools::getValue('id_customization', 0)))) {
                             Tools::redirectAdmin($currentIndex . '&conf=4token=' . $this->token);
                         } else {
                             $this->_errors[] = Tools::displayError('an error occured while deleting an order return detail');
                         }
                     } else {
                         $this->_errors[] = Tools::displayError('you need at least one product');
                     }
                 } else {
                     $this->_errors[] = Tools::displayError('the order return is invalid');
                 }
             } else {
                 $this->_errors[] = Tools::displayError('the order return detail is invalid');
             }
         } else {
             $this->_errors[] = Tools::displayError('You do not have permission to delete here.');
         }
     } elseif (Tools::isSubmit('submitAddorder_return')) {
         if ($this->tabAccess['edit'] === '1') {
             if ($id_order_return = intval(Tools::getValue('id_order_return')) and Validate::isUnsignedId($id_order_return)) {
                 $orderReturn = new OrderReturn($id_order_return);
                 $customer = new Customer($orderReturn->id_customer);
                 $orderReturn->state = intval(Tools::getValue('state'));
                 if ($orderReturn->save()) {
                     $orderReturnState = new OrderReturnState($orderReturn->state);
                     $vars = array('{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{id_order_return}' => $id_order_return, '{state_order_return}' => $orderReturnState->name[intval(Configuration::get('PS_LANG_DEFAULT'))]);
                     Mail::Send(intval($cookie->id_lang), 'order_return_state', html_entity_decode($this->l('Your order return state has changed'), ENT_NOQUOTES, 'UTF-8'), $vars, $customer->email, $customer->firstname . ' ' . $customer->lastname);
                     Tools::redirectAdmin($currentIndex . '&conf=4&token=' . $this->token);
                 }
             } else {
                 $this->_errors[] = Tools::displayError('no order return ID.');
             }
         } else {
             $this->_errors[] = Tools::displayError('You do not have permission to edit here.');
         }
     }
     parent::postProcess();
 }
开发者ID:sealence,项目名称:local,代码行数:50,代码来源:AdminReturn.php

示例15: init

 /**
  * Initialize category controller
  * @see FrontController::init()
  */
 public function init()
 {
     // Get category ID
     $id_category = (int) Tools::getValue('id_category');
     if (!$id_category || !Validate::isUnsignedId($id_category)) {
         $this->errors[] = Tools::displayError('Missing category ID');
     }
     // Instantiate category
     $this->category = new Category($id_category, $this->context->language->id);
     parent::init();
     if (!$this->category->checkAccess($this->context->customer->id)) {
         $this->errors[] = Tools::displayError('You do not have access to this category.');
     }
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:18,代码来源:CategoryController.php


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