-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbootstrap.php
70 lines (64 loc) · 2.39 KB
/
bootstrap.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
<?php
/**
* papaya CMS
*
* @copyright 2000-2018 by papayaCMS project - All rights reserved.
* @link http://www.papaya-cms.com/
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License, version 2
*
* You can redistribute and/or modify this script under the terms of the GNU General Public
* License (GPL) version 2, provided that the copyright and license notes, including these
* lines, remain unmodified. papaya is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE.
*/
error_reporting(2047);
define('PAPAYA_ADMIN_PAGE', TRUE);
if (defined('PAPAYA_DOCUMENT_ROOT')) {
$path = PAPAYA_DOCUMENT_ROOT;
} else {
if (
isset($_SERVER['PATH_TRANSLATED']) &&
'' !== $_SERVER['PATH_TRANSLATED'] &&
FALSE === strpos($_SERVER['PATH_TRANSLATED'], '/modsec-')
) {
$path = str_replace('\\', '/', dirname(dirname($_SERVER['PATH_TRANSLATED'])));
} else {
$path = str_replace('\\', '/', dirname(dirname($_SERVER['SCRIPT_FILENAME'])));
}
if ('/' !== substr($path, -1)) {
$path .= '/';
}
/**
* Papaya document root - front controller directory on server
* @ignore
*/
define('PAPAYA_DOCUMENT_ROOT', $path);
}
if (file_exists($path.'../papaya.php')) {
/** @noinspection PhpIncludeInspection */
include_once $path.'../papaya.php';
} else {
/** @noinspection PhpIncludeInspection */
include_once $path.'conf.inc.php';
}
$isDevelopmentMode = defined('PAPAYA_DBG_DEVMODE') && PAPAYA_DBG_DEVMODE;
$includePapayaFile = function($fileName, $ifExistsOnly = FALSE) use ($isDevelopmentMode) {
if ($ifExistsOnly && !(file_exists($fileName) && is_readable($fileName))) {
return NULL;
}
/** @noinspection PhpIncludeInspection */
return $isDevelopmentMode ? include $fileName : @include $fileName;
};
if (file_exists($path.'../vendor/autoload.php')) {
$includePapayaFile($path.'../vendor/autoload.php');
} elseif (file_exists($path.'vendor/autoload.php')) {
/** @noinspection PhpIncludeInspection */
$includePapayaFile($path.'vendor/autoload.php');
}
$includePapayaFile(__DIR__.'/inc.glyphs.php', TRUE);
$includePapayaFile($path.'revision.inc.php', TRUE);
/** @var Papaya\CMS\CMSApplication $application */
$application = \Papaya\CMS\CMSApplication::getInstance();
$application->request->isAdministration = TRUE;
return $application;