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


PHP Validate::isTableOrIdentifier方法代码示例

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


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

示例1: getTranslationsFieldsChild

 /**
  * Check then return multilingual fields for database interaction
  *
  * @return array Multilingual fields
  */
 public function getTranslationsFieldsChild()
 {
     parent::validateFieldsLang();
     $fieldsArray = array('title', 'url');
     $fields = array();
     $languages = Language::getLanguages(false);
     $defaultLanguage = (int) Configuration::get('PS_LANG_DEFAULT');
     foreach ($languages as $language) {
         $fields[$language['id_lang']]['id_lang'] = (int) $language['id_lang'];
         $fields[$language['id_lang']][self::$definition['primary']] = (int) $this->id;
         foreach ($fieldsArray as $field) {
             if (!Validate::isTableOrIdentifier($field)) {
                 die(Tools::displayError());
             }
             if (isset($this->{$field}[$language['id_lang']]) and !empty($this->{$field}[$language['id_lang']])) {
                 $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']], true);
             } elseif (in_array($field, $this->fieldsRequiredLang)) {
                 $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage], true);
             } else {
                 $fields[$language['id_lang']][$field] = '';
             }
         }
     }
     return $fields;
 }
开发者ID:arozanski,项目名称:simpleresponsivetheme,代码行数:30,代码来源:ResponsiveLinksClass.php

示例2: getTranslationsFieldsChild

 /**
  * Check then return multilingual fields for database interaction
  *
  * @return array Multilingual fields
  */
 public function getTranslationsFieldsChild()
 {
     parent::validateFieldsLang();
     $fieldsArray = array('name', 'link');
     $fields = array();
     $languages = Language::getLanguages(false);
     $defaultLanguage = Configuration::get('PS_LANG_DEFAULT');
     foreach ($languages as $language) {
         $fields[$language['id_lang']]['id_lang'] = $language['id_lang'];
         $fields[$language['id_lang']][$this->identifier] = intval($this->id);
         foreach ($fieldsArray as $field) {
             if (!Validate::isTableOrIdentifier($field)) {
                 die(Tools::displayError());
             }
             /* Check fields validity */
             if (isset($this->{$field}[$language['id_lang']]) and !empty($this->{$field}[$language['id_lang']])) {
                 $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']]);
             } elseif (in_array($field, $this->fieldsRequiredLang)) {
                 $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage]);
             } else {
                 $fields[$language['id_lang']][$field] = '';
             }
         }
     }
     return $fields;
 }
开发者ID:TheTypoMaster,项目名称:neonflexible,代码行数:31,代码来源:AdvancedTopMenuElementsClass.php

示例3: getTranslationsFieldsChild

 public function getTranslationsFieldsChild()
 {
     parent::validateFieldsLang();
     $fieldsArray = array('meta_title', 'meta_description', 'meta_keywords', 'link_rewrite');
     $fields = array();
     $languages = Language::getLanguages(false);
     $defaultLanguage = (int) Configuration::get('PS_LANG_DEFAULT');
     foreach ($languages as $language) {
         $fields[$language['id_lang']]['id_lang'] = (int) $language['id_lang'];
         $fields[$language['id_lang']][$this->identifier] = (int) $this->id;
         $fields[$language['id_lang']]['content'] = isset($this->content[$language['id_lang']]) ? pSQL($this->content[$language['id_lang']], true) : '';
         foreach ($fieldsArray as $field) {
             if (!Validate::isTableOrIdentifier($field)) {
                 die(Tools::displayError());
             }
             if (isset($this->{$field}[$language['id_lang']]) and !empty($this->{$field}[$language['id_lang']])) {
                 $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']]);
             } elseif (in_array($field, $this->fieldsRequiredLang)) {
                 $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage]);
             } else {
                 $fields[$language['id_lang']][$field] = '';
             }
         }
     }
     return $fields;
 }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:26,代码来源:CMS.php

