init.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. <?php
  2. /**
  3. * init.php -- initialisation file
  4. *
  5. * File should be loaded in every file in src/ or plugins that occupate an entire frame
  6. *
  7. * @copyright &copy; 2006 The SquirrelMail Project Team
  8. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  9. * @version $Id$
  10. * @package squirrelmail
  11. */
  12. /**
  13. * This is a development version so in order to track programmer mistakes we
  14. * set the error reporting to E_ALL
  15. */
  16. error_reporting(E_ALL);
  17. /**
  18. * If register_globals are on, unregister globals.
  19. * Second test covers boolean set as string (php_value register_globals off).
  20. */
  21. if ((bool) ini_get('register_globals') &&
  22. strtolower(ini_get('register_globals'))!='off') {
  23. /**
  24. * Remove all globals that are not reserved by PHP
  25. * 'value' and 'key' are used by foreach. Don't unset them inside foreach.
  26. */
  27. foreach ($GLOBALS as $key => $value) {
  28. switch($key) {
  29. case 'HTTP_POST_VARS':
  30. case '_POST':
  31. case 'HTTP_GET_VARS':
  32. case '_GET':
  33. case 'HTTP_COOKIE_VARS':
  34. case '_COOKIE':
  35. case 'HTTP_SERVER_VARS':
  36. case '_SERVER':
  37. case 'HTTP_ENV_VARS':
  38. case '_ENV':
  39. case 'HTTP_POST_FILES':
  40. case '_FILES':
  41. case '_REQUEST':
  42. case 'HTTP_SESSION_VARS':
  43. case '_SESSION':
  44. case 'GLOBALS':
  45. case 'key':
  46. case 'value':
  47. break;
  48. case 'sInitLocation':
  49. // FIXME: variable must be set only in src/login.php
  50. break;
  51. default:
  52. unset($GLOBALS[$key]);
  53. }
  54. }
  55. // Unset variables used in foreach
  56. unset($GLOBALS['key']);
  57. unset($GLOBALS['value']);
  58. }
  59. /**
  60. * Used as a dummy value, e.g., for passing as an empty
  61. * hook argument.
  62. */
  63. global $null;
  64. $null = NULL;
  65. /**
  66. * [#1518885] session.use_cookies = off breaks SquirrelMail
  67. *
  68. * When session cookies are not used, all http redirects, meta refreshes,
  69. * src/download.php and javascript URLs are broken. Setting must be set
  70. * before session is started.
  71. */
  72. if (!(bool)ini_get('session.use_cookies') ||
  73. ini_get('session.use_cookies') == 'off') {
  74. ini_set('session.use_cookies','1');
  75. }
  76. /**
  77. * calculate SM_PATH and calculate the base_uri
  78. * assumptions made: init.php is only called from plugins or from the src dir.
  79. * files in the plugin directory may not be part of a subdirectory called "src"
  80. *
  81. */
  82. if (isset($_SERVER['SCRIPT_NAME'])) {
  83. $a = explode('/',$_SERVER['SCRIPT_NAME']);
  84. } elseif (isset($HTTP_SERVER_VARS['SCRIPT_NAME'])) {
  85. $a = explode('/',$HTTP_SERVER_VARS['SCRIPT_NAME']);
  86. } else {
  87. $error = 'Unable to detect script environment. '
  88. .'Please test your PHP settings and send PHP core config, $_SERVER '
  89. .'and $HTTP_SERVER_VARS to SquirrelMail developers.';
  90. die($error);
  91. }
  92. $sSM_PATH = '';
  93. for($i = count($a) -2;$i > -1; --$i) {
  94. $sSM_PATH .= '../';
  95. if ($a[$i] === 'src' || $a[$i] === 'plugins') {
  96. break;
  97. }
  98. }
  99. $base_uri = implode('/',array_slice($a,0,$i)). '/';
  100. define('SM_PATH',$sSM_PATH);
  101. define('SM_BASE_URI', $base_uri);
  102. /**
  103. * global var $bInit is used to check if initialisation took place.
  104. * At this moment it's a workarounf for the include of addrbook_search_html
  105. * inside compose.php. If we found a better way then remove this. Do only use
  106. * this var if you know for sure a page can be called stand alone and be included
  107. * in another file.
  108. */
  109. $bInit = true;
  110. /**
  111. * This theme as a failsafe if no themes were found, or if we error
  112. * out before anything could be initialised.
  113. */
  114. $color = array();
  115. $color[0] = '#DCDCDC'; /* light gray TitleBar */
  116. $color[1] = '#800000'; /* red */
  117. $color[2] = '#CC0000'; /* light red Warning/Error Messages */
  118. $color[3] = '#A0B8C8'; /* green-blue Left Bar Background */
  119. $color[4] = '#FFFFFF'; /* white Normal Background */
  120. $color[5] = '#FFFFCC'; /* light yellow Table Headers */
  121. $color[6] = '#000000'; /* black Text on left bar */
  122. $color[7] = '#0000CC'; /* blue Links */
  123. $color[8] = '#000000'; /* black Normal text */
  124. $color[9] = '#ABABAB'; /* mid-gray Darker version of #0 */
  125. $color[10] = '#666666'; /* dark gray Darker version of #9 */
  126. $color[11] = '#770000'; /* dark red Special Folders color */
  127. $color[12] = '#EDEDED';
  128. $color[13] = '#800000'; /* (dark red) Color for quoted text -- > 1 quote */
  129. $color[14] = '#ff0000'; /* (red) Color for quoted text -- >> 2 or more */
  130. $color[15] = '#002266'; /* (dark blue) Unselectable folders */
  131. $color[16] = '#ff9933'; /* (orange) Highlight color */
  132. require(SM_PATH . 'functions/global.php');
  133. require(SM_PATH . 'functions/arrays.php');
  134. /* load default configuration */
  135. require(SM_PATH . 'config/config_default.php');
  136. /* reset arrays in default configuration */
  137. $ldap_server = array();
  138. $plugins = array();
  139. $fontsets = array();
  140. $aTemplateSet = array();
  141. $aTemplateSet[0]['ID'] = 'default';
  142. $aTemplateSet[0]['NAME'] = 'Default';
  143. /* load site configuration */
  144. require(SM_PATH . 'config/config.php');
  145. /* load local configuration overrides */
  146. if (file_exists(SM_PATH . 'config/config_local.php')) {
  147. require(SM_PATH . 'config/config_local.php');
  148. }
  149. require(SM_PATH . 'functions/plugin.php');
  150. require(SM_PATH . 'include/constants.php');
  151. require(SM_PATH . 'include/languages.php');
  152. require(SM_PATH . 'class/template/Template.class.php');
  153. require(SM_PATH . 'class/error.class.php');
  154. /**
  155. * If magic_quotes_runtime is on, SquirrelMail breaks in new and creative ways.
  156. * Force magic_quotes_runtime off.
  157. * tassium@squirrelmail.org - I put it here in the hopes that all SM code includes this.
  158. * If there's a better place, please let me know.
  159. */
  160. ini_set('magic_quotes_runtime','0');
  161. /* if running with magic_quotes_gpc then strip the slashes
  162. from POST and GET global arrays */
  163. if (get_magic_quotes_gpc()) {
  164. sqstripslashes($_GET);
  165. sqstripslashes($_POST);
  166. }
  167. /* strip any tags added to the url from PHP_SELF.
  168. This fixes hand crafted url XXS expoits for any
  169. page that uses PHP_SELF as the FORM action */
  170. $_SERVER['PHP_SELF'] = strip_tags($_SERVER['PHP_SELF']);
  171. $PHP_SELF = php_self();
  172. /**
  173. * Initialize the session
  174. */
  175. /** set the name of the session cookie */
  176. if (!isset($session_name) || !$session_name) {
  177. $session_name = 'SQMSESSID';
  178. }
  179. /**
  180. * if session.auto_start is On then close the session
  181. */
  182. $sSessionAutostartName = session_name();
  183. if ((isset($sSessionAutostartName) || $sSessionAutostartName == '') &&
  184. $sSessionAutostartName !== $session_name) {
  185. $sCookiePath = ini_get('session.cookie_path');
  186. $sCookieDomain = ini_get('session.cookie_domain');
  187. // reset the cookie
  188. setcookie($sSessionAutostartName,'',time() - 604800,$sCookiePath,$sCookieDomain);
  189. @session_destroy();
  190. session_write_close();
  191. }
  192. /**
  193. * includes from classes stored in the session
  194. */
  195. require(SM_PATH . 'class/mime.class.php');
  196. ini_set('session.name' , $session_name);
  197. session_set_cookie_params (0, $base_uri);
  198. sqsession_is_active();
  199. /**
  200. * SquirrelMail version number -- DO NOT CHANGE
  201. */
  202. $version = '1.5.2 [SVN]';
  203. /**
  204. * SquirrelMail internal version number -- DO NOT CHANGE
  205. * $sm_internal_version = array (release, major, minor)
  206. */
  207. $SQM_INTERNAL_VERSION = array(1,5,2);
  208. /* if plugins are disabled only for one user and
  209. * the current user is NOT that user, turn them
  210. * back on
  211. */
  212. sqgetGlobalVar('username',$username,SQ_SESSION);
  213. if ($disable_plugins && !empty($disable_plugins_user)
  214. && $username != $disable_plugins_user) {
  215. $disable_plugins = false;
  216. }
  217. /* remove all plugins if they are disabled */
  218. if ($disable_plugins) {
  219. $plugins = array();
  220. }
  221. /**
  222. * Include Compatibility plugin if available.
  223. */
  224. if (!$disable_plugins && file_exists(SM_PATH . 'plugins/compatibility/functions.php'))
  225. include_once(SM_PATH . 'plugins/compatibility/functions.php');
  226. /**
  227. * MAIN PLUGIN LOADING CODE HERE
  228. * On init, we no longer need to load all plugin setup files.
  229. * Now, we load the statically generated hook registrations here
  230. * and let the hook calls include only the plugins needed.
  231. */
  232. $squirrelmail_plugin_hooks = array();
  233. if (!$disable_plugins && file_exists(SM_PATH . 'config/plugin_hooks.php')) {
  234. require(SM_PATH . 'config/plugin_hooks.php');
  235. }
  236. /**
  237. * allow plugins to override main configuration; hook is placed
  238. * here to allow plugins to use session information to do their work
  239. */
  240. do_hook('config_override', $null);
  241. /**
  242. * DISABLED.
  243. * Remove globalized session data in rg=on setups
  244. *
  245. * Code can be utilized when session is started, but data is not loaded.
  246. * We have already loaded configuration and other important vars. Can't
  247. * clean session globals here.
  248. if ((bool) @ini_get('register_globals') &&
  249. strtolower(ini_get('register_globals'))!='off') {
  250. foreach ($_SESSION as $key => $value) {
  251. unset($GLOBALS[$key]);
  252. }
  253. }
  254. */
  255. sqsession_register(SM_BASE_URI,'base_uri');
  256. /**
  257. * Retrieve the language cookie
  258. */
  259. if (! sqgetGlobalVar('squirrelmail_language',$squirrelmail_language,SQ_COOKIE)) {
  260. $squirrelmail_language = '';
  261. }
  262. /**
  263. * @var $sInitlocation From where do we include.
  264. */
  265. if (!isset($sInitLocation)) {
  266. $sInitLocation=NULL;
  267. }
  268. switch ($sInitLocation) {
  269. case 'style':
  270. // need to get the right template set up
  271. //
  272. sqGetGlobalVar('templateid', $templateid, SQ_GET);
  273. // sanitize just in case...
  274. //
  275. $templateid = preg_replace('/(\.\.\/){1,}/', '', $templateid);
  276. // make sure given template actually is available
  277. //
  278. $found_templateset = false;
  279. for ($i = 0; $i < count($aTemplateSet); ++$i) {
  280. if ($aTemplateSet[$i]['ID'] == $templateid) {
  281. $found_templateset = true;
  282. break;
  283. }
  284. }
  285. // FIXME: do we need/want to check here for actual (physical) presence of template sets?
  286. // selected template not available, fall back to default template
  287. //
  288. if (!$found_templateset) {
  289. $sTemplateID = Template::get_default_template_set();
  290. } else {
  291. $sTemplateID = $templateid;
  292. }
  293. session_write_close();
  294. break;
  295. case 'redirect':
  296. /**
  297. * directory hashing functions are needed for all setups in case
  298. * plugins use own pref files.
  299. */
  300. require(SM_PATH . 'functions/prefs.php');
  301. require(SM_PATH . 'functions/auth.php');
  302. /* hook loads custom prefs backend plugins */
  303. $prefs_backend = do_hook('prefs_backend', $null);
  304. if (isset($prefs_backend) && !empty($prefs_backend) && file_exists(SM_PATH . $prefs_backend)) {
  305. require(SM_PATH . $prefs_backend);
  306. } elseif (isset($prefs_dsn) && !empty($prefs_dsn)) {
  307. require(SM_PATH . 'functions/db_prefs.php');
  308. } else {
  309. require(SM_PATH . 'functions/file_prefs.php');
  310. }
  311. //nobreak;
  312. case 'login':
  313. require(SM_PATH . 'functions/display_messages.php' );
  314. require(SM_PATH . 'functions/page_header.php');
  315. require(SM_PATH . 'functions/html.php');
  316. // reset template file cache
  317. //
  318. $sTemplateID = Template::get_default_template_set();
  319. Template::cache_template_file_hierarchy(TRUE);
  320. /**
  321. * Make sure icon variables are setup for the login page.
  322. */
  323. $icon_theme = $icon_themes[$icon_theme_def]['PATH'];
  324. /*
  325. * NOTE: The $icon_theme_path var should contain the path to the icon
  326. * theme to use. If the admin has disabled icons, or the user has
  327. * set the icon theme to "None," no icons will be used.
  328. */
  329. $icon_theme_path = (!$use_icons || $icon_theme=='none') ? NULL : ($icon_theme == 'template' ? SM_PATH . Template::calculate_template_images_directory($sTemplateID) : $icon_theme);
  330. /**
  331. * cleanup old cookies with a cookie path the same as the standard php.ini
  332. * cookie path. All previous SquirrelMail version used the standard php.ini
  333. * cookie path for storing the session name. That behaviour changed.
  334. */
  335. if ($sCookiePath !== SM_BASE_URI) {
  336. /**
  337. * do not delete the standard sessions with session.name is i.e. PHPSESSID
  338. * because they probably belong to other php apps
  339. */
  340. if (ini_get('session.name') !== $sSessionAutostartName) {
  341. // This does not work. Sometimes the cookie with SQSESSID=deleted and path /
  342. // is picked up in webmail.php => login will fail
  343. //sqsetcookie(ini_get('session.name'),'',0,$sCookiePath);
  344. }
  345. }
  346. break;
  347. default:
  348. require(SM_PATH . 'functions/display_messages.php' );
  349. require(SM_PATH . 'functions/page_header.php');
  350. require(SM_PATH . 'functions/html.php');
  351. require(SM_PATH . 'functions/strings.php');
  352. /**
  353. * Check if we are logged in
  354. */
  355. require(SM_PATH . 'functions/auth.php');
  356. if ( !sqsession_is_registered('user_is_logged_in') ) {
  357. // First we store some information in the new session to prevent
  358. // information-loss.
  359. //
  360. $session_expired_post = $_POST;
  361. $session_expired_location = $PHP_SELF;
  362. if (!sqsession_is_registered('session_expired_post')) {
  363. sqsession_register($session_expired_post,'session_expired_post');
  364. }
  365. if (!sqsession_is_registered('session_expired_location')) {
  366. sqsession_register($session_expired_location,'session_expired_location');
  367. }
  368. // signout page will deal with users who aren't logged
  369. // in on its own; don't show error here
  370. //
  371. if (strpos($PHP_SELF, 'signout.php') !== FALSE) {
  372. return;
  373. }
  374. /**
  375. * Initialize the template object (logout_error uses it)
  376. */
  377. /*
  378. * $sTemplateID is not initialized when a user is not logged in, so we
  379. * will use the config file defaults here. If the neccesary variables
  380. * are net set, force a default value.
  381. */
  382. $sTemplateID = Template::get_default_template_set();
  383. $oTemplate = Template::construct_template($sTemplateID);
  384. set_up_language($squirrelmail_language, true);
  385. logout_error( _("You must be logged in to access this page.") );
  386. exit;
  387. }
  388. //FIXME: remove next line if the placement of the copy of this line above does not prove to be problematic
  389. sqgetGlobalVar('username',$username,SQ_SESSION);
  390. sqgetGlobalVar('authz',$authz,SQ_SESSION);
  391. /**
  392. * Setting the prefs backend
  393. */
  394. sqgetGlobalVar('prefs_cache', $prefs_cache, SQ_SESSION );
  395. sqgetGlobalVar('prefs_are_cached', $prefs_are_cached, SQ_SESSION );
  396. if ( !sqsession_is_registered('prefs_are_cached') ||
  397. !isset( $prefs_cache) ||
  398. !is_array( $prefs_cache)) {
  399. $prefs_are_cached = false;
  400. $prefs_cache = false; //array();
  401. }
  402. /* see 'redirect' case */
  403. require(SM_PATH . 'functions/prefs.php');
  404. $prefs_backend = do_hook('prefs_backend', $null);
  405. if (isset($prefs_backend) && !empty($prefs_backend) && file_exists(SM_PATH . $prefs_backend)) {
  406. require(SM_PATH . $prefs_backend);
  407. } elseif (isset($prefs_dsn) && !empty($prefs_dsn)) {
  408. require(SM_PATH . 'functions/db_prefs.php');
  409. } else {
  410. require(SM_PATH . 'functions/file_prefs.php');
  411. }
  412. /**
  413. * initializing user settings
  414. */
  415. require(SM_PATH . 'include/load_prefs.php');
  416. // i do not understand the frames language cookie story
  417. /**
  418. * We'll need this to later have a noframes version
  419. *
  420. * Check if the user has a language preference, but no cookie.
  421. * Send him a cookie with his language preference, if there is
  422. * such discrepancy.
  423. */
  424. $my_language = getPref($data_dir, $username, 'language');
  425. if ($my_language != $squirrelmail_language) {
  426. sqsetcookie('squirrelmail_language', $my_language, time()+2592000, $base_uri);
  427. }
  428. // /dont understand
  429. /**
  430. * Set up the language.
  431. */
  432. $err=set_up_language(getPref($data_dir, $username, 'language'));
  433. // Japanese translation used without mbstring support
  434. if ($err==2) {
  435. $sError =
  436. "<p>You need to have PHP installed with the multibyte string function \n".
  437. "enabled (using configure option --enable-mbstring).</p>\n".
  438. "<p>System assumed that you accidently switched to Japanese translation \n".
  439. "and reverted your language preference to English.</p>\n".
  440. "<p>Please refresh this page in order to use webmail.</p>\n";
  441. error_box($sError);
  442. }
  443. $timeZone = getPref($data_dir, $username, 'timezone');
  444. /* Check to see if we are allowed to set the TZ environment variable.
  445. * We are able to do this if ...
  446. * safe_mode is disabled OR
  447. * safe_mode_allowed_env_vars is empty (you are allowed to set any) OR
  448. * safe_mode_allowed_env_vars contains TZ
  449. */
  450. $tzChangeAllowed = (!ini_get('safe_mode')) ||
  451. !strcmp(ini_get('safe_mode_allowed_env_vars'),'') ||
  452. preg_match('/^([\w_]+,)*TZ/', ini_get('safe_mode_allowed_env_vars'));
  453. if ( $timeZone != SMPREF_NONE && ($timeZone != "")
  454. && $tzChangeAllowed ) {
  455. // get time zone key, if strict or custom strict timezones are used
  456. if (isset($time_zone_type) &&
  457. ($time_zone_type == 1 || $time_zone_type == 3)) {
  458. /* load time zone functions */
  459. require(SM_PATH . 'include/timezones.php');
  460. $realTimeZone = sq_get_tz_key($timeZone);
  461. } else {
  462. $realTimeZone = $timeZone;
  463. }
  464. // set time zone
  465. if ($realTimeZone) {
  466. putenv("TZ=".$realTimeZone);
  467. }
  468. }
  469. /**
  470. * php 5.1.0 added time zone functions. Set time zone with them in order
  471. * to prevent E_STRICT notices and allow time zone modifications in safe_mode.
  472. */
  473. if (function_exists('date_default_timezone_set')) {
  474. if ($timeZone != SMPREF_NONE && $timeZone != "") {
  475. date_default_timezone_set($timeZone);
  476. } else {
  477. // interface runs on server's time zone. Remove php E_STRICT complains
  478. $default_timezone = @date_default_timezone_get();
  479. date_default_timezone_set($default_timezone);
  480. }
  481. }
  482. break;
  483. }
  484. /*
  485. * $sTemplateID is not initialized when a user is not logged in, so we
  486. * will use the config file defaults here. If the neccesary variables
  487. * are not set, force a default value.
  488. *
  489. * If the user is logged in, $sTemplateID will be set in load_prefs.php,
  490. * so we shouldn't change it here.
  491. */
  492. if (!isset($sTemplateID)) {
  493. $sTemplateID = Template::get_default_template_set();
  494. $icon_theme_path = !$use_icons ? NULL : Template::calculate_template_images_directory($sTemplateID);
  495. }
  496. // template object may have already been constructed in load_prefs.php
  497. //
  498. if (empty($oTemplate)) {
  499. $oTemplate = Template::construct_template($sTemplateID);
  500. }
  501. // We want some variables to always be available to the template
  502. $oTemplate->assign('javascript_on', checkForJavascript());
  503. $oTemplate->assign('base_uri', sqm_baseuri());
  504. $always_include = array('sTemplateID', 'icon_theme_path');
  505. foreach ($always_include as $var) {
  506. $oTemplate->assign($var, (isset($$var) ? $$var : NULL));
  507. }
  508. /**
  509. * Initialize our custom error handler object
  510. */
  511. $oErrorHandler = new ErrorHandler($oTemplate,'error_message.tpl');
  512. /**
  513. * Activate custom error handling
  514. */
  515. if (version_compare(PHP_VERSION, "4.3.0", ">=")) {
  516. $oldErrorHandler = set_error_handler(array($oErrorHandler, 'SquirrelMailErrorhandler'));
  517. } else {
  518. $oldErrorHandler = set_error_handler('SquirrelMailErrorhandler');
  519. }
  520. /**
  521. * Javascript support detection function
  522. * @param boolean $reset recheck javascript support if set to true.
  523. * @return integer SMPREF_JS_ON or SMPREF_JS_OFF ({@see include/constants.php})
  524. * @since 1.5.1
  525. */
  526. function checkForJavascript($reset = FALSE) {
  527. global $data_dir, $username, $javascript_on, $javascript_setting;
  528. if ( !$reset && sqGetGlobalVar('javascript_on', $javascript_on, SQ_SESSION) )
  529. return $javascript_on;
  530. if ( ( $reset || !isset($javascript_setting) )
  531. // getPref() not defined (nor is it meaningful) when user not
  532. // logged in, but that begs the question if $javascript_on is
  533. // not in the session in that case, where do we get it from?
  534. && ( sqGetGlobalVar('user_is_logged_in', $user_is_logged_in, SQ_SESSION)
  535. && $user_is_logged_in) )
  536. $javascript_setting = getPref($data_dir, $username, 'javascript_setting', SMPREF_JS_AUTODETECT);
  537. if ( !sqGetGlobalVar('new_js_autodetect_results', $js_autodetect_results) &&
  538. !sqGetGlobalVar('js_autodetect_results', $js_autodetect_results) )
  539. $js_autodetect_results = SMPREF_JS_OFF;
  540. if ( $javascript_setting == SMPREF_JS_AUTODETECT )
  541. $javascript_on = $js_autodetect_results;
  542. else
  543. $javascript_on = $javascript_setting;
  544. sqsession_register($javascript_on, 'javascript_on');
  545. return $javascript_on;
  546. }
  547. function sqm_baseuri() {
  548. global $base_uri;
  549. return $base_uri;
  550. }