| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * display_messages.php |
| 5 | * |
| 6 | * Copyright (c) 1999-2002 The SquirrelMail Project Team |
| 7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | * |
| 9 | * This contains all messages, including information, error, and just |
| 10 | * about any other message you can think of. |
| 11 | * |
| 12 | * $Id$ |
| 13 | */ |
| 14 | |
| 15 | /** |
| 16 | * Find out where squirrelmail lives and try to be smart about it. |
| 17 | * The only problem would be when squirrelmail lives in directories |
| 18 | * called "src", "functions", or "plugins", but people who do that need |
| 19 | * to be beaten with a steel pipe anyway. |
| 20 | * |
| 21 | * @return the base uri of squirrelmail installation. |
| 22 | */ |
| 23 | function sqm_baseuri(){ |
| 24 | global $base_uri, $PHP_SELF; |
| 25 | /** |
| 26 | * If it is in the session, just return it. |
| 27 | */ |
| 28 | if (isset($base_uri)){ |
| 29 | return $base_uri; |
| 30 | } |
| 31 | $dirs = array("|src/.*|", "|plugins/.*|", "|functions/.*|"); |
| 32 | $repl = array("", "", ""); |
| 33 | $base_uri = preg_replace($dirs, $repl, $PHP_SELF); |
| 34 | return $base_uri; |
| 35 | } |
| 36 | |
| 37 | function error_username_password_incorrect() { |
| 38 | global $frame_top, $color; |
| 39 | /* XXX: Should really not start the HTML before this, or close off more |
| 40 | cleanly. */ |
| 41 | |
| 42 | if (!isset($frame_top)) { |
| 43 | $frame_top = '_top'; |
| 44 | } |
| 45 | |
| 46 | echo '<BR>'. |
| 47 | '<TABLE COLS=1 WIDTH="75%" BORDER="0" BGCOLOR="' . $color[4] . '" ALIGN=CENTER>'. |
| 48 | '<TR BGCOLOR="' . $color[0] . '">'. |
| 49 | '<TH>' . _("ERROR") . '</TH>'. |
| 50 | '</TR>' . |
| 51 | '<TR><TD>'. |
| 52 | '<CENTER><BR>' . _("Unknown user or password incorrect.") . |
| 53 | '<BR><A HREF="' . sqm_baseuri() . '"login.php" TARGET='. |
| 54 | $frame_top.'>' . _("Click here to try again") . |
| 55 | '</A>.</CENTER>'. |
| 56 | '</TD></TR>'. |
| 57 | '</TABLE>'. |
| 58 | '</BODY></HTML>'; |
| 59 | } |
| 60 | |
| 61 | function error_message($message, $mailbox, $sort, $startMessage, $color) { |
| 62 | $urlMailbox = urlencode($mailbox); |
| 63 | |
| 64 | echo '<BR>'. |
| 65 | "<TABLE COLS=1 WIDTH=\"70%\" BORDER=\"0\" BGCOLOR=\"$color[4]\" ALIGN=CENTER>". |
| 66 | '<TR>'. |
| 67 | "<TD BGCOLOR=\"$color[0]\">". |
| 68 | "<FONT COLOR=\"$color[2]\"><B><CENTER>" . _("ERROR") . '</CENTER></B></FONT>'. |
| 69 | '</TD></TR><TR><TD>'. |
| 70 | "<CENTER><BR>$message<BR>\n". |
| 71 | '<BR>'. |
| 72 | "<A HREF=\"" . sqm_baseuri() |
| 73 | . "src/right_main.php?sort=$sort&startMessage=$startMessage" |
| 74 | . "&mailbox=$urlMailbox\">"; |
| 75 | printf (_("Click here to return to %s"), $mailbox); |
| 76 | echo '</A>.'. |
| 77 | '</TD></TR>'. |
| 78 | '</TABLE>'; |
| 79 | } |
| 80 | |
| 81 | function plain_error_message($message, $color) { |
| 82 | echo "<br><TABLE COLS=1 WIDTH=\"70%\" BORDER=\"0\" BGCOLOR=\"$color[4]\" ALIGN=CENTER>". |
| 83 | '<TR>'. |
| 84 | "<TD BGCOLOR=\"$color[0]\">". |
| 85 | "<FONT COLOR=\"$color[2]\"><B><CENTER>" . _("ERROR") . '</CENTER></B></FONT>'. |
| 86 | '</TD></TR><TR><TD>'. |
| 87 | "<CENTER><BR>$message". |
| 88 | '</CENTER>'. |
| 89 | '</TD></TR>'. |
| 90 | '</TABLE>'; |
| 91 | } |
| 92 | |
| 93 | function logout_error( $errString, $errTitle = '' ) { |
| 94 | |
| 95 | GLOBAL $frame_top, $org_logo, $org_name, $org_logo_width, $org_logo_height, |
| 96 | $hide_sm_attributions, $version, $DOCUMENT_ROOT, |
| 97 | $squirrelmail_language; |
| 98 | $base_uri = sqm_baseuri(); |
| 99 | include_once($DOCUMENT_ROOT . $base_uri . 'functions/page_header.php' ); |
| 100 | if ( !isset( $org_logo ) ) { |
| 101 | // Don't know yet why, but in some accesses $org_logo is not set. |
| 102 | include( $DOCUMENT_ROOT . $base_uri . 'config/config.php' ); |
| 103 | } |
| 104 | /* Display width and height like good little people */ |
| 105 | $width_and_height = ''; |
| 106 | if (isset($org_logo_width) && is_int($org_logo_width) && $org_logo_width>0) { |
| 107 | $width_and_height = " WIDTH=\"$org_logo_width\""; |
| 108 | } |
| 109 | if (isset($org_logo_height) && is_int($org_logo_height) && $org_logo_height>0) { |
| 110 | $width_and_height .= " HEIGHT=\"$org_logo_height\""; |
| 111 | } |
| 112 | |
| 113 | if (!isset($frame_top) || $frame_top == '' ) { |
| 114 | $frame_top = '_top'; |
| 115 | } |
| 116 | |
| 117 | if ( !isset( $color ) ) { |
| 118 | $color = array(); |
| 119 | $color[0] = '#DCDCDC'; /* light gray TitleBar */ |
| 120 | $color[1] = '#800000'; /* red */ |
| 121 | $color[2] = '#CC0000'; /* light red Warning/Error Messages */ |
| 122 | $color[3] = '#A0B8C8'; /* green-blue Left Bar Background */ |
| 123 | $color[4] = '#FFFFFF'; /* white Normal Background */ |
| 124 | $color[5] = '#FFFFCC'; /* light yellow Table Headers */ |
| 125 | $color[6] = '#000000'; /* black Text on left bar */ |
| 126 | $color[7] = '#0000CC'; /* blue Links */ |
| 127 | $color[8] = '#000000'; /* black Normal text */ |
| 128 | $color[9] = '#ABABAB'; /* mid-gray Darker version of #0 */ |
| 129 | $color[10] = '#666666'; /* dark gray Darker version of #9 */ |
| 130 | $color[11] = '#770000'; /* dark red Special Folders color */ |
| 131 | $color[12] = '#EDEDED'; |
| 132 | $color[15] = '#002266'; /* (dark blue) Unselectable folders */ |
| 133 | } |
| 134 | |
| 135 | if ( $errTitle == '' ) { |
| 136 | $errTitle = $errString; |
| 137 | } |
| 138 | set_up_language($squirrelmail_language, true); |
| 139 | displayHtmlHeader( $errTitle ); |
| 140 | |
| 141 | echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n\n" . |
| 142 | '<CENTER>'. |
| 143 | "<IMG SRC=\"$org_logo\" ALT=\"" . sprintf(_("%s Logo"), $org_name) . |
| 144 | "\"$width_and_height><BR>\n". |
| 145 | ( $hide_sm_attributions ? '' : |
| 146 | '<SMALL>' . sprintf (_("SquirrelMail version %s"), $version) . "<BR>\n". |
| 147 | ' ' . _("By the SquirrelMail Development Team") . "<BR></SMALL>\n" ) . |
| 148 | "<table cellspacing=1 cellpadding=0 bgcolor=\"$color[1]\" width=\"70%\"><tr><td>". |
| 149 | "<TABLE COLS=1 WIDTH=\"100%\" BORDER=\"0\" BGCOLOR=\"$color[4]\" ALIGN=CENTER>". |
| 150 | "<TR><TD BGCOLOR=\"$color[0]\">". |
| 151 | "<FONT COLOR=\"$color[2]\"><B><CENTER>" . _("ERROR") . |
| 152 | '</CENTER></B></FONT></TD></TR>'. |
| 153 | '<TR><TD><CENTER>' . $errString . '</CENTER></TD></TR>'. |
| 154 | "<TR><TD BGCOLOR=\"$color[0]\">". |
| 155 | "<FONT COLOR=\"$color[2]\"><B><CENTER>". |
| 156 | '<a href="' . $base_uri . 'src/login.php" target="' . |
| 157 | $frame_top . '">' . |
| 158 | _("Go to the login page") . "</a></CENTER></B></FONT>". |
| 159 | '</TD></TR>'. |
| 160 | '</TABLE></td></tr></table></body></html>'; |
| 161 | } |
| 162 | |
| 163 | ?> |