-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgp-load.php
More file actions
75 lines (64 loc) · 2.4 KB
/
gp-load.php
File metadata and controls
75 lines (64 loc) · 2.4 KB
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
<?php
/**
* Finds and loads the config file and the bootstrapping code
*/
// Die if PHP is not new enough
if ( version_compare( PHP_VERSION, '5.2', '<' ) ) {
die( sprintf( "Your server is running PHP version %s but GeoPress requires at least 5.2.\n", PHP_VERSION ) );
}
// Fix empty PHP_SELF
$PHP_SELF = $_SERVER['PHP_SELF'];
if ( empty($PHP_SELF) )
$_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
/**
* Define GP_PATH as this file's parent directory
*/
define( 'GP_PATH', dirname( __FILE__ ) . '/' );
define( 'GP_INC', 'gp-includes/' );
if ( defined( 'GP_CONFIG_FILE' ) && GP_CONFIG_FILE ) {
require_once GP_CONFIG_FILE;
require_once( GP_PATH . 'gp-settings.php' );
} elseif ( file_exists( GP_PATH . 'gp-config.php') ) {
require_once( GP_PATH . 'gp-config.php');
require_once( GP_PATH . 'gp-settings.php' );
} elseif ( file_exists( dirname( GP_PATH ) . '/gp-config.php') ) {
require_once( dirname( GP_PATH ) . '/gp-config.php' );
require_once( GP_PATH . 'gp-settings.php' );
} elseif ( !defined( 'GP_INSTALLING' ) || !GP_INSTALLING ) {
$install_uri = preg_replace( '|/[^/]+?$|', '/', $_SERVER['PHP_SELF'] ) . 'install.php';
header( 'Location: ' . $install_uri );
die();
} else {
/* ADD SOME STYLING TO THE ERROR PAGE */
/* THIS PROVIDES A PLACE TO START ADDING INSTALL INSTRUCTIONS */
/* CAN THEN ADD AS AN INCLUDE !!! :-) */
?>
<style>
body {
background:#F8FDFF;
}
.install-wrapper {
background:#FFF;
border:1px solid #DDD;
position:relative;
width:80%;
padding:5%;
margin:25px 5%;
text-align: center;
font-weight: bold;
background: #EFEFEF;
background: -webkit-gradient(linear, 0 0, 0 100%, from(#FFF), to(#EEE));
background: -moz-linear-gradient(top, #FFF, #EEE);
-pie-background: linear-gradient(90deg, #EEE, #FFF);
behavior: url(gp-admin/css/PIE.php);
z-index:0;
}
</style>
<?php
// HOW TO HAVE THIS TRANSLATABLE IF NO GP SETTINGS ...?
echo '<div class="install-wrapper">';
echo 'gp-config.php does not yet exist!<br /><br />( please make a copy of gp-config-sample.php and rename it to gp-config.php after making changes to the database username, etc )';
echo '</div>';
//-> originally just this: die("gp-config.php doesn't exist! Please create one on top of gp-config-sample.php");
die();
}