本文整理汇总了PHP中build_cfg_template函数的典型用法代码示例。如果您正苦于以下问题:PHP build_cfg_template函数的具体用法?PHP build_cfg_template怎么用?PHP build_cfg_template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_cfg_template函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_config
/**
* Display config page
*
* @return null
*/
public function display_config()
{
// Output relevant page
foreach ($this->display_vars['vars'] as $config_key => $vars) {
if (!is_array($vars) && strpos($config_key, 'legend') === false) {
continue;
}
if (strpos($config_key, 'legend') !== false) {
$this->template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($this->user->lang[$vars]) ? $this->user->lang[$vars] : $vars));
continue;
}
$type = explode(':', $vars['type']);
$l_explain = '';
if ($vars['explain'] && isset($vars['lang_explain'])) {
$l_explain = isset($this->user->lang[$vars['lang_explain']]) ? $this->user->lang[$vars['lang_explain']] : $vars['lang_explain'];
} else {
if ($vars['explain']) {
$l_explain = isset($this->user->lang[$vars['lang'] . '_EXPLAIN']) ? $this->user->lang[$vars['lang'] . '_EXPLAIN'] : '';
}
}
$this->template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($this->user->lang[$vars['lang']]) ? $this->user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars)));
unset($this->display_vars['vars'][$config_key]);
}
}
示例2: main
//.........这里部分代码省略.........
$display_vars = array('title' => 'ACP_PBWOW_POSTSTYLING_TITLE', 'vars' => array('legend1' => 'ACP_PBWOW_BLIZZ', 'blizz_enable' => array('lang' => 'PBWOW_BLIZZ_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'blizz_ranks' => array('lang' => 'PBWOW_BLIZZ_RANKS', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_ranks'), 'blizz_color' => array('lang' => 'PBWOW_BLIZZ_COLOR', 'validate' => 'string', 'type' => 'text:7:7', 'explain' => true), 'legend2' => 'ACP_PBWOW_PROPASS', 'propass_enable' => array('lang' => 'PBWOW_PROPASS_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'propass_ranks' => array('lang' => 'PBWOW_PROPASS_RANKS', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_ranks'), 'propass_color' => array('lang' => 'PBWOW_PROPASS_COLOR', 'validate' => 'string', 'type' => 'text:7:7', 'explain' => true), 'legend3' => 'ACP_PBWOW_RED', 'red_enable' => array('lang' => 'PBWOW_RED_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'red_ranks' => array('lang' => 'PBWOW_RED_RANKS', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_ranks'), 'red_color' => array('lang' => 'PBWOW_RED_COLOR', 'validate' => 'string', 'type' => 'text:7:7', 'explain' => true), 'legend4' => 'ACP_PBWOW_GREEN', 'green_enable' => array('lang' => 'PBWOW_GREEN_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'green_ranks' => array('lang' => 'PBWOW_GREEN_RANKS', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_ranks'), 'green_color' => array('lang' => 'PBWOW_GREEN_COLOR', 'validate' => 'string', 'type' => 'text:7:7', 'explain' => true)));
break;
case 'ads':
$display_vars = array('title' => 'ACP_PBWOW_ADS_TITLE', 'vars' => array('legend1' => 'ACP_PBWOW_ADS_INDEX', 'ads_index_enable' => array('lang' => 'PBWOW_ADS_INDEX_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'ads_index_code' => array('lang' => 'PBWOW_ADS_INDEX_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'legend2' => 'ACP_PBWOW_ADS_TOP', 'ads_top_enable' => array('lang' => 'PBWOW_ADS_TOP_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'ads_top_code' => array('lang' => 'PBWOW_ADS_TOP_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'legend3' => 'ACP_PBWOW_ADS_BOTTOM', 'ads_bottom_enable' => array('lang' => 'PBWOW_ADS_BOTTOM_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'ads_bottom_code' => array('lang' => 'PBWOW_ADS_BOTTOM_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'legend4' => 'ACP_PBWOW_ADS_SIDE', 'ads_side_enable' => array('lang' => 'PBWOW_ADS_SIDE_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'ads_side_code' => array('lang' => 'PBWOW_ADS_SIDE_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'legend5' => 'ACP_PBWOW_TRACKING', 'tracking_enable' => array('lang' => 'PBWOW_TRACKING_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'tracking_code' => array('lang' => 'PBWOW_TRACKING_CODE', 'type' => 'textarea:6:6', 'explain' => true)));
break;
}
$action = request_var('action', '');
$submit = isset($_POST['submit']) ? true : false;
$cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
$error = array();
// We validate the complete config if we want
validate_config_vars($display_vars['vars'], $cfg_array, $error);
// Do not write values if there is an error
if (sizeof($error)) {
$submit = false;
}
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... and then write to config
foreach ($display_vars['vars'] as $config_name => $null) {
if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
continue;
}
$this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
if ($submit) {
$this->set_pbwow_config($config_name, $config_value);
}
}
if ($submit) {
if ($action == 'refresh_topic_ranks' && $legacy_topics_mod == true) {
$this->refresh_topic_ranks();
$cache->purge();
}
if ($action == 'create_topic_ranks' && $legacy_topics_mod == false) {
$db_tool->sql_column_add($topics_table, 'topic_first_poster_rank_img', array('VCHAR', ''));
$db_tool->sql_column_add($topics_table, 'topic_first_poster_rank_title', array('VCHAR', ''));
add_log('admin', 'Topics MOD installed', $user->lang['ACP_PBWOW2_' . strtoupper($mode)]);
trigger_error('Topics MOD installed' . adm_back_link($this->u_action));
}
if (($action == 'drop_topic_ranks' || $action == 'remove_legacy') && $legacy_topics_mod == true) {
$db_tool->sql_column_remove($topics_table, 'topic_first_poster_rank_img');
$db_tool->sql_column_remove($topics_table, 'topic_first_poster_rank_title');
add_log('admin', 'Topics MOD uninstalled', $user->lang['ACP_PBWOW2_' . strtoupper($mode)]);
trigger_error('Topics MOD uninstalled' . adm_back_link($this->u_action));
}
if ($action == 'refresh_all_themes') {
$this->refresh_all_themes();
$cache->purge();
add_log('admin', 'LOG_THEME_REFRESHED', $user->lang['ACP_PBWOW2_' . strtoupper($mode)]);
trigger_error('All theme data refreshed' . adm_back_link($this->u_action));
}
// Get data from select boxes and store in DB
if ($mode == 'poststyling') {
$this->store_select_options('blizz_ranks');
$this->store_select_options('propass_ranks');
$this->store_select_options('red_ranks');
$this->store_select_options('green_ranks');
add_log('admin', 'LOG_PBWOW_CONFIG', $user->lang['ACP_PBWOW2_' . strtoupper($mode)]);
$cache->purge();
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
if ($mode == ('config' || 'ads')) {
$this->store_select_options('wowtips_script');
$this->store_select_options('d3tips_script');
$this->store_select_options('tooltips_region');
add_log('admin', 'LOG_PBWOW_CONFIG', $user->lang['ACP_PBWOW2_' . strtoupper($mode)]);
$cache->purge();
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
}
$this->page_title = $display_vars['title'];
$title_explain = $user->lang[$display_vars['title'] . '_EXPLAIN'];
$template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $title_explain, 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'S_CONSTANTSOKAY' => $constantsokay ? true : false, 'PBWOW_DBTABLE' => $dbtable, 'S_DBOKAY' => $dbokay ? true : false, 'L_PBWOW_DB_GOOD' => sprintf($user->lang['PBWOW_DB_GOOD'], $dbtable), 'L_PBWOW_DB_BAD' => sprintf($user->lang['PBWOW_DB_BAD'], $dbtable), 'L_PBWOW_RANKS_CREATE_EXPLAIN' => sprintf($user->lang['PBWOW_RANKS_CREATE_EXPLAIN'], $topics_table, $topics_table), 'L_PBWOW_CHARSDB_GOOD' => sprintf($user->lang['PBWOW_CHARSDB_GOOD'], $chars_table), 'L_PBWOW_CHARSDB_BAD' => sprintf($user->lang['PBWOW_CHARSDB_BAD'], $chars_table), 'TOPICS_TABLE' => $topics_table, 'U_ACTION' => $this->u_action));
if ($mode == 'overview') {
$template->assign_vars(array('S_INDEX' => true, 'DB_VERSION' => isset($pbwow_config['pbwow2_version']) ? $pbwow_config['pbwow2_version'] : '', 'MODULE_VERSION' => isset($module_version) ? $module_version : '', 'STYLE_VERSION' => $style_version, 'IMAGESET_VERSION' => $imageset_version, 'TEMPLATE_VERSION' => $template_version, 'THEME_VERSION' => $theme_version, 'S_CHECK_V' => empty($versions) ? false : true, 'DB_VERSION_V' => isset($versions['db_version']['version']) ? $versions['db_version']['version'] : '', 'MODULE_VERSION_V' => isset($versions['module_version']['version']) ? $versions['module_version']['version'] : '', 'ATEMPLATE_VERSION_V' => isset($versions['atemplate_version']['version']) ? $versions['atemplate_version']['version'] : '', 'STYLE_VERSION_V' => isset($versions['style_version']['version']) ? $versions['style_version']['version'] : '', 'IMAGESET_VERSION_V' => isset($versions['imageset_version']['version']) ? $versions['imageset_version']['version'] : '', 'TEMPLATE_VERSION_V' => isset($versions['template_version']['version']) ? $versions['template_version']['version'] : '', 'THEME_VERSION_V' => isset($versions['theme_version']['version']) ? $versions['theme_version']['version'] : '', 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&versioncheck_force=1'), 'S_ALLOW_FOPEN' => $allow_fopen, 'S_CPF_ON_MEMBERLIST' => $config['load_cpf_memberlist'] == 1 ? true : false, 'S_CPF_ON_VIEWPROFILE' => $config['load_cpf_viewprofile'] == 1 ? true : false, 'S_CPF_ON_VIEWTOPIC' => $config['load_cpf_viewtopic'] == 1 ? true : false, 'S_CPF_PBGUILD' => isset($cpflist['pbguild']) && $cpflist['pbguild']['field_no_view'] == 0 ? true : false, 'S_CPF_PBREALM' => isset($cpflist['pbrealm']) && $cpflist['pbrealm']['field_no_view'] == 0 ? true : false, 'S_CPF_PBLEVEL' => isset($cpflist['pblevel']) && $cpflist['pblevel']['field_no_view'] == 0 ? true : false, 'S_CPF_PBRACE' => isset($cpflist['pbrace']) && $cpflist['pbrace']['field_no_view'] == 0 ? true : false, 'S_CPF_PBGENDER' => isset($cpflist['pbgender']) && $cpflist['pbgender']['field_no_view'] == 0 ? true : false, 'S_CPF_PBCLASS' => isset($cpflist['pbclass']) && $cpflist['pbclass']['field_no_view'] == 0 ? true : false, 'S_CPF_PBPVPRANK' => isset($cpflist['pbpvprank']) && $cpflist['pbpvprank']['field_no_view'] == 0 ? true : false, 'S_CPF_PBARMORYCHARLINK' => isset($cpflist['pbarmorycharlink']) && $cpflist['pbarmorycharlink']['field_no_view'] == 0 ? true : false, 'S_CPF_PBARMORYGUILDLINK' => isset($cpflist['pbarmoryguildlink']) && $cpflist['pbarmoryguildlink']['field_no_view'] == 0 ? true : false, 'S_CPF_PBDCLASS' => isset($cpflist['pbdclass']) && $cpflist['pbguild']['pbdclass'] == 0 ? true : false, 'S_CPF_PBDGENDER' => isset($cpflist['pbdgender']) && $cpflist['pbguild']['pbdgender'] == 0 ? true : false, 'S_CPF_PBDFOLLOWER' => isset($cpflist['pbdfollower']) && $cpflist['pbguild']['pbdfollower'] == 0 ? true : false, 'S_BNETCHARS_ACTIVE' => isset($pbwow_config['bnetchars_enable']) && $pbwow_config['bnetchars_enable'] ? true : false, 'S_BNETCHARS_CONSTOKAY' => $chars_constokay ? true : false, 'S_BNETCHARS_DBOKAY' => $chars_dbokay ? true : false, 'S_CPF_PBBNETHOST' => isset($cpflist['pbbnethost']) && $cpflist['pbbnethost']['field_no_view'] == 0 ? true : false, 'S_CPF_PBBNETREALM' => isset($cpflist['pbbnetrealm']) && $cpflist['pbbnetrealm']['field_no_view'] == 0 ? true : false, 'S_CPF_PBBNETNAME' => isset($cpflist['pbbnetname']) && $cpflist['pbbnetname']['field_no_view'] == 0 ? true : false, 'S_CPF_PBNETAVATAR' => isset($cpflist['pbbnetavatar']) && $cpflist['pbbnetavatar']['field_no_view'] == 0 ? true : false, 'S_LEGACY_CONSTANTS' => $legacy_constants, 'S_LEGACY_DB_ACTIVE' => $legacy_db_active, 'S_LEGACY_TOPICS_MOD' => $legacy_topics_mod));
}
// Output relevant page
foreach ($display_vars['vars'] as $config_key => $vars) {
if (!is_array($vars) && strpos($config_key, 'legend') === false) {
continue;
}
if (strpos($config_key, 'legend') !== false) {
$template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
continue;
}
$type = explode(':', $vars['type']);
$l_explain = '';
if ($vars['explain'] && isset($vars['lang_explain'])) {
$l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
} else {
if ($vars['explain']) {
$l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
}
}
$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
if (empty($content)) {
continue;
}
$template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
unset($display_vars['vars'][$config_key]);
}
}
示例3: generate_stuff_for_cfg_template
/**
* Abstracted method to generate acp configuration pages out of a list of display vars, using
* the function build_cfg_template().
* Build configuration template for acp configuration pages
*
* @param array $display_vars The display vars for this acp site
*/
protected function generate_stuff_for_cfg_template($display_vars)
{
$this->new_config = $this->config;
$cfg_array = $this->request->is_set('config') ? $this->request->variable('config', ['' => ''], true) : $this->new_config;
$error = isset($error) ? $error : [];
validate_config_vars($display_vars['vars'], $cfg_array, $error);
foreach ($display_vars['vars'] as $config_key => $vars) {
if (!is_array($vars) && strpos($config_key, 'legend') === false) {
continue;
}
if (strpos($config_key, 'legend') !== false) {
$this->template->assign_block_vars('options', ['S_LEGEND' => true, 'LEGEND' => isset($this->user->lang[$vars]) ? $this->user->lang[$vars] : $vars]);
continue;
}
$type = explode(':', $vars['type']);
$l_explain = '';
if ($vars['explain'] && isset($vars['lang_explain'])) {
$l_explain = isset($this->user->lang[$vars['lang_explain']]) ? $this->user->lang[$vars['lang_explain']] : $vars['lang_explain'];
} else {
if ($vars['explain']) {
$l_explain = isset($this->user->lang[$vars['lang'] . '_EXPLAIN']) ? $this->user->lang[$vars['lang'] . '_EXPLAIN'] : '';
}
}
$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
if (empty($content)) {
continue;
}
$this->template->assign_block_vars('options', ['KEY' => $config_key, 'TITLE' => isset($this->user->lang[$vars['lang']]) ? $this->user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content]);
//unset($display_vars['vars'][$config_key]);
}
$this->template->assign_vars(['S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action]);
}
示例4: main
//.........这里部分代码省略.........
$allow_deny = $this->new_config['secure_allow_deny'] ? 'ALLOWED' : 'DISALLOWED';
$sql = 'SELECT *
FROM ' . SITELIST_TABLE;
$result = $db->sql_query($sql);
$defined_ips = '';
$ips = array();
while ($row = $db->sql_fetchrow($result)) {
$value = $row['site_ip'] ? $row['site_ip'] : $row['site_hostname'];
if ($value) {
$defined_ips .= '<option' . ($row['ip_exclude'] ? ' class="sep"' : '') . ' value="' . $row['site_id'] . '">' . $value . '</option>';
$ips[$row['site_id']] = $value;
}
}
$db->sql_freeresult($result);
$template->assign_vars(array('S_SECURE_DOWNLOADS' => $this->new_config['secure_downloads'], 'S_DEFINED_IPS' => $defined_ips != '' ? true : false, 'S_WARNING' => sizeof($error) ? true : false, 'WARNING_MSG' => implode('<br />', $error), 'DEFINED_IPS' => $defined_ips, 'L_SECURE_TITLE' => $user->lang['DEFINE_' . $allow_deny . '_IPS'], 'L_IP_EXCLUDE' => $user->lang['EXCLUDE_FROM_' . $allow_deny . '_IP'], 'L_REMOVE_IPS' => $user->lang['REMOVE_' . $allow_deny . '_IPS']));
// Output relevant options
foreach ($display_vars['vars'] as $config_key => $vars) {
if (!is_array($vars) && strpos($config_key, 'legend') === false) {
continue;
}
if (strpos($config_key, 'legend') !== false) {
$template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
continue;
}
$type = explode(':', $vars['type']);
$l_explain = '';
if ($vars['explain'] && isset($vars['lang_explain'])) {
$l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
} else {
if ($vars['explain']) {
$l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
}
}
$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
if (empty($content)) {
continue;
}
$template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => $user->lang[$vars['lang']], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
unset($display_vars['vars'][$config_key]);
}
break;
case 'extensions':
if ($submit || isset($_POST['add_extension_check'])) {
if ($submit) {
// Change Extensions ?
$extension_change_list = request_var('extension_change_list', array(0));
$group_select_list = request_var('group_select', array(0));
// Generate correct Change List
$extensions = array();
for ($i = 0, $size = sizeof($extension_change_list); $i < $size; $i++) {
$extensions[$extension_change_list[$i]]['group_id'] = $group_select_list[$i];
}
$sql = 'SELECT *
FROM ' . EXTENSIONS_TABLE . '
ORDER BY extension_id';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
if ($row['group_id'] != $extensions[$row['extension_id']]['group_id']) {
$sql = 'UPDATE ' . EXTENSIONS_TABLE . '
SET group_id = ' . (int) $extensions[$row['extension_id']]['group_id'] . '
WHERE extension_id = ' . $row['extension_id'];
$db->sql_query($sql);
add_log('admin', 'LOG_ATTACH_EXT_UPDATE', $row['extension']);
}
}
$db->sql_freeresult($result);
示例5: main
function main($id, $mode)
{
global $db, $user, $auth, $template;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
$action = request_var('action', '');
$submit = isset($_POST['submit']) ? true : false;
$form_key = 'acp_thanks_reput';
add_form_key($form_key);
/**
* Validation types are:
* string, int, bool,
* script_path (absolute path in url - beginning with / and no trailing slash),
* rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable)
*/
$display_vars = array('title' => 'ACP_THANKS_REPUT_SETTINGS', 'vars' => array('legend' => 'GENERAL_OPTIONS', 'thanks_post_reput_view' => array('lang' => 'THANKS_POST_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'thanks_topic_reput_view' => array('lang' => 'THANKS_TOPIC_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'thanks_topic_reput_view_column' => array('lang' => 'THANKS_TOPIC_REPUT_VIEW_COLUMN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'thanks_forum_reput_view' => array('lang' => 'THANKS_FORUM_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'thanks_forum_reput_view_column' => array('lang' => 'THANKS_FORUM_REPUT_VIEW_COLUMN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'thanks_number_digits' => array('lang' => 'THANKS_NUMBER_DIGITS', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => false), 'thanks_number_row_reput' => array('lang' => 'THANKS_NUMBER_ROW_REPUT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true), 'legend1' => 'GRAPHIC_OPTIONS', 'thanks_reput_graphic' => array('lang' => 'THANKS_REPUT_GRAPHIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'thanks_reput_height' => array('lang' => 'THANKS_REPUT_HEIGHT', 'validate' => 'int:1:25', 'type' => 'text:4:6', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'thanks_reput_level' => array('lang' => 'THANKS_REPUT_LEVEL', 'validate' => 'int:4:13', 'type' => 'text:4:4', 'explain' => false), 'thanks_reput_image' => array('lang' => 'THANKS_REPUT_IMAGE', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true, 'append' => '<br /><img src="' . ($config['thanks_reput_image'] ? $phpbb_root_path . $config['thanks_reput_image'] : '') . '" alt="' . $user->lang['THANKS_REPUT_IMAGE'] . '"/>'), 'thanks_reput_image_back' => array('lang' => 'THANKS_REPUT_IMAGE_BACK', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true, 'append' => '<br /><img src="' . ($config['thanks_reput_image_back'] ? $phpbb_root_path . $config['thanks_reput_image_back'] : '') . '" alt="' . $user->lang['THANKS_REPUT_IMAGE_BACK'] . '"/>'), 'legend2' => 'GRAPHIC_DEFAULT'));
if (isset($display_vars['lang'])) {
$user->add_lang($display_vars['lang']);
}
$this->new_config = $config;
$cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
$error = array();
// We validate the complete config if whished
validate_config_vars($display_vars['vars'], $cfg_array, $error);
if ($submit && !check_form_key($form_key)) {
$error[] = $user->lang['FORM_INVALID'];
}
// Do not write values if there is an error
if (sizeof($error)) {
$submit = false;
}
if (!empty($cfg_array['thanks_reput_image']) && !file_exists($phpbb_root_path . $config['thanks_reput_image'])) {
$error[] = $user->lang['THANKS_REPUT_IMAGE_NOEXIST'];
}
if (!empty($cfg_array['thanks_reput_image_back']) && !file_exists($phpbb_root_path . $config['thanks_reput_image_back'])) {
$error[] = $user->lang['THANKS_REPUT_IMAGE_BACK_NOEXIST'];
}
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
foreach ($display_vars['vars'] as $config_name => $null) {
if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
continue;
}
$this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
if ($submit) {
set_config($config_name, $config_value);
}
}
if ($submit) {
add_log('admin', 'LOG_CONFIG_' . strtoupper($mode));
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
$this->tpl_name = 'acp_thanks_reput';
$this->page_title = $display_vars['title'];
$template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], 'GRAPHIC_STAR_BLUE_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_STAR_BLUE'], 'GRAPHIC_STAR_GOLD_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_STAR_GOLD'], 'GRAPHIC_STAR_BACK_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_STAR_BACK'], 'GRAPHIC_BLOCK_RED_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_BLOCK_RED'], 'GRAPHIC_BLOCK_BACK_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_BLOCK_BACK'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
// Output relevant page
foreach ($display_vars['vars'] as $config_key => $vars) {
if (!is_array($vars) && strpos($config_key, 'legend') === false) {
continue;
}
if (strpos($config_key, 'legend') !== false) {
$template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
continue;
}
$type = explode(':', $vars['type']);
$l_explain = '';
if ($vars['explain'] && isset($vars['lang_explain'])) {
$l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
} else {
if ($vars['explain']) {
$l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
}
}
$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
if (empty($content)) {
continue;
}
$template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
unset($display_vars['vars'][$config_key]);
}
}
示例6: assign_complex_option
/**
* Assign "complex option to template.
*
* @param string $name Option name.
* @param array $data Option data.
*
* @return null
*/
protected function assign_complex_option($name, $data)
{
$l_explain = '';
if ($data['explain']) {
$l_explain = isset($data['lang_explain']) ? $data['lang_explain'] : $data['lang'] . '_EXPLAIN';
$l_explain = $this->user->lang($l_explain);
}
$properties = explode(':', $data['type']);
$content = build_cfg_template($properties, $name, $data);
if (!empty($content)) {
$this->template->assign_block_vars('options', array('KEY' => $name, 'TITLE' => $this->user->lang($vars['lang']), 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content['tpl']));
}
}
示例7: _get_field_template
/**
* @param $field
* @param array $db_settings
* @param array $vars
* @return string
*/
private function _get_field_template($field, array &$db_settings, array &$vars)
{
$vars['lang_explain'] = $this->_explain_field($vars);
$vars['append'] = $this->_append_field($vars);
$type = explode(':', $vars['type']);
$method = '_prep_' . $type[0] . '_field_for_display';
if (is_callable(array($this, $method))) {
$this->_set_params($field, $vars, $db_settings);
$this->{$method}($vars, $type, $field, $db_settings);
}
return build_cfg_template($type, $field, $db_settings, $field, $vars);
}
示例8: main
function main($id, $mode)
{
global $config, $request, $template, $user;
$this->page_title = 'ACP_POSTS_MERGING';
$this->tpl_name = 'acp_posts_merging';
$submit = isset($_POST['submit']) ? true : false;
$form_key = 'config_posts_merging';
add_form_key($form_key);
$display_vars = array('title' => 'ACP_POSTS_MERGING', 'vars' => array('legend1' => 'ACP_POSTS_MERGING', 'merge_interval' => array('lang' => 'MERGE_INTERVAL', 'validate' => 'int', 'type' => 'text:3:4', 'explain' => true, 'append' => ' ' . $user->lang['HOURS']), 'merge_no_forums' => array('lang' => 'MERGE_NO_FORUMS', 'validate' => 'string', 'type' => 'text:5:255', 'explain' => true), 'merge_no_topics' => array('lang' => 'MERGE_NO_TOPICS', 'validate' => 'string', 'type' => 'text:5:255', 'explain' => true), 'legend2' => 'ACP_SUBMIT_CHANGES'));
if (isset($display_vars['lang'])) {
$user->add_lang($display_vars['lang']);
}
$this->new_config = $config;
$cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc($request->variable('config', array('' => ''), true)) : $this->new_config;
$error = array();
// We validate the complete config if wished
validate_config_vars($display_vars['vars'], $cfg_array, $error);
if ($submit && !check_form_key($form_key)) {
$error[] = $user->lang['FORM_INVALID'];
}
// Do not write values if there is an error
if (sizeof($error)) {
$submit = false;
}
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
foreach ($display_vars['vars'] as $config_name => $null) {
if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
continue;
}
$this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
if ($submit) {
$config->set($config_name, $config_value);
}
}
if ($submit) {
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
// Output relevant page
foreach ($display_vars['vars'] as $config_key => $vars) {
if (!is_array($vars) && strpos($config_key, 'legend') === false) {
continue;
}
if (strpos($config_key, 'legend') !== false) {
$template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
continue;
}
$type = explode(':', $vars['type']);
$l_explain = '';
if ($vars['explain'] && isset($vars['lang_explain'])) {
$l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
} else {
if ($vars['explain']) {
$l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
}
}
$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
if (empty($content)) {
continue;
}
$template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
unset($display_vars['vars'][$config_key]);
}
}
示例9: display_settings
/**
* Display the options a user can configure for this extension
*
* @return null
* @access public
*/
public function display_settings()
{
// Create a form key for preventing CSRF attacks
add_form_key('acp_video');
// Is the form being submitted to us?
if ($this->request->is_set_post('submit')) {
if (!check_form_key('acp_video')) {
trigger_error($this->user->lang['FORM_INVALID'] . adm_back_link($this->u_action));
}
// Set the options the user configured
$this->set_options();
// Add option settings change action to the admin log
$this->phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'ACP_VIDEO_SETTINGS');
}
// Set the options the user configured
$display_vars = array('vars' => array('legend1' => 'ACP_VIDEO_GENERAL_SETTINGS', 'video_width' => array('lang' => 'ACP_VIDEO_WIDTH', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true, 'append' => ' ' . $this->user->lang['PIXEL']), 'video_height' => array('lang' => 'ACP_VIDEO_HEIGHT', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true, 'append' => ' ' . $this->user->lang['PIXEL']), 'google_api_key' => array('lang' => 'ACP_GOOGLE_KEY', 'validate' => 'string', 'type' => 'text:40:40', 'explain' => true), 'enable_video_statics_on_index' => array('lang' => 'ACP_ENABLE_VIDEO_STATICS_ON_INDEX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'enable_comments' => array('lang' => 'ACP_ENABLE_COMMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'comments_per_page' => array('lang' => 'ACP_COMMENTS_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => true), 'legend5' => 'ACP_SUBMIT_CHANGES'));
$this->new_config = $this->config;
$cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc($this->request->variable('config', array('' => ''), true)) : $this->new_config;
$error = array();
if (sizeof($error)) {
$submit = false;
}
validate_config_vars($display_vars['vars'], $cfg_array, $error);
$submit = isset($_POST['submit']) ? true : false;
$form_name = 'acp_video';
foreach ($display_vars['vars'] as $config_name => $null) {
if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
continue;
}
$this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
if ($submit) {
if (!$this->config->set($config_name, $config_value)) {
$error = true;
}
}
}
foreach ($display_vars['vars'] as $config_key => $vars) {
if (!is_array($vars) && strpos($config_key, 'legend') === false) {
continue;
}
if (strpos($config_key, 'legend') !== false) {
$this->template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($this->user->lang[$vars]) ? $this->user->lang[$vars] : $vars));
continue;
}
$type = explode(':', $vars['type']);
$l_explain = '';
if ($vars['explain'] && isset($vars['lang_explain'])) {
$l_explain = isset($this->user->lang[$vars['lang_explain']]) ? $this->user->lang[$vars['lang_explain']] : $vars['lang_explain'];
} else {
if ($vars['explain']) {
$l_explain = isset($this->user->lang[$vars['lang'] . '_EXPLAIN']) ? $this->user->lang[$vars['lang'] . '_EXPLAIN'] : '';
}
}
$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
if (empty($content)) {
continue;
}
$this->template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($this->user->lang[$vars['lang']]) ? $this->user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
unset($display_vars['vars'][$config_key]);
}
}
示例10: main
//.........这里部分代码省略.........
/**
* Config vars
*/
switch ($mode) {
case 'overview':
$display_vars = array('title' => 'PBWOW_OVERVIEW_TITLE', 'vars' => array());
break;
case 'config':
$display_vars = array('title' => 'PBWOW_CONFIG_TITLE', 'vars' => array('legend1' => 'PBWOW_LOGO', 'logo_size_width' => array('lang' => 'PBWOW_LOGO_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'logo_size_height' => array('lang' => 'PBWOW_LOGO_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'logo_enable' => array('lang' => 'PBWOW_LOGO_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'logo_src' => array('lang' => 'PBWOW_LOGO_SRC', 'validate' => 'string', 'type' => 'text:20:255', 'explain' => true), 'logo_size' => array('lang' => 'PBWOW_LOGO_SIZE', 'validate' => 'int:0', 'type' => 'dimension:0', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'logo_margins' => array('lang' => 'PBWOW_LOGO_MARGINS', 'validate' => 'string', 'type' => 'text:20:20', 'explain' => true), 'legend2' => 'PBWOW_TOPBAR', 'topbar_enable' => array('lang' => 'PBWOW_TOPBAR_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'topbar_code' => array('lang' => 'PBWOW_TOPBAR_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'topbar_fixed' => array('lang' => 'PBWOW_TOPBAR_FIXED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend3' => 'PBWOW_HEADERLINKS', 'headerlinks_enable' => array('lang' => 'PBWOW_HEADERLINKS_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'headerlinks_code' => array('lang' => 'PBWOW_HEADERLINKS_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'legend4' => 'PBWOW_VIDEOBG', 'videobg_enable' => array('lang' => 'PBWOW_VIDEOBG_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'videobg_allpages' => array('lang' => 'PBWOW_VIDEOBG_ALLPAGES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'fixedbg' => array('lang' => 'PBWOW_FIXEDBG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend5' => 'PBWOW_AVATARS', 'avatars_enable' => array('lang' => 'PBWOW_AVATARS_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'avatars_path' => array('lang' => 'PBWOW_AVATARS_PATH', 'validate' => 'string', 'type' => 'text:20:255', 'explain' => true), 'smallranks_enable' => array('lang' => 'PBWOW_SMALLRANKS_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'legend6' => 'PBWOW_BNETCHARS', 'bnetchars_enable' => array('lang' => 'PBWOW_BNETCHARS_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'bnet_apikey' => array('lang' => 'PBWOW_BNET_APIKEY', 'validate' => 'string', 'type' => 'text:32:64', 'explain' => true), 'bnetchars_cachetime' => array('lang' => 'PBWOW_BNETCHARS_CACHETIME', 'validate' => 'int:0', 'type' => 'text:6:6', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'bnetchars_timeout' => array('lang' => 'PBWOW_BNETCHARS_TIMEOUT', 'validate' => 'int:0', 'type' => 'text:1:1', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'legend7' => 'PBWOW_ADS_INDEX', 'ads_index_enable' => array('lang' => 'PBWOW_ADS_INDEX_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'ads_index_code' => array('lang' => 'PBWOW_ADS_INDEX_CODE', 'type' => 'textarea:6:6', 'explain' => true)));
break;
default:
$display_vars = array('title' => 'ACP_PBWOW3_CATEGORY', 'vars' => array());
break;
}
$submit = $request->is_set_post('submit');
$cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc($request->variable('config', array('' => ''), true)) : $new_config;
$error = array();
// We validate the complete config if we want
validate_config_vars($display_vars['vars'], $cfg_array, $error);
// Do not write values if there is an error
if (sizeof($error)) {
$submit = false;
}
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... and then write to config
foreach ($display_vars['vars'] as $config_name => $null) {
if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
continue;
}
$new_config[$config_name] = $config_value = $cfg_array[$config_name];
if ($submit) {
$this->set_pbwow_config($config_name, $config_value);
// Enable/disable Battle.net profile fields when the API is enabled/disabled
if ($config_name == 'bnetchars_enable') {
$this->toggle_game_cpf('bnet', $config_value);
}
}
}
if ($submit) {
if ($mode != 'overview') {
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PBWOW_CONFIG');
$cache->purge();
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
}
$this->page_title = $display_vars['title'];
$title_explain = $user->lang[$display_vars['title'] . '_EXPLAIN'];
$template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $title_explain, 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'S_CONSTANTSOKAY' => $constantsokay ? true : false, 'PBWOW_DBTABLE' => $this->pbwow_config_table, 'S_DBOKAY' => $dbokay ? true : false, 'S_CURL_DANGER' => isset($this->pbwow_config['bnetchars_enable']) && $this->pbwow_config['bnetchars_enable'] && !$allow_curl, 'L_PBWOW_DB_GOOD' => sprintf($user->lang['PBWOW_DB_GOOD'], $this->pbwow_config_table), 'L_PBWOW_DB_BAD' => sprintf($user->lang['PBWOW_DB_BAD'], $this->pbwow_config_table), 'L_PBWOW_CHARSDB_GOOD' => sprintf($user->lang['PBWOW_CHARSDB_GOOD'], $this->pbwow_chars_table), 'L_PBWOW_CHARSDB_BAD' => sprintf($user->lang['PBWOW_CHARSDB_BAD'], $this->pbwow_chars_table), 'U_ACTION' => $this->u_action));
if ($mode == 'overview') {
$pb_bnet_host = isset($cpflist['pb_bnet_host']) && $cpflist['pb_bnet_host']['field_active'] && !$cpflist['pb_bnet_host']['field_no_view'] ? true : false;
$pb_bnet_realm = isset($cpflist['pb_bnet_realm']) && $cpflist['pb_bnet_realm']['field_active'] && !$cpflist['pb_bnet_realm']['field_no_view'] ? true : false;
$pb_bnet_name = isset($cpflist['pb_bnet_name']) && $cpflist['pb_bnet_name']['field_active'] && !$cpflist['pb_bnet_name']['field_no_view'] ? true : false;
$pb_bnet_url = isset($cpflist['pb_bnet_url']) && $cpflist['pb_bnet_url']['field_active'] && !$cpflist['pb_bnet_url']['field_no_view'] ? true : false;
$pb_bnet_avatar = isset($cpflist['pb_bnet_avatar']) && $cpflist['pb_bnet_avatar']['field_active'] && !$cpflist['pb_bnet_avatar']['field_no_view'] ? true : false;
$pb_wow_race = isset($cpflist['pb_wow_race']) && $cpflist['pb_wow_race']['field_active'] && !$cpflist['pb_wow_race']['field_no_view'] ? true : false;
$pb_wow_gender = isset($cpflist['pb_wow_gender']) && $cpflist['pb_wow_gender']['field_active'] && !$cpflist['pb_wow_gender']['field_no_view'] ? true : false;
$pb_wow_class = isset($cpflist['pb_wow_class']) && $cpflist['pb_wow_class']['field_active'] && !$cpflist['pb_wow_class']['field_no_view'] ? true : false;
$pb_wow_level = isset($cpflist['pb_wow_level']) && $cpflist['pb_wow_level']['field_active'] && !$cpflist['pb_wow_level']['field_no_view'] ? true : false;
$pb_wow_guild = isset($cpflist['pb_wow_guild']) && $cpflist['pb_wow_guild']['field_active'] && !$cpflist['pb_wow_guild']['field_no_view'] ? true : false;
$pb_diablo_class = isset($cpflist['pb_diablo_class']) && $cpflist['pb_diablo_class']['field_active'] && !$cpflist['pb_diablo_class']['field_no_view'] ? true : false;
$pb_diablo_gender = isset($cpflist['pb_diablo_gender']) && $cpflist['pb_diablo_gender']['field_active'] && !$cpflist['pb_diablo_gender']['field_no_view'] ? true : false;
$pb_diablo_follower = isset($cpflist['pb_diablo_follower']) && $cpflist['pb_diablo_follower']['field_active'] && !$cpflist['pb_diablo_follower']['field_no_view'] ? true : false;
$pb_wildstar_race = isset($cpflist['pb_wildstar_race']) && $cpflist['pb_wildstar_race']['field_active'] && !$cpflist['pb_wildstar_race']['field_no_view'] ? true : false;
$pb_wildstar_gender = isset($cpflist['pb_wildstar_gender']) && $cpflist['pb_wildstar_gender']['field_active'] && !$cpflist['pb_wildstar_gender']['field_no_view'] ? true : false;
$pb_wildstar_class = isset($cpflist['pb_wildstar_class']) && $cpflist['pb_wildstar_class']['field_active'] && !$cpflist['pb_wildstar_class']['field_no_view'] ? true : false;
$pb_wildstar_path = isset($cpflist['pb_wildstar_path']) && $cpflist['pb_wildstar_path']['field_active'] && !$cpflist['pb_wildstar_path']['field_no_view'] ? true : false;
$pb_wow_enabled = $pb_wow_race && $pb_wow_gender && $pb_wow_class && $pb_wow_level && $pb_wow_guild;
$pb_diablo_enabled = $pb_diablo_class && $pb_diablo_gender && $pb_diablo_follower;
$pb_wildstar_enabled = $pb_wildstar_race && $pb_wildstar_gender && $pb_wildstar_class && $pb_wildstar_path;
$pb_wow_activate_url = $this->u_action . '&game=wow&enable=' . ($pb_wow_enabled ? '0' : '1');
$pb_diablo_activate_url = $this->u_action . '&game=diablo&enable=' . ($pb_diablo_enabled ? '0' : '1');
$pb_wildstar_activate_url = $this->u_action . '&game=wildstar&enable=' . ($pb_wildstar_enabled ? '0' : '1');
$pb_charsdb_flush_url = $this->u_action . '&charsdb_flush=1';
$template->assign_vars(array('S_INDEX' => true, 'S_CHECK_V' => empty($versions) ? false : true, 'EXT_VERSION' => $ext_version, 'EXT_VERSION_V' => isset($versions['ext_version']['version']) ? $versions['ext_version']['version'] : '', 'STYLE_VERSION' => isset($style_version) ? $style_version : '', 'STYLE_VERSION_V' => isset($versions['style_version']['version']) ? $versions['style_version']['version'] : '', 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&versioncheck_force=1'), 'S_ALLOW_CURL' => $allow_curl, 'S_CPF_ON_MEMBERLIST' => $config['load_cpf_memberlist'] == 1 ? true : false, 'S_CPF_ON_VIEWPROFILE' => $config['load_cpf_viewprofile'] == 1 ? true : false, 'S_CPF_ON_VIEWTOPIC' => $config['load_cpf_viewtopic'] == 1 ? true : false, 'S_PB_WOW' => $pb_wow_enabled, 'S_PB_DIABLO' => $pb_diablo_enabled, 'S_PB_WILDSTAR' => $pb_wildstar_enabled, 'U_PB_WOW' => $pb_wow_activate_url, 'U_PB_DIABLO' => $pb_diablo_activate_url, 'U_PB_WILDSTAR' => $pb_wildstar_activate_url, 'S_BNETCHARS_ACTIVE' => isset($this->pbwow_config['bnetchars_enable']) && $this->pbwow_config['bnetchars_enable'] ? true : false, 'S_BNETCHARS_CONSTOKAY' => $chars_constokay ? true : false, 'S_BNETCHARS_DBOKAY' => $chars_dbokay ? true : false, 'BNET_APIKEY' => isset($this->pbwow_config['bnet_apikey']) ? $this->pbwow_config['bnet_apikey'] : false, 'U_CHARSDB_FLUSH' => $pb_charsdb_flush_url, 'S_PB_BNET_HOST' => $pb_bnet_host, 'S_PB_BNET_REALM' => $pb_bnet_realm, 'S_PB_BNET_NAME' => $pb_bnet_name, 'S_PB_BNET_URL' => $pb_bnet_url, 'S_PB_BNET_AVATAR' => $pb_bnet_avatar, 'S_PB_WOW_RACE' => $pb_wow_race, 'S_PB_WOW_GENDER' => $pb_wow_gender, 'S_PB_WOW_CLASS' => $pb_wow_class, 'S_PB_WOW_LEVEL' => $pb_wow_level, 'S_PB_WOW_GUILD' => $pb_wow_guild, 'S_PB_DIABLO_CLASS' => $pb_diablo_class, 'S_PB_DIABLO_GENDER' => $pb_diablo_gender, 'S_PB_DIABLO_FOLLOWER' => $pb_diablo_follower, 'S_PB_WILDSTAR_RACE' => $pb_wildstar_race, 'S_PB_WILDSTAR_GENDER' => $pb_wildstar_gender, 'S_PB_WILDSTAR_CLASS' => $pb_wildstar_class, 'S_PB_WILDSTAR_PATH' => $pb_wildstar_path, 'S_LEGACY_CONSTANTS' => $legacy_constants, 'S_LEGACY_DB_ACTIVE' => $legacy_db_active));
}
// Output relevant page
foreach ($display_vars['vars'] as $config_key => $vars) {
if (!is_array($vars) && strpos($config_key, 'legend') === false) {
continue;
}
if (strpos($config_key, 'legend') !== false) {
$template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
continue;
}
$type = explode(':', $vars['type']);
$l_explain = '';
if ($vars['explain'] && isset($vars['lang_explain'])) {
$l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
} else {
if ($vars['explain']) {
$l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
}
}
$content = build_cfg_template($type, $config_key, $new_config, $config_key, $vars);
if (empty($content)) {
continue;
}
$template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
unset($display_vars['vars'][$config_key]);
}
}
示例11: settings
function settings($id, $mode)
{
global $config, $db, $user, $auth, $template;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
$submit = isset($_POST['submit']) ? true : false;
$action = request_var('action', '');
$this->tpl_name = 'acp_board';
$this->page_title = $user->lang['ACP_BLOGS'];
blog_plugins::plugin_do('acp_main_start');
$settings = array('legend0' => 'VERSION', 'user_blog_version' => array('lang' => 'VERSION', 'type' => 'custom', 'method' => 'blog_version', 'explain' => false), 'legend1' => 'BLOG_SETTINGS', 'user_blog_enable' => array('lang' => 'ENABLE_USER_BLOG', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_enable_plugins' => array('lang' => 'ENABLE_USER_BLOG_PLUGINS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_subscription_enabled' => array('lang' => 'ENABLE_SUBSCRIPTIONS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_enable_zebra' => array('lang' => 'BLOG_ENABLE_ZEBRA', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_seo' => array('lang' => 'BLOG_ENABLE_SEO', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_search' => array('lang' => 'BLOG_ENABLE_SEARCH', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_user_permissions' => array('lang' => 'BLOG_ENABLE_USER_PERMISSIONS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_enable_ratings' => array('lang' => 'BLOG_ENABLE_RATINGS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_enable_attachments' => array('lang' => 'BLOG_ENABLE_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_enable_feeds' => array('lang' => 'BLOG_ENABLE_FEEDS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => false), 'legend2' => 'BLOG_POST_VIEW_SETTINGS', 'user_blog_guest_captcha' => array('lang' => 'BLOG_GUEST_CAPTCHA', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'user_blog_custom_profile_enable' => array('lang' => 'ENABLE_BLOG_CUSTOM_PROFILES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'user_blog_links_output_block' => array('lang' => 'OUTPUT_CPLINKS_BLOCK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'user_blog_always_show_blog_url' => array('lang' => 'BLOG_ALWAYS_SHOW_URL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'user_blog_text_limit' => array('lang' => 'DEFAULT_TEXT_LIMIT', 'validate' => 'int', 'type' => 'text:5:5', 'explain' => true), 'user_blog_user_text_limit' => array('lang' => 'USER_TEXT_LIMIT', 'validate' => 'int', 'type' => 'text:5:5', 'explain' => true), 'user_blog_inform' => array('lang' => 'BLOG_INFORM', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => true), 'user_blog_message_from' => array('lang' => 'BLOG_MESSAGE_FROM', 'validate' => 'string', 'type' => 'text:5:5', 'explain' => true), 'user_blog_min_rating' => array('lang' => 'BLOG_MIN_RATING', 'validate' => 'int', 'type' => 'text:5:5', 'explain' => true), 'user_blog_max_rating' => array('lang' => 'BLOG_MAX_RATING', 'validate' => 'int', 'type' => 'text:5:5', 'explain' => true), 'user_blog_quick_reply' => array('lang' => 'BLOG_QUICK_REPLY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend3' => 'BLOG_ATTACHMENT_SETTINGS', 'user_blog_max_attachments' => array('lang' => 'BLOG_MAX_ATTACHMENTS', 'validate' => 'int', 'type' => 'text:5:5', 'explain' => true));
blog_plugins::plugin_do_ref('acp_main_settings', $settings);
$this->new_config = $config;
$cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
$error = array();
// We validate the complete config if whished
validate_config_vars($settings, $cfg_array, $error);
// Do not write values if there is an error
if (sizeof($error)) {
$submit = false;
}
$template->assign_vars(array('L_TITLE' => $user->lang['BLOG_SETTINGS'], 'L_TITLE_EXPLAIN' => $user->lang['BLOG_SETTINGS_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
foreach ($settings as $config_key => $vars) {
if ($submit) {
if (!isset($cfg_array[$config_key]) || strpos($config_key, 'legend') !== false) {
continue;
}
$this->new_config[$config_key] = $config_value = $cfg_array[$config_key];
set_config($config_key, $config_value);
} else {
if ((!is_array($vars) || !isset($this->new_config[$config_key])) && strpos($config_key, 'legend') === false) {
continue;
}
if (strpos($config_key, 'legend') !== false) {
$template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
continue;
}
$type = explode(':', $vars['type']);
$l_explain = '';
if ($vars['explain'] && isset($vars['lang_explain'])) {
$l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
} else {
if ($vars['explain']) {
$l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
}
}
$template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars)));
}
}
if ($submit) {
add_log('admin', 'LOG_BLOG_CONFIG');
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
}
示例12: saveConfig
function saveConfig($display_vars)
{
global $db, $user, $auth, $template, $config, $error;
if (!is_array($error)) {
$error = array();
}
$submit = request_var('submit', '');
$form_key = 'acp_raidattendance';
add_form_key($form_key);
if (isset($display_vars['lang'])) {
$user->add_lang($display_vars['lang']);
}
$this->new_config = $config;
$cfg_array = request_var('config', array('' => ''));
$cfg_array = sizeof($cfg_array) > 1 ? utf8_normalize_nfc($cfg_array) : $this->new_config;
// We validate the complete config if whished
validate_config_vars($display_vars['vars'], $cfg_array, $error);
if ($submit && !check_form_key($form_key)) {
$error[] = $user->lang['FORM_INVALID'];
}
// Do not write values if there is an error
if (sizeof($error)) {
$submit = false;
}
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
// Add the "names"...
foreach ($display_vars['vars'] as $config_name => $null) {
if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
continue;
}
if ($config_name == 'auth_method') {
continue;
}
$this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
if ($submit) {
set_config($config_name, $config_value);
}
}
// Save non-"normal" configs
if ($submit) {
for ($ix = 0; $ix < 10; ++$ix) {
$config_name = 'raidattendance_raider_rank' . $ix . '_name';
$config_value = $cfg_array[$config_name];
set_config($config_name, $config_value);
}
// save the raids
$this->saveRaidSetup();
add_log('admin', 'LOG_CONFIG_RAIDATTENDANCE_SETTINGS');
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
$this->page_title = $display_vars['title'];
$template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
// Output relevant page
foreach ($display_vars['vars'] as $config_key => $vars) {
if (!is_array($vars) && strpos($config_key, 'legend') === false) {
continue;
}
if (strpos($config_key, 'legend') !== false) {
$template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
continue;
}
$type = explode(':', $vars['type']);
$l_explain = '';
if ($vars['explain'] && isset($vars['lang_explain'])) {
$l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
} else {
if ($vars['explain']) {
$l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
}
}
$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
if (empty($content)) {
continue;
}
$template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
unset($display_vars['vars'][$config_key]);
}
}
示例13: main
//.........这里部分代码省略.........
if (isset($module_name)) {
if ($module_data['module_classname'] !== 'custom') {
add_log('admin', 'LOG_PORTAL_CONFIG', $module_name);
}
} else {
add_log('admin', 'LOG_PORTAL_CONFIG', $this->user->lang['ACP_PORTAL_' . strtoupper($mode) . '_INFO']);
}
trigger_error($this->user->lang['CONFIG_UPDATED'] . (!empty($img_error) ? '<br /><br />' . $this->user->lang['MODULE_IMAGE_ERROR'] . '<br />' . $img_error : '') . adm_back_link($module_id ? append_sid("{$this->phpbb_root_path}adm/index.{$this->php_ex}", 'i=portal&mode=modules') : $this->u_action));
}
// show custom HTML files on the settings page of the modules instead of the standard board3 portal one, if chosen by module
if (!isset($this->c_class->custom_acp_tpl) || empty($this->c_class->custom_acp_tpl)) {
$this->tpl_name = 'portal/acp_portal_config';
} else {
$this->tpl_name = 'portal/' . $this->c_class->custom_acp_tpl;
}
$this->page_title = $display_vars['title'];
$this->template->assign_vars(array('L_TITLE' => $this->user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => isset($this->user->lang[$display_vars['title'] . '_EXP']) ? $this->user->lang[$display_vars['title'] . '_EXP'] : '', 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action . ($module_id ? '&module_id=' . $module_id : '')));
// Output relevant page
foreach ($display_vars['vars'] as $config_key => $vars) {
if (!is_array($vars) && strpos($config_key, 'legend') === false) {
continue;
}
if (strpos($config_key, 'legend') !== false) {
$this->template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($this->user->lang[$vars]) ? $this->user->lang[$vars] : $vars));
continue;
}
$this->new_config[$config_key] = $this->config[$config_key];
$type = explode(':', $vars['type']);
$l_explain = '';
if ($vars['explain']) {
$l_explain = isset($this->user->lang[$vars['lang'] . '_EXP']) ? $this->user->lang[$vars['lang'] . '_EXP'] : '';
}
if ($vars['type'] != 'custom') {
$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
} else {
$args = array($this->new_config[$config_key], $config_key, $module_id);
if (!is_array($vars['method'])) {
$func = array($this->c_class, $vars['method']);
} else {
$func = $vars['method'];
}
$content = call_user_func_array($func, $args);
}
if (empty($content)) {
continue;
}
$this->template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($this->user->lang[$vars['lang']]) ? $this->user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
unset($display_vars['vars'][$config_key]);
}
break;
case 'modules':
$action = request_var('action', '');
$module_id = request_var('module_id', '');
// Create an array of already installed modules
$portal_modules = obtain_portal_modules();
$installed_modules = $module_column = array();
foreach ($portal_modules as $cur_module) {
$installed_modules[] = $cur_module['module_classname'];
// Create an array with the columns the module is in
$module_column[$cur_module['module_classname']][] = column_num_string($cur_module['module_column']);
}
if ($action == 'move_up') {
$this->move_module_up($module_id);
} elseif ($action == 'move_down') {
$this->move_module_down($module_id);
} elseif ($action == 'move_right') {
示例14: main
function main($id, $mode)
{
global $db, $user, $auth, $template, $request, $phpbb_log;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
// Set up general vars
$action = $request->variable('action', '');
$submit = isset($_POST['submit']) ? true : false;
$this->tpl_name = 'acp_hidebbcode';
$form_key = 'acp_hidebbcode';
add_form_key($form_key);
switch ($mode) {
case 'settings':
$display_vars = array('title' => 'HIDEBB_SETTINGS', 'vars' => array('legend1' => 'GENERAL_SETTINGS', 'hidebbcode_unhide_reply' => array('lang' => 'HIDEBB_REPLY_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'hidebbcode_unhide_tfp' => array('lang' => 'HIDEBB_TFP_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'hidebbcode_hide_attach' => array('lang' => 'HIDEBB_HIDE_ATTACH', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'legend2' => 'ACP_SUBMIT_CHANGES'));
break;
default:
trigger_error('NO_MODE', E_USER_ERROR);
break;
}
if (isset($display_vars['lang'])) {
$user->add_lang($display_vars['lang']);
}
$this->new_config = $config;
$cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc($request->variable('config', array('' => ''), true)) : $this->new_config;
$error = array();
// We validate the complete config if whished
validate_config_vars($display_vars['vars'], $cfg_array, $error);
// Lets check if the path entered isn't valid and if we're gonna complain
if ($submit && $mode == 'settings') {
// Checks
}
if ($submit && !check_form_key($form_key)) {
$error[] = $user->lang['FORM_INVALID'];
}
// Do not write values if there is an error
if (sizeof($error)) {
$submit = false;
}
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
foreach ($display_vars['vars'] as $config_name => $null) {
if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
continue;
}
$this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
if ($submit) {
$config->set($config_name, $config_value);
}
}
if (sizeof($error)) {
$submit = false;
}
if ($submit) {
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_HIDEBBCODE');
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
$this->page_title = $display_vars['title'];
$template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error)));
$template->assign_var('U_ACTION', $this->u_action);
// Output relevant page set in $display_vars
foreach ($display_vars['vars'] as $config_key => $vars) {
if (!is_array($vars) && strpos($config_key, 'legend') === false) {
continue;
}
if (strpos($config_key, 'legend') !== false) {
$template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
continue;
}
$type = explode(':', $vars['type']);
$l_explain = '';
if ($vars['explain'] && isset($vars['lang_explain'])) {
$l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
} else {
if ($vars['explain']) {
$l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
}
}
$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
if (empty($content)) {
continue;
}
$template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
unset($display_vars['vars'][$config_key]);
}
}
示例15: infraction_general
public function infraction_general()
{
global $auth, $db, $user, $template;
global $config, $phpbb_root_path, $phpEx, $phpbb_admin_path;
$action = request_var('action', '');
$submit = isset($_POST['submit']) || isset($_POST['allow_quick_reply_enable']) ? true : false;
$form_key = 'acp_infractions';
add_form_key($form_key);
$display_vars = array('title' => 'ACP_INFRACTION_GENERAL', 'vars' => array('legend1' => 'ACP_INFRACTION_GENERAL', 'infractions_hard_delete' => array('lang' => 'INFRACTION_DELETE_TYPE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'infractions_deleted_keep_time' => array('lang' => 'INFRACTION_DELETE_KEEP_TIME', 'validate' => 'int', 'type' => 'text:40:40', 'explain' => true), 'infractions_pm_sig' => array('lang' => 'INFRACTION_PM_SIG', 'validate' => 'string', 'type' => 'textarea:4:40', 'explain' => true)));
// ---------
if (isset($display_vars['lang'])) {
$user->add_lang($display_vars['lang']);
}
$this->new_config = $config;
$cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
$error = array();
// We validate the complete config if whished
validate_config_vars($display_vars['vars'], $cfg_array, $error);
if ($submit && !check_form_key($form_key)) {
$error[] = $user->lang['FORM_INVALID'];
}
// Do not write values if there is an error
if (sizeof($error)) {
$submit = false;
}
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
foreach ($display_vars['vars'] as $config_name => $null) {
if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
continue;
}
if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id') {
continue;
}
$this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
if ($config_name == 'email_function_name') {
$this->new_config['email_function_name'] = trim(str_replace(array('(', ')'), array('', ''), $this->new_config['email_function_name']));
$this->new_config['email_function_name'] = empty($this->new_config['email_function_name']) || !function_exists($this->new_config['email_function_name']) ? 'mail' : $this->new_config['email_function_name'];
$config_value = $this->new_config['email_function_name'];
}
if ($submit) {
set_config($config_name, $config_value);
if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable'])) {
enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', log(FORUM_FLAG_QUICK_REPLY, 2));
}
}
}
// Output relevant page
foreach ($display_vars['vars'] as $config_key => $vars) {
if (!is_array($vars) && strpos($config_key, 'legend') === false) {
continue;
}
if (strpos($config_key, 'legend') !== false) {
$template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
continue;
}
$type = explode(':', $vars['type']);
$l_explain = '';
if ($vars['explain'] && isset($vars['lang_explain'])) {
$l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
} else {
if ($vars['explain']) {
$l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
}
}
$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
if (empty($content)) {
continue;
}
$template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
unset($display_vars['vars'][$config_key]);
}
if ($submit) {
add_log('admin', 'INFRACTION_LOG_UPDATED');
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
}