Ukrainian Language , Oleg Baranovsky
[squirrelmail.git] / src / options.php
index ef02ed880d83d3ca6ec4e830511630671e76bb7e..50f45037d0cd42a7e10c7ded28c50ae87b35a963 100644 (file)
@@ -19,7 +19,6 @@ define('SM_PATH','../');
 require_once(SM_PATH . 'include/validate.php');
 require_once(SM_PATH . 'functions/display_messages.php');
 require_once(SM_PATH . 'functions/imap.php');
-require_once(SM_PATH . 'functions/array.php');
 require_once(SM_PATH . 'functions/options.php');
 require_once(SM_PATH . 'functions/strings.php');
 require_once(SM_PATH . 'functions/html.php');
@@ -115,9 +114,31 @@ function print_optionpages_row($leftopt, $rightopt = false) {
 
 /* ---------------------------- main ---------------------------- */
 
+/* get the globals that we may need */
+if (isset($_GET['optpage'])) {
+    $optpage = $_GET['optpage'];
+}
+elseif (isset($_POST['optpage'])) {
+    $optpage = $_POST['optpage'];
+}
+if (isset($_POST['optmode'])) {
+    $optmode = $_POST['optmode'];
+}
+if (isset($_POST['optpage_data'])) {
+    $optpage_data = $_POST['optpage_data'];
+}
+$username = $_SESSION['username'];
+$key = $_COOKIE['key'];
+$onetimepad = $_SESSION['onetimepad'];
+$delimiter = $_SESSION['delimiter'];
+
+/* end of getting globals */
+
 /* Make sure we have an Option Page set. Default to main. */
-if (!isset($optpage)) {
-    $optpage = 'main';
+if ( !isset($optpage) || $optpage == '' ) {
+    $optpage = SMOPT_PAGE_MAIN;
+} else {
+    $optpage = strip_tags( $optpage );
 }
 
 /* Make sure we have an Option Mode set. Default to display. */
@@ -136,7 +157,8 @@ $optpage_loader = '';
 
 /* Set the load information for each page. */
 switch ($optpage) {
-    case SMOPT_PAGE_MAIN: break;
+    case SMOPT_PAGE_MAIN: 
+        break;
     case SMOPT_PAGE_PERSONAL:
         $optpage_name     = _("Personal Information");
         $optpage_file     = SM_PATH . 'include/options/personal.php';
@@ -174,8 +196,11 @@ switch ($optpage) {
 /*** Second, load the option information for this page. ***/
 /**********************************************************/
 
-if ($optpage != SMOPT_PAGE_MAIN) {
+if ( !@is_file( $optpage_file ) ) {
+    $optpage = SMOPT_PAGE_MAIN;
+} else if ($optpage != SMOPT_PAGE_MAIN ) {
     /* Include the file for this optionpage. */
+    
     require_once($optpage_file);
 
     /* Assemble the data for this option page. */