-
-
Notifications
You must be signed in to change notification settings - Fork 158
/
index.php
executable file
·114 lines (104 loc) · 4.14 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
/*
------------------------------------------------------------------------------
$Id$
AbanteCart, Ideal OpenSource Ecommerce Solution
http://www.AbanteCart.com
Copyright © 2011-2015 Belavier Commerce LLC
This source file is subject to Open Software License (OSL 3.0)
License details is bundled with this package in the file LICENSE.txt.
It is also available at this URL:
<http://www.opensource.org/licenses/OSL-3.0>
UPGRADE NOTE:
Do not edit or add to this file if you wish to upgrade AbanteCart to newer
versions in the future. If you wish to customize AbanteCart for your
needs please refer to http://www.AbanteCart.com for more information.
------------------------------------------------------------------------------
*/
// Real path (operating system web root) to the directory where abantecart is installed
$root_path = dirname(__FILE__);
if (defined('IS_WINDOWS')) {
$root_path = str_replace('\\', '/', $root_path);
}
define('DIR_ROOT', $root_path);
// HTTP
define('HTTP_SERVER', 'http://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/.\\') . '/');
define('HTTP_ABANTECART', 'http://' . $_SERVER['HTTP_HOST'] . rtrim(rtrim(dirname($_SERVER['PHP_SELF']), 'static_pages'), '/.\\'). '/');
// DIR
define('DIR_APP_SECTION', str_replace('\'', '/', realpath(dirname(__FILE__))) . '/');
define('DIR_CORE', str_replace('\'', '/', realpath(dirname(__FILE__) . '/../')) . '/core/');
define('DIR_ABANTECART', str_replace('\'', '/', realpath(DIR_APP_SECTION . '../')) . '/');
// Startup
require_once(DIR_ABANTECART . 'system/config.php');
// New Installation
if (!defined('DB_DATABASE')) {
header('Location: ../install/index.php');
exit;
}
session_start();
$error = 'Please check AbanteCart and webserver error logs for more details. You can check error log in the control panel if it is functional. Otherwise, refer to error log located on your web server';
if ( !empty($_SESSION['exception_msg']) ) {
$error = $_SESSION['exception_msg'];
unset($_SESSION['exception_msg']);
}
$subject = rawurlencode("AbanteCart Crash Report " . UNIQUE_ID);
$pos = -2;
$t ='';
$count = 0;
$log_contents_end = "Log file tail: \n\n";
$log_handle = fopen(DIR_ABANTECART . "system/logs/error.txt", "r");
//read 100 lines backwards from the eof or less
$max_lines = 100;
$max_bytes = filesize(DIR_ABANTECART . "system/logs/error.txt");
$lines = array();
while ($count < $max_lines) {
//read one line back
while ($t != "\n") {
if(abs($pos) >= $max_bytes){
break;
}
fseek($log_handle, $pos, SEEK_END);
$t = fgetc($log_handle);
$pos = $pos - 1;
}
$lines[] = fgets($log_handle);
$count++;
$t='';
}
fclose ($log_handle);
$body = rawurlencode($log_contents_end . implode("", array_reverse($lines)) );
?>
<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>AbanteCart - Error</title>
<link rel="stylesheet" type="text/css" href="view/stylesheet/stylesheet.css" />
</head>
<body>
<div id="container">
<div id="header"><img src="view/image/logo.png" alt="AbanteCart" title="AbanteCart" /></div>
<div id="content">
<div id="content_top"></div>
<div id="content_middle">
<h1 class="error">There has been a critical error processing your request</h1>
<div style="width: 100%; display: inline-block;">
<?php echo $error; ?>
</div>
<br><br>
<center>
<div style="font-size: 16px;">
<b><a href="mailto:help@abantecart.com?subject=<?php echo $subject ?>&body=<?php echo $body ?>">Report this problem to AbanteCart team (do not change email subject)</a></b>
</div>
<br><br>
<div>
<a href="<?php echo HTTP_ABANTECART; ?>">Go to main page</a>
</div>
</center>
</div>
<div id="content_bottom"></div>
</div>
<div id="footer"><a onclick="window.open('http://www.abantecart.com');">Project Homepage</a>|<a onclick="window.open('http://docs.abantecart.com');">Documentation</a>|<a onclick="window.open('http://forum.abantecart.com');">Support Forums</a>|<a onclick="window.open('http://marketplace.abantecart.com');">Marketplace</a></div>
</div>
</body>
</html>