/** * Init all variables and load the settings from the database. * Check the requests and prepare the templates to load. */ function PortaMx($doinit = false) { global $context, $modSettings, $boardurl, $scripturl, $user_info, $maintenance, $language, $pmxCacheFunc, $sc, $cookiename, $txt; // we can exit on this... if (defined('PortaMx') || isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach' && empty($doinit)) { if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach' && !empty($user_info['possibly_robot'])) { redirectexit(); } else { return; } } define('PortaMx', 1); // no sign up for robots please !! if (!empty($user_info['possibly_robot']) && !empty($_REQUEST['action']) && $_REQUEST['action'] == 'signup') { redirectexit(); } if (empty($user_info['possibly_robot'])) { // portal enable/disable request ? if ((isset($_REQUEST['pmxportal']) || isset($_REQUEST['pmxsef'])) && allowedTo('admin_forum')) { $mode = 'pmx' . (isset($_REQUEST['pmxportal']) ? 'portal' : 'sef'); updateSettings(array($mode . '_disabled' => $_REQUEST[$mode] == 'off' ? '1' : '0')); redirectexit(); } // clear PortaMx cache request ? if (isset($_GET['action']) && isset($_GET['area']) && (in_array($_GET['action'], array('admin', 'portamx')) && $_GET['area'] == 'pmx_cache')) { if (isset($_GET[$_SESSION['session_var']]) && $_GET[$_SESSION['session_var']] == $sc) { $pmxCacheFunc['clean'](); $_SESSION['pmx_cache_cleared'] = true; } if (isset($_SESSION['pmx_last_request'])) { redirectexit($_SESSION['pmx_last_request']); } } elseif (pmx_checkECL_Cookie() && strpos($_SERVER['REQUEST_URL'], 'viewsmfile') === false) { $_SESSION['pmx_last_request'] = $_SERVER['REQUEST_URL']; } $lang = $pmxCacheFunc['get']($user_info['ip'] . '-lang'); if (!pmx_checkECL_Cookie()) { if ($lang === null) { // get browser language $browserlang = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']) : ''; if (preg_match_all('~en\\b|de\\b~i', $browserlang, $temp) > 0) { $avail = array_keys(PortaMx_getLanguages()); if (in_array('de', $temp[0])) { if (in_array('german', $avail)) { $lang = 'german'; } elseif (in_array('german-utf8', $avail)) { $lang = 'german-utf8'; } } else { $lang = $language; } $_POST['language'] = $lang; $_POST['redir'] = pmx_http_build_query($_GET); } } else { $context['pmx']['currlang'] = $context['user']['language'] = $user_info['language'] = $language = $lang; } // need to releoad base language loadLanguage('index+Modifications'); } else { if ($lang !== null) { $_POST['language'] = $lang; $_POST['redir'] = pmx_http_build_query($_GET); } } // check if a language change requested if (!empty($_POST['language'])) { $pmxCacheFunc['clean'](); $context['pmx']['currlang'] = $context['user']['language'] = $user_info['language'] = $language = $_POST['language']; if (pmx_checkECL_Cookie()) { // Make it permanent for members. if (!empty($user_info['id'])) { updateMemberData($user_info['id'], array('lngfile' => $user_info['language'])); } else { $_SESSION['language'] = $user_info['language']; } } else { $pmxCacheFunc['put']($user_info['ip'] . '-lang', $language, 360, false); $_POST['redir'] = pmx_http_build_query($_GET); } if (isset($_POST['redir'])) { redirectexit($_POST['redir']); } } } if (empty($modSettings['pmx_eclmodal']) && !pmx_checkECL_Cookie() && (!empty($_REQUEST['action']) && $_REQUEST['action'] != 'xml' || !empty($_REQUEST['page']) || !empty($_REQUEST['cat']) || !empty($_REQUEST['art']))) { if (empty($user_info['possibly_robot']) && !empty($_REQUEST['action']) && $_REQUEST['action'] == 'login') { setupMenuContext(); pmx_ECL_Error($_REQUEST['action']); } else { redirectexit(); } } // redirect on illegal request if (!empty($_REQUEST['pmxportal']) || !empty($_REQUEST['pmxsef']) || !empty($_REQUEST['pmxerror']) && !empty($_REQUEST['action'])) { redirectexit('pmxerror=unknown'); } // check if a permanent theme change requested if (isset($_REQUEST['theme']) && isset($_REQUEST['pmxrd'])) { PortaMx_ChangeTheme($_REQUEST['theme'], $_REQUEST['pmxrd']); } // load all settings PortaMx_getSettings(); // shoutbox POST request? if (!empty($_POST['pmx_shout']) && !empty($_POST['shoutbox_id'])) { PortaMx_GetShoutbox($_POST['shoutbox_id']); if (pmx_checkECL_Cookie()) { $_SESSION['pmx_shoutreload'] = true; } exit; } // exit on follow actions $rqaction = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; if (isset($_REQUEST['xml']) || in_array($rqaction, array('jseditor', 'jsoption', '.xml', 'xmlhttp', 'verificationcode', 'printpage'))) { return; } // login with redirect .. correct SEF url if ($rqaction == 'login' && !empty($_SESSION['old_url']) && function_exists('pmxsef_query')) { $_SESSION['old_url'] = $scripturl . pmx_http_build_query(pmxsef_query(rawurldecode(ltrim(str_replace($boardurl, '', $_SESSION['old_url']), '/')))); } // check if a pmxscriptdebug/pmxspidertest requested $tmp = isset($_GET['pmxscriptdebug']) ? 'pmxscriptdebug' : (isset($_GET['pmxspidertest']) ? 'pmxspidertest' : ''); if (!empty($tmp) && in_array($_GET[$tmp], array('on', 'off'))) { if (allowPmx('pmx_admin')) { if ($tmp == 'pmxscriptdebug') { pmx_setcookie($tmp, $_GET[$tmp] == 'on' ? '1' : ''); unset($_GET[$tmp]); redirectexit(pmx_http_build_query($_GET)); } elseif ($tmp == 'pmxspidertest' && $_GET[$tmp] == 'on' && !empty($modSettings['pmx_ecl'])) { $logCook = pmx_getcookie($cookiename); pmx_setcookie($tmp, $logCook); pmx_setcookie($cookiename, ''); pmx_setcookie('pmx_eclauth', ''); pmx_setcookie('PHPSESSID', ''); unset($logCook); redirectexit(); } } elseif ($tmp == 'pmxspidertest' && $_GET[$tmp] == 'off' && pmx_getcookie('pmxspidertest')) { $udata = pmx_getcookie($tmp); if (isset($udata) && is_array($dtmp = unserialize($udata)) && count($dtmp == 4)) { pmx_setECL_Cookie(); pmx_setcookie($cookiename, $udata, $dtmp[2]); unset($dtmp); unset($udata); } pmx_setcookie('pmxspidertest', ''); redirectexit(); } } // load common javascript loadJavascriptFile(PortaMx_loadCompressed('PortaMx.js'), array('external' => true)); addInlineJavascript(' var pmx_restore_top = ' . intval(!empty($context['pmx']['settings']['restoretop'])) . ';'); if ($doinit || !empty($modSettings['pmxportal_disabled'])) { loadLanguage($context['pmx_templatedir'] . 'PortaMx'); loadCSSFile(PortaMx_loadCompressed('portamx.css'), array('external' => true)); return; } // on Admin or Moderate load admin language, css and javascript if (($rqaction == 'admin' || $rqaction == 'portamx') && isset($_REQUEST['area']) && in_array($_REQUEST['area'], explode(',', $context['pmx']['areas']))) { loadJavascriptFile(PortaMx_loadCompressed('PortaMxAdmin.js'), array('external' => true)); loadCSSFile(PortaMx_loadCompressed('portamx_admin.css'), array('external' => true)); loadLanguage($context['pmx_templatedir'] . 'Admin'); addInlineJavascript("\n\t" . 'BlockActive=\'' . $txt['pmx_status_activ'] . ' - ' . $txt['pmx_status_change'] . '\';' . "\n\t" . 'BlockInactive=\'' . $txt['pmx_status_inactiv'] . ' - ' . $txt['pmx_status_change'] . '\';'); } // Error request? if (!empty($_REQUEST['pmxerror'])) { return PmxError(); } // check Error request, Forum request $context['pmx']['forumReq'] = !empty($_REQUEST['action']) || !empty($context['current_board']) || !empty($context['current_topic']); if (empty($context['pmx']['forumReq']) && !empty($context['pmx']['settings']['other_actions'])) { $reqtyp = Pmx_StrToArray($context['pmx']['settings']['other_actions']); foreach ($reqtyp as $rtyp) { @(list($rtyp, $rval) = Pmx_StrToArray($rtyp, '=')); $context['pmx']['forumReq'] = $context['pmx']['forumReq'] || isset($_REQUEST[$rtyp]) && (is_null($rval) || $_REQUEST[$rtyp] == $rval); } } // check Page, category, article request $pmxRequestTypes = array('spage', 'art', 'cat', 'child'); $context['pmx']['pageReq'] = array(); foreach ($pmxRequestTypes as $type) { if (empty($_REQUEST['action']) && !empty($_REQUEST[$type])) { $context['pmx']['pageReq'][$type] = PortaMx_makeSafe($_REQUEST[$type]); } } // no request on forum or pages and no frontpage .. go to forum if (empty($context['pmx']['forumReq']) && empty($context['pmx']['pageReq']) && $context['pmx']['settings']['frontpage'] == 'none') { $_REQUEST['action'] = $_GET['action'] = 'community'; $context['pmx']['forumReq'] = true; } // Disable HighSlide on action? if (isset($_REQUEST['action']) && isset($context['pmx']['settings']['noHS_onaction'])) { $noHighSlide = isset($context['pmx']['settings']['noHS_onaction']) ? Pmx_StrToArray($context['pmx']['settings']['noHS_onaction']) : array(); if (in_array($_REQUEST['action'], $noHighSlide)) { $context['pmx']['settings']['disableHS'] = 1; } } // Admin panel/block hidding ? $hideRequest = array_intersect($context['pmx']['extracmd'], array_keys($_REQUEST)); if (!empty($hideRequest) && allowPmx('pmx_admin')) { @(list($hideRequest) = array_values($hideRequest)); $mode = substr($hideRequest, 5); $hidetyp = substr($hideRequest, 0, 5); $offparts = empty($modSettings['pmx_' . $hidetyp . 'off']) ? array() : Pmx_StrToArray($modSettings['pmx_' . $hidetyp . 'off']); if ($mode == 'off') { if ($hidetyp == 'panel') { $offparts = array_intersect($_REQUEST[$hideRequest] == 'all' ? $context['pmx']['block_sides'] : array_merge($offparts, Pmx_StrToArray($_REQUEST[$hideRequest])), $context['pmx']['block_sides']); } else { $offparts = array_merge($offparts, Pmx_StrToIntArray($_REQUEST[$hideRequest])); } } else { if ($hidetyp == 'panel') { $offparts = array_intersect($_REQUEST[$hideRequest] == 'all' ? array() : array_diff($offparts, Pmx_StrToArray($_REQUEST[$hideRequest])), $context['pmx']['block_sides']); } else { $offparts = $_REQUEST[$hideRequest] == 'all' ? array() : array_diff($offparts, Pmx_StrToIntArray($_REQUEST[$hideRequest])); } } updateSettings(array('pmx_' . $hidetyp . 'off' => implode(',', $offparts))); unset($_GET[$hideRequest]); redirectexit(pmx_http_build_query($_GET)); } // check all the actions and more... if (empty($context['pmx']['forumReq'])) { // if a redirect request, exit $requrl = strpos($_SERVER['REQUEST_URL'], substr($scripturl, 0, strrpos($scripturl, '/'))) === false ? $_SERVER['REQUEST_URL'] : $scripturl; if (substr($requrl, 0, strrpos($requrl, '/')) != substr($scripturl, 0, strrpos($scripturl, '/'))) { return; } // we use the frontpage ? $useFront = $context['pmx']['settings']['frontpage'] == 'none' && empty($context['pmx']['pageReq']) ? '' : 'frontpage'; // get all block on active panels they can view $context['pmx']['viewblocks'] = getPanelsToShow($useFront); // frontpage and/or Page blocks exist ? if (!empty($maintenance) && $context['pmx']['settings']['frontpage'] != 'none' || empty($useFront) || !empty($context['pmx']['show_pagespanel']) || !empty($context['pmx']['show_frontpanel']) && $context['pmx']['settings']['frontpage'] != 'none') { // setup headers PortaMx_headers('frontpage'); $context['robot_no_index'] = empty($context['pmx']['settings']['indexfront']); if ($context['pmx']['settings']['frontpage'] == 'fullsize') { loadTemplate($context['pmx_templatedir'] . 'Frontpage'); $context['template_layers'] = array('fronthtml', 'portamx'); call_integration_hook('integrate_load_theme'); } else { loadTemplate($context['pmx_templatedir'] . 'Mainindex'); $context['template_layers'][] = 'portamx'; } if (!empty($context['pmx']['pageReq']) || empty($context['pmx']['forumReq']) && $context['pmx']['settings']['frontpage'] != 'none') { loadTemplate($context['pmx_templatedir'] . 'PortaMx'); } } else { // page req error? if (!empty($context['pmx']['pageReq']) && empty($context['pmx']['show_pagespanel'])) { redirectexit('pmxerror=page'); } // else go to forum $_REQUEST['action'] = $_GET['action'] = !empty($maintenance) && empty($user_info['is_admin']) ? '' : 'community'; $context['pmx']['forumReq'] = true; $context['pmx']['viewblocks'] = null; } } if (!empty($context['pmx']['forumReq'])) { // get the action $action = isset($_REQUEST['action']) ? $_REQUEST['action'] == 'collapse' ? 'community' : $_REQUEST['action'] : (isset($_REQUEST['board']) ? 'boards' : (isset($_REQUEST['topic']) ? 'topics' : '')); // get all block on active panels they can view $context['pmx']['viewblocks'] = getPanelsToShow($action); // setup headers PortaMx_headers($action); // load the "Main" template on pages, cats or arts if (!empty($context['pmx']['pageReq'])) { loadTemplate($context['pmx_templatedir'] . 'PortaMx'); } loadTemplate($context['pmx_templatedir'] . 'Mainindex'); $context['template_layers'][] = 'portamx'; } // Load the Frame template loadTemplate($context['pmx_templatedir'] . 'Frames'); // supress these links if ECL not accepted if (!empty($rqaction) && !pmx_checkECL_Cookie() && isset($modSettings['pmx_eclmodalaction']) && in_array($rqaction, Pmx_StrToArray($modSettings['pmx_eclmodalaction']))) { pmx_ECL_Error('request'); } // Create the linktree return pmx_MakeLinktree(); }
/** * Receive all the Posts from Settings Manager, check and save it. * Finally the Admin settings are prepared and the templare loaded. */ function PortaMx_AdminSettings() { global $boarddir, $scripturl, $smcFunc, $context, $modSettings, $txt, $pmxCacheFunc; $admMode = PortaMx_makeSafe($_GET['action']); $pmx_area = PortaMx_makeSafe($_GET['area']); if (($admMode == 'admin' || $admMode == 'portamx') && ($pmx_area == 'pmx_settings' || $pmx_area == 'pmx_sefengine') && allowPmx('pmx_admin')) { if ($admMode == 'admin') { // fix the linktree foreach ($context['linktree'] as $key => $data) { if (strpos($data['url'], 'pmx_settings') !== false || strpos($data['url'], 'pmx_sefengine') !== false) { $context['linktree'] = array_merge(array_slice($context['linktree'], 0, $key), array(array('url' => $scripturl . '?action=admin;area=pmx_center;' . $context['session_var'] . '=' . $context['session_id'], 'name' => $txt['pmx_extension'])), array_slice($context['linktree'], $key, count($context['linktree']) - $key)); break; } } } require_once $context['pmx_sourcedir'] . 'AdminSubs.php'; $context['pmx']['subaction'] = isset($_GET['sa']) ? $_GET['sa'] : ($pmx_area == 'pmx_sefengine' ? '' : 'globals'); // From template ? if (PortaMx_checkPOST()) { checkSession('post'); $currentPanel = ''; // check the Post array if (isset($_POST['save_settings']) && !empty($_POST['save_settings'])) { // check defined numeric vars (check_num_vars holds the posted array to check like [varname][varname] ...) if (isset($_POST['check_num_vars'])) { foreach ($_POST['check_num_vars'] as $val) { $data = explode(',', $val); $post = '$_POST' . str_replace(array('[', ']'), array('[\'', '\']'), $data[0]); if (eval("return isset({$post});") && eval("return !is_numeric({$post});")) { eval("{$post} = {$data['1']};"); } } unset($_POST['check_num_vars']); } if (!empty($_POST['curPanel'])) { $currentPanel = 'pn=' . $_POST['curPanel'] . ';'; } // access update? if (!empty($_POST['update_access'])) { $perms = array('pmx_promote' => array(), 'pmx_create' => array(), 'pmx_articles' => array(), 'pmx_blocks' => array(), 'pmx_admin' => array()); if (isset($_POST['setaccess'])) { foreach ($_POST['setaccess'] as $acsname => $acsdata) { $perms[$acsname] = $acsdata; } } $smcFunc['db_insert']('replace', ' {db_prefix}portamx_settings', array('varname' => 'string', 'config' => 'string'), array('permissions', serialize($perms)), array('varname')); // clear settins cache $pmxCacheFunc['clean'](); } elseif (!empty($_POST['update_pmxsef'])) { $arrayToken = array('pmxsef_stripchars', 'pmxsef_actions'); foreach ($_POST as $token => $value) { if (substr($token, 0, 7) == 'pmxsef_') { // check... if ($token == 'pmxsef_spacechar') { $_POST[$token] = !in_array(substr($_POST[$token], 0, 1), array('-', '_', '')) ? '-' : (!empty($_POST[$token]) ? substr($_POST[$token], 0, 1) : ''); } elseif ($token == 'pmxsef_ssefspace') { $_POST[$token] = substr($_POST[$token], 0, 1); } elseif ($token == 'pmxsef_aliasactions') { $alias = array(); $tmp = Pmx_StrToArray($_POST[$token], ','); foreach ($tmp as $d) { $t = Pmx_StrToArray($d, '='); if (!in_array($t[0], array('admin', 'portamx'))) { $alias[$t[1]] = $t[0]; } } $_POST[$token] = serialize($alias); } elseif ($token == 'pmxsef_ignorerequests') { $alias = array(); $tmp = Pmx_StrToArray($_POST[$token], ','); foreach ($tmp as $d) { $t = Pmx_StrToArray($d, '='); $alias[$t[0]] = $t[1]; } $_POST[$token] = serialize($alias); } elseif (in_array($token, $arrayToken)) { $_POST[$token] = implode(',', Pmx_StrToArray($_POST[$token], ',')); } if ($token != 'pmxsef_enable') { $smcFunc['db_insert']('replace', ' {db_prefix}settings', array('variable' => 'string', 'value' => 'string'), array($token, $_POST[$token]), array('variable')); } } } // alway disable SEF if no .htaccess or web.config found if ((file_exists($boarddir . '/.htaccess') || file_exists($boarddir . '/web.config')) == false) { $_POST['pmxsef_enable'] = '0'; } // setup the the SMF hooks $hooklist = array('integrate_pre_load' => 'pmxsef_convertSEF', 'integrate_buffer' => 'ob_pmxsef', 'integrate_redirect' => 'pmxsef_Redirect', 'integrate_outgoing_email' => 'pmxsef_EmailOutput', 'integrate_exit' => 'pmxsef_XMLOutput', 'integrate_fix_url' => 'pmxsef_fixurl'); // get the hooks from database $smfhooks = array(); $request = $smcFunc['db_query']('', ' SELECT variable, value FROM {db_prefix}settings WHERE variable IN ({array_string:hooks})', array('hooks' => array_keys($hooklist))); if ($smcFunc['db_num_rows']($request) > 0) { while ($row = $smcFunc['db_fetch_assoc']($request)) { $smfhooks[$row['variable']] = $row['value']; } $smcFunc['db_free_result']($request); } // update the hooks foreach ($hooklist as $hookname => $value) { if (isset($smfhooks[$hookname])) { $smfhooks[$hookname] = trim((!empty($_POST['pmxsef_enable']) ? $value . ',' : '') . trim(str_replace($value, '', $smfhooks[$hookname]), ','), ','); } else { $smfhooks[$hookname] = trim(!empty($_POST['pmxsef_enable']) ? $value : ''); } $smcFunc['db_insert']('replace', ' {db_prefix}settings', array('variable' => 'string', 'value' => 'string'), array($hookname, $smfhooks[$hookname]), array('variable')); } if (!empty($_POST['pmxsef_enable'])) { $oldState = intval(!empty($modSettings['queryless_urls'])); updateSettings(array('queryless_urls' => '0')); $smcFunc['db_insert']('replace', ' {db_prefix}settings', array('variable' => 'string', 'value' => 'string'), array('oldstate_queryless_urls', $oldState), array('variable')); } else { if (isset($modSettings['oldstate_queryless_urls'])) { updateSettings(array('queryless_urls' => $modSettings['oldstate_queryless_urls'])); } } // clear cache $pmxCacheFunc['clean'](); } else { $config = array(); $request = $smcFunc['db_query']('', ' SELECT config FROM {db_prefix}portamx_settings WHERE varname = {string:settings}', array('settings' => 'settings')); if ($smcFunc['db_num_rows']($request) > 0) { $row = $smcFunc['db_fetch_assoc']($request); $smcFunc['db_free_result']($request); $config = unserialize($row['config']); } $setKeys = array_diff(array_keys($_POST), array('pmx_fronttheme', 'pmx_frontthempg', 'pmx_ecl', 'pmx_eclmodal', 'pmx_eclmodalmobi', 'pmx_eclmodaltop', 'pmx_eclmodalaction', 'save_settings', 'sa', 'sc')); foreach ($setKeys as $key) { if ($key == 'promotes') { $promo = Pmx_StrToIntArray($_POST[$key]); $smcFunc['db_query']('', ' UPDATE {db_prefix}portamx_settings SET config = {string:config} WHERE varname = {string:settings}', array('config' => serialize($promo), 'settings' => 'promotes')); // find all promoted block $blocks = null; $request = $smcFunc['db_query']('', ' SELECT id FROM {db_prefix}portamx_blocks WHERE active = 1 AND blocktype = {string:blocktype}', array('blocktype' => 'promotedposts')); while ($row = $smcFunc['db_fetch_assoc']($request)) { $blocks[] = $row['id']; } $smcFunc['db_free_result']($request); $_SESSION['pmx_refresh_promote'] = $blocks; } else { if ($key == 'dl_access') { $_POST['dl_access'] = implode(',', $_POST['dl_access']); } $config[$key] = $_POST[$key]; } } $smcFunc['db_query']('', ' UPDATE {db_prefix}portamx_settings SET config = {string:config} WHERE varname = {string:settings}', array('config' => serialize($config), 'settings' => 'settings')); // other settings they stored in smf_settings table $setKeys = array('pmx_fronttheme', 'pmx_frontthempg', 'pmx_ecl', 'pmx_eclmodal', 'pmx_eclmodalmobi', 'pmx_eclmodaltop', 'pmx_eclmodalaction', 'pmx_quickreply'); foreach ($setKeys as $key) { if (isset($_POST[$key])) { $smcFunc['db_insert']('replace', ' {db_prefix}settings', array('variable' => 'string', 'value' => 'string'), array($key, $_POST[$key]), array('variable')); } } // set frontmode flag $smcFunc['db_insert']('replace', ' {db_prefix}settings', array('variable' => 'string', 'value' => 'string'), array('pmx_frontmode', $config['frontpage'] == 'none' ? '0' : '1'), array('variable')); if (isset($_POST['pmx_ecl'])) { pmx_setcookie('pmx_eclauth', ''); if (!empty($_POST['pmx_ecl'])) { pmx_setECL_Cookie(true); } } // clear cached values $pmxCacheFunc['clean'](); } } redirectexit('action=' . $admMode . ';area=' . $pmx_area . (!empty($context['pmx']['subaction']) ? ';sa=' . $context['pmx']['subaction'] : '') . ';' . $currentPanel . $context['session_var'] . '=' . $context['session_id']); } // SEF engine settings ? if ($pmx_area == 'pmx_sefengine') { // pmxsef default settings $context['pmx']['pmxsef_enable'] = '0'; $context['pmx']['pmxsef_lowercase'] = '1'; $context['pmx']['pmxsef_autosave'] = '0'; $context['pmx']['pmxsef_spacechar'] = '-'; $context['pmx']['pmxsef_ssefspace'] = ''; $context['pmx']['pmxsef_stripchars'] = '",&,<,>,~,!,@,#,$,%,^,&,*,(,),-,=,+,<,[,{,],},>,;,:,\',",/,?,\\,|'; $context['pmx']['pmxsef_singletoken'] = 'add,advanced,all,asc,calendar,check,children,conversation,desc,home,kstart,nw,profile,save,sound,togglebar,topicseen,view,viewweek,xml'; $context['pmx']['pmxsef_actions'] = 'about:mozilla,about:unknown,activate,admin,announce,attachapprove,buddy,calendar,clock,collapse,community,coppa,credits,deletemsg,display,dlattach,editpoll,editpoll2,emailuser,findmember,groups,help,helpadmin,im,jseditor,jsmodify,jsoption,keepalive,lock,lockvoting,login,login2,logout,markasread,mergetopics,mlist,moderate,modifycat,modifykarma,movetopic,movetopic2,notify,notifyboard,openidreturn,pm,portamx,post,post2,printpage,profile,promote,quotefast,quickmod,quickmod2,recent,register,register2,reminder,removepoll,removetopic2,reporttm,requestmembers,restoretopic,search,search2,sendtopic,smstats,suggest,spellcheck,splittopics,stats,sticky,trackip,unread,unreadreplies,verificationcode,viewprofile,vote,viewquery,viewsmfile,who,.xml,xmlhttp'; $context['pmx']['pmxsef_ignoreactions'] = ''; $context['pmx']['pmxsef_aliasactions'] = ''; $context['pmx']['pmxsef_ignorerequests'] = ''; $context['pmx']['pmxsef_codepages'] = '/PortaMx/sefcodepages/x'; $nocheck = array('pmxsef_enable', 'pmxsef_lowercase', 'pmxsef_spacechar'); // read the settings from database $request = $smcFunc['db_query']('', ' SELECT variable, value FROM {db_prefix}settings WHERE variable LIKE {string:variable}', array('variable' => 'pmxsef_%')); if ($smcFunc['db_num_rows']($request) > 0) { while ($row = $smcFunc['db_fetch_assoc']($request)) { $value = trim($row['value']); if ($row['variable'] == 'pmxsef_aliasactions') { $tmp = unserialize($value); if (!empty($tmp)) { foreach ($tmp as $act => $alias) { $context['pmx'][$row['variable']][] = $alias . '=' . $act; } $context['pmx'][$row['variable']] = implode(',', $context['pmx'][$row['variable']]); } } elseif ($row['variable'] == 'pmxsef_ignorerequests') { $tmp = unserialize($value); if (!empty($tmp)) { foreach ($tmp as $act => $alias) { $context['pmx'][$row['variable']][] = $act . '=' . $alias; } $context['pmx'][$row['variable']] = implode(',', $context['pmx'][$row['variable']]); } } elseif (in_array($row['variable'], $nocheck) || !empty($value)) { $context['pmx'][$row['variable']] = $value; } } $smcFunc['db_free_result']($request); } // check if enabled $request = $smcFunc['db_query']('', ' SELECT value FROM {db_prefix}settings WHERE variable = {string:hook}', array('hook' => 'integrate_pre_load')); if ($smcFunc['db_num_rows']($request) > 0) { $row = $smcFunc['db_fetch_assoc']($request); $smcFunc['db_free_result']($request); if (strpos($row['value'], 'pmxsef_convertSEF') !== false) { $context['pmx']['pmxsef_enable'] = '1'; } } } else { $context['pmx']['admthemes'] = PortaMx_getsmfThemes(); $context['pmx']['admgroups'] = PortaMx_getUserGroups(true); $context['pmx']['limitgroups'] = PortaMx_getUserGroups(true, false); $context['pmx']['acsgroups'] = PortaMx_getUserGroups(false, !empty($context['pmx']['settings']['postcountacs'])); $context['pmx']['sysstat'] = $pmxCacheFunc['stat'](); $request = $smcFunc['db_query']('', ' SELECT variable, value FROM {db_prefix}settings WHERE variable IN ({array_string:vars})', array('vars' => array('pmx_fronttheme', 'pmx_frontthempg', 'pmx_ecl', 'pmx_eclmodal', 'pmx_eclmodalmobi', 'pmx_eclmodaltop', 'pmx_eclmodalaction'))); if ($smcFunc['db_num_rows']($request) > 0) { while ($row = $smcFunc['db_fetch_assoc']($request)) { $context['pmx'][$row['variable']] = $row['value']; } $smcFunc['db_free_result']($request); } } // setup pagetitle $context['page_title'] = $txt['pmx_settings']; $context['pmx']['AdminMode'] = $admMode; // load language and execute template loadLanguage($context['pmx_templatedir'] . 'AdminSettings'); loadTemplate($context['pmx_templatedir'] . 'AdminSettings'); } else { fatal_error($txt['pmx_acces_error']); } }