本文整理汇总了PHP中XCube_Utils::decrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP XCube_Utils::decrypt方法的具体用法?PHP XCube_Utils::decrypt怎么用?PHP XCube_Utils::decrypt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XCube_Utils
的用法示例。
在下文中一共展示了XCube_Utils::decrypt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
/**
* Get a config value in a format ready for output
*
* @return string
*/
function &getConfValueForOutput()
{
switch ($this->getVar('conf_valuetype')) {
case 'int':
$ret = (int) $this->getVar('conf_value', 'N');
return $ret;
case 'array':
$ret = unserialize($this->getVar('conf_value', 'N'));
return $ret;
case 'float':
$ret = (double) $this->getVar('conf_value', 'N');
return $ret;
case 'textarea':
return $this->getVar('conf_value');
case 'encrypt':
$ret = XCube_Utils::decrypt($this->getVar('conf_value', 'N'));
return $ret;
default:
return $this->getVar('conf_value', 'N');
}
$ret = null;
return $ret;
}
示例2: array
/**
* Get configs from a certain category
*
* @param int $category ID of a category
* @param int $module ID of a module
*
* @return array array of {@link XoopsConfig}s
* @todo This method keeps cache for categories. This may be problem...
*/
function &getConfigsByCat($category, $module = 0)
{
static $_cachedConfigs = array();
if (!empty($_cachedConfigs[$module][$category])) {
return $_cachedConfigs[$module][$category];
} else {
$ret = array();
$criteria = new CriteriaCompo(new Criteria('conf_modid', (int) $module));
if (!empty($category)) {
$criteria->add(new Criteria('conf_catid', (int) $category));
}
// get config values
$configs = array();
$db = $this->_cHandler->db;
$result = $db->query('SELECT conf_name,conf_value,conf_valuetype FROM ' . $db->prefix('config') . ' ' . $criteria->renderWhere() . ' ORDER BY conf_order ASC');
if ($result) {
while (list($name, $value, $type) = $db->fetchRow($result)) {
switch ($type) {
case 'array':
$ret[$name] = unserialize($value);
break;
case 'encrypt':
$ret[$name] = XCube_Utils::decrypt($value);
break;
default:
$ret[$name] = $value;
}
}
$_cachedConfigs[$module][$category] =& $ret;
}
return $ret;
}
}
示例3: prepare
function prepare()
{
//
// Set form properties
//
$configArr = array();
if (func_num_args()) {
$configArr = func_get_arg(0);
}
foreach ($configArr as $config) {
switch ($config->get('conf_valuetype')) {
case 'text':
case 'string':
if ($config->get('conf_formtype') == 'textarea') {
$this->mFormProperties[$config->get('conf_name')] = new XCube_TextProperty($config->get('conf_name'));
} else {
$this->mFormProperties[$config->get('conf_name')] = new XCube_StringProperty($config->get('conf_name'));
}
$this->set($config->get('conf_name'), $config->get('conf_value'));
break;
case 'float':
$this->mFormProperties[$config->get('conf_name')] = new XCube_FloatProperty($config->get('conf_name'));
$this->set($config->get('conf_name'), $config->get('conf_value'));
$this->mFieldProperties[$config->get('conf_name')] = new XCube_FieldProperty($this);
$this->mFieldProperties[$config->get('conf_name')]->setDependsByArray(array('required'));
$this->mFieldProperties[$config->get('conf_name')]->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, $config->get('conf_title'));
break;
case 'int':
$this->mFormProperties[$config->get('conf_name')] = new XCube_IntProperty($config->get('conf_name'));
$this->set($config->get('conf_name'), $config->get('conf_value'));
$this->mFieldProperties[$config->get('conf_name')] = new XCube_FieldProperty($this);
$this->mFieldProperties[$config->get('conf_name')]->setDependsByArray(array('required'));
$this->mFieldProperties[$config->get('conf_name')]->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, $config->get('conf_title'));
break;
case 'other':
$this->mFormProperties[$config->get('conf_name')] = new XCube_StringProperty($config->get('conf_name'));
$this->set($config->get('conf_name'), $config->get('conf_value'));
break;
case 'array':
if ($config->get('conf_formtype') == 'textarea') {
$this->mFormProperties[$config->get('conf_name')] = new XCube_StringProperty($config->get('conf_name'));
$this->set($config->get('conf_name'), implode("|", unserialize($config->get('conf_value'))));
} else {
$this->mFormProperties[$config->get('conf_name')] = new XCube_StringArrayProperty($config->get('conf_name'));
$t_arr = unserialize($config->get('conf_value'));
if (is_array($t_arr)) {
foreach ($t_arr as $_key => $_value) {
$this->set($config->get('conf_name'), $_key, $_value);
}
}
}
break;
case 'encrypt':
if ($config->get('conf_formtype') == 'textarea') {
$this->mFormProperties[$config->get('conf_name')] = new XCube_TextProperty($config->get('conf_name'));
} else {
$this->mFormProperties[$config->get('conf_name')] = new XCube_StringProperty($config->get('conf_name'));
}
$this->set($config->get('conf_name'), XCube_Utils::decrypt($config->get('conf_value')));
break;
}
}
}