Quellcode durchsuchen

allow sm to be in an embedded frame

teepe vor 23 Jahren
Ursprung
Commit
e4b09fa02b
7 geänderte Dateien mit 40 neuen und 10 gelöschten Zeilen
  1. 22 2
      config/conf.pl
  2. 9 0
      config/config_default.php
  3. 3 3
      functions/auth.php
  4. 2 1
      functions/display_messages.php
  5. 2 2
      functions/page_header.php
  6. 1 1
      src/options.php
  7. 1 1
      src/signout.php

+ 22 - 2
config/conf.pl

@@ -327,6 +327,7 @@ while (($command ne "q") && ($command ne "Q")) {
       print "3.  Organization Title   : $WHT$org_title$NRM\n";
       print "3.  Organization Title   : $WHT$org_title$NRM\n";
       print "4.  Signout Page         : $WHT$signout_page$NRM\n";
       print "4.  Signout Page         : $WHT$signout_page$NRM\n";
       print "5.  Default Language     : $WHT$squirrelmail_default_language$NRM\n";
       print "5.  Default Language     : $WHT$squirrelmail_default_language$NRM\n";
+      print "6.  Top Frame            : $WHT$frame_top$NRM\n";
       print "\n";
       print "\n";
       print "R   Return to Main Menu\n";
       print "R   Return to Main Menu\n";
    } elsif ($menu == 2) {
    } elsif ($menu == 2) {
@@ -503,7 +504,8 @@ while (($command ne "q") && ($command ne "Q")) {
          elsif ($command == 2) { $org_logo   = command2 (); }
          elsif ($command == 2) { $org_logo   = command2 (); }
          elsif ($command == 3) { $org_title  = command3 (); }
          elsif ($command == 3) { $org_title  = command3 (); }
          elsif ($command == 4) { $signout_page  = command4 (); }
          elsif ($command == 4) { $signout_page  = command4 (); }
-	 elsif ($command == 5) { $squirrelmail_default_language = command5(); }
+         elsif ($command == 5) { $squirrelmail_default_language = command5(); }
+         elsif ($command == 6) { $frame_top = command6(); }
       } elsif ($menu == 2) {
       } elsif ($menu == 2) {
          if    ($command == 1)  { $domain                 = command11 (); }
          if    ($command == 1)  { $domain                 = command11 (); }
          elsif ($command == 2)  { $imapServerAddress      = command12 (); }
          elsif ($command == 2)  { $imapServerAddress      = command12 (); }
@@ -644,6 +646,23 @@ sub command5 {
    return $new_signout_page;
    return $new_signout_page;
 }
 }
 
 
+# Default top frame
+sub command6 {
+    print "SquirrelMail defaults to using the whole of the browser window.\n";
+    print "This allows you to keep it within a specified frame. The default\n";
+    print "is '_top'\n";
+    print "\n";
+    print "[$WHT$frame_top$NRM]: $WHT";
+    $new_frame_top = <STDIN>;
+    if ($new_frame_top eq "\n") {
+        $new_frame_top = '_top';
+    } else {
+        $new_frame_top =~ s/[\r|\n]//g;
+        $new_frame_top =~ s/^\s+$//g;
+    }
+    return $new_frame_top;
+}
+
 ####################################################################################
 ####################################################################################
 
 
 # domain
 # domain
@@ -1815,11 +1834,12 @@ sub save_data {
         print CF "\$config_use_color = $config_use_color;\n"; 
         print CF "\$config_use_color = $config_use_color;\n"; 
         print CF "\n";
         print CF "\n";
      
      
-        print CF "global \$org_name, \$org_logo, \$org_title, \$signout_page;\n";
+        print CF "global \$org_name, \$org_logo, \$org_title, \$signout_page, \$frame_top;\n";
         print CF "\$org_name      = \"$org_name\";\n";
         print CF "\$org_name      = \"$org_name\";\n";
         print CF "\$org_logo      = '$org_logo';\n";
         print CF "\$org_logo      = '$org_logo';\n";
         print CF "\$org_title     = \"$org_title\";\n";
         print CF "\$org_title     = \"$org_title\";\n";
         print CF "\$signout_page  = '$signout_page';\n";
         print CF "\$signout_page  = '$signout_page';\n";
+        print CF "\$frame_top     = '$frame_top';\n";
         print CF "\n";
         print CF "\n";
      
      
         print CF "global \$motd;\n";
         print CF "global \$motd;\n";

+ 9 - 0
config/config_default.php

@@ -431,6 +431,15 @@ $default_unseen_type   = 1;
 global $invert_time;
 global $invert_time;
 $invert_time = false;
 $invert_time = false;
 
 
+/**
+ * By default SquirrelMail takes up the whole browser window,
+ * this allows you to embed it within sites using frames. Set
+ * this to the frame you want it to stay in.
+ */
+
+global $frame_top;
+$frame_top = '_top';
+
 global $plugins;
 global $plugins;
 /**
 /**
  * To install plugins, just add elements to this array that have
  * To install plugins, just add elements to this array that have

+ 3 - 3
functions/auth.php

@@ -14,7 +14,7 @@
 require_once( '../functions/page_header.php' );
 require_once( '../functions/page_header.php' );
 
 
 function is_logged_in () {
 function is_logged_in () {
-    global $squirrelmail_language;
+    global $squirrelmail_language, $frame_top;
 
 
     if ( session_is_registered('user_is_logged_in') ) {
     if ( session_is_registered('user_is_logged_in') ) {
         return;
         return;
@@ -27,9 +27,9 @@ function is_logged_in () {
     echo "<body bgcolor=\"ffffff\">\n" .
     echo "<body bgcolor=\"ffffff\">\n" .
          '<br><br><center><b>' .
          '<br><br><center><b>' .
          _("You must be logged in to access this page.").'</b><br><br>' .
          _("You must be logged in to access this page.").'</b><br><br>' .
-         "<a href=\"../src/login.php\" target=\"_top\">"._("Go to the login page")."</a>\n" .
+         "<a href=\"../src/login.php\" target=\"$frame_top\">"._("Go to the login page")."</a>\n" .
          "</center></body></html>\n";
          "</center></body></html>\n";
     exit;
     exit;
 }
 }
 
 
-?>
+?>

+ 2 - 1
functions/display_messages.php

@@ -13,6 +13,7 @@
  */
  */
 
 
 function error_username_password_incorrect() {
 function error_username_password_incorrect() {
+    global $frame_top;
 
 
     echo '<BR>'.
     echo '<BR>'.
                 '<TABLE COLS=1 WIDTH="75%" NOBORDER BGCOLOR="' . $color[4] . '" ALIGN=CENTER>'.
                 '<TABLE COLS=1 WIDTH="75%" NOBORDER BGCOLOR="' . $color[4] . '" ALIGN=CENTER>'.
@@ -21,7 +22,7 @@ function error_username_password_incorrect() {
                 '</TR>' .
                 '</TR>' .
                 '<TR><TD>'.
                 '<TR><TD>'.
                     '<CENTER><BR>' . _("Unknown user or password incorrect.") .
                     '<CENTER><BR>' . _("Unknown user or password incorrect.") .
-                    '<BR><A HREF="login.php" TARGET=_top>' .
+                    '<BR><A HREF="login.php" TARGET='.$frame_top.'>' .
                     _("Click here to try again") .
                     _("Click here to try again") .
                     '</A>.</CENTER>'.
                     '</A>.</CENTER>'.
                 '</TD></TR>'.
                 '</TD></TR>'.

+ 2 - 2
functions/page_header.php

@@ -49,7 +49,7 @@ function displayInternalLink($path, $text, $target='') {
 
 
 function displayPageHeader($color, $mailbox) {
 function displayPageHeader($color, $mailbox) {
 
 
-    global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF;
+    global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF, $frame_top;
 
 
     displayHtmlHeader ();
     displayHtmlHeader ();
 
 
@@ -111,7 +111,7 @@ function checkForm() {
     }
     }
     echo  "      </TD>\n"
     echo  "      </TD>\n"
         . "      <TD ALIGN=right><b>\n";
         . "      <TD ALIGN=right><b>\n";
-    displayInternalLink ('src/signout.php', _("Sign Out"), '_top');
+    displayInternalLink ('src/signout.php', _("Sign Out"), $frame_top);
     echo "      </b></TD>\n"
     echo "      </b></TD>\n"
         . "   </TR>\n"
         . "   </TR>\n"
         . "   <TR BGCOLOR=\"$color[4]\">\n"
         . "   <TR BGCOLOR=\"$color[4]\">\n"

+ 1 - 1
src/options.php

@@ -235,7 +235,7 @@ if ($optpage == SMOPT_PAGE_MAIN) {
         if ($max_refresh == SMOPT_REFRESH_FOLDERLIST) {
         if ($max_refresh == SMOPT_REFRESH_FOLDERLIST) {
             echo '<A HREF="../src/left_main.php" TARGET="left">' . _("Refresh Folder List") . '</A><BR>';
             echo '<A HREF="../src/left_main.php" TARGET="left">' . _("Refresh Folder List") . '</A><BR>';
         } else if ($max_refresh) {
         } else if ($max_refresh) {
-            echo '<A HREF="../src/webmail.php?right_frame=options.php" TARGET="_top">' . _("Refresh Page") . '</A><BR>';
+            echo '<A HREF="../src/webmail.php?right_frame=options.php" TARGET="$frame_top">' . _("Refresh Page") . '</A><BR>';
         }
         }
     }
     }
     /******************************************/
     /******************************************/

+ 1 - 1
src/signout.php

@@ -88,7 +88,7 @@ CELLPADDING="2" ALIGN="CENTER">
     <TD ALIGN="CENTER">
     <TD ALIGN="CENTER">
       <?php do_hook('logout_above_text'); ?>
       <?php do_hook('logout_above_text'); ?>
       <?php echo _("You have been successfully signed out.") ?><BR>
       <?php echo _("You have been successfully signed out.") ?><BR>
-      <A HREF="login.php" TARGET="_top">
+      <A HREF="login.php" TARGET="<?php echo $frame_top ?>">
       <?php echo _("Click here to log back in.") ?>
       <?php echo _("Click here to log back in.") ?>
       </A><BR><BR>
       </A><BR><BR>
     </TD>
     </TD>