This repository has been archived by the owner on Jun 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
index.php
52 lines (42 loc) · 1.59 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
<?php
/**
* Simple Stats: PHP web statistics software. See the license.txt file for copyright and licensing information.
*/
if ( get_magic_quotes_gpc() ) {
foreach ( array_keys( $_GET ) as $key )
$_GET[$key] = stripslashes( $_GET[$key] );
foreach ( array_keys( $_POST ) as $key )
$_POST[$key] = stripslashes( $_POST[$key] );
foreach ( array_keys( $_COOKIE ) as $key )
$_COOKIE[$key] = stripslashes( $_COOKIE[$key] );
$_REQUEST = array_merge( $_GET, $_POST );
}
define( 'SIMPLE_STATS_PATH', realpath( dirname( __FILE__ ) ) );
if( file_exists( SIMPLE_STATS_PATH.'/config.php' ) )
require_once( SIMPLE_STATS_PATH.'/config.php' );
require_once( SIMPLE_STATS_PATH.'/includes/classes.php' );
require_once( SIMPLE_STATS_PATH.'/includes/ua.php' );
require_once( SIMPLE_STATS_PATH.'/includes/functions.php' );
include_once( SIMPLE_STATS_PATH.'/includes/countries.php' );
$page = ( isset( $_GET['p'] ) && in_array( $_GET['p'], array( 'paths', 'overview', 'options', 'js', 'login', 'logout' ) ) ) ? $_GET['p'] : 'overview';
$ss = new SimpleStats();
if( !$ss->is_installed() ) {
// check whether we've just finished setup
if( isset( $_POST['action'] ) && $_POST['action'] == 'complete_setup' ) {
$ss->setup_options();
}
else {
$page = 'setup';
require_once( SIMPLE_STATS_PATH.'/includes/setup.php' );
exit;
}
}
date_default_timezone_set( $ss->options['tz'] );
if ( $page == 'logout' || needs_authentication() ) {
if ( $page == 'logout' )
logout();
if ( $page != 'login' && !is_logged_in() )
request_login( $page );
}
require_once( SIMPLE_STATS_PATH.'/includes/'.$page.'.php' );
render_page();