本文整理汇总了PHP中setConfig函数的典型用法代码示例。如果您正苦于以下问题:PHP setConfig函数的具体用法?PHP setConfig怎么用?PHP setConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setConfig函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init(array $argv = array(), $verbosity = 0)
{
$this->_verbosity = $verbosity;
/* First element is the php script name. Store it for debugging. */
$this->_php_exec = array_shift($argv);
/* Second element is just the executable we called to run ZF commands. Store it for printing errors/usage. */
$this->_native_exec = array_shift($argv);
$opts = $this->getOptions()->addArguments($argv);
$opts->parse();
// Shortcut to verbosity option so that we can display more earlier
if (isset($opts->verbosity)) {
$this->_verbosity = $opts->verbosity;
}
// Shortcut to help option so that no arguments have to be specified
if (isset($opts->help)) {
$this->printHelp();
return null;
}
try {
$actionName = array_shift($argv);
$context = Zend_Build_Manifest::getInstance()->getContext(self::MF_ACTION_TYPE, $actionName);
$config = $this->_parseParams($context, $argv);
$action = new $context->class();
$action . setConfig($config);
$action . configure();
} catch (Zend_Console_Exception $e) {
throw $e->prependUsage($this->getUsage());
}
return $this;
}
示例2: __call
public function __call($func, $argv)
{
if (substr($func, 0, 3) == 'get') {
$uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($func, 3)));
$key = Inflector::lower($uncamelizeMethod);
if (isset($argv[0])) {
$environment = $argv[0];
} else {
$environment = APPLICATION_ENV;
}
return getConfig($key, $environment);
} elseif (substr($func, 0, 3) == 'set') {
$uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($func, 3)));
$key = Inflector::lower($uncamelizeMethod);
$value = Arrays::first($argv);
if (isset($argv[1])) {
$environment = $argv[1];
} else {
$environment = 'all';
}
setConfig($key, $value, $environment);
return $this;
} elseif (substr($func, 0, 3) == 'has') {
$uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($func, 3)));
$key = Inflector::lower($uncamelizeMethod);
if (isset($argv[0])) {
$environment = $argv[0];
} else {
$environment = APPLICATION_ENV;
}
return null !== getConfig($key, $environment);
}
}
示例3: updatesyncredit
function updatesyncredit($syncredit)
{
require_once R_P . 'admin/cache.php';
setConfig('uc_syncredit', $syncredit);
updatecache_c();
return new ApiResponse(1);
}
示例4: goAction
function goAction($act, $category_id, $course_id, $courses, $exercises)
{
if (!$act || $act == null) {
$act = "default";
}
switch ($act) {
case 'default':
showPage();
break;
case 'getCategory':
showCategories();
break;
case 'getCategoryJson':
showCategoryTree();
break;
case 'getCourses':
showCourses($category_id);
break;
case 'getTracks':
showTracks($category_id, $course_id);
break;
case 'getScores':
showScores($category_id, $course_id);
break;
case 'getSummary':
showSummary($category_id, $courses, $exercises);
break;
case 'getExcel':
showExcel($category_id, $courses, $exercises);
break;
case 'getCfgs':
showConfig($category_id, $course_id);
break;
case 'saveCfgs':
$count = $_GET['count'];
$configs = $_GET['config'];
setConfig($category_id, $course_id, $count, $configs);
break;
case 'createCfgs':
$quiz_count = @$_GET['count'];
if (!isset($quiz_count) || $quiz_count == null || $quiz_count <= 0) {
drawConfigPanel($category_id, $course_id);
} else {
drawConfigPanel($category_id, $course_id, $quiz_count);
}
break;
case 'removeCfgs':
removeConfig($category_id, $course_id);
break;
case 'getStudents':
showStudentConfigs();
break;
case 'saveStudents':
$students = $_GET['s'];
saveStudentConfigs($students);
break;
}
}
示例5: setConfig
function setConfig($key, $value)
{
if (!$key) {
return true;
}
require_once R_P . 'admin/cache.php';
setConfig('db_' . $key, $value);
updatecache_c();
}
示例6: insertWebmasterKey
/**
* 插入站长中心id
* @param int $siteId 站长中心id
* @return bool
*/
function insertWebmasterKey($siteId)
{
if ($siteId <= 0) {
return new ApiResponse(false);
}
require_once R_P . 'admin/cache.php';
setConfig('db_siteappkey', $siteId);
updatecache_c();
return new ApiResponse(true);
}
示例7: test_matchPWD
public function test_matchPWD()
{
setConfig("PWD_HASH_TYPE", "logiks");
$salt = strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.');
$algo_actual = getPWDHash('test', $salt);
$first = matchPWD($algo_actual, 'test', $salt);
$this->assertEquals(true, $first);
$first = matchPWD($algo_actual, 'testing', $salt);
$this->assertEquals(false, $first);
}
示例8: appsUpdateCache
function appsUpdateCache($apps)
{
if ($apps && is_array($apps)) {
require_once R_P . 'admin/cache.php';
setConfig('db_apps_list', $apps);
updatecache_c();
return new ApiResponse(true);
} else {
return new ApiResponse(false);
}
}
示例9: create_dbconfig_table
function create_dbconfig_table()
{
$dir = dirname(dirname(__FILE__));
require_once $dir . '/config.php';
$table = 'config';
$params = array(array('id', 'int(11)', 'NOT NULL', 'AUTO_INCREMENT'), array('name', 'varchar(255)', 'DEFAULT NULL'), array('value', 'varchar(255)', 'DEFAULT NULL'), array('PRIMARY KEY (id)'), array('UNIQUE KEY name (name)'));
$newTable = $DB->createTable($table, $params);
if ($newTable) {
setConfig('toto', 'titi');
return true;
}
}
示例10: _saveBindInfo
function _saveBindInfo($options)
{
require_once R_P . 'admin/cache.php';
global ${$this->_config_key};
$bindInfo = ${$this->_config_key} ? ${$this->_config_key} : array();
foreach ($options as $key => $value) {
$bindInfo[$key] = $value;
}
${$this->_config_key} = $bindInfo;
setConfig($this->_config_key, $bindInfo);
updatecache_c();
return true;
}
示例11: matchPWD
function matchPWD($pwdHash, $pwd, $salt = null)
{
if (strlen(getConfig("PWD_HASH_TYPE")) <= 0 || !getConfig("PWD_HASH_TYPE")) {
setConfig("PWD_HASH_TYPE", "logiks");
}
$newHash = getPWDHash($pwd, $salt);
// printArray([$newHash,$pwd,$salt,$pwdHash]);
if (is_array($newHash)) {
$newHash = $newHash['hash'];
}
//println($pwdHash);println(getPWDHash($pwd, $salt));exit($pwd);
// println(($pwdHash===$newHash));exit("XXX $pwdHash $newHash ".getConfig("PWD_HASH_TYPE"));
return $pwdHash === $newHash;
}
示例12: checkBan
function checkBan()
{
// We need the database and the current time.
global $DB;
global $TIMEMARK;
// Get the ban time, the maximum attempts etc..
$maxAllowedPerIP = getConfig("banAttempts");
$banTime = getConfig("banTime") * 60;
$timeFrame = 1800;
$targetTimeStamp = $TIMEMARK - $timeFrame;
// Enforce minimal settings.
if ($maxAllowedPerIP < 5) {
setConfig("banAttempts", "5");
$maxAllowedPerIP = 5;
}
if ($banTime < 60) {
setConfig("banTime", "1");
$banTime = 60;
}
// Wash the username and IP.
$username = strtolower(sanitize($_POST[username]));
$ip = $_SERVER[REMOTE_ADDR];
// Load counts from database.
$attemptsIP = $DB->getCol("SELECT COUNT(incident) FROM failed_logins WHERE ip='" . $ip . "' AND failed_logins.time > " . $targetTimeStamp);
$attemptsUsername = $DB->getCol("SELECT COUNT(incident) FROM failed_logins WHERE username='" . $username . "' AND failed_logins.time > " . $targetTimeStamp);
// Deny access if limits reached.
if ($attemptsIP[0] > $maxAllowedPerIP || $attemptsUsername[0] > $maxAllowedPerIP) {
// Get the time of the latest attempt.
$latestAttempt = $DB->getCol("SELECT time FROM failed_logins WHERE ip='" . $ip . "' OR username='" . $username . "' ORDER BY time DESC LIMIT 1");
// Lets check if that is still in the baaaaad area.
if ($latestAttempt[0] + $banTime > $TIMEMARK) {
// Still banned.
$remain = numberToString($latestAttempt[0] + $banTime - $TIMEMARK);
makeNotice("You have reached the maximum number of login attempts. You are temporarily banned for " . number_format($banTime / 60, 0) . " minutes. Time left on ban: " . $remain, "error", "Banned");
}
}
// If we get here, all is good.
}
示例13: alertMusic
function alertMusic($state)
{
//虾米音乐网编辑器开启/关闭
require_once R_P . 'admin/cache.php';
setConfig('db_xiami_music_open', $state);
updatecache_c();
return new ApiResponse(true);
}
示例14: exit
<?php
!function_exists('adminmsg') && exit('Forbidden');
$basename = "{$admin_file}?adminjob=ipban&job=ipstates";
if ($action != 'submit' && $action != 'ipIndex') {
ifcheck($db_ipstates, 'ipstates');
include PrintEot('ipstates');
} elseif ($_POST['action'] == "submit") {
S::gp(array('ipstates'), 'P');
setConfig('db_ipstates', $ipstates);
updatecache_c();
$navConfigService = L::loadClass('navconfig', 'site');
$navConfigService->controlShowByKey('sort_ipstate', $ipstates);
adminmsg('operate_success');
} elseif ($action == "ipIndex") {
$ipTable = L::loadClass('IPTable', 'utility');
$ipTable->createIpIndex();
adminmsg('operate_success');
}
示例15: is_array
}
}
$config['groups'] = is_array($groups) ? ',' . implode(',', $groups) . ',' : '';
$updatecache = false;
$config['groups_creditset'] = array();
if (is_array($creditset) && !empty($creditset)) {
foreach ($creditset as $key => $value) {
foreach ($value as $k => $v) {
$creditset[$key][$k] = $v === '' ? in_array($key, array('Post', 'Reply', 'Delete', 'Deleterp')) ? '' : 0 : round($v, $k == 'rvrc' ? 1 : 0);
}
}
$config['groups_creditset'] = $creditset;
}
$config['groups_creditlog'] = is_array($creditlog) && !empty($creditlog) ? $creditlog : array();
foreach ($config as $key => $value) {
setConfig("o_{$key}", $value, null, true);
}
updatecache_conf('o', true);
adminmsg('operate_success', $j_url);
}
} elseif ($action == 'setting') {
!is_array($config = $_POST['config']) && ($config = array());
foreach ($config as $key => $value) {
if ($value) {
$isint = false;
if ($_POST['step'] == 'basic') {
if ($key == 'name' || $key == 'moneytype') {
$config[$key] = S::escapeChar($value);
} elseif ($key == 'rate') {
$config[$key] = (double) $value;
} else {