• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP validate_config_vars函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中validate_config_vars函数的典型用法代码示例。如果您正苦于以下问题:PHP validate_config_vars函数的具体用法?PHP validate_config_vars怎么用?PHP validate_config_vars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: 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));
     }
 }
开发者ID:EXreaction,项目名称:User-Blog-Mod,代码行数:53,代码来源:acp_blogs.php


示例2: get_submitted_settings

 /**
  * @param array $default_settings
  * @return array|void
  */
 public function get_submitted_settings(array $default_settings)
 {
     if (!function_exists('validate_config_vars')) {
         include $this->phpbb_root_path . 'includes/functions_acp.' . $this->php_ext;
     }
     $cfg_array = utf8_normalize_nfc($this->request->variable('config', array('' => ''), true));
     $errors = array();
     validate_config_vars($default_settings, $cfg_array, $errors);
     if (sizeof($errors)) {
         return array('errors' => join("\n", $errors));
     }
     $this->_get_multi_select($cfg_array, $default_settings);
     return array_intersect_key($cfg_array, $default_settings);
 }
开发者ID:BogusCurry,项目名称:phpBB-ext-sitemaker,代码行数:18,代码来源:cfg_handler.php


示例3: blog_confirm

/**
* Build Confirm
*
* @param string $title The title of the page
* @param string $explain The explanation of the page
* @param array $display_vars The array holding all of the settings/information - like how admin_board is setup
* @param string $submit_type The type of submit buttons you want shown. Currently supported: 'submit/reset' or 'yes/no' 
* @param string $action The page you want to submit to.  Leave as self to be the current page.
*/
function blog_confirm($title, $explain, $display_vars, $submit_type = 'submit/reset', $action = 'self')
{
    global $template, $user;
    $submit = isset($_POST['submit']) ? true : false;
    $error = $settings = array();
    if ($submit) {
        // check the form key
        if (!check_form_key('confirm')) {
            $error[] = $user->lang['FORM_INVALID'];
        }
        $settings = request_var('setting', array('' => ''));
        validate_config_vars($display_vars, $settings, $error);
        if (!sizeof($error)) {
            return $settings;
        } else {
            $template->assign_vars(array('S_ERROR' => true, 'ERROR_MSG' => implode($error, '<br />')));
        }
    }
    // Add the form key
    add_form_key('confirm');
    if ($action === 'self') {
        global $blog_urls;
        if (isset($blog_urls['self'])) {
            $action = $blog_urls['self'];
        } else {
            $action = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
        }
    }
    $template->assign_vars(array('L_TITLE' => isset($user->lang[$title]) ? $user->lang[$title] : $title, 'L_TITLE_EXPLAIN' => isset($user->lang[$explain]) ? $user->lang[$explain] : $explain, 'U_ACTION' => $action, 'S_YES_NO' => $submit_type == 'submit/reset' ? false : true));
    foreach ($display_vars as $key => $vars) {
        if (strpos($key, 'legend') !== false) {
            $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
            continue;
        }
        $default = isset($settings[$key]) ? $settings[$key] : $vars['default'];
        $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' => $key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => build_blog_cfg_template($type, $key, $default)));
    }
    $template->set_filenames(array('body' => 'blog/blog_confirm.html'));
    return 'build';
}
开发者ID:EXreaction,项目名称:User-Blog-Mod,代码行数:58,代码来源:functions_confirm.php


示例4: main