示例4: toggleStatus

    public function toggleStatus()
    {
        if (!Validate::isTableOrIdentifier($this->identifier) or !Validate::isTableOrIdentifier($this->table)) {
            die(Tools::displayError());
        }
        /* Change status to active/inactive */
        return Db::getInstance()->Execute('
		UPDATE `' . pSQL(_DB_PREFIX_ . $this->table) . '`
		SET `comment_status` = !`comment_status`
		WHERE `' . pSQL($this->identifier) . '` = ' . (int) $this->id);
    }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:11,代码来源:CommentObject.php

示例5: __construct

    public function __construct()
    {
        global $cookie;
        $this->table = 'message';
        $this->className = 'Message';
        $this->view = 'noActionColumn';
        $this->delete = true;
        $this->colorOnBackground = true;
        $start = 0;
        $this->_defaultOrderBy = 'date_add';
        /* Manage default params values */
        if (empty($limit)) {
            $limit = !isset($cookie->{$this->table . '_pagination'}) ? $this->_pagination[0] : ($limit = $cookie->{$this->table . '_pagination'});
        }
        if (!Validate::isTableOrIdentifier($this->table)) {
            die(Tools::displayError('Table name is invalid:') . ' "' . $this->table . '"');
        }
        if (empty($orderBy)) {
            $orderBy = Tools::getValue($this->table . 'Orderby', $this->_defaultOrderBy);
        } elseif ($orderBy == 'id_order') {
            $orderBy = 'm.id_order';
        }
        if (empty($orderWay)) {
            $orderWay = Tools::getValue($this->table . 'Orderway', 'ASC');
        }
        $limit = (int) Tools::getValue('pagination', $limit);
        $cookie->{$this->table . '_pagination'} = $limit;
        /* Check params validity */
        if (!Validate::isOrderBy($orderBy) or !Validate::isOrderWay($orderWay) or !is_numeric($start) or !is_numeric($limit)) {
            die(Tools::displayError('get list params is not valid'));
        }
        if ($orderBy == 'id_order') {
            $orderBy = 'm.id_order';
        }
        /* Determine offset from current page */
        if ((isset($_POST['submitFilter' . $this->table]) or isset($_POST['submitFilter' . $this->table . '_x']) or isset($_POST['submitFilter' . $this->table . '_y'])) and !empty($_POST['submitFilter' . $this->table]) and is_numeric($_POST['submitFilter' . $this->table])) {
            $start = (int) ($_POST['submitFilter' . $this->table] - 1) * $limit;
        }
        $sql = 'SELECT SQL_CALC_FOUND_ROWS m.id_message, m.id_cart, m.id_employee, IF(m.id_order > 0, m.id_order, \'--\') id_order, m.message, m.private, m.date_add, CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS customer,
		c.id_customer, count(m.id_message) nb_messages, (SELECT message FROM ' . _DB_PREFIX_ . 'message WHERE id_order = m.id_order ORDER BY date_add DESC LIMIT 1) last_message,
		(SELECT COUNT(m2.id_message) FROM ' . _DB_PREFIX_ . 'message m2 WHERE 1 AND m2.id_customer != 0 AND m2.id_order = m.id_order AND m2.id_message NOT IN 
		(SELECT mr2.id_message FROM ' . _DB_PREFIX_ . 'message_readed mr2 WHERE mr2.id_employee = ' . (int) $cookie->id_employee . ') GROUP BY m2.id_order) nb_messages_not_read_by_me
		FROM ' . _DB_PREFIX_ . 'message m
		LEFT JOIN ' . _DB_PREFIX_ . 'orders o ON (o.id_order = m.id_order)
		LEFT JOIN ' . _DB_PREFIX_ . 'customer c ON (c.id_customer = m.id_customer)
		GROUP BY m.id_order
		ORDER BY ' . (isset($orderBy) ? pSQL($orderBy) : 'date_add') . ' ' . (isset($orderWay) ? pSQL($orderWay) : 'DESC') . '
		LIMIT ' . (int) $start . ',' . (int) $limit;
        $this->_list = Db::getInstance()->ExecuteS($sql);
        $this->_listTotal = Db::getInstance()->getValue('SELECT FOUND_ROWS() AS `' . md5($sql) . '`');
        $this->fieldsDisplay = array('id_order' => array('title' => $this->l('Order ID'), 'align' => 'center', 'width' => 30), 'id_customer' => array('title' => $this->l('Customer ID'), 'align' => 'center', 'width' => 30), 'customer' => array('title' => $this->l('Customer'), 'width' => 100, 'filter_key' => 'customer', 'tmpTableFilter' => true), 'last_message' => array('title' => $this->l('Last message'), 'width' => 400, 'orderby' => false), 'nb_messages_not_read_by_me' => array('title' => $this->l('Unread message(s)'), 'width' => 30, 'align' => 'center'), 'nb_messages' => array('title' => $this->l('Number of messages'), 'width' => 30, 'align' => 'center'));
        parent::__construct();
    }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:53,代码来源:AdminMessages.php

示例6: update

 public function update($nullValues = false)
 {
     $result = 1;
     $fields = $this->getTranslationsFieldsChild();
     foreach ($fields as $field) {
         foreach ($field as $key => $value) {
             if (!Validate::isTableOrIdentifier($key)) {
                 die(Tools::displayError());
             }
         }
         $mode = Db::getInstance()->getRow('SELECT `id_lang` FROM `' . pSQL(_DB_PREFIX_ . $this->table) . '_lang` WHERE `' . pSQL($this->identifier) . '` = ' . intval($this->id) . ' AND `id_lang` = ' . intval($field['id_lang']));
         $result *= !Db::getInstance()->NumRows() ? Db::getInstance()->AutoExecute(_DB_PREFIX_ . $this->table . '_lang', $field, 'INSERT') : Db::getInstance()->AutoExecute(_DB_PREFIX_ . $this->table . '_lang', $field, 'UPDATE', '`' . pSQL($this->identifier) . '` = ' . intval($this->id) . ' AND `id_lang` = ' . intval($field['id_lang']));
     }
     return $result;
 }
开发者ID:sealence,项目名称:local,代码行数:15,代码来源:CMS.php

示例7: deleteSelection

 public function deleteSelection($selection)
 {
     if (!is_array($selection) or !Validate::isTableOrIdentifier($this->identifier) or !Validate::isTableOrIdentifier($this->table)) {
         die(Tools::displayError());
     }
     foreach ($selection as $id) {
         $obj = new Currency((int) $id);
         $res[$id] = $obj->delete();
     }
     foreach ($res as $value) {
         if (!$value) {
             return false;
         }
     }
     return true;
 }
开发者ID:yiuked,项目名称:tmcart,代码行数:16,代码来源:Currency.php

示例8: makeTranslationFields

 protected function makeTranslationFields(&$fields, &$fieldsArray, $id_language)
 {
     $fields[$id_language]['id_lang'] = $id_language;
     $fields[$id_language][$this->identifier] = (int) $this->id;
     foreach ($fieldsArray as $field) {
         /* Check fields validity */
         if (!Validate::isTableOrIdentifier($field)) {
             die(Tools::displayError());
         }
         /* Copy the field, or the default language field if it's both required and empty */
         if (!$this->id_lang and isset($this->{$field}[$id_language]) and !empty($this->{$field}[$id_language]) or $this->id_lang and isset($this->{$field}) and !empty($this->{$field})) {
             $fields[$id_language][$field] = $this->id_lang ? pSQL($this->{$field}, true) : pSQL($this->{$field}[$id_language], true);
         } elseif (in_array($field, $this->fieldsRequiredLang)) {
             $fields[$id_language][$field] = $this->id_lang ? pSQL($this->{$field}, true) : pSQL($this->{$field}[Configuration::get('PS_LANG_DEFAULT')], true);
         } else {
             $fields[$id_language][$field] = '';
         }
     }
 }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:19,代码来源:TagsObject.php

示例9: getTranslationsFieldsChild

 public function getTranslationsFieldsChild()
 {
     parent::validateFieldsLang();
     $fieldsArray = array('meta_title', 'meta_description', 'title', 'seo_url', 'meta_keywords');
     $fields = array();
     $languages = Language::getLanguages(false);
     $defaultLanguage = Configuration::get('PS_LANG_DEFAULT');
     foreach ($languages as $language) {
         $fields[$language['id_lang']]['id_lang'] = $language['id_lang'];
         $fields[$language['id_lang']][$this->identifier] = intval($this->id);
         $fields[$language['id_lang']]['description'] = (isset($this->description[$language['id_lang']]) and !empty($this->description[$language['id_lang']])) ? pSQL($this->description[$language['id_lang']], true) : pSQL($this->description[$defaultLanguage], true);
         foreach ($fieldsArray as $field) {
             if (!Validate::isTableOrIdentifier($field)) {
                 die(Tools::displayError());
             }
             if (isset($this->{$field}[$language['id_lang']]) and !empty($this->{$field}[$language['id_lang']])) {
                 $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']]);
             } else {
                 $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage]);
             }
         }
     }
     return $fields;
 }
