本文整理汇总了PHP中config::set方法的典型用法代码示例。如果您正苦于以下问题:PHP config::set方法的具体用法?PHP config::set怎么用?PHP config::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类config
的用法示例。
在下文中一共展示了config::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTimeline
public static function getTimeline($user = array(), $privacy = 2, $template = 'timeline/helpers/timeline')
{
loader::model('timeline/timeline');
// Get actions
$actions = codebreeder::instance()->timeline_model->getActions($user ? $user['user_id'] : 0, true, 0, config::item('actions_per_page', 'timeline'));
$ratings = array();
// Do we have actions and are we logged in?
if ($actions && users_helper::isLoggedin()) {
foreach ($actions as $action) {
if ($action['rating']) {
$ratings[$action['relative_resource']][] = $action['item_id'];
} else {
$ratings['timeline'][] = $action['action_id'];
}
}
// Load votes and like models
loader::model('comments/votes');
loader::model('comments/likes');
// Get likes and votes
$likes = codebreeder::instance()->likes_model->getMultiLikes($ratings);
$votes = codebreeder::instance()->votes_model->getMultiVotes($ratings);
$ratings = $likes + $votes;
}
// Can we post messages?
$post = session::permission('messages_post', 'timeline') && codebreeder::instance()->users_model->getPrivacyAccess($user['user_id'], $privacy, false) ? true : false;
view::assign(array('actions' => $actions, 'user' => $user, 'post' => $post, 'ratings' => $ratings), '', $template);
// Update comments pagination
config::set('comments_per_page', config::item('comments_per_page', 'timeline'), 'comments');
return view::load($template, array(), 1);
}
示例2: update014
function update014()
{
global $url, $smarty;
//Checking if this Update already done
if (CURRENT_DB_UPDATE < "014") {
if (is_null(config::get('014updatestatus'))) {
config::set('014updatestatus', 0);
}
$qry = DBFactory::getDBQuery(true);
if (config::get('014updatestatus') < 1) {
// Add killmail summary. time, hash, trust.
$sql = 'CREATE TABLE IF NOT EXISTS `kb3_mails` (
`kll_id` int(11) NOT NULL auto_increment,
`kll_timestamp` datetime NOT NULL default "0000-00-00 00:00:00",
`kll_external_id` int(8) default NULL,
`kll_hash` BINARY(16) NOT NULL,
`kll_trust` TINYINT NOT NULL DEFAULT 0,
PRIMARY KEY (`kll_id`),
UNIQUE KEY `external_id` (`kll_external_id`),
UNIQUE KEY `time_hash` (`kll_timestamp`,`kll_hash`)
) Engine=InnoDB';
$qry->execute($sql);
}
killCache();
config::set("DBUpdate", "014");
$qry->execute("INSERT INTO kb3_config (cfg_site, cfg_key, cfg_value) SELECT cfg_site, 'DBUpdate', '014' FROM kb3_config GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '014'");
config::del("014updatestatus");
$smarty->assign('refresh', 1);
$smarty->assign('content', "Update 014 completed.");
$smarty->display('update.tpl');
die;
}
}
示例3: update016
/**
* @package EDK
*/
function update016()
{
global $url, $smarty;
//Checking if this Update already done
if (CURRENT_DB_UPDATE < "016") {
$qry = DBFactory::getDBQuery(true);
$sql = "ALTER TABLE `kb3_mails` ADD `kll_modified_time` DATETIME NOT NULL ";
$qry->execute("SHOW COLUMNS FROM kb3_mails LIKE 'kll_modified_time'");
if (!$qry->recordCount()) {
$qry->execute($sql);
}
$sql = "ALTER TABLE `kb3_mails` ADD INDEX ( `kll_modified_time` ) ";
$qry->execute("SHOW INDEXES FROM kb3_mails");
$indexexists = false;
while ($testresult = $qry->getRow()) {
if ($testresult['Column_name'] == 'kll_modified_time') {
$indexexists = true;
}
}
if (!$indexexists) {
$qry->execute($sql);
}
config::set("DBUpdate", "016");
$qry->execute("INSERT INTO kb3_config (cfg_site, cfg_key, cfg_value) SELECT cfg_site, 'DBUpdate', '016' FROM kb3_config GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '016'");
$smarty->assign('refresh', 1);
$smarty->assign('content', "Update 016 completed.");
$smarty->display('update.tpl');
die;
}
}
示例4: boot
static function boot()
{
$pathinfo = request::getPathInfo();
// 生成part
if (isset($pathinfo[1])) {
if ($p = strpos($pathinfo, '/', 2)) {
$part = substr($pathinfo, 0, $p);
} else {
$part = $pathinfo;
}
} else {
$part = '/';
}
if ($part == '/openapi') {
return kernel::single('base_rpc_service')->process($pathinfo);
} elseif ($part == '/app-doc') {
//cachemgr::init();
return kernel::single('base_misc_doc')->display($pathinfo);
}
// 确认是否安装流程. 如果是安装流程则开启debug. 如果不是则检查是否安装, 如果未安装则跳到安装流程
// 目前其他的url, 都应移到routes中进行
//
if ($part == '/setup') {
config::set('app.debug', true);
} else {
static::checkInstalled();
}
cacheobject::init();
static::registRouteMiddleware();
$response = route::dispatch(request::instance());
// 临时处理方式
kernel::single('base_session')->close();
$response->send();
exit;
}
示例5: start
/**
* Preparation of the form.
*
* @return none
*/
function start()
{
$this->page = new Page();
$this->page->setTitle('Include custom code settings');
$this->page->addHeader('<link rel="stylesheet" type="text/css" href="' . KB_HOST . '/mods/inc_cc/style.css" />');
if (isset($_POST['clear'])) {
config::set('inc_cc_settings', null);
}
$this->_opt = config::get('inc_cc_settings');
if (isset($_POST['add'])) {
if (isset($_POST['add_options']) && !empty($_POST['add_options'])) {
$this->_opt[$_POST['add_options']['position']][] = $_POST['add_options']['code'];
config::set('inc_cc_settings', $this->_opt);
}
}
if (isset($_POST['rm']) || isset($_POST['set'])) {
if (isset($_POST['set_options']) && !empty($_POST['set_options'])) {
foreach ($_POST['set_options'] as $position => $arr) {
foreach ($arr as $key => $val) {
if (isset($_POST['set_options'][$position][$key]['check'])) {
unset($this->_opt[$position][$key]);
if (isset($_POST['set'])) {
$this->_opt[$val['position']][] = $val['code'];
}
}
}
}
}
config::set('inc_cc_settings', $this->_opt);
}
}
示例6: sendTemplate
public function sendTemplate($keyword, $email, $tags = array(), $language = '')
{
loader::model('system/emailtemplates');
if (!$language) {
$language = config::item('language_id', 'system');
}
if (is_numeric($language)) {
$language = config::item('languages', 'core', 'keywords', $language);
} elseif (!in_array($language, config::item('languages', 'core', 'keywords'))) {
return false;
}
if (!($template = config::item($keyword . '_' . $language, '_system_emails_cache'))) {
if (!($template = $this->cache->item('core_email_template_' . $keyword . '_' . $language))) {
$template = $this->emailtemplates_model->prepareTemplate($keyword, $language);
if (count($template) == 3) {
if ($template[$keyword]['active']) {
$template = array('subject' => $template[$keyword]['subject'], 'message_html' => utf8::trim($template['header']['message_html'] . $template[$keyword]['message_html'] . $template['footer']['message_html']), 'message_text' => utf8::trim($template['header']['message_text'] . "\n\n" . $template[$keyword]['message_text'] . "\n\n" . $template['footer']['message_text']));
} else {
$template = 'none';
}
} else {
error::show('Could not fetch email template from the database: ' . $keyword);
}
$this->cache->set('core_email_template_' . $keyword . '_' . $language, $template, 60 * 60 * 24 * 30);
}
config::set(array($keyword . '_' . $language => $template), '', '_system_emails_cache');
}
$retval = true;
if (is_array($template) && $template) {
$retval = $this->sendEmail($email, $template['subject'], $template['message_text'], $template['message_html'], $tags);
}
return $retval;
}
示例7: update034
/**
* @package EDK
*/
function update034()
{
global $url, $smarty;
//Checking if this Update already done
if (CURRENT_DB_UPDATE < "034") {
if (is_null(config::get('034updatestatus'))) {
config::set('034updatestatus', 0);
}
$qry = DBFactory::getDBQuery(true);
if (config::get('034updatestatus') < 1) {
$qry->execute("SHOW COLUMNS FROM kb3_invtypes LIKE 'radius'");
if ($qry->recordCount()) {
$sql = "ALTER TABLE `kb3_invtypes` DROP COLUMN `radius` ";
$qry->execute($sql);
}
}
config::set("DBUpdate", "034");
$qry->execute("INSERT INTO kb3_config (cfg_site, cfg_key, cfg_value) SELECT cfg_site, 'DBUpdate', '034' FROM kb3_config GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '034'");
config::del("034updatestatus");
$smarty->assign('refresh', 1);
$smarty->assign('content', "Update 034 completed.");
$smarty->display('update.tpl');
die;
}
}
示例8: index
function index()
{
$page = sf::getModel("pages")->showPage($this->type, input::getInput("get.id"));
config::set('title', $page->getSubject());
view::set("page", $page);
view::apply("inc_body", "template/about_us");
view::display("template/page");
}
示例9: handle
public function handle($request, Clousure $next)
{
if (isset($_COOKIE['site']['preview']) && $_COOKIE['site']['preview'] == 'true') {
config::set('cache.enabled', false);
theme::preview();
}
return $next($request);
}
示例10: autor
public function autor()
{
$params = $this->getParams();
if (isset($params[0])) {
$alias = strtolower($params[0]);
$this->data['one_autor'] = $this->model->getOneAutor($alias);
config::set('heading', $this->data['one_autor'][0]['name'] . ':');
}
}
示例11: show
/**
* 查看新闻
*/
function show()
{
$article = sf::getModel("articles", input::getInput("get.id"));
//设置页面title
config::set('title', $article->getSubject());
view::set("article", $article);
view::apply("inc_body", "template/article_show");
view::display("template/page");
}
示例12: show
/**
* 查看产品
*/
function show()
{
$product = sf::getModel("products", input::getInput("get.id"));
//设置页面title
config::set('title', $product->getSubject());
view::set("product", $product);
view::apply("inc_body", "template/product_show");
view::display("template/page");
}
示例13: init
private static function init()
{
if (!config::get("cfg_language")) {
config::set("cfg_language", "en");
}
@(include_once "common/language/" . config::get("cfg_language") . ".php");
include_once "common/language/en.php";
self::$lang = $language;
}
示例14: build
function build($sCollectFunctionName = 'declareadminmenu', $bCheckAccess = false)
{
$this->collect($sCollectFunctionName, $bCheckAccess);
$aTabs = $this->getTabs();
$this->sm->assign('menuTabs', $aTabs);
config::set('tpl_page_title', $this->getPageTitle());
$first = current($aTabs);
return $first['url'];
}
示例15: install
public static function install()
{
$version = (int) module::version('google_analytics');
// module is not installed yet
if ($version === 0) {
config::set('google_analytics.id', 0);
module::version('google_analytics', 1);
}
}