//.........这里部分代码省略.........
         if ($db_tool->sql_table_exists($legacy_dbtable) || $db_tool->sql_table_exists($table_prefix . 'pbwow_config')) {
             $legacy_db_active = true;
         }
         // Check if topics table has been modded
         if ($db_tool->sql_column_exists(TOPICS_TABLE, 'topic_first_poster_rank_img') || $db_tool->sql_column_exists(TOPICS_TABLE, 'topic_first_poster_rank_title')) {
             $legacy_topics_mod = true;
         }
     }
     /**
      *	Validation types are:
      *		string, int, bool,
      *		script_path (absolute path in url - beginning with / and no trailing slash),
      *		rpath (relative), rwpath (realtive, writeable), path (relative path, but able to escape the root), wpath (writeable)
      */
     switch ($mode) {
         case 'overview':
             $display_vars = array('title' => 'ACP_PBWOW2_OVERVIEW_TITLE', 'vars' => array());
             break;
         case 'config':
             $display_vars = array('title' => 'ACP_PBWOW_CONFIG_TITLE', 'vars' => array('legend1' => 'ACP_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:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'logo_margins' => array('lang' => 'PBWOW_LOGO_MARGINS', 'validate' => 'string', 'type' => 'text:20:20', 'explain' => true), 'legend2' => 'ACP_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' => 'ACP_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' => 'ACP_PBWOW_NAVMENU', 'navmenu_enable' => array('lang' => 'PBWOW_NAVMENU_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'legend5' => 'ACP_PBWOW_IE6MESSAGE', 'ie6message_enable' => array('lang' => 'PBWOW_IE6MESSAGE_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'ie6message_code' => array('lang' => 'PBWOW_IE6MESSAGE_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'legend6' => 'ACP_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), 'bg_fixed' => array('lang' => 'PBWOW_BG_FIXED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend7' => 'ACP_PBWOW_BNETCHARS', 'bnetchars_enable' => array('lang' => 'PBWOW_BNETCHARS_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', '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']), 'legend8' => 'ACP_PBWOW_TOOLTIPS', 'wowtips_script' => array('lang' => 'PBWOW_WOWTIPS_SCRIPT', 'validate' => 'int', 'type' => 'custom', 'explain' => true, 'method' => 'select_single'), 'd3tips_script' => array('lang' => 'PBWOW_D3TIPS_SCRIPT', 'validate' => 'int', 'type' => 'custom', 'explain' => true, 'method' => 'select_single'), 'zamtips_enable' => array('lang' => 'PBWOW_ZAMTIPS_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'tooltips_region' => array('lang' => 'PBWOW_TOOLTIPS_REGION', 'validate' => 'int', 'type' => 'custom', 'explain' => true, 'method' => 'select_single'), 'tooltips_footer' => array('lang' => 'PBWOW_TOOLTIPS_FOOTER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'tooltips_local' => array('lang' => 'PBWOW_TOOLTIPS_LOCAL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true)));
             break;
         case 'poststyling':
             $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') {
开发者ID:gonzo1247,项目名称:hitman_roa,代码行数:67,代码来源:acp_pbwow2.php


示例5: 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]);
 }
开发者ID:Reaper88,项目名称:ajaxchat,代码行数:39,代码来源:ajaxchat_module.php


