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


PHP config::set方法代码示例

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


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

示例1: main

 public function main($id, $mode)
 {
     global $config, $request, $template, $user;
     $this->config = $config;
     $this->request = $request;
     $this->template = $template;
     $this->user = $user;
     // Add the common lang file
     $this->user->add_lang(array('acp/common'));
     // Add the board snowstormlights ACP lang file
     $this->user->add_lang_ext('prosk8er/snowstormlights', 'info_acp_snowstorm_lights');
     // Load a template from adm/style for our ACP page
     $this->tpl_name = 'snowstorm_lights';
     // Set the page title for our ACP page
     $this->page_title = $user->lang['ACP_SNOWSTORM_LIGHTS'];
     // Define the name of the form for use as a form key
     $form_key = 'acp_snowstorm_lights';
     add_form_key($form_key);
     // If form is submitted or previewed
     if ($this->request->is_set_post('submit')) {
         // Test if form key is valid
         if (!check_form_key($form_key)) {
             trigger_error('FORM_INVALID');
         }
         // Store the config enable/disable state
         $scl_enabled = $this->request->variable('scl_enabled', 0);
         $this->config->set('scl_enabled', $scl_enabled);
         $snow_enabled = $request->variable('snow_enabled', 0);
         $this->config->set('snow_enabled', $snow_enabled);
         // Output message to user for the update
         trigger_error($this->user->lang('SNOWSTORM_LIGHTS_SAVED') . adm_back_link($this->u_action));
     }
     // Output data to the template
     $this->template->assign_vars(array('SCL_ENABLED' => isset($this->config['scl_enabled']) ? $this->config['scl_enabled'] : '', 'SNOW_ENABLED' => isset($this->config['snow_enabled']) ? $this->config['snow_enabled'] : '', 'U_ACTION' => $this->u_action));
 }
开发者ID:Mauron,项目名称:Snowstorm-Lights,代码行数:35,代码来源:snowstorm_lights_module.php

