-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexponent_setup.php
More file actions
96 lines (88 loc) · 3.9 KB
/
exponent_setup.php
File metadata and controls
96 lines (88 loc) · 3.9 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
##################################################
#
# Copyright (c) 2004-2006 OIC Group, Inc.
# Written and Designed by James Hunt
#
# This file is part of Exponent
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
// Set up sessions to use cookies, NO MATTER WHAT
ini_set('session.use_cookies',1);
// Set the save_handler to files
ini_set('session.save_handler','files');
if (DEVELOPMENT) {
// In development mode, we need to turn on full throttle error reporting.
// Display all errors (some production servers have this set to off)
ini_set('display_errors',1);
// Up the ante on the error reporting so we can see notices as well.
ini_set('error_reporting',E_ALL);
// This is rarely set to true, but the first time it is, we'll be ready.
ini_set('ignore_repeated_errors',0);
} else {
// We can't be showing errors in a production environment...
ini_set('display_errors',0);
ini_set('ignore_repeated_errors',1);
}
if (DEVELOPMENT >= 2) {
function debug($str) { echo $str.'<br /><br />'; }
function dump_debug($var) { var_dump($var);echo '<br /><br />'; }
} else {
function debug($str) { }
function dump_debug($var) { }
}
// The following code was lifted from phpMyAdmin, but then again, this is Open Source, right?
// Determines platform (OS), browser and version of the user
// Based on a phpBuilder article:
// see http://www.phpbuilder.net/columns/tim20000821.php
if (!defined('EXPONENT_USER_OS')) {
// 1. Platform
if (strstr($_SERVER['HTTP_USER_AGENT'], 'Win')) {
define('EXPONENT_USER_OS', 'Win');
} else if (strstr($_SERVER['HTTP_USER_AGENT'], 'Mac')) {
define('EXPONENT_USER_OS', 'Mac');
} else if (strstr($_SERVER['HTTP_USER_AGENT'], 'Linux')) {
define('EXPONENT_USER_OS', 'Linux');
} else if (strstr($_SERVER['HTTP_USER_AGENT'], 'Unix')) {
define('EXPONENT_USER_OS', 'Unix');
} else if (strstr($_SERVER['HTTP_USER_AGENT'], 'OS/2')) {
define('EXPONENT_USER_OS', 'OS/2');
} else {
define('EXPONENT_USER_OS', 'Other');
}
// 2. browser and version
// (must check everything else before Mozilla)
$log_version = array();
if (preg_match('@Opera(/| )([0-9].[0-9]{1,2})@', $_SERVER['HTTP_USER_AGENT'], $log_version)) {
define('EXPONENT_USER_BROWSER_VERSION', $log_version[2]);
define('EXPONENT_USER_BROWSER', 'OPERA');
} else if (preg_match('@MSIE ([0-9].[0-9]{1,2})@', $_SERVER['HTTP_USER_AGENT'], $log_version)) {
define('EXPONENT_USER_BROWSER_VERSION', $log_version[1]);
define('EXPONENT_USER_BROWSER', 'IE');
} else if (preg_match('@OmniWeb/([0-9].[0-9]{1,2})@', $_SERVER['HTTP_USER_AGENT'], $log_version)) {
define('EXPONENT_USER_BROWSER_VERSION', $log_version[1]);
define('EXPONENT_USER_BROWSER', 'OMNIWEB');
} else if (preg_match('@(Konqueror/)(.*)(;)@', $_SERVER['HTTP_USER_AGENT'], $log_version)) {
define('EXPONENT_USER_BROWSER_VERSION', $log_version[2]);
define('EXPONENT_USER_BROWSER', 'KONQUEROR');
} else if (preg_match('@Mozilla/([0-9].[0-9]{1,2})@', $_SERVER['HTTP_USER_AGENT'], $log_version)
&& preg_match('@Safari/([0-9]*)@', $_SERVER['HTTP_USER_AGENT'], $log_version2)) {
define('EXPONENT_USER_BROWSER_VERSION', $log_version[1] . '.' . $log_version2[1]);
define('EXPONENT_USER_BROWSER', 'SAFARI');
} else if (preg_match('@Mozilla/([0-9].[0-9]{1,2})@', $_SERVER['HTTP_USER_AGENT'], $log_version)) {
define('EXPONENT_USER_BROWSER_VERSION', $log_version[1]);
define('EXPONENT_USER_BROWSER', 'MOZILLA');
} else {
define('EXPONENT_USER_BROWSER_VERSION', 0);
define('EXPONENT_USER_BROWSER', 'OTHER');
}
}
?>