示例6: main

    function main($id, $mode)
    {
        global $db, $user, $auth, $template, $cache;
        global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
        $user->add_lang(array('posting', 'viewtopic', 'acp/attachments'));
        $error = $notify = array();
        $submit = isset($_POST['submit']) ? true : false;
        $action = request_var('action', '');
        $form_key = 'acp_attach';
        add_form_key($form_key);
        if ($submit && !check_form_key($form_key)) {
            trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
        }
        switch ($mode) {
            case 'attach':
                $l_title = 'ACP_ATTACHMENT_SETTINGS';
                break;
            case 'extensions':
                $l_title = 'ACP_MANAGE_EXTENSIONS';
                break;
            case 'ext_groups':
                $l_title = 'ACP_EXTENSION_GROUPS';
                break;
            case 'orphan':
                $l_title = 'ACP_ORPHAN_ATTACHMENTS';
                break;
            default:
                trigger_error('NO_MODE', E_USER_ERROR);
                break;
        }
        $this->tpl_name = 'acp_attachments';
        $this->page_title = $l_title;
        $template->assign_vars(array('L_TITLE' => $user->lang[$l_title], 'L_TITLE_EXPLAIN' => $user->lang[$l_title . '_EXPLAIN'], 'U_ACTION' => $this->u_action));
        switch ($mode) {
            case 'attach':
                include_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
                $sql = 'SELECT group_name, cat_id
					FROM ' . EXTENSION_GROUPS_TABLE . '
					WHERE cat_id > 0
					ORDER BY cat_id';
                $result = $db->sql_query($sql);
                $s_assigned_groups = array();
                while ($row = $db->sql_fetchrow($result)) {
                    $s_assigned_groups[$row['cat_id']][] = $row['group_name'];
                }
                $db->sql_freeresult($result);
                $l_legend_cat_images = $user->lang['SETTINGS_CAT_IMAGES'] . ' [' . $user->lang['ASSIGNED_GROUP'] . ': ' . (!empty($s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE]) ? implode(', ', $s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE]) : $user->lang['NO_EXT_GROUP']) . ']';
                $display_vars = array('title' => 'ACP_ATTACHMENT_SETTINGS', 'vars' => array('legend1' => 'ACP_ATTACHMENT_SETTINGS', 'img_max_width' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'img_max_height' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'img_link_width' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'img_link_height' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'upload_path' => array('lang' => 'UPLOAD_DIR', 'validate' => 'wpath', 'type' => 'text:25:100', 'explain' => true), 'display_order' => array('lang' => 'DISPLAY_ORDER', 'validate' => 'bool', 'type' => 'custom', 'method' => 'display_order', 'explain' => true), 'attachment_quota' => array('lang' => 'ATTACH_QUOTA', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true), 'max_filesize' => array('lang' => 'ATTACH_MAX_FILESIZE', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true), 'max_filesize_pm' => array('lang' => 'ATTACH_MAX_PM_FILESIZE', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true), 'max_attachments' => array('lang' => 'MAX_ATTACHMENTS', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => false), 'max_attachments_pm' => array('lang' => 'MAX_ATTACHMENTS_PM', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => false), 'secure_downloads' => array('lang' => 'SECURE_DOWNLOADS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'secure_allow_deny' => array('lang' => 'SECURE_ALLOW_DENY', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_allow_deny', 'explain' => true), 'secure_allow_empty_referer' => array('lang' => 'SECURE_EMPTY_REFERRER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'check_attachment_content' => array('lang' => 'CHECK_CONTENT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => $l_legend_cat_images, 'img_display_inlined' => array('lang' => 'DISPLAY_INLINED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'img_create_thumbnail' => array('lang' => 'CREATE_THUMBNAIL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'img_max_thumb_width' => array('lang' => 'MAX_THUMB_WIDTH', 'validate' => 'int', 'type' => 'text:7:15', 'explain' => true, 'append' => ' px'), 'img_min_thumb_filesize' => array('lang' => 'MIN_THUMB_FILESIZE', 'validate' => 'int', 'type' => 'text:7:15', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), 'img_imagick' => array('lang' => 'IMAGICK_PATH', 'validate' => 'string', 'type' => 'text:20:200', 'explain' => true, 'append' => '&nbsp;&nbsp;<span>[ <a href="' . $this->u_action . '&amp;action=imgmagick">' . $user->lang['SEARCH_IMAGICK'] . '</a> ]</span>'), 'img_max' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' px'), 'img_link' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' px')));
                $this->new_config = $config;
                $cfg_array = isset($_REQUEST['config']) ? request_var('config', array('' => '')) : $this->new_config;
                $error = array();
                // We validate the complete config if whished
                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...
                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 (in_array($config_name, array('attachment_quota', 'max_filesize', 'max_filesize_pm'))) {
                        $size_var = request_var($config_name, '');
                        $this->new_config[$config_name] = $config_value = $size_var == 'kb' ? round($config_value * 1024) : ($size_var == 'mb' ? round($config_value * 1048576) : $config_value);
                    }
                    if ($submit) {
                        set_config($config_name, $config_value);
                    }
                }
                $this->perform_site_list();
                if ($submit) {
                    add_log('admin', 'LOG_CONFIG_ATTACH');
                    // Check Settings
                    $this->test_upload($error, $this->new_config['upload_path'], false);
                    if (!sizeof($error)) {
                        trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
                    }
                }
                $template->assign_var('S_ATTACHMENT_SETTINGS', true);
                if ($action == 'imgmagick') {
                    $this->new_config['img_imagick'] = $this->search_imagemagick();
                }
                // We strip eventually manual added convert program, we only want the patch
                if ($this->new_config['img_imagick']) {
                    // Change path separator
                    $this->new_config['img_imagick'] = str_replace('\\', '/', $this->new_config['img_imagick']);
                    $this->new_config['img_imagick'] = str_replace(array('convert', '.exe'), array('', ''), $this->new_config['img_imagick']);
                    // Check for trailing slash
                    if (substr($this->new_config['img_imagick'], -1) !== '/') {
                        $this->new_config['img_imagick'] .= '/';
                    }
                }
                $supported_types = get_supported_image_types();
                // Check Thumbnail Support
                if (!$this->new_config['img_imagick'] && (!isset($supported_types['format']) || !sizeof($supported_types['format']))) {
                    $this->new_config['img_create_thumbnail'] = 0;
                }
                $template->assign_vars(array('U_SEARCH_IMAGICK' => $this->u_action . '&amp;action=imgmagick', 'S_THUMBNAIL_SUPPORT' => !$this->new_config['img_imagick'] && (!isset($supported_types['format']) || !sizeof($supported_types['format'])) ? false : true));
