function ShowBoardNewsMain() { global $context, $txt; if (empty($_POST['bn-save'])) { checkSession('get'); } //Save if (!empty($_POST['bn-save'])) { checkSession('post'); if (!empty($_POST['boards'])) { foreach ($_POST['boards'] as $i => $v) { if (!is_numeric($_POST['boards'][$i])) { unset($_POST['boards'][$i]); } } $id_boards = implode(',', $_POST['boards']); } $_POST['board_news_limit'] = !empty($_POST['board_news_limit']) && is_numeric($_POST['board_news_limit']) ? (int) $_POST['board_news_limit'] : 10; $_POST['board_news_lenght'] = !empty($_POST['board_news_lenght']) && is_numeric($_POST['board_news_lenght']) ? (int) $_POST['board_news_lenght'] : 0; //save the ultimate portal settings section board news saveUltimatePortalSettings("config_board_news"); //save the select multiple in the ultimate portal table settings $board_news_view = $id_boards; $configUltimatePortalVar['board_news_view'] = $board_news_view; updateUltimatePortalSettings($configUltimatePortalVar, 'config_board_news'); redirectexit('action=adminportal;area=board-news;sa=bn-main;' . $context['session_var'] . '=' . $context['session_id']); } up_loadJumpTo(); $context['sub_template'] = 'board_news_main'; $context['page_title'] = $txt['ultport_admin_board_news_title'] . ' - ' . $txt['ultport_admin_board_news_main'] . ' - ' . $txt['ultport_admin_module_title2']; }
function saveUltimatePortalSettings($section) { global $context; prepareUltimatePortalSettingContext($section); foreach ($context['up-config_vars'] as $configvars) { $configUltimatePortalVar[$configvars['variable']] = !empty($_POST[$configvars['variable']]) ? $_POST[$configvars['variable']] : ''; } updateUltimatePortalSettings($configUltimatePortalVar, $section); }
function ShowSEO() { global $context, $txt, $sourcedir, $boarddir, $smcFunc, $ultimateportalSettings; require_once $sourcedir . '/Subs-UltimatePortal.php'; //Save Robot if (!empty($_POST['save_robot'])) { checkSession('post'); if (!empty($_POST['robots_add'])) { $robots_txt = stripslashes($_POST['robots_add']); $filename = $boarddir . '/robots.txt'; @chmod($filename, 0644); if (!($handle = fopen($filename, 'w'))) { fatal_error($txt['ultport_error_fopen_error'] . $filename . '.', false); } // Write the headers to our opened file. if (!fwrite($handle, $robots_txt)) { fatal_error($txt['ultport_error_fopen_error'] . $filename . '.', false); } fclose($handle); } } //Save Config General if (!empty($_POST['save_seo_config'])) { checkSession('post'); //save the ultimate portal settings section seo saveUltimatePortalSettings("config_seo"); redirectexit('action=adminportal;area=preferences;sa=seo;' . $context['session_var'] . '=' . $context['session_id']); } //Save Google Verification Code if (!empty($_POST['save_seo_google_verification_code'])) { checkSession('post'); $verification = $smcFunc['db_escape_string']($_POST['seo_google_verification_code']); $extension_code = strtolower(substr(strrchr($verification, '.'), 1)); if (!empty($extension_code)) { fatal_error($txt['seo_google_verification_code_error'], false); } //save the ultimate portal settings section seo $configUltimatePortalVar['seo_google_verification_code'] = empty($ultimateportalSettings['seo_google_verification_code']) ? $verification : $ultimateportalSettings['seo_google_verification_code'] . ',' . $verification; updateUltimatePortalSettings($configUltimatePortalVar, 'config_seo'); if (!empty($verification)) { $filename = $boarddir . '/' . $verification . '.html'; $content = 'google-site-verification: ' . $verification . '.html'; if (!($handle = fopen($filename, 'a'))) { fatal_error($txt['ultport_error_fopen_error'] . $filename, false); } fwrite($handle, $content); fclose($handle); } redirectexit('action=adminportal;area=preferences;sa=seo;' . $context['session_var'] . '=' . $context['session_id']); } //Delete google Verification Code? if (!empty($_REQUEST['file'])) { $verification = $smcFunc['db_escape_string']($_REQUEST['file']); unlink($boarddir . '/' . $verification . '.html'); $verifications_codes = explode(',', $ultimateportalSettings['seo_google_verification_code']); $count = count($verifications_codes); if ($count > 1) { for ($i = 0; $i <= $count; $i++) { if (!empty($verifications_codes[$i])) { //save the ultimate portal settings section seo if ($verifications_codes[$i] == $verification) { $position = $i; } } } } else { $configUltimatePortalVar['seo_google_verification_code'] = ''; } //Not first? if (!empty($position) && $position >= 1 && ($position != count($verifications_codes) - 1 || $position == count($verifications_codes) - 1)) { $configUltimatePortalVar['seo_google_verification_code'] = str_replace(',' . $verification, '', $ultimateportalSettings['seo_google_verification_code']); } //Okay, is first :P if ($count > 1 && $position == 0) { $configUltimatePortalVar['seo_google_verification_code'] = str_replace($verification . ',', '', $ultimateportalSettings['seo_google_verification_code']); } updateUltimatePortalSettings($configUltimatePortalVar, 'config_seo'); redirectexit('action=adminportal;area=preferences;sa=seo;' . $context['session_var'] . '=' . $context['session_id']); } if (file_exists($boarddir . '/robots.txt')) { $context['robots_txt'] = file_get_contents($boarddir . '/robots.txt'); } $context['sub_template'] = 'preferences_seo'; $context['page_title'] = $txt['ultport_seo_title'] . ' - ' . $txt['ultport_preferences_title']; }