Commit a11b81ae114afe0943195e30830e596a398bf8b7

Authored by kevin_fourie
1 parent 4939c393

Merged in from DEV trunk...

KTS-3311
"Custom Error page graphics not displaying in windows XP"
Fixed. Added a check to remove unwanted / or \ in then rooturl.

Committed By: Jonathan Byrne
Reviewed By: Megan Watson

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/branches/3.5.2c-Release-Branch@8396 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 59 additions and 14 deletions
customerrorpage.php
1 <?php 1 <?php
  2 +/**
  3 + * $Id: customerrorpage.php 8391 2008-04-23 10:12:34Z jonathan_byrne $
  4 + *
  5 + * KnowledgeTree Community Edition
  6 + * Document Management Made Simple
  7 + * Copyright (C) 2008 KnowledgeTree Inc.
  8 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify it under
  11 + * the terms of the GNU General Public License version 3 as published by the
  12 + * Free Software Foundation.
  13 + *
  14 + * This program is distributed in the hope that it will be useful, but WITHOUT
  15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 + * details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 + *
  22 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 + * California 94120-7775, or email info@knowledgetree.com.
  24 + *
  25 + * The interactive user interfaces in modified source and object code versions
  26 + * of this program must display Appropriate Legal Notices, as required under
  27 + * Section 5 of the GNU General Public License version 3.
  28 + *
  29 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  30 + * these Appropriate Legal Notices must retain the display of the "Powered by
  31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 + * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * copyright notice.
  35 + * Contributor( s): ______________________________________
  36 + */
2 37
3 if (array_key_exists('fatal', $_POST)) 38 if (array_key_exists('fatal', $_POST))
4 { 39 {
@@ -13,32 +48,41 @@ if (array_key_exists(&#39;Error_MessageOne&#39;, $_POST) &amp;&amp; array_key_exists(&#39;Error_Mess @@ -13,32 +48,41 @@ if (array_key_exists(&#39;Error_MessageOne&#39;, $_POST) &amp;&amp; array_key_exists(&#39;Error_Mess
13 } 48 }
14 49
15 session_start(); 50 session_start();
16 -require_once("config/dmsDefaults.php"); 51 +
17 52
18 if (array_key_exists('sErrorMessage', $_SESSION)) 53 if (array_key_exists('sErrorMessage', $_SESSION))
19 { 54 {
20 -$phperror = $_SESSION['sErrorMessage']; 55 + $phperror = $_SESSION['sErrorMessage'];
21 } 56 }
22 57
23 -global $default;  
24 -  
25 -$sUrl = $default->rootUrl; 58 +//Finding root Url
  59 +$sHost = $_SERVER['HTTP_HOST'];
  60 +$sScriptName = dirname($_SERVER['SCRIPT_NAME']);
  61 +$sRoot = $sHost.$sScriptName;
  62 +$sLastChar = substr($sScriptName, -1, 1);
  63 +$sScriptName = ($sLastChar == '\\' || $sLastChar == '/') ? substr($sScriptName, 0, -1) : $sScriptName;
  64 +$bSSLEnabled = false;
  65 +if ($_SERVER['HTTPS'] === 'on')
  66 +{
  67 + $bSSLEnabled = true;
  68 +}
  69 +$sRootUrl = ($bSSLEnabled ? 'https://' : 'http://').$sRoot;
26 70
27 ?> 71 ?>
28 72
29 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html> 73 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>
30 <head> 74 <head>
31 <title>Knowledgetree - Desklet</title> 75 <title>Knowledgetree - Desklet</title>
32 - <link rel="stylesheet" type="text/css" href="<?php echo $sUrl ?>/resources/css/errors.css" /> 76 + <link rel="stylesheet" type="text/css" href="<?php echo $sRootUrl ?>/resources/css/errors.css" />
33 77
34 <script type="text/javascript"> 78 <script type="text/javascript">
35 79
36 function Click() 80 function Click()
37 { 81 {
38 -var open = document.getElementById('exp');  
39 -open.style.display = 'block';  
40 -var border = document.getElementById('error-container');  
41 -border.style.height = '250px'; 82 + var open = document.getElementById('exp');
  83 + open.style.display = 'block';
  84 + var border = document.getElementById('error-container');
  85 + border.style.height = '220px';
42 } 86 }
43 87
44 </script> 88 </script>
@@ -51,12 +95,13 @@ border.style.height = &#39;250px&#39;; @@ -51,12 +95,13 @@ border.style.height = &#39;250px&#39;;
51 <div id="acc-error"> 95 <div id="acc-error">
52 96
53 97
54 - <h1>Error!! - You have encountered a problem starting your document management system.</h1>  
55 - <p><h2>Please contact your systems administrator</h2></p>  
56 - <p>For more details, click here <img src="<?php echo $sUrl ?>/resources/graphics/info.gif" style="cursor: pointer;" onclick="Click()" /><div id ="exp" style="display: none; "> <?php if(isset($sErrorMessage)){ echo $sErrorMessage; }else if(isset($posted)){ echo $posted; } else if($phperror){ echo $phperror; } ?></div></p> 98 + <h1>An Has Error Occurred</h1>
  99 + <p>You have encountered a problem with your document management system.</p>
  100 + <p>Please contact your systems administrator.</p>
  101 + <p>For more information on the error click here: <img src="<?php echo $sRootUrl ?>/resources/graphics/info.gif" style="cursor: pointer;" onclick="Click()" /><div id ="exp" style="display: none; "> <?php if(isset($sErrorMessage)){ echo $sErrorMessage; }else if(isset($posted)){ echo $posted; } else if($phperror){ echo $phperror; } ?></div></p>
57 102
58 </div> 103 </div>
59 </div> 104 </div>
60 105
61 </body> 106 </body>
62 -</html>  
63 \ No newline at end of file 107 \ No newline at end of file
  108 +</html>