//.........这里部分代码省略.........
开发者ID:jvinhit,项目名称:php,代码行数:101,代码来源:acp_attachments.php


示例7: 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]);
     }
 }
开发者ID:jsib,项目名称:intranet,代码行数:79,代码来源:acp_thanks_reput.php


示例8: main

 function main($id, $mode)
 {
     global $config, $user, $template, $request, $phpbb_container;
     $this->user = $user;
     $this->tpl_name = 'acp_board';
     $this->page_title = 'ACP_PMWELCOME_SETTINGS';
     $submit = $request->is_set_post('submit');
     $form_key = 'pmwelcome';
     add_form_key($form_key);
     $display_vars = array('title' => 'ACP_PMWELCOME', 'vars' => array('legend1' => 'ACP_PMWELCOME_SETTINGS', 'pmwelcome_user' => array('lang' => 'ACP_PMWELCOME_USER', 'validate' => 'int:0:255', 'type' => 'number:0:255', 'explain' => true), 'pmwelcome_subject' => array('lang' => 'ACP_PMWELCOME_SUBJECT', 'validate' => 'string', 'type' => 'text:50:250', 'explain' => false), 'pmwelcome_post_text' => array('lang' => 'ACP_PMWELCOME_TEXT', 'validate' => '', 'type' => 'textarea:15:30', 'explain' => true), 'legend2' => 'ACP_SUBMIT_CHANGES'));
     if (isset($display_vars['lang'])) {
         $user->add_lang($display_vars['lang']);
     }
     $this->new_config = $config;
     $cfg_array = $request->is_set('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;
     }
     /* config text class && Anvar */
     $config_text = $phpbb_container->get('config_text');
     $text_ary = array('pmwelcome_post_text');
     // 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) {
             /* Add config text && Anvar */
             if (in_array($config_name, $text_ary)) {
                 $config_text->set($config_name, $config_value);
             } else {
                 $config->set($config_name, $config_value);
             }
         }
     }
     if ($submit) {
         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'] : '';
             }
         }
         /* Get config text && Anvar */
         if (in_array($config_key, $text_ary)) {
             $this->new_config[$config_key] = $config_text->get($config_key);
         }
         $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]);
     }
 }
开发者ID:Galixte,项目名称:apwa,代码行数:78,代码来源:pmwelcome_module.php


示例9: 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]);
     }
 }
开发者ID:phpbb-store,项目名称:OfficeForum,代码行数:63,代码来源:posts_merging_module.php


示例10: 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['l 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP validate_current_theme函数代码示例发布时间:2022-05-23
下一篇:
PHP validate_calendars函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap