/** * Assigns row id's to each block in a specified column * * - ensures each block has a unique row id * - For each block in a column, it will sequentially number the row id * based on the order the blocks are returned via getBlockInfo * * @param int|null $column_id */ function fixColumnRows($column_id = null) { $db = database(); // Get the list of all blocks in this column $blockList = getBlockInfo($column_id); $blockIds = array(); foreach ($blockList as $block) { $blockIds[] = $block['id']; } $counter = 0; // Now sequentially set the row number for each block in this column foreach ($blockIds as $block) { $counter = $counter + 1; $db->query('', ' UPDATE {db_prefix}sp_blocks SET row = {int:counter} WHERE id_block = {int:block}', array('counter' => $counter, 'block' => $block)); } }
function sportal_admin_page_edit() { global $txt, $context, $modSettings, $smcFunc, $sourcedir, $options; require_once $sourcedir . '/Subs-Editor.php'; require_once $sourcedir . '/Subs-Post.php'; $context['SPortal']['is_new'] = empty($_REQUEST['page_id']); if (!empty($_REQUEST['content_mode']) && $_POST['type'] == 'bbc') { $_REQUEST['content'] = html_to_bbc($_REQUEST['content']); $_REQUEST['content'] = un_htmlspecialchars($_REQUEST['content']); $_POST['content'] = $_REQUEST['content']; } $context['sides'] = array(5 => $txt['sp-positionHeader'], 1 => $txt['sp-positionLeft'], 2 => $txt['sp-positionTop'], 3 => $txt['sp-positionBottom'], 4 => $txt['sp-positionRight'], 6 => $txt['sp-positionFooter']); $blocks = getBlockInfo(); $context['page_blocks'] = array(); foreach ($blocks as $block) { $shown = false; $tests = array('all', 'allpages', 'sforum'); if (!$context['SPortal']['is_new']) { $tests[] = 'p' . (int) $_REQUEST['page_id']; } foreach (array('display', 'display_custom') as $field) { if (substr($block[$field], 0, 4) === '$php') { continue 2; } $block[$field] = explode(',', $block[$field]); if (!$context['SPortal']['is_new'] && in_array('-p' . (int) $_REQUEST['page_id'], $block[$field])) { continue; } foreach ($tests as $test) { if (in_array($test, $block[$field])) { $shown = true; break; } } } $context['page_blocks'][$block['column']][] = array('id' => $block['id'], 'label' => $block['label'], 'shown' => $shown); } if (!empty($_POST['submit'])) { checkSession(); if (!isset($_POST['title']) || $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['title'], ENT_QUOTES)) === '') { fatal_lang_error('sp_error_page_name_empty', false); } if (!isset($_POST['namespace']) || $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['namespace'], ENT_QUOTES)) === '') { fatal_lang_error('sp_error_page_namespace_empty', false); } $result = $smcFunc['db_query']('', ' SELECT id_page FROM {db_prefix}sp_pages WHERE namespace = {string:namespace} AND id_page != {int:current} LIMIT 1', array('limit' => 1, 'namespace' => $smcFunc['htmlspecialchars']($_POST['namespace'], ENT_QUOTES), 'current' => (int) $_POST['page_id'])); list($has_duplicate) = $smcFunc['db_fetch_row']($result); $smcFunc['db_free_result']($result); if (!empty($has_duplicate)) { fatal_lang_error('sp_error_page_namespace_duplicate', false); } if (preg_match('~[^A-Za-z0-9_]+~', $_POST['namespace']) != 0) { fatal_lang_error('sp_error_page_namespace_invalid_chars', false); } if (preg_replace('~[0-9]+~', '', $_POST['namespace']) === '') { fatal_lang_error('sp_error_page_namespace_numeric', false); } if ($_POST['type'] == 'php' && !empty($_POST['content']) && empty($modSettings['sp_disable_php_validation'])) { $error = sp_validate_php($_POST['content']); if ($error) { fatal_lang_error('error_sp_php_' . $error, false); } } $permission_set = 0; $groups_allowed = $groups_denied = ''; if (!empty($_POST['permission_set'])) { $permission_set = (int) $_POST['permission_set']; } elseif (!empty($_POST['membergroups']) && is_array($_POST['membergroups'])) { $groups_allowed = $groups_denied = array(); foreach ($_POST['membergroups'] as $id => $value) { if ($value == 1) { $groups_allowed[] = (int) $id; } elseif ($value == -1) { $groups_denied[] = (int) $id; } } $groups_allowed = implode(',', $groups_allowed); $groups_denied = implode(',', $groups_denied); } if (!empty($_POST['blocks']) && is_array($_POST['blocks'])) { foreach ($_POST['blocks'] as $id => $block) { $_POST['blocks'][$id] = (int) $block; } } else { $_POST['blocks'] = array(); } $fields = array('namespace' => 'string', 'title' => 'string', 'body' => 'string', 'type' => 'string', 'permission_set' => 'int', 'groups_allowed' => 'string', 'groups_denied' => 'string', 'style' => 'string', 'status' => 'int'); $page_info = array('id' => (int) $_POST['page_id'], 'namespace' => $smcFunc['htmlspecialchars']($_POST['namespace'], ENT_QUOTES), 'title' => $smcFunc['htmlspecialchars']($_POST['title'], ENT_QUOTES), 'body' => $smcFunc['htmlspecialchars']($_POST['content'], ENT_QUOTES), 'type' => $_POST['type'], 'permission_set' => $permission_set, 'groups_allowed' => $groups_allowed, 'groups_denied' => $groups_denied, 'style' => sportal_parse_style('implode'), 'status' => !empty($_POST['status']) ? 1 : 0); if ($page_info['type'] == 'bbc') { preparsecode($page_info['body']); } if ($context['SPortal']['is_new']) { unset($page_info['id']); $smcFunc['db_insert']('', '{db_prefix}sp_pages', $fields, $page_info, array('id_page')); $page_info['id'] = $smcFunc['db_insert_id']('{db_prefix}sp_pages', 'id_page'); } else { $update_fields = array(); foreach ($fields as $name => $type) { $update_fields[] = $name . ' = {' . $type . ':' . $name . '}'; } $smcFunc['db_query']('', ' UPDATE {db_prefix}sp_pages SET ' . implode(', ', $update_fields) . ' WHERE id_page = {int:id}', $page_info); } $to_show = array(); $not_to_show = array(); $changes = array(); foreach ($context['page_blocks'] as $page_blocks) { foreach ($page_blocks as $block) { if ($block['shown'] && !in_array($block['id'], $_POST['blocks'])) { $not_to_show[] = $block['id']; } elseif (!$block['shown'] && in_array($block['id'], $_POST['blocks'])) { $to_show[] = $block['id']; } } } foreach ($to_show as $id) { if (empty($blocks[$id]['display']) && empty($blocks[$id]['display_custom']) || $blocks[$id]['display'] == 'sportal') { $changes[$id] = array('display' => 'portal,p' . $page_info['id'], 'display_custom' => ''); } elseif (in_array($blocks[$id]['display'], array('allaction', 'allboard'))) { $changes[$id] = array('display' => '', 'display_custom' => $blocks[$id]['display'] . ',p' . $page_info['id']); } elseif (in_array('-p' . $page_info['id'], explode(',', $blocks[$id]['display_custom']))) { $changes[$id] = array('display' => $blocks[$id]['display'], 'display_custom' => implode(',', array_diff(explode(',', $blocks[$id]['display_custom']), array('-p' . $page_info['id'])))); } elseif (empty($blocks[$id]['display_custom'])) { $changes[$id] = array('display' => implode(',', array_merge(explode(',', $blocks[$id]['display']), array('p' . $page_info['id']))), 'display_custom' => ''); } else { $changes[$id] = array('display' => $blocks[$id]['display'], 'display_custom' => implode(',', array_merge(explode(',', $blocks[$id]['display_custom']), array('p' . $page_info['id'])))); } } foreach ($not_to_show as $id) { if (count(array_intersect(array($blocks[$id]['display'], $blocks[$id]['display_custom']), array('sforum', 'allpages', 'all'))) > 0) { $changes[$id] = array('display' => '', 'display_custom' => $blocks[$id]['display'] . $blocks[$id]['display_custom'] . ',-p' . $page_info['id']); } elseif (empty($blocks[$id]['display_custom'])) { $changes[$id] = array('display' => implode(',', array_diff(explode(',', $blocks[$id]['display']), array('p' . $page_info['id']))), 'display_custom' => ''); } else { $changes[$id] = array('display' => implode(',', array_diff(explode(',', $blocks[$id]['display']), array('p' . $page_info['id']))), 'display_custom' => implode(',', array_diff(explode(',', $blocks[$id]['display_custom']), array('p' . $page_info['id'])))); } } foreach ($changes as $id => $data) { $smcFunc['db_query']('', ' UPDATE {db_prefix}sp_blocks SET display = {string:display}, display_custom = {string:display_custom} WHERE id_block = {int:id}', array('id' => $id, 'display' => $data['display'], 'display_custom' => $data['display_custom'])); } redirectexit('action=admin;area=portalpages'); } if (!empty($_POST['preview'])) { $permission_set = 0; $groups_allowed = $groups_denied = array(); if (!empty($_POST['permission_set'])) { $permission_set = (int) $_POST['permission_set']; } elseif (!empty($_POST['membergroups']) && is_array($_POST['membergroups'])) { foreach ($_POST['membergroups'] as $id => $value) { if ($value == 1) { $groups_allowed[] = (int) $id; } elseif ($value == -1) { $groups_denied[] = (int) $id; } } } $context['SPortal']['page'] = array('id' => $_POST['page_id'], 'page_id' => $_POST['namespace'], 'title' => $smcFunc['htmlspecialchars']($_POST['title'], ENT_QUOTES), 'body' => $smcFunc['htmlspecialchars']($_POST['content'], ENT_QUOTES), 'type' => $_POST['type'], 'permission_set' => $permission_set, 'groups_allowed' => $groups_allowed, 'groups_denied' => $groups_denied, 'style' => sportal_parse_style('implode'), 'status' => !empty($_POST['status'])); if ($context['SPortal']['page']['type'] == 'bbc') { preparsecode($context['SPortal']['page']['body']); } loadTemplate('PortalPages'); $context['SPortal']['preview'] = true; } elseif ($context['SPortal']['is_new']) { $context['SPortal']['page'] = array('id' => 0, 'page_id' => 'page' . mt_rand(1, 5000), 'title' => $txt['sp_pages_default_title'], 'body' => '', 'type' => 'bbc', 'permission_set' => 3, 'groups_allowed' => array(), 'groups_denied' => array(), 'style' => '', 'status' => 1); } else { $_REQUEST['page_id'] = (int) $_REQUEST['page_id']; $context['SPortal']['page'] = sportal_get_pages($_REQUEST['page_id']); } if ($context['SPortal']['page']['type'] == 'bbc') { $context['SPortal']['page']['body'] = str_replace(array('"', '<', '>', ' '), array('"', '<', '>', ' '), un_preparsecode($context['SPortal']['page']['body'])); } if ($context['SPortal']['page']['type'] != 'bbc') { $temp_editor = !empty($options['wysiwyg_default']); $options['wysiwyg_default'] = false; } $editorOptions = array('id' => 'content', 'value' => $context['SPortal']['page']['body'], 'width' => '95%', 'height' => '200px', 'preview_type' => 0); create_control_richedit($editorOptions); $context['post_box_name'] = $editorOptions['id']; if (isset($temp_editor)) { $options['wysiwyg_default'] = $temp_editor; } $context['SPortal']['page']['groups'] = sp_load_membergroups(); $context['SPortal']['page']['style'] = sportal_parse_style('explode', $context['SPortal']['page']['style'], !empty($context['SPortal']['preview'])); $context['page_title'] = $context['SPortal']['is_new'] ? $txt['sp_admin_pages_add'] : $txt['sp_admin_pages_edit']; $context['sub_template'] = 'pages_edit'; }
function fixColumnRows($column_id = null) { global $smcFunc; $blockList = getBlockInfo($column_id); $blockIds = array(); foreach ($blockList as $block) { $blockIds[] = $block['id']; } $counter = 0; foreach ($blockIds as $block) { $counter = $counter + 1; $smcFunc['db_query']('', ' UPDATE {db_prefix}sp_blocks SET row = {int:counter} WHERE id_block = {int:block}', array('counter' => $counter, 'block' => $block)); } }
/** * Loads all the defined portal blocks in to context */ function sportal_load_blocks() { global $context, $modSettings, $options; $context['SPortal']['sides'] = array(5 => array('id' => '5', 'name' => 'header', 'active' => true), 1 => array('id' => '1', 'name' => 'left', 'active' => !empty($modSettings['showleft'])), 2 => array('id' => '2', 'name' => 'top', 'active' => true), 3 => array('id' => '3', 'name' => 'bottom', 'active' => true), 4 => array('id' => '4', 'name' => 'right', 'active' => !empty($modSettings['showright'])), 6 => array('id' => '6', 'name' => 'footer', 'active' => true)); // Get the blocks in the system $blocks = getBlockInfo(null, null, true, true, true); // If the member has arranged the blocks, display them like that if (!empty($options['sp_block_layout'])) { $layout = @unserialize($options['sp_block_layout']); // If some bad arrangement data found its way in if ($layout === false) { resetMemberLayout(); } else { foreach ($layout as $id => $column) { if (empty($column) || empty($id) || !$context['SPortal']['sides'][$id]['active']) { continue; } foreach ($column as $item) { if (empty($blocks[$item])) { continue; } $blocks[$item]['style'] = sportal_parse_style('explode', $blocks[$item]['style'], true); $context['SPortal']['blocks'][$id][] = $blocks[$item]; unset($blocks[$item]); } $context['SPortal']['blocks']['custom_arrange'] = true; } } } if (!isset($context['SPortal']['blocks'])) { $context['SPortal']['blocks'] = array(); } foreach ($blocks as $block) { if (!$context['SPortal']['sides'][$block['column']]['active']) { continue; } if ($context['browser_body_id'] === 'mobile' && empty($block['mobile_view'])) { continue; } $block['style'] = sportal_parse_style('explode', $block['style'], true); $context['SPortal']['sides'][$block['column']]['last'] = $block['id']; $context['SPortal']['blocks'][$block['column']][] = $block; } foreach ($context['SPortal']['sides'] as $side) { if (empty($context['SPortal']['blocks'][$side['id']])) { $context['SPortal']['sides'][$side['id']]['active'] = false; } $context['SPortal']['sides'][$side['id']]['collapsed'] = $context['user']['is_guest'] ? !empty($_COOKIE['sp_' . $side['name']]) : !empty($options['sp_' . $side['name']]); } }
function sportal_init($standalone = false) { global $context, $sourcedir, $scripturl, $modSettings, $txt; global $settings, $options, $boarddir, $maintenance, $sportal_version; $sportal_version = '2.3.5'; if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach') { return; } if (!$standalone) { loadTemplate(false, 'portal'); if (!empty($context['right_to_left'])) { loadTemplate(false, 'portal_rtl'); } if (!empty($_REQUEST['action']) && in_array($_REQUEST['action'], array('admin', 'helpadmin'))) { loadLanguage('SPortalAdmin', sp_languageSelect('SPortalAdmin')); } if (!isset($settings['sp_images_url'])) { if (file_exists($settings['theme_dir'] . '/images/sp')) { $settings['sp_images_url'] = $settings['theme_url'] . '/images/sp'; } else { $settings['sp_images_url'] = $settings['default_theme_url'] . '/images/sp'; } } if (!empty($context['current_topic'])) { $context['can_add_article'] = allowedTo(array('sp_admin', 'sp_manage_articles', 'sp_add_article')); $context['can_remove_article'] = allowedTo(array('sp_admin', 'sp_manage_articles', 'sp_remove_article')); } $context['SPortal']['core_compat'] = $settings['name'] == 'Core Theme'; $context['SPortal']['on_portal'] = getShowInfo(0, 'portal', ''); } if (WIRELESS || $standalone && (isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode'])) || !empty($settings['disable_sp']) || empty($modSettings['sp_portal_mode']) || (!empty($modSettings['sp_maintenance']) || !empty($maintenance)) && !allowedTo('admin_forum') || isset($_GET['debug']) || empty($modSettings['allow_guestAccess']) && $context['user']['is_guest']) { $context['disable_sp'] = true; if ($standalone) { $get_string = ''; foreach ($_GET as $get_var => $get_value) { $get_string .= $get_var . (!empty($get_value) ? '=' . $get_value : '') . ';'; } redirectexit(substr($get_string, 0, -1)); } return; } if (!$standalone) { require_once $sourcedir . '/PortalBlocks.php'; if (SMF != 'SSI') { require_once $boarddir . '/SSI.php'; } loadTemplate('Portal'); loadLanguage('SPortal', sp_languageSelect('SPortal')); if (!empty($modSettings['sp_maintenance']) && !allowedTo('sp_admin')) { $modSettings['sp_portal_mode'] = 0; } if (empty($modSettings['sp_standalone_url'])) { $modSettings['sp_standalone_url'] = ''; } if ($modSettings['sp_portal_mode'] == 3) { $context += array('portal_url' => $modSettings['sp_standalone_url'], 'page_title' => $context['forum_name']); } else { $context += array('portal_url' => $scripturl); } if ($modSettings['sp_portal_mode'] == 1) { $context['linktree'][0] = array('url' => $scripturl . '?action=forum', 'name' => $context['forum_name']); } // If you want to remove Forum link when it is // alone, take out the following two comment lines. //if (empty($context['linktree'][1])) // $context['linktree'] = array(); if (!empty($context['linktree']) && $modSettings['sp_portal_mode'] == 1) { foreach ($context['linktree'] as $key => $tree) { if (strpos($tree['url'], '#c') !== false && strpos($tree['url'], 'action=forum#c') === false) { $context['linktree'][$key]['url'] = str_replace('#c', '?action=forum#c', $tree['url']); } } } } $context['standalone'] = $standalone; // Load the headers if necessary. sportal_init_headers(); $context['SPortal']['sides'] = array(5 => array('id' => '5', 'name' => 'header', 'active' => true), 1 => array('id' => '1', 'name' => 'left', 'active' => !empty($modSettings['showleft'])), 2 => array('id' => '2', 'name' => 'top', 'active' => true), 3 => array('id' => '3', 'name' => 'bottom', 'active' => true), 4 => array('id' => '4', 'name' => 'right', 'active' => !empty($modSettings['showright'])), 6 => array('id' => '6', 'name' => 'footer', 'active' => true)); $blocks = getBlockInfo(null, null, true, true, true); $context['SPortal']['blocks'] = array(); foreach ($blocks as $block) { if (!$context['SPortal']['sides'][$block['column']]['active']) { continue; } $block['style'] = sportal_parse_style('explode', $block['style'], true); $context['SPortal']['sides'][$block['column']]['last'] = $block['id']; $context['SPortal']['blocks'][$block['column']][] = $block; } foreach ($context['SPortal']['sides'] as $side) { if (empty($context['SPortal']['blocks'][$side['id']])) { $context['SPortal']['sides'][$side['id']]['active'] = false; } $context['SPortal']['sides'][$side['id']]['collapsed'] = $context['user']['is_guest'] ? !empty($_COOKIE['sp_' . $side['name']]) : !empty($options['sp_' . $side['name']]); } if (!empty($context['template_layers']) && !in_array('portal', $context['template_layers'])) { $context['template_layers'][] = 'portal'; } }
function sportal_admin_block_delete() { global $smcFunc; // Check if he can? checkSession('get'); // Make sure ID is an integer. $_REQUEST['block_id'] = (int) $_REQUEST['block_id']; // Do we have that? if (empty($_REQUEST['block_id'])) { fatal_lang_error('error_sp_id_empty', false); } // Make sure column ID is an integer too. $_REQUEST['col'] = (int) $_REQUEST['col']; // Only Admins can Remove PHP Blocks if (!allowedTo('admin_forum')) { $context['SPortal']['block'] = current(getBlockInfo(null, $_REQUEST['block_id'])); if ($context['SPortal']['block']['type'] == 'sp_php' && !allowedTo('admin_forum')) { fatal_lang_error('cannot_admin_forum', false); } } // We don't need it anymore. $smcFunc['db_query']('', ' DELETE FROM {db_prefix}sp_blocks WHERE id_block = {int:id}', array('id' => $_REQUEST['block_id'])); $smcFunc['db_query']('', ' DELETE FROM {db_prefix}sp_parameters WHERE id_block = {int:id}', array('id' => $_REQUEST['block_id'])); // Fix column rows. fixColumnRows($_REQUEST['col']); // Return back to the block list. redirectexit('action=admin;area=portalblocks'); }
/** * Interface for adding/editing a page */ public function action_sportal_admin_page_edit() { global $txt, $context, $options; $context['SPortal']['is_new'] = empty($_REQUEST['page_id']); $pages_errors = Error_Context::context('pages', 0); // Some help will be needed require_once SUBSDIR . '/Editor.subs.php'; require_once SUBSDIR . '/Post.subs.php'; // Convert this to BBC? if (!empty($_REQUEST['content_mode']) && $_POST['type'] === 'bbc') { require_once SUBSDIR . 'Html2BBC.class.php'; $bbc_converter = new Convert_BBC($_REQUEST['content']); $_REQUEST['content'] = $bbc_converter->get_bbc(); $_REQUEST['content'] = un_htmlspecialchars($_REQUEST['content']); $_POST['content'] = $_REQUEST['content']; } // Load in the blocks that can be used on a page $this->blocks = getBlockInfo(); $context['page_blocks'] = $this->_sportal_admin_page_load_blocks(); // Saving the work? if (!empty($_POST['submit']) && !$pages_errors->hasErrors()) { checkSession(); $this->_sportal_admin_page_edit_save(); } // Doing a quick look before you save or you messed up? if (!empty($_POST['preview']) || $pages_errors->hasErrors()) { $context['SPortal']['page'] = array('id' => $_POST['page_id'], 'page_id' => $_POST['namespace'], 'title' => Util::htmlspecialchars($_POST['title'], ENT_QUOTES), 'body' => Util::htmlspecialchars($_POST['content'], ENT_QUOTES), 'type' => $_POST['type'], 'permissions' => $_POST['permissions'], 'style' => sportal_parse_style('implode'), 'status' => !empty($_POST['status'])); // Fix up bbc errors before we go to the preview if ($context['SPortal']['page']['type'] == 'bbc') { preparsecode($context['SPortal']['page']['body']); } loadTemplate('PortalPages'); // Showing errors or a preview? if ($pages_errors->hasErrors()) { $context['pages_errors'] = array('errors' => $pages_errors->prepareErrors(), 'type' => $pages_errors->getErrorType() == 0 ? 'minor' : 'serious', 'title' => $txt['sp_form_errors_detected']); } else { $context['SPortal']['preview'] = true; } } elseif ($context['SPortal']['is_new']) { $context['SPortal']['page'] = array('id' => 0, 'page_id' => 'page' . mt_rand(1, 5000), 'title' => $txt['sp_pages_default_title'], 'body' => '', 'type' => 'bbc', 'permissions' => 3, 'style' => '', 'status' => 1); } else { $_REQUEST['page_id'] = (int) $_REQUEST['page_id']; $context['SPortal']['page'] = sportal_get_pages($_REQUEST['page_id']); } if ($context['SPortal']['page']['type'] === 'bbc') { $context['SPortal']['page']['body'] = str_replace(array('"', '<', '>', ' '), array('"', '<', '>', ' '), un_preparsecode($context['SPortal']['page']['body'])); } // Set up the editor, values, initial state, etc if ($context['SPortal']['page']['type'] !== 'bbc') { // No wizzy mode if they don't need it $temp_editor = !empty($options['wysiwyg_default']); $options['wysiwyg_default'] = false; } $editorOptions = array('id' => 'content', 'value' => $context['SPortal']['page']['body'], 'width' => '100%', 'height' => '225px', 'preview_type' => 2); create_control_richedit($editorOptions); $context['post_box_name'] = $editorOptions['id']; if (isset($temp_editor)) { $options['wysiwyg_default'] = $temp_editor; } // Set the editor box as needed (editor or textbox, etc) addInlineJavascript(' $(window).load(function() { diewithfire = window.setTimeout(function() {sp_update_editor("' . $context['SPortal']['page']['type'] . '", "");}, 200); }); '); // Permissions $context['SPortal']['page']['permission_profiles'] = sportal_get_profiles(null, 1, 'name'); if (empty($context['SPortal']['page']['permission_profiles'])) { fatal_lang_error('error_sp_no_permission_profiles', false); } // And for the template $context['SPortal']['page']['style'] = sportal_parse_style('explode', $context['SPortal']['page']['style'], !empty($context['SPortal']['preview'])); $context['SPortal']['page']['body'] = sportal_parse_content($context['SPortal']['page']['body'], $context['SPortal']['page']['type'], 'return'); $context['page_title'] = $context['SPortal']['is_new'] ? $txt['sp_admin_pages_add'] : $txt['sp_admin_pages_edit']; $context['sub_template'] = 'pages_edit'; }
/** * Function for deleting a block. */ public function action_sportal_admin_block_delete() { global $context; // Check if he can? checkSession('get'); // Make sure ID is an integer. $_REQUEST['block_id'] = (int) $_REQUEST['block_id']; // Do we have that? if (empty($_REQUEST['block_id'])) { fatal_lang_error('error_sp_id_empty', false); } // Make sure column ID is an integer too. $_REQUEST['col'] = (int) $_REQUEST['col']; // Only Admins can Remove PHP Blocks if (!allowedTo('admin_forum')) { $context['SPortal']['block'] = current(getBlockInfo(null, $_REQUEST['block_id'])); if ($context['SPortal']['block']['type'] == 'sp_php' && !allowedTo('admin_forum')) { fatal_lang_error('cannot_admin_forum', false); } } // We don't need it anymore. sp_block_delete($_REQUEST['block_id']); // Fix column rows. fixColumnRows($_REQUEST['col']); // Return back to the block list. redirectexit('action=admin;area=portalblocks'); }