开发者ID:acreno,项目名称:pm-ps,代码行数:24,代码来源:AdvancedSearchSeoClass.php

示例10: delete

 /**
  * Delete a state only if is not in use
  *
  * @return boolean
  */
 public function delete()
 {
     if (!Validate::isTableOrIdentifier($this->identifier) or !Validate::isTableOrIdentifier($this->table)) {
         die(Tools::displayError());
     }
     if (!$this->isUsed()) {
         /* Database deletion */
         $result = Db::getInstance()->Execute('DELETE FROM `' . pSQL(_DB_PREFIX_ . $this->table) . '` WHERE `' . pSQL($this->identifier) . '` = ' . (int) $this->id);
         if (!$result) {
             return false;
         }
         /* Database deletion for multilingual fields related to the object */
         if (method_exists($this, 'getTranslationsFieldsChild')) {
             Db::getInstance()->Execute('DELETE FROM `' . pSQL(_DB_PREFIX_ . $this->table) . '_lang` WHERE `' . pSQL($this->identifier) . '` = ' . (int) $this->id);
         }
         return $result;
     } else {
         return false;
     }
 }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:25,代码来源:State.php

示例11: getList

 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = null)
 {
     if (!Validate::isTableOrIdentifier($this->table)) {
         die('filter is corrupted');
     }
     if (empty($order_by)) {
         $order_by = Tools::getValue($this->table . 'Orderby', $this->_defaultOrderBy);
     }
     if (empty($order_way)) {
         $order_way = Tools::getValue($this->table . 'Orderway', 'ASC');
     }
     // Try and obtain getList arguments from $_GET
     $order_by = Tools::getValue($this->table . 'Orderby');
     $order_way = Tools::getValue($this->table . 'Orderway');
     // Validate the orderBy and orderWay fields
     switch ($order_by) {
         case 'filename':
         case 'filesize':
         case 'date':
         case 'age':
             break;
         default:
             $order_by = 'date';
     }
     switch ($order_way) {
         case 'asc':
         case 'desc':
             break;
         default:
             $order_way = 'desc';
     }
     if (empty($limit)) {
         $limit = !isset($this->context->cookie->{$this->table . '_pagination'}) ? $this->_pagination[0] : ($limit = $this->context->cookie->{$this->table . '_pagination'});
     }
     $limit = (int) Tools::getValue('pagination', $limit);
     $this->context->cookie->{$this->table . '_pagination'} = $limit;
     /* Determine offset from current page */
     if (!empty($_POST['submitFilter' . $this->list_id]) && is_numeric($_POST['submitFilter' . $this->list_id])) {
         $start = (int) $_POST['submitFilter' . $this->list_id] - 1 * $limit;
     }
     $this->_lang = (int) $id_lang;
     $this->_orderBy = $order_by;
     $this->_orderWay = strtoupper($order_way);
     $this->_list = array();
     // Find all the backups
     $dh = @opendir(PrestaShopBackup::getBackupPath());
     if ($dh === false) {
         $this->errors[] = $this->trans('Unable to open your backup directory', array(), 'Admin.AdvParameters.Notification');
         return;
     }
     while (($file = readdir($dh)) !== false) {
         if (preg_match('/^([_a-zA-Z0-9\\-]*[\\d]+-[a-z\\d]+)\\.sql(\\.gz|\\.bz2)?$/', $file, $matches) == 0) {
             continue;
         }
         $timestamp = (int) $matches[1];
         $date = date('Y-m-d H:i:s', $timestamp);
         $age = time() - $timestamp;
         if ($age < 3600) {
             $age = '< 1 ' . $this->trans('Hour', array(), 'Admin.Global');
         } elseif ($age < 86400) {
             $age = floor($age / 3600);
             $age = $age . ' ' . ($age == 1 ? $this->trans('Hour', array(), 'Admin.Global') : $this->trans('Hours', array(), 'Admin.Global'));
         } else {
             $age = floor($age / 86400);
             $age = $age . ' ' . ($age == 1 ? $this->trans('Day', array(), 'Admin.Global') : $this->trans('Days', array(), 'Admin.Global'));
         }
         $size = filesize(PrestaShopBackup::getBackupPath($file));
         $this->_list[] = array('filename' => $file, 'age' => $age, 'date' => $date, 'filesize' => number_format($size / 1000, 2) . ' Kb', 'timestamp' => $timestamp, 'filesize_sort' => $size);
     }
     closedir($dh);
     $this->_listTotal = count($this->_list);
     // Sort the _list based on the order requirements
     switch ($this->_orderBy) {
         case 'filename':
             $this->sort_by = 'filename';
             $sorter = 'strSort';
             break;
         case 'filesize':
             $this->sort_by = 'filesize_sort';
             $sorter = 'intSort';
             break;
         case 'age':
         case 'date':
             $this->sort_by = 'timestamp';
             $sorter = 'intSort';
             break;
     }
     usort($this->_list, array($this, $sorter));
     $this->_list = array_slice($this->_list, $start, $limit);
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:90,代码来源:AdminBackupController.php

示例12: getTranslationsFields

 /**
  * Prepare multilingual fields for database insertion
  *
  * @param array $fieldsArray Multilingual fields to prepare
  * return array Prepared fields for database insertion
  */
 protected function getTranslationsFields($fieldsArray)
 {
     /* WARNING : Product do not use this function, so do not forget to report any modification if necessary */
     if (!Validate::isTableOrIdentifier($this->identifier)) {
         die(Tools::displayError());
     }
     $fields = array();
     $languages = Language::getLanguages();
     $defaultLanguage = Configuration::get('PS_LANG_DEFAULT');
     foreach ($languages as $language) {
         $fields[$language['id_lang']]['id_lang'] = $language['id_lang'];
         $fields[$language['id_lang']][$this->identifier] = intval($this->id);
         foreach ($fieldsArray as $field) {
             /* Check fields validity */
             if (!Validate::isTableOrIdentifier($field)) {
                 die(Tools::displayError());
             }
             $htmlOK = $this->fieldsValidateLang[$field] == 'isCleanHtml';
             /* Copy the field, or the default language field if it's both required and empty */
             if (isset($this->{$field}[$language['id_lang']]) and !Tools::isEmpty($this->{$field}[$language['id_lang']])) {
                 $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']], $htmlOK);
             } elseif (in_array($field, $this->fieldsRequiredLang)) {
                 $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage], $htmlOK);
             } else {
                 $fields[$language['id_lang']][$field] = '';
             }
         }
     }
     return $fields;
 }
