} $template_to_parse = CMS_TPL . 'cms_layout_list_body.tpl'; $template->assign_var('CMS_PAGE_TITLE', $lang['CMS_PAGES']); $template->assign_vars(array('L_LAYOUT_TITLE' => $is_layout_special ? $lang['CMS_STANDARD_PAGES'] : $lang['CMS_CUSTOM_PAGES'], 'L_LAYOUT_TEXT' => $is_layout_special ? $lang['Layout_Special_Explain'] : $lang['Layout_Explain'], 'S_LAYOUT_SPECIAL' => $is_layout_special, 'S_LAYOUT_ACTION' => append_sid($cms_admin->root), 'S_HIDDEN_FIELDS' => $cms_admin->s_hidden_fields)); $cms_admin->show_layouts_list($is_layout_special); } } if ($cms_admin->mode == 'config') { $template_to_parse = CMS_TPL . 'cms_config_body.tpl'; $template->assign_var('CMS_PAGE_TITLE', $lang['CMS_CONFIG']); // Pull all config data $sql = "SELECT * FROM " . $cms_admin->tables['block_variable_table'] . " AS b, " . $cms_admin->tables['block_config_table'] . " AS p\n\t\tWHERE (b.bid = 0)\n\t\t\tAND (p.bid = 0)\n\t\t\tAND (p.config_name = b.config_name)\n\t\tORDER BY b.block, b.bvid, p.id"; $result = $db->sql_query($sql); $controltype = array('1' => 'textbox', '2' => 'dropdown list', '3' => 'radio buttons', '4' => 'checkbox'); while ($row = $db->sql_fetchrow($result)) { create_cms_field_tpl($row, true); } $db->sql_freeresult($result); if (isset($_POST['save'])) { $message = $lang['CMS_Config_updated'] . '<br /><br />' . sprintf($lang['CMS_Click_return_config'], '<a href="' . append_sid($cms_admin->root . '?mode=config') . '">', '</a>') . '<br /><br />' . sprintf($lang['CMS_Click_return_cms'], '<a href="' . append_sid($cms_admin->root) . '">', '</a>') . '<br /><br />'; message_die(GENERAL_MESSAGE, $message); } $template->assign_vars(array('S_CONFIG_ACTION' => append_sid($cms_admin->root), 'L_CONFIGURATION_TITLE' => $lang['CMS_CONFIG'], 'L_CONFIGURATION_EXPLAIN' => $lang['Portal_Explain'], 'L_GENERAL_CONFIG' => $lang['Portal_General_Config'])); } //if (($cms_admin->mode == 'auth') && ($auth->acl_get('cms_edit'))) if ($cms_admin->mode == 'auth') { $css_temp = array('cms_auth.css'); $template->css_include = array_merge($template->css_include, $css_temp); unset($css_temp); include_once IP_ROOT_PATH . 'includes/functions_admin_phpbb3.' . PHP_EXT; $roles_admin = request_var('roles_admin', 0);
function manage_block_settings() { global $db, $lang, $class_form, $template, $user; if (isset($_POST['hascontent'])) { $block_content = request_var('blockfile', ''); $block_text = empty($block_content) ? true : false; $hascontent = true; } else { $block_content = false; $block_text = false; $hascontent = false; } $block_content_file = $block_content; if ($this->action == 'edit') { if (!empty($this->bs_id)) { $b_info = $this->get_block_settings_info(); if (($b_info['locked'] == '1' || $b_info['user_id'] != $user->data['user_id']) && $user->data['user_level'] != ADMIN) { message_die(GENERAL_MESSAGE, $lang['Not_Auth_View']); } } else { message_die(GENERAL_MESSAGE, $lang['No_blocks_selected']); } } else { $b_info['bposition'] = ''; $b_info['blockfile'] = ''; $b_info['view'] = 0; $b_info['groups'] = ''; } if ($user->data['user_level'] == ADMIN) { $blocks_array = $this->get_blocks_files_list(); $options_array = array(); $options_langs_array = array(); $options_array[] = ''; $options_langs_array[] = '[ ' . $lang['B_TEXT_BLOCK'] . ' ]'; foreach ($blocks_array as $block_file) { $options_array[] = BLOCKS_PREFIX . $block_file; $options_langs_array[] = $block_file . (!empty($lang['cms_block_' . $block_file]) ? ' [' . $lang['cms_block_' . $block_file] . ']' : ''); } $block_content_file_old = $b_info['blockfile']; $b_info['blockfile'] = isset($_POST['blockfile']) ? request_var('blockfile', '') : $b_info['blockfile']; $select_name = 'blockfile'; $default = $b_info['blockfile']; $select_js = ''; $blockfile = $class_form->build_select_box($select_name, $default, $options_array, $options_langs_array, $select_js); $locked = !empty($b_info['locked']) ? true : false; $locked_hidden = isset($_POST['locked']) ? true : false; } else { $blockfile = $lang['B_TEXT_BLOCK']; $locked = false; $locked_hidden = false; } if (!defined('IN_CMS_USERS')) { $locked = true; $locked_hidden = true; } $b_info['view'] = isset($_POST['view']) ? request_post_var('view', 0) : $b_info['view']; $select_name = 'view'; $default = $b_info['view']; $options_array = array(0, 1, 2, 3, 4, 8); $options_langs_array = array($lang['B_ALL'], $lang['B_GUESTS'], $lang['B_REG'], $lang['B_MOD'], $lang['B_ADMIN'], $lang['B_ALL_NO_BOTS']); $select_js = ''; $view = $class_form->build_select_box($select_name, $default, $options_array, $options_langs_array, $select_js); if (isset($_POST['message'])) { $message = request_var('message', '', true); $message = htmlspecialchars_decode($message, ENT_COMPAT); } elseif (!empty($b_info['content'])) { $message = $b_info['content']; } else { $message = ''; } $group = get_all_usergroups($b_info['groups']); if (empty($group)) { $group = ' ' . $lang['None']; } $b_name = isset($_POST['name']) ? request_var('name', '') : (!empty($b_info['name']) ? trim($b_info['name']) : ''); $b_type = isset($_POST['type']) ? request_var('type', '') : ($b_info['type'] ? $b_info['type'] : 0); $max_group_id = get_max_group_id(); $b_group = ''; $b_group_hidden = ''; $not_first = false; for ($i = 1; $i <= $max_group_id; $i++) { if (isset($_POST['group' . strval($i)])) { $b_group_hidden .= '<input type="hidden" name="group' . strval($i) . '" value="1" />'; } } if ($block_text == true) { $template->assign_var('CMS_PAGE_TITLE', $lang['BLOCKS_CREATION_02']); //generate_smilies('inline'); $this->s_hidden_fields .= '<input type="hidden" name="blockfile" value="" />'; $this->s_hidden_fields .= '<input type="hidden" name="hascontent" value="1" />'; //$this->s_hidden_fields .= '<input type="hidden" name="name" value="' . htmlspecialchars($b_name) . '" />'; $this->s_hidden_fields .= '<input type="hidden" name="name" value="' . $b_name . '" />'; $this->s_hidden_fields .= '<input type="hidden" name="view" value="' . $b_info['view'] . '" />'; $this->s_hidden_fields .= '<input type="hidden" name="locked" value="' . $locked_hidden . '" />'; $this->s_hidden_fields .= $b_group_hidden; } elseif ($block_content != false) { $template->assign_var('CMS_PAGE_TITLE', $lang['BLOCKS_CREATION_02']); $this->s_hidden_fields .= '<input type="hidden" name="blockfile" value="' . $block_content_file . '" />'; $this->s_hidden_fields .= '<input type="hidden" name="message" value="" />'; $this->s_hidden_fields .= '<input type="hidden" name="type" value="0" />'; //$this->s_hidden_fields .= '<input type="hidden" name="name" value="' . htmlspecialchars($b_name) . '" />'; $this->s_hidden_fields .= '<input type="hidden" name="name" value="' . $b_name . '" />'; $this->s_hidden_fields .= '<input type="hidden" name="view" value="' . $b_info['view'] . '" />'; $this->s_hidden_fields .= '<input type="hidden" name="locked" value="' . $locked_hidden . '" />'; $this->s_hidden_fields .= $b_group_hidden; $block_vars_default = array(); $block_count_variables = 0; if (!empty($block_content_file)) { $block_vars_default = $this->get_block_vars_default($block_content_file); $block_count_variables = sizeof($block_vars_default); $block_vars_default_names = array(); for ($i = 0; $i < $block_count_variables; $i++) { $block_vars_default_names[$block_vars_default[$i]['config_name']] = $i; } } if ($this->bs_id > 0 && $block_content_file == $block_content_file_old) { $sql = "SELECT * FROM " . $this->tables['block_config_table'] . " AS c, " . $this->tables['block_variable_table'] . " AS bv\n\t\t\t\t\t\t\t\t\tWHERE c.bid = '" . $this->bs_id . "'\n\t\t\t\t\t\t\t\t\t\tAND bv.bid = '" . $this->bs_id . "'\n\t\t\t\t\t\t\t\t\t\tAND c.config_name = bv.config_name\n\t\t\t\t\t\t\t\t\tORDER BY c.id"; $result = $db->sql_query($sql); $rows_counter = 0; $vars_counter = 0; $block_vars_existing_names = array(); while ($row = $db->sql_fetchrow($result)) { if (in_array($row['config_name'], $block_vars_default_names)) { create_cms_field_tpl($row, false); $vars_counter++; } $block_vars_existing_names[$row['config_name']] = $rows_counter; $rows_counter++; } for ($i = 0; $i < $block_count_variables; $i++) { if (!in_array($block_vars_default[$i]['config_name'], $block_vars_existing_names)) { create_cms_field_tpl($block_vars_default[$i], false); $vars_counter++; } } if (empty($vars_counter)) { $template->assign_block_vars('cms_no_bv', array('L_NO_BV' => $lang['No_bv_selected'])); } $db->sql_freeresult($result); } else { if (!empty($block_vars_default)) { for ($i = 0; $i < $block_count_variables; $i++) { create_cms_field_tpl($block_vars_default[$i], false); } } else { $template->assign_block_vars('cms_no_bv', array('L_NO_BV' => $lang['No_bv_selected'])); } } } else { $template->assign_var('CMS_PAGE_TITLE', $lang['BLOCKS_CREATION_01']); $this->s_hidden_fields .= '<input type="hidden" name="message" value="' . htmlspecialchars($message) . '" />'; $this->s_hidden_fields .= '<input type="hidden" name="type" value="' . $b_type . '" />'; // Mighty Gorgon: this is not needed because it is assigned via submit button! //$this->s_hidden_fields .= '<input type="hidden" name="hascontent" value="1" />'; } $template->assign_vars(array('NAME' => $b_name, 'HTML' => !$b_type ? 'checked="checked"' : '', 'BBCODE' => $b_type ? 'checked="checked"' : '', 'CONTENT' => htmlspecialchars($message), 'BLOCKFILE' => $blockfile, 'BLOCK_CONFIG' => $block_config, 'VIEWBY' => $view, 'GROUP' => $group, 'LOCKED' => !empty($locked) ? 'checked="checked"' : '', 'S_BLOCKS_ACTION' => append_sid($this->root . $this->s_append_url), 'S_HIDDEN_FIELDS' => $this->s_hidden_fields)); // BBCBMG - BEGIN include IP_ROOT_PATH . 'includes/bbcb_mg.' . PHP_EXT; $template->assign_var_from_handle('BBCB_MG', 'bbcb_mg'); // BBCBMG - END // BBCBMG SMILEYS - BEGIN generate_smilies('inline'); include IP_ROOT_PATH . 'includes/bbcb_smileys_mg.' . PHP_EXT; $template->assign_var_from_handle('BBCB_SMILEYS_MG', 'bbcb_smileys_mg'); // BBCBMG SMILEYS - END return true; }