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


PHP pSQL函数代码示例

本文整理汇总了PHP中pSQL函数的典型用法代码示例。如果您正苦于以下问题:PHP pSQL函数的具体用法?PHP pSQL怎么用?PHP pSQL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pSQL函数的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: getFields

 public function getFields()
 {
     parent::validateFields();
     $fields['id_lang'] = (int) $this->id_lang;
     $fields['name'] = pSQL($this->name);
     return $fields;
 }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:7,代码来源:Tag.php

示例3: add_module_to_hook

function add_module_to_hook($module_name, $hook_name)
{
    $res = true;
    $id_module = Db::getInstance()->getValue('
	SELECT `id_module` FROM `' . _DB_PREFIX_ . 'module`
	WHERE `name` = "' . $module_name . '"');
    if ((int) $id_module > 0) {
        $id_hook = Db::getInstance()->getValue('SELECT `id_hook` FROM `' . _DB_PREFIX_ . 'hook` WHERE `name` = "' . $hook_name . '"');
        if (!$id_hook) {
            if (!Db::getInstance()->execute('
			INSERT IGNORE INTO `' . _DB_PREFIX_ . 'hook` (`name`, `title`)
			VALUES ("' . pSQL($hook_name) . '", "' . pSQL($hook_name) . '")')) {
                $res = false;
            } else {
                $id_hook = Db::getInstance()->Insert_ID();
            }
        }
        if ((int) $id_hook > 0) {
            if (!Db::getInstance()->execute('
			INSERT IGNORE INTO `' . _DB_PREFIX_ . 'hook_module` (`id_module`, `id_hook`, `position`)
			VALUES (
			' . (int) $id_module . ',
			' . (int) $id_hook . ',
			(SELECT IFNULL(
				(SELECT max_position from (SELECT MAX(position)+1 as max_position  FROM `' . _DB_PREFIX_ . 'hook_module`  WHERE `id_hook` = ' . (int) $id_hook . ') AS max_position), 1))
			)')) {
                $res = false;
            }
        }
    }
    return $res;
}
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:32,代码来源:add_module_to_hook.php

示例4: getFields

 public function getFields()
 {
     parent::validateFields();
     $fields['id_country'] = (int) $this->id_country;
     $fields['format'] = pSQL($this->format);
     return $fields;
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:7,代码来源:AddressFormat.php

示例5: getFields

 public function getFields()
 {
     parent::validateFields();
     $fields['server'] = pSQL($this->server);
     $fields['getvar'] = pSQL($this->getvar);
     return $fields;
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:7,代码来源:SearchEngine.php

示例6: getFields

 public function getFields()
 {
     parent::validateFields();
     $fields['file'] = pSQL($this->file);
     $fields['mime'] = pSQL($this->mime);
     return $fields;
 }
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:7,代码来源:Attachment.php

示例7: add_new_groups

function add_new_groups($french, $standard)
{
    $res = Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'group` (`id_group`, `date_add`, `date_upd`) VALUES (NULL, NOW(), NOW())');
    $last_id = Db::getInstance()->Insert_ID();
    $languages = Db::getInstance()->executeS('SELECT id_lang, iso_code FROM `' . _DB_PREFIX_ . 'lang`');
    $sql = '';
    foreach ($languages as $lang) {
        if (strtolower($lang['iso_code']) == 'fr') {
            $sql .= '(' . (int) $last_id . ', ' . (int) $lang['id_lang'] . ', "' . pSQL($french) . '"),';
        } else {
            $sql .= '(' . (int) $last_id . ', ' . (int) $lang['id_lang'] . ', "' . pSQL($standard) . '"),';
        }
    }
    $sql = substr($sql, 0, strlen($sql) - 1);
    $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'group_lang` (`id_group`, `id_lang`, `name`) VALUES ' . $sql);
    // we add the different id_group in the configuration
    if (strtolower($standard) == 'visitor') {
        $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, "PS_UNIDENTIFIED_GROUP", "' . (int) $last_id . '", NOW(), NOW())');
    } else {
        if (strtolower($standard) == 'guest') {
            $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, "PS_GUEST_GROUP", "' . (int) $last_id . '", NOW(), NOW())');
        } else {
            if (strtolower($standard) == 'test') {
                $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, "PS_TEST", "' . (int) $last_id . '", NOW(), NOW())');
            }
        }
    }
    // Add shop association
    $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'group_shop` (`id_group`, `id_shop`) (SELECT ' . (int) $last_id . ', `value` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'PS_SHOP_DEFAULT\')');
    // Copy categories associations from the group of id 1 (default group for both visitors and customers in version 1.4) to the new group
    $res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'category_group` (`id_category`, `id_group`) (SELECT `id_category`, ' . (int) $last_id . ' FROM `' . _DB_PREFIX_ . 'category_group` WHERE `id_group` = 1)');
    return $res;
}
开发者ID:dev-lav,项目名称:htdocs,代码行数:33,代码来源:add_new_groups.php

示例8: getGlossaries

 /**
  * Get all available glossaries
  *
  * @param integer $id_lang Language id
  * @param array $criteria Criterias for where clause
  * @param integer $start Start number
  * @param integer $limit Number of glossaries to return
  * @param string $order_by Field for ordering
  * @param string $order_way Way for ordering (ASC or DESC)
  * @param boolean $only_active Returns only active glossaries if TRUE
  * @param Context|null $context
  *
  * @return array list of glossaries
  */
 public static function getGlossaries($id_lang, $criteria = array(), $start = null, $limit = null, $order_by = null, $order_way = null, $only_active = false, Context $context = null)
 {
     $where = '';
     if (!$context) {
         $context = Context::getContext();
     }
     if ($order_by !== null) {
         if (!Validate::isOrderBy($order_by) || !Validate::isOrderWay($order_way)) {
             die(Tools::displayError());
         }
         if ($order_by == 'id') {
             $order_by_prefix = 'l';
         } else {
             $order_by_prefix = 'll';
         }
         if (strpos($order_by, '.') > 0) {
             $order_by = explode('.', $order_by);
             $order_by_prefix = $order_by[0];
             $order_by = $order_by[1];
         }
     }
     if (isset($criteria['k'])) {
         $where .= " AND ll.name LIKE '" . pSQL($criteria['k']) . "%' ";
     }
     $sql = 'SELECT l.*, ll.*
             FROM `' . _DB_PREFIX_ . 'lexikotron` l
             LEFT JOIN `' . _DB_PREFIX_ . 'lexikotron_lang` ll ON (l.`id_lexikotron` = ll.`id_lexikotron`)
             WHERE ll.`id_lang` = ' . (int) $id_lang . ($only_active ? ' AND l.`active` = 1' : '') . '
                 ' . $where . '
                 ' . ($order_by != null ? 'ORDER BY ' . (isset($order_by_prefix) ? pSQL($order_by_prefix) . '.' : '') . '`' . pSQL($order_by) . '` ' . pSQL($order_way) : '') . ($limit > 0 ? ' LIMIT ' . (int) $start . ',' . (int) $limit : '');
     $rows = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
     return $rows;
 }
开发者ID:xanou,项目名称:lexikotron,代码行数:47,代码来源:Glossary.php

示例9: getBlockContent

 public static function getBlockContent($params, &$smarty)
 {
     //use in template as {getBelvgBlockContent id="block_identifier"}
     if (!Module::isEnabled('belvg_staticblocks')) {
         return FALSE;
     }
     if (isset($params['id'])) {
         $block_identifier = $params['id'];
         $sql = '
         SELECT `id_belvg_staticblocks`
         FROM `' . _DB_PREFIX_ . 'belvg_staticblocks`
         WHERE `block_identifier` = "' . pSQL($block_identifier) . '" AND `status` = "1"';
         if (Shop::isFeatureActive()) {
             $sql .= ' AND `id_belvg_staticblocks` IN (
                 SELECT sa.`id_belvg_staticblocks`
                 FROM `' . _DB_PREFIX_ . 'belvg_staticblocks_shop` sa
                 WHERE sa.id_shop IN (' . implode(', ', Shop::getContextListShopID()) . ')
             )';
         }
         $block_id = (int) Db::getInstance()->getValue($sql);
         if ($block_id) {
             $id_lang = Context::getContext()->cookie->id_lang;
             $block = new self($block_id);
             if (isset($block->content[$id_lang])) {
                 return $block->content[$id_lang];
             }
         }
     }
 }