示例2: main

 public function main($id, $mode)
 {
     global $config, $request, $template, $user;
     $this->config = $config;
     $this->request = $request;
     $this->template = $template;
     $this->user = $user;
     $this->user->add_lang('acp/common');
     $this->user->add_lang_ext('phpbbmodders/holidayflare', 'holidayflare_acp');
     $this->tpl_name = 'acp_holidayflare';
     $this->page_title = $this->user->lang('ACP_HOLIDAYFLARE');
     $form_key = 'acp_holidayflare';
     add_form_key($form_key);
     if ($this->request->is_set_post('submit')) {
         if (!check_form_key($form_key)) {
             trigger_error($user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
         }
         /* XMAS Start */
         $enable_xmas = $this->request->variable('enable_xmas', 0);
         $this->config->set('enable_xmas', $enable_xmas);
         /* XMAS Stop */
         /* Valentine Start */
         $enable_valentine = $this->request->variable('enable_valentine', 0);
         $this->config->set('enable_valentine', $enable_valentine);
         /* Valentine Stop */
         trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
     }
     $this->template->assign_vars(array('S_ENABLE_XMAS' => isset($this->config['enable_xmas']) ? $this->config['enable_xmas'] : '', 'S_ENABLE_VALENTINE' => isset($this->config['enable_valentine']) ? $this->config['enable_valentine'] : '', 'U_ACTION' => $this->u_action));
 }
开发者ID:TWEagle,项目名称:holiday_flare,代码行数:29,代码来源:holidayflare_module.php

示例3: acquire

 /**
  * Tries to acquire the lock by updating
  * the configuration variable in the database.
  *
  * As a lock may only be held by one process at a time, lock
  * acquisition may fail if another process is holding the lock
  * or if another process obtained the lock but never released it.
  * Locks are forcibly released after a timeout of 1 hour.
  *
  * @return	bool			true if lock was acquired
  *							false otherwise
  */
 public function acquire()
 {
     if ($this->locked) {
         return false;
     }
     if (!isset($this->config[$this->config_name])) {
         $this->config->set($this->config_name, '0', false);
     }
     $lock_value = $this->config[$this->config_name];
     // make sure lock cannot be acquired by multiple processes
     if ($lock_value) {
         // if the other process is running more than an hour already we have to assume it
         // aborted without cleaning the lock
         $time = explode(' ', $lock_value);
         $time = $time[0];
         if ($time + 3600 >= time()) {
             return false;
         }
     }
     $this->unique_id = time() . ' ' . unique_id();
     // try to update the config value, if it was already modified by another
     // process we failed to acquire the lock.
     $this->locked = $this->config->set_atomic($this->config_name, $lock_value, $this->unique_id, false);
     return $this->locked;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:37,代码来源:db.php

示例4: run

 /**
  * Run the cronjob.
  */
 public function run()
 {
     $time = strtotime('- ' . $this->config['ajaxshoutbox_prune_days'] . ' days');
     $sql = 'SELECT * FROM ' . $this->table . ' WHERE post_time <= ' . $time;
     $result = $this->db->sql_query($sql);
     $canpush = $this->push->canPush();
     $delete = array();
     while ($row = $this->db->sql_fetchrow($result)) {
         if ($canpush) {
             if ($this->push->delete($row['shout_id']) !== false) {
                 $delete[] = $row['shout_id'];
             }
         } else {
             $delete[] = $row['shout_id'];
         }
     }
     $this->db->sql_freeresult();
     if (sizeof($delete)) {
         $sql = 'DELETE FROM ' . $this->table . ' WHERE ' . $this->db->sql_in_set('shout_id', $delete);
         $this->db->sql_query($sql);
         $uuid = $this->user->data['user_id'];
         if (!$uuid) {
             $uuid = ANONYMOUS;
         }
         $this->log->add('admin', $uuid, $this->user->ip, 'LOG_AJAX_SHOUTBOX_PRUNED', time(), array(sizeof($delete)));
     }
     $this->config->set('shoutbox_prune_gc', time(), false);
 }
开发者ID:alhitary,项目名称:ajax-shoutbox-ext,代码行数:31,代码来源:shoutbox_prune.php

示例5: update

 /**
  * Update an existing config setting.
  *
  * @param string $config_name The name of the config setting you would
  * 	like to update
  * @param mixed $config_value The value of the config setting
  * @return null
  * @throws \phpbb\db\migration\exception
  */
 public function update($config_name, $config_value)
 {
     if (!isset($this->config[$config_name])) {
         throw new \phpbb\db\migration\exception('CONFIG_NOT_EXIST', $config_name);
     }
     $this->config->set($config_name, $config_value);
 }
开发者ID:phpbb,项目名称:phpbb-core,代码行数:16,代码来源:config.php

示例6: run

 /**
  * Run this cronjob
  * @see \phpbb\cron\task\task::run()
  */
 public function run()
 {
     $now = time();
     // Extensions
     $available_updates = $this->version_checker->check_ext_versions();
     // phpBB
     $phpbb_update = $this->version_checker->check_phpbb_version();
     if (is_array($available_updates) && is_array($phpbb_update)) {
         $available_updates = array_merge($available_updates, $phpbb_update);
     } else {
         if (is_array($phpbb_update)) {
             //TODO: Store errors, this shouldn't happen, even with no updates there should be an array
             $available_updates = $phpbb_update;
         } else {
             // phpBB Version check failed
             //TODO: Store errors and if they happen too often in a row, create a new notification.
         }
     }
     if (is_array($available_updates)) {
         foreach ($available_updates as $extname => $data) {
             $notify_data = array('name' => $extname, 'version' => $data['new'], 'old_version' => $data['current']);
             $notification_type = $extname === 'phpbb' ? 'phpbb_update' : 'ext_update';
             $this->notification_manager->add_notifications('gn36.versionchecknotifier.notification.type.' . $notification_type, $notify_data);
         }
     }
     $this->config->set('versionchecknotifier_last_gc', $now, true);
 }
开发者ID:gn36,项目名称:phpbb-ext-versionchecknotifier,代码行数:31,代码来源:versionchecknotifier.php

示例7: run

    /**
     * Runs this cron task.
     *
     * @return null
     */
    public function run()
    {
        $sql = 'UPDATE ' . RATING_TABLE . ' SET 
			`top_hits_before` = `top_hits`,
			`top_hosts_before` = `top_hosts`,
			`top_in_before` = `top_in`,
			`top_out_before` = `top_out`,
			`top_hits` = 0,
			`top_hosts` = 0,
			`top_in` = 0,
			`top_out` = 0
		WHERE `top_id` BETWEEN 1 AND 100000
			AND top_hosts > 1';
        $this->db->sql_query($sql);
        $this->db->sql_query('TRUNCATE TABLE ' . RATING_CLICK_TABLE);
        $this->db->sql_query('TRUNCATE TABLE ' . RATING_HITS_TABLE);
        $this->db->sql_query('TRUNCATE TABLE ' . RATING_ONLINE_TABLE);
        $this->db->sql_query('OPTIMIZE TABLE ' . RATING_TABLE);
        $this->db->sql_query('OPTIMIZE TABLE ' . RATING_CLICK_TABLE);
        $this->db->sql_query('OPTIMIZE TABLE ' . RATING_HITS_TABLE);
        $this->db->sql_query('OPTIMIZE TABLE ' . RATING_ONLINE_TABLE);
        //$this->config->set('rating_platforms_active', 0);
        $timestamp = time();
        $timezone = new \DateTimeZone($this->config['board_timezone']);
        $time = $this->user->get_timestamp_from_format('Y-m-d H:i:s', date('Y', $timestamp) . '-' . date('m', $timestamp) . '-' . date('d', $timestamp) . ' 00:00:00', $timezone);
        $this->config->set('top_rating_last_gc', $time);
    }
开发者ID:bb3mobi,项目名称:bb3top,代码行数:32,代码来源:top_rating.php

示例8: manage_list

 /**
  * @param string $list_name whitelist or blacklist
  * @param string $u_action phpbb acp-u_action
  */
 private function manage_list($u_action, $list_name)
 {
     $list_name_upper = strtoupper($list_name);
     // Define the name of the form for use as a form key
     $form_name = 'topictags';
     add_form_key($form_name);
     $errors = array();
     if ($this->request->is_set_post('submit')) {
         if (!check_form_key($form_name)) {
             trigger_error('FORM_INVALID');
         }
         $this->config->set(prefixes::CONFIG . '_' . $list_name . '_enabled', $this->request->variable(prefixes::CONFIG . '_' . $list_name . '_enabled', 0));
         $list = rawurldecode(base64_decode($this->request->variable(prefixes::CONFIG . '_' . $list_name, '')));
         if (!empty($list)) {
             $list = json_decode($list, true);
             $tags = array();
             for ($i = 0, $size = sizeof($list); $i < $size; $i++) {
                 $tags[] = $list[$i]['text'];
             }
             $list = json_encode($tags);
         }
         // store the list
         $this->config_text->set(prefixes::CONFIG . '_' . $list_name, $list);
         trigger_error($this->user->lang('TOPICTAGS_' . $list_name_upper . '_SAVED') . adm_back_link($u_action));
     }
     // display
     $list = $this->config_text->get(prefixes::CONFIG . '_' . $list_name);
     $list = base64_encode(rawurlencode($list));
     $this->template->assign_vars(array('TOPICTAGS_VERSION' => $this->user->lang('TOPICTAGS_INSTALLED', $this->config[prefixes::CONFIG . '_version']), 'TOPICTAGS_' . $list_name_upper . '_ENABLED' => $this->config[prefixes::CONFIG . '_' . $list_name . '_enabled'], 'TOPICTAGS_' . $list_name_upper => $list, 'S_RH_TOPICTAGS_INCLUDE_NG_TAGS_INPUT' => true, 'S_RH_TOPICTAGS_INCLUDE_CSS' => true, 'TOPICTAGS_CONVERT_SPACE_TO_MINUS' => $this->config[prefixes::CONFIG . '_convert_space_to_minus'] ? 'true' : 'false', 'S_ERROR' => sizeof($errors) ? true : false, 'ERROR_MSG' => implode('<br />', $errors), 'U_ACTION' => $u_action));
 }
开发者ID:NuLeaf,项目名称:phpbb-ext-tags,代码行数:34,代码来源:white_and_blacklist_controller.php

示例9: run

 /**
  * Runs this cron task.
  *
  * @return null
  */
 public function run()
 {
     $this->config->set('sitemaker_blocks_cleanup_last_gc', time());
     $routes = $this->clean_styles();
     $this->clean_routes($routes);
     $this->clean_blocks();
     $this->clean_custom_blocks();
 }
开发者ID:BogusCurry,项目名称:phpBB-ext-sitemaker,代码行数:13,代码来源:blocks_cleanup.php

示例10: run

 /**
  * Run cron task
  */
 public function run()
 {
     require $this->ext_root_path . 'common.' . $this->php_ext;
     $this->config->set('titania_last_cleanup', time(), true);
     $revisions = $this->get_incomplete_revisions();
     $this->delete_revisions(array_keys($revisions));
     $attachments = array_merge($this->get_orphan_attachments(), $this->get_revision_attachments($revisions));
     $this->delete_attachments($attachments);
 }
开发者ID:Sajaki,项目名称:customisation-db,代码行数:12,代码来源:cleanup.php

示例11: set_options

 /**
  * Set the options a user can configure
  *
  * @return null
  * @access protected
  */
 protected function set_options()
 {
     $this->config->set('userranks_enable', $this->request->variable('userranks_enable', 0));
     $this->config->set('userranks_header_link', $this->request->variable('userranks_header_link', 0));
     $this->config->set('userranks_ignore_bots', $this->request->variable('userranks_ignore_bots', 0));
     $this->config->set('userranks_members', $this->request->variable('userranks_members', 0));
     $this->config->set('userranks_members_admin', $this->request->variable('userranks_members_admin', 0));
     $this->config->set('userranks_special', $this->request->variable('userranks_special', 0));
     $this->config->set('userranks_special_admin', $this->request->variable('userranks_special_admin', 0));
 }
开发者ID:Galixte,项目名称:david63-userranks,代码行数:16,代码来源:admin_controller.php

示例12: unique_id

 /**
  * Return unique id
  *
  * @param string $extra Additional entropy
  *
  * @return string Unique id
  */
 public function unique_id($extra = 'c')
 {
     static $dss_seeded = false;
     $val = $this->config['rand_seed'] . microtime();
     $val = md5($val);
     $this->config['rand_seed'] = md5($this->config['rand_seed'] . $val . $extra);
     if ($dss_seeded !== true && $this->config['rand_seed_last_update'] < time() - rand(1, 10)) {
         $this->config->set('rand_seed_last_update', time(), true);
         $this->config->set('rand_seed', $this->config['rand_seed'], true);
         $dss_seeded = true;
     }
     return substr($val, 4, 16);
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:20,代码来源:helper.php

示例13: main

 /**
  * Main ACP module
  *
  * @param int $id
  * @param string $mode
  * @access public
  */
 public function main($id, $mode)
 {
     $this->tpl_name = 'acp_topic_preview';
     $this->page_title = $this->user->lang('TOPIC_PREVIEW');
     $form_key = 'acp_topic_preview';
     add_form_key($form_key);
     if ($this->request->is_set_post('submit')) {
         if (!check_form_key($form_key)) {
             trigger_error($this->user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
         }
         $this->config->set('topic_preview_limit', abs($this->request->variable('topic_preview_limit', 0)));
         // abs() no negative values
         $this->config->set('topic_preview_width', abs($this->request->variable('topic_preview_width', 0)));
         // abs() no negative values
         $this->config->set('topic_preview_delay', abs($this->request->variable('topic_preview_delay', 0)));
         // abs() no negative values
         $this->config->set('topic_preview_drift', $this->request->variable('topic_preview_drift', 0));
         $this->config->set('topic_preview_avatars', $this->request->variable('topic_preview_avatars', 0));
         $this->config->set('topic_preview_last_post', $this->request->variable('topic_preview_last_post', 0));
         $this->config->set('topic_preview_strip_bbcodes', $this->request->variable('topic_preview_strip_bbcodes', ''));
         $styles = $this->get_styles();
         foreach ($styles as $row) {
             $this->set_style_theme($row['style_id'], $this->request->variable('style_' . $row['style_id'], ''));
         }
         trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
     }
     $styles = $this->get_styles();
     foreach ($styles as $row) {
         $this->template->assign_block_vars('styles', array('STYLE_ID' => $row['style_id'], 'STYLE_THEME' => $this->user->lang('TOPIC_PREVIEW_THEME', $row['style_name']), 'STYLE_THEME_EXPLAIN' => $this->user->lang('TOPIC_PREVIEW_THEME_EXPLAIN', $row['style_name']), 'THEME_OPTIONS' => $this->theme_options($row['topic_preview_theme'])));
     }
     $this->template->assign_vars(array('TOPIC_PREVIEW_LIMIT' => $this->config['topic_preview_limit'], 'TOPIC_PREVIEW_WIDTH' => $this->config['topic_preview_width'], 'TOPIC_PREVIEW_DELAY' => $this->config['topic_preview_delay'], 'TOPIC_PREVIEW_DRIFT' => $this->config['topic_preview_drift'], 'S_TOPIC_PREVIEW_AVATARS' => $this->config['topic_preview_avatars'], 'S_TOPIC_PREVIEW_LAST_POST' => $this->config['topic_preview_last_post'], 'TOPIC_PREVIEW_STRIP' => $this->config['topic_preview_strip_bbcodes'], 'U_ACTION' => $this->u_action));
 }
开发者ID:CageStooge,项目名称:dsForums,代码行数:39,代码来源:topic_preview_module.php

示例14: main

 function main($id, $mode)
 {
     global $phpbb_container, $user, $template, $config, $request;
     $this->phpbb_container = $phpbb_container;
     $this->user = $user;
     $this->template = $template;
     $this->config = $config;
     $this->request = $request;
     $this->log = $this->phpbb_container->get('log');
     $this->tpl_name = 'acp_codebox_plus';
     $this->page_title = $this->user->lang('CODEBOX_PLUS_TITLE');
     add_form_key('o0johntam0o/acp_codebox_plus');
     if ($this->request->is_set_post('submit')) {
         if (!check_form_key('o0johntam0o/acp_codebox_plus')) {
             trigger_error('FORM_INVALID');
         }
         $this->config->set('codebox_plus_syntax_highlighting', $request->variable('codebox_plus_syntax_highlighting', 0));
         $this->config->set('codebox_plus_expanded', $request->variable('codebox_plus_expanded', 0));
         $this->config->set('codebox_plus_download', $request->variable('codebox_plus_download', 0));
         $this->config->set('codebox_plus_login_required', $request->variable('codebox_plus_login_required', 0));
         $this->config->set('codebox_plus_prevent_bots', $request->variable('codebox_plus_prevent_bots', 0));
         $this->config->set('codebox_plus_captcha', $request->variable('codebox_plus_captcha', 0));
         $this->config->set('codebox_plus_max_attempt', $request->variable('codebox_plus_max_attempt', 0));
         $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'CODEBOX_PLUS_LOG_MSG');
         trigger_error($this->user->lang('CODEBOX_PLUS_SAVED') . adm_back_link($this->u_action));
     }
     $this->template->assign_vars(array('U_ACTION' => $this->u_action, 'S_CODEBOX_PLUS_VERSION' => isset($this->config['codebox_plus_version']) ? $this->config['codebox_plus_version'] : 0, 'S_CODEBOX_PLUS_SYNTAX_HIGHLIGHTING' => isset($this->config['codebox_plus_syntax_highlighting']) ? $this->config['codebox_plus_syntax_highlighting'] : 0, 'S_CODEBOX_PLUS_EXPANDED' => isset($this->config['codebox_plus_expanded']) ? $this->config['codebox_plus_expanded'] : 0, 'S_CODEBOX_PLUS_DOWNLOAD' => isset($this->config['codebox_plus_download']) ? $this->config['codebox_plus_download'] : 0, 'S_CODEBOX_PLUS_LOGIN_REQUIRED' => isset($this->config['codebox_plus_login_required']) ? $this->config['codebox_plus_login_required'] : 0, 'S_CODEBOX_PLUS_PREVENT_BOTS' => isset($this->config['codebox_plus_prevent_bots']) ? $this->config['codebox_plus_prevent_bots'] : 0, 'S_CODEBOX_PLUS_CAPTCHA' => isset($this->config['codebox_plus_captcha']) ? $this->config['codebox_plus_captcha'] : 0, 'S_CODEBOX_PLUS_MAX_ATTEMPT' => isset($this->config['codebox_plus_max_attempt']) ? $this->config['codebox_plus_max_attempt'] : 0));
 }
开发者ID:sujith84,项目名称:phpBB-Extension-Codebox-Plus,代码行数:28,代码来源:main_module.php

示例15: acp_board_config

 public function acp_board_config($event)
 {
     $mode = $event['mode'];
     if ($mode == 'post') {
         $new_config = array('legend_newtopic' => 'ACP_NEWTOPIC', 'newtopic_forum' => array('lang' => 'ACP_NEWTOPIC_FORUM', 'validate' => 'string', 'type' => 'custom', 'function' => array($this, 'select_forums'), 'explain' => true), 'newtopic_button' => array('lang' => 'ACP_NEWTOPIC_BUTTON', 'validate' => 'string', 'type' => 'text:25:40', 'explain' => false));
         $search_slice = 'max_post_img_height';
         $display_vars = $event['display_vars'];
         $display_vars['vars'] = phpbb_insert_config_array($display_vars['vars'], $new_config, array('after' => $search_slice));
         $event['display_vars'] = array('title' => $display_vars['title'], 'vars' => $display_vars['vars']);
         if ($event['submit']) {
             $values = $this->request->variable('newtopic_forum', array(0 => ''));
             $this->config->set('newtopic_forum', implode(',', $values));
         }
     }
 }
开发者ID:Galixte,项目名称:newtopic,代码行数:15,代码来源:listener.php


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