开发者ID:redb,项目名称:prestashop,代码行数:36,代码来源:ObjectModel.php

示例13: getTranslationsFieldsChild

 public function getTranslationsFieldsChild()
 {
     if (version_compare(_PS_VERSION_, '1.5', '<')) {
         if (count($this->tables) == 1) {
             return;
         }
         parent::validateFieldsLang();
         $fields_array = array();
         $fields = array();
         $definition = $this->getDefinitionProperty();
         if (isset($definition)) {
             foreach ($definition['fields'] as $field_name => $field) {
                 if (is_array($this->{$field_name})) {
                     $fields_array[] = $field_name;
                 }
             }
         }
         foreach (Language::getLanguages(false) as $language) {
             $fields[$language['id_lang']]['id_lang'] = $language['id_lang'];
             $fields[$language['id_lang']][$this->identifier] = (int) $this->{$this->identifier};
             foreach ($fields_array as $field) {
                 if (!Validate::isTableOrIdentifier($field)) {
                     die(Tools::displayError());
                 }
                 if (isset($this->{$field}[$language['id_lang']]) && !empty($this->{$field}[$language['id_lang']])) {
                     $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']]);
                 } elseif (in_array($field, $this->fieldsRequiredLang)) {
                     if ($this->{$field} != '') {
                         $fields[$language['id_lang']][$field] = pSQL($this->{$field}[(int) _PS_LANG_DEFAULT_]);
                     }
                 } else {
                     $fields[$language['id_lang']][$field] = '';
                 }
             }
         }
         return $fields;
     } else {
         $this->validateFieldsLang();
         $is_lang_multishop = $this->isLangMultishop();
         $fields = array();
         if ($this->id_lang === null) {
             foreach (Language::getLanguages(false) as $language) {
                 $fields[$language['id_lang']] = $this->formatFields(self::FORMAT_LANG, $language['id_lang']);
                 $fields[$language['id_lang']]['id_lang'] = $language['id_lang'];
                 if ($this->id_shop && $is_lang_multishop) {
                     $fields[$language['id_lang']]['id_shop'] = (int) $this->id_shop;
                 }
             }
         } else {
             $fields = array($this->id_lang => $this->formatFields(self::FORMAT_LANG, $this->id_lang));
             $fields[$this->id_lang]['id_lang'] = $this->id_lang;
             if ($this->id_shop && $is_lang_multishop) {
                 $fields[$this->id_lang]['id_shop'] = (int) $this->id_shop;
             }
         }
         return $fields;
     }
 }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:58,代码来源:ObjectModel.php