开发者ID:sho5kubota,项目名称:guidingyou2,代码行数:29,代码来源:BelvgStaticBlocks.php

示例10: addAlert

    public static function addAlert($email, $id_product)
    {
        $res = Db::getInstance()->execute('
			INSERT INTO `' . _DB_PREFIX_ . 'stock_alert` (`id_product`, `email`)
			VALUES (' . (int) $id_product . ', \'' . pSQL($email) . '\')');
        return $res;
    }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:7,代码来源:StockAlert.php

示例11: init

 public function init()
 {
     if ($cms_rewrite = Tools::getValue('cms_rewrite')) {
         $sql = 'SELECT l.`id_cms`
             FROM `' . _DB_PREFIX_ . 'cms_lang` l
             LEFT JOIN `' . _DB_PREFIX_ . 'cms_shop` s ON (l.`id_cms` = s.`id_cms`)
             WHERE l.`link_rewrite` = \'' . pSQL(str_replace('.html', '', $cms_rewrite)) . '\'';
         if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
             $sql .= ' AND s.`id_shop` = ' . (int) Shop::getContextShopID();
         }
         $id_cms = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
         if ($id_cms > 0) {
             $_GET['id_cms'] = $id_cms;
         }
     } elseif ($cms_category_rewrite = Tools::getValue('cms_category_rewrite')) {
         $sql = 'SELECT `id_cms_category`
             FROM `' . _DB_PREFIX_ . 'cms_category_lang`
             WHERE `link_rewrite` = \'' . pSQL($cms_category_rewrite) . '\'';
         if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
             $sql .= ' AND s.`id_shop` = ' . (int) Shop::getContextShopID();
         }
         $id_cms_category = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
         if ($id_cms_category > 0) {
             $_GET['id_cms_category'] = $id_cms_category;
         }
     }
     parent::init();
 }
开发者ID:Barclee,项目名称:zzCleanURLs,代码行数:28,代码来源:CmsController.php

示例12: add_unknown_gender

