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


PHP DoliDB::decrypt方法代码示例

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


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

示例1: setValues

 /**
  *	Load setup values into conf object (read llx_const)
  *  Note that this->db->xxx, this->file->xxx and this->multicompany have been already loaded when setValues is called.
  *
  *	@param      DoliDB		$db		Database handler
  *	@return     int					< 0 if KO, >= 0 if OK
  */
 function setValues($db)
 {
     global $conf;
     dol_syslog(get_class($this) . "::setValues");
     /*
      * Definition de toutes les constantes globales d'environnement
      * - En constante php (TODO a virer)
      * - En $this->global->key=value
      */
     $sql = "SELECT " . $db->decrypt('name') . " as name,";
     $sql .= " " . $db->decrypt('value') . " as value, entity";
     $sql .= " FROM " . MAIN_DB_PREFIX . "const";
     if (!empty($this->multicompany->transverse_mode)) {
         $sql .= " WHERE entity IN (0,1," . $this->entity . ")";
     } else {
         $sql .= " WHERE entity IN (0," . $this->entity . ")";
     }
     $sql .= " ORDER BY entity";
     // This is to have entity 0 first, then entity 1 that overwrite.
     $resql = $db->query($sql);
     if ($resql) {
         $i = 0;
         $numr = $db->num_rows($resql);
         while ($i < $numr) {
             $objp = $db->fetch_object($resql);
             $key = $objp->name;
             $value = $objp->value;
             if ($key) {
                 if (!defined("{$key}")) {
                     define("{$key}", $value);
                 }
                 // In some cases, the constant might be already forced (Example: SYSLOG_HANDLERS during install)
                 $this->global->{$key} = $value;
                 if ($value && preg_match('/^MAIN_MODULE_/', $key)) {
                     // If this is constant for a new tab page activated by a module. It initializes modules_parts['tabs'].
                     if (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_TABS_/i', $key)) {
                         $partname = 'tabs';
                         $params = explode(':', $value, 2);
                         if (!isset($this->modules_parts[$partname]) || !is_array($this->modules_parts[$partname])) {
                             $this->modules_parts[$partname] = array();
                         }
                         $this->modules_parts[$partname][$params[0]][] = $value;
                         // $value may be a string or an array
                     } elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_([A-Z]+)$/i', $key, $reg)) {
                         $modulename = strtolower($reg[1]);
                         $partname = strtolower($reg[2]);
                         if (!isset($this->modules_parts[$partname]) || !is_array($this->modules_parts[$partname])) {
                             $this->modules_parts[$partname] = array();
                         }
                         $arrValue = json_decode($value, true);
                         if (is_array($arrValue) && !empty($arrValue)) {
                             $value = $arrValue;
                         } else {
                             if (in_array($partname, array('login', 'menus', 'substitutions', 'triggers', 'tpl'))) {
                                 $value = '/' . $modulename . '/core/' . $partname . '/';
                             } else {
                                 if (in_array($partname, array('models', 'theme'))) {
                                     $value = '/' . $modulename . '/';
                                 } else {
                                     if (in_array($partname, array('sms'))) {
                                         $value = $modulename;
                                     } else {
                                         if ($value == 1) {
                                             $value = '/' . $modulename . '/core/modules/' . $partname . '/';
                                         }
                                     }
                                 }
                             }
                         }
                         // ex: partname = societe
                         $this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value));
                         // $value may be a string or an array
                     } elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)$/i', $key, $reg)) {
                         $modulename = strtolower($reg[1]);
                         if ($modulename == 'propale') {
                             $modulename = 'propal';
                         }
                         if (!isset($this->{$modulename}) || !is_object($this->{$modulename})) {
                             $this->{$modulename} = new stdClass();
                         }
                         $this->{$modulename}->enabled = true;
                         $this->modules[] = $modulename;
                         // Add this module in list of enabled modules
                     }
                 }
             }
             $i++;
         }
         $db->free($resql);
     }
     //var_dump($this->modules);
     //var_dump($this->modules_parts['theme']);
     // If you can't set timezone of your PHP, set this constant. Better is to set it to UTC.
//.........这里部分代码省略.........
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:101,代码来源:conf.class.php

示例2: dolibarr_get_const

/**
 *	Recupere une constante depuis la base de donnees.
 *
 *	@param	    DoliDB		$db         Database handler
 *	@param	    string		$name		Nom de la constante
 *	@param	    int			$entity		Multi company id
 *	@return     string      			Valeur de la constante
 *
 *	@see		dolibarr_del_const, dolibarr_set_const, dol_set_user_param
 */
function dolibarr_get_const($db, $name, $entity = 1)
{
    global $conf;
    $value = '';
    $sql = "SELECT " . $db->decrypt('value') . " as value";
    $sql .= " FROM " . MAIN_DB_PREFIX . "const";
    $sql .= " WHERE name = " . $db->encrypt($name, 1);
    $sql .= " AND entity = " . $entity;
    dol_syslog("admin.lib::dolibarr_get_const", LOG_DEBUG);
    $resql = $db->query($sql);
    if ($resql) {
        $obj = $db->fetch_object($resql);
        if ($obj) {
            $value = $obj->value;
        }
    }
    return $value;
}
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:28,代码来源:admin.lib.php


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