示例14: toggle

 /**
  * Toggle object status in database
  *
  * return boolean Update result
  */
 public function toggle($key = 'active')
 {
     if (!Validate::isTableOrIdentifier($this->identifier) or !Validate::isTableOrIdentifier($this->table)) {
         die('Fatal error:Object not exist!');
         /* Object must have a variable called 'active' */
     } elseif (!array_key_exists($key, $this->fields)) {
         die('Fatal error:No field \'' . $key . '\'');
     }
     /* Update active status on object */
     $this->{$key} = $this->{$key} > 0 ? 0 : 1;
     /* Change status to active/inactive */
     return $this->update();
 }
开发者ID:yiuked,项目名称:tmcart,代码行数:18,代码来源:ObjectBase.php

示例15: getList

    /**
     * Get the current objects' list form the database
     *
     * @param integer $id_lang Language used for display
     * @param string $order_by ORDER BY clause
     * @param string $_orderWay Order way (ASC, DESC)
     * @param integer $start Offset in LIMIT clause
     * @param integer $limit Row count in LIMIT clause
     */
    public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
    {
        /* Manage default params values */
        $use_limit = true;
        if ($limit === false) {
            $use_limit = false;
        } elseif (empty($limit)) {
            if (isset($this->context->cookie->{$this->table . '_pagination'}) && $this->context->cookie->{$this->table . '_pagination'}) {
                $limit = $this->context->cookie->{$this->table . '_pagination'};
            } else {
                $limit = $this->_pagination[1];
            }
        }
        if (!Validate::isTableOrIdentifier($this->table)) {
            throw new PrestaShopException(sprintf('Table name %s is invalid:', $this->table));
        }
        if (empty($order_by)) {
            if ($this->context->cookie->{$this->table . 'Orderby'}) {
                $order_by = $this->context->cookie->{$this->table . 'Orderby'};
            } elseif ($this->_orderBy) {
                $order_by = $this->_orderBy;
            } else {
                $order_by = $this->_defaultOrderBy;
            }
        }
        if (empty($order_way)) {
            if ($this->context->cookie->{$this->table . 'Orderway'}) {
                $order_way = $this->context->cookie->{$this->table . 'Orderway'};
            } elseif ($this->_orderWay) {
                $order_way = $this->_orderWay;
            } else {
                $order_way = $this->_defaultOrderWay;
            }
        }
        $limit = (int) Tools::getValue('pagination', $limit);
        $this->context->cookie->{$this->table . '_pagination'} = $limit;
        /* Check params validity */
        if (!Validate::isOrderBy($order_by) || !Validate::isOrderWay($order_way) || !is_numeric($start) || !is_numeric($limit) || !Validate::isUnsignedId($id_lang)) {
            throw new PrestaShopException('get list params is not valid');
        }
        /* Determine offset from current page */
        if ((isset($_POST['submitFilter' . $this->table]) || isset($_POST['submitFilter' . $this->table . '_x']) || isset($_POST['submitFilter' . $this->table . '_y'])) && !empty($_POST['submitFilter' . $this->table]) && is_numeric($_POST['submitFilter' . $this->table])) {
            $start = ((int) $_POST['submitFilter' . $this->table] - 1) * $limit;
        }
        /* Cache */
        $this->_lang = (int) $id_lang;
        $this->_orderBy = strpos($order_by, '.') !== false ? substr($order_by, strpos($order_by, '.') + 1) : $order_by;
        $this->_orderWay = Tools::strtoupper($order_way);
        /* SQL table : orders, but class name is Order */
        $sql_table = $this->table == 'order' ? 'orders' : $this->table;
        // Add SQL shop restriction
        $select_shop = $join_shop = $where_shop = '';
        if ($this->shopLinkType) {
            $select_shop = ', shop.name as shop_name ';
            $join_shop = ' LEFT JOIN ' . _DB_PREFIX_ . $this->shopLinkType . ' shop
							ON a.id_' . $this->shopLinkType . ' = shop.id_' . $this->shopLinkType;
            $where_shop = Shop::addSqlRestriction($this->shopShareDatas, 'a', $this->shopLinkType);
        }
        if ($this->multishop_context && Shop::isTableAssociated($this->table) && !empty($this->className)) {
            if (Shop::getContext() != Shop::CONTEXT_ALL || !$this->context->employee->isSuperAdmin()) {
                $test_join = !preg_match('#`?' . preg_quote(_DB_PREFIX_ . $this->table . '_shop') . '`? *sa#', $this->_join);
                if (Shop::isFeatureActive() && $test_join && Shop::isTableAssociated($this->table)) {
                    $this->_where .= ' AND a.' . $this->identifier . ' IN (
						SELECT sa.' . $this->identifier . '
						FROM `' . _DB_PREFIX_ . $this->table . '_shop` sa
						WHERE sa.id_shop IN (' . implode(', ', Shop::getContextListShopID()) . ')
					)';
                }
            }
        }
        /* Query in order to get results with all fields */
        $lang_join = '';
        if ($this->lang) {
            $lang_join = 'LEFT JOIN `' . _DB_PREFIX_ . $this->table . '_lang` b ON (b.`' . $this->identifier . '` = a.`' . $this->identifier . '` AND b.`id_lang` = ' . (int) $id_lang;
            if ($id_lang_shop) {
                if (!Shop::isFeatureActive()) {
                    $lang_join .= ' AND b.`id_shop` = 1';
                } elseif (Shop::getContext() == Shop::CONTEXT_SHOP) {
                    $lang_join .= ' AND b.`id_shop` = ' . (int) $id_lang_shop;
                } else {
                    $lang_join .= ' AND b.`id_shop` = a.id_shop_default';
                }
            }
            $lang_join .= ')';
        }
        $having_clause = '';
        if (isset($this->_filterHaving) || isset($this->_having)) {
            $having_clause = ' HAVING ';
            if (isset($this->_filterHaving)) {
                $having_clause .= ltrim($this->_filterHaving, ' AND ');
            }
//.........这里部分代码省略.........
开发者ID:jicheng17,项目名称:vipinsg,代码行数:101,代码来源:AdminController.php


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