function add_unknown_gender()
{
    $res = true;
    // creates the new gender
    $id_type = 2;
    $res &= Db::getInstance()->execute('
		INSERT INTO `' . _DB_PREFIX_ . 'gender` (`type`)
		VALUES (' . (int) $id_type . ')');
    // retrieves its id
    $id_gender = Db::getInstance()->Insert_ID();
    // inserts lang values
    $languages = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'lang`');
    $lang_names = array('en' => 'Unknown', 'de' => 'Unbekannte', 'es' => 'Desconocido', 'fr' => 'Inconnu', 'it' => 'Sconosciuto');
    foreach ($languages as $lang) {
        $name = isset($lang_names[$lang['iso_code']]) ? $lang_names[$lang['iso_code']] : 'Unknown';
        $res &= Db::getInstance()->execute('
			INSERT INTO `' . _DB_PREFIX_ . 'gender_lang` (`id_gender`, `id_lang`, `name`) VALUES
				(' . (int) $id_gender . ', ' . (int) $lang['id_lang'] . ', \'' . pSQL($name) . '\')');
    }
    // for all clients where id gender is 0, sets the new id gender
    $res &= Db::getInstance()->execute('
		UPDATE `' . _DB_PREFIX_ . 'customers`
		SET `id_gender` = ' . (int) $id_gender . '
		WHERE `id_gender` = 0');
}
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:25,代码来源:add_unknown_gender.php

示例13: getIdByName

    /**
     * Get a zone ID from its default language name
     *
     * @return integer id_zone
     */
    public static function getIdByName($name)
    {
        return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
		SELECT `id_zone`
		FROM `' . _DB_PREFIX_ . 'zone`
		WHERE `name` = \'' . pSQL($name) . '\'');
    }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:12,代码来源:Zone.php

示例14: getForSellerByModuleName

 public static function getForSellerByModuleName($module_name, $id_seller)
 {
     ${"GLOBALS"}["zkcagbwt"] = "id_seller";
     $gzcdohkbbg = "key";
     ${"GLOBALS"}["ktsfkx"] = "module_name";
     $xigepp = "id_seller";
     $ttfaclm = "result";
     ${"GLOBALS"}["ctufmpefcs"] = "id_seller";
     $cgjureyee = "obj";
     if (!isset(${${"GLOBALS"}["zkcagbwt"]}) or intval(${$xigepp}) <= 0) {
         return false;
     }
     ${${"GLOBALS"}["pqnbriqkmcpj"]} = "\n\t\tSELECT a.* \n\t\tFROM `" . _DB_PREFIX_ . "agile_seller_paymentinfo` a\n\t\tWHERE 1\n\t\t    AND a.`module_name` = '" . pSQL(${${"GLOBALS"}["ktsfkx"]}) . "'\n\t\t    AND a.`id_seller` = " . pSQL(${${"GLOBALS"}["ctufmpefcs"]}) . "\n\t\t";
     ${${"GLOBALS"}["plodwcumusd"]} = new AgileSellerPaymentInfo();
     ${"GLOBALS"}["gsvthjtmecpa"] = "result";
     ${${"GLOBALS"}["gsvthjtmecpa"]} = Db::getInstance()->getRow(${${"GLOBALS"}["pqnbriqkmcpj"]});
     if (!${${"GLOBALS"}["jvynnnsmtb"]}) {
         return ${$cgjureyee};
     }
     ${"GLOBALS"}["pmnmlsxn"] = "value";
     $obj->id = ${$ttfaclm}[$obj->identifier];
     foreach (${${"GLOBALS"}["jvynnnsmtb"]} as ${$gzcdohkbbg} => ${${"GLOBALS"}["pmnmlsxn"]}) {
         ${"GLOBALS"}["yyqgjlxussf"] = "obj";
         $tmxdrdkyc = "value";
         if (key_exists(${${"GLOBALS"}["lpbzrpslxl"]}, ${${"GLOBALS"}["yyqgjlxussf"]})) {
             $obj->{${${"GLOBALS"}["lpbzrpslxl"]}} = ${$tmxdrdkyc};
         }
     }
     return ${${"GLOBALS"}["plodwcumusd"]};
 }
开发者ID:evilscripts,项目名称:gy,代码行数:30,代码来源:AgileSellerPaymentInfo.php

示例15: getProductTaxRate

    /**
     * Return the product tax
     *
     * @param integer $id_product
     * @param integer $id_address
     * @return Tax Rate
     */
    public static function getProductTaxRate($id_product, $id_address = null, $getCarrierRate = false)
    {
        include_once _PS_ROOT_DIR_ . '/modules/avalaratax/avalaratax.php';
        /* Instanciate the Avalara module and check if active */
        $avalara = new AvalaraTax();
        if (!$avalara->active) {
            return parent::getProductTaxRate($id_product, $id_address, $getCarrierRate);
        }
        /* With Avalara, we disable the tax for non logged users */
        if (!(int) $id_address) {
            return 0.0;
        }
        $region = Db::getInstance()->getValue('SELECT s.`iso_code`
									FROM ' . _DB_PREFIX_ . 'address a
									LEFT JOIN ' . _DB_PREFIX_ . 'state s ON (s.`id_state` = a.`id_state`)
									WHERE a.`id_address` = ' . (int) $id_address);
        /* If the Merchant does not want to calculate taxes outside his state and we are outside the state, we return 0 */
        if (!empty($region) && $region != Configuration::get('AVALARATAX_STATE') && !Configuration::get('AVALARATAX_TAX_OUTSIDE')) {
            return 0.0;
        }
        return (double) Db::getInstance()->getValue('SELECT ac.`tax_rate`
		FROM ' . _DB_PREFIX_ . 'avalara_' . ($getCarrierRate ? 'carrier' : 'product') . '_cache ac
		WHERE ac.`id_' . ($getCarrierRate ? 'carrier' : 'product') . '` = ' . (int) $id_product . '
		AND ac.`region` = \'' . pSQL($region) . '\'');
    }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:32,代码来源:Tax.php


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