Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
06256d6c
Commit
06256d6c
authored
12 years ago
by
Peter Rotich
Browse files
Options
Downloads
Patches
Plain Diff
Set default timezone when none is set in php.ini
parent
731baca1
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.inc.php
+25
-12
25 additions, 12 deletions
main.inc.php
with
25 additions
and
12 deletions
main.inc.php
+
25
−
12
View file @
06256d6c
...
...
@@ -13,8 +13,8 @@
See LICENSE.TXT for details.
vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
**********************************************************************/
#Disable direct access.
if
(
!
strcasecmp
(
basename
(
$_SERVER
[
'SCRIPT_NAME'
]),
basename
(
__FILE__
)))
die
(
'kwaheri rafiki!'
);
...
...
@@ -44,10 +44,23 @@
if
(
defined
(
'E_DEPRECATED'
))
# 5.3.0
$error_reporting
&=
~
(
E_DEPRECATED
|
E_USER_DEPRECATED
);
error_reporting
(
$error_reporting
);
//Respect whatever is set in php.ini (sysadmin knows better??)
#Don't display errors
ini_set
(
'display_errors'
,
1
);
ini_set
(
'display_startup_errors'
,
1
);
//Default timezone
if
(
!
ini_get
(
'date.timezone'
))
{
if
(
function_exists
(
'date_default_timezone_set'
))
{
if
(
@
date_default_timezone_get
())
//Let PHP determine the timezone.
@
date_default_timezone_set
(
@
date_default_timezone_get
());
else
//Default to EST - if PHP can't figure it out.
date_default_timezone_set
(
'America/New_York'
);
}
else
{
//Default when all fails. PHP < 5.
ini_set
(
'date.timezone'
,
'America/New_York'
);
}
}
#Set Dir constants
if
(
!
defined
(
'ROOT_PATH'
))
define
(
'ROOT_PATH'
,
'./'
);
//root path. Damn directories
...
...
@@ -70,7 +83,7 @@
$configfile
=
ROOT_DIR
.
'ostconfig.php'
;
elseif
(
file_exists
(
INCLUDE_DIR
.
'settings.php'
))
{
//OLD config file.. v 1.6 RC5
$configfile
=
INCLUDE_DIR
.
'settings.php'
;
//Die gracefully on upgraded v1.6 RC5 installation - otherwise script dies with confusing message.
//Die gracefully on upgraded v1.6 RC5 installation - otherwise script dies with confusing message.
if
(
!
strcasecmp
(
basename
(
$_SERVER
[
'SCRIPT_NAME'
]),
'settings.php'
))
die
(
'Please rename config file include/settings.php to include/ost-config.php to continue!'
);
}
elseif
(
file_exists
(
INCLUDE_DIR
.
'ost-config.php'
))
//NEW config file v 1.6 stable ++
...
...
@@ -82,18 +95,18 @@
require
(
$configfile
);
define
(
'CONFIG_FILE'
,
$configfile
);
//used in admin.php to check perm.
//Path separator
if
(
!
defined
(
'PATH_SEPARATOR'
)){
if
(
strpos
(
$_ENV
[
'OS'
],
'Win'
)
!==
false
||
!
strcasecmp
(
substr
(
PHP_OS
,
0
,
3
),
'WIN'
))
define
(
'PATH_SEPARATOR'
,
';'
);
//Windows
else
else
define
(
'PATH_SEPARATOR'
,
':'
);
//Linux
}
//Set include paths. Overwrite the default paths.
ini_set
(
'include_path'
,
'./'
.
PATH_SEPARATOR
.
INCLUDE_DIR
.
PATH_SEPARATOR
.
PEAR_DIR
);
#include required files
require
(
INCLUDE_DIR
.
'class.osticket.php'
);
...
...
@@ -121,7 +134,7 @@
#Session related
define
(
'SESSION_SECRET'
,
MD5
(
SECRET_SALT
));
//Not that useful anymore...
define
(
'SESSION_TTL'
,
86400
);
// Default 24 hours
define
(
'DEFAULT_MAX_FILE_UPLOADS'
,
ini_get
(
'max_file_uploads'
)
?
ini_get
(
'max_file_uploads'
)
:
5
);
define
(
'DEFAULT_PRIORITY_ID'
,
1
);
...
...
@@ -157,24 +170,24 @@
define
(
'TICKET_LOCK_TABLE'
,
TABLE_PREFIX
.
'ticket_lock'
);
define
(
'TICKET_EVENT_TABLE'
,
TABLE_PREFIX
.
'ticket_event'
);
define
(
'TICKET_EMAIL_INFO_TABLE'
,
TABLE_PREFIX
.
'ticket_email_info'
);
define
(
'EMAIL_TABLE'
,
TABLE_PREFIX
.
'email'
);
define
(
'EMAIL_TEMPLATE_TABLE'
,
TABLE_PREFIX
.
'email_template'
);
define
(
'FILTER_TABLE'
,
TABLE_PREFIX
.
'filter'
);
define
(
'FILTER_RULE_TABLE'
,
TABLE_PREFIX
.
'filter_rule'
);
define
(
'BANLIST_TABLE'
,
TABLE_PREFIX
.
'email_banlist'
);
//Not in use anymore....as of v 1.7
define
(
'SLA_TABLE'
,
TABLE_PREFIX
.
'sla'
);
define
(
'API_KEY_TABLE'
,
TABLE_PREFIX
.
'api_key'
);
define
(
'TIMEZONE_TABLE'
,
TABLE_PREFIX
.
'timezone'
);
define
(
'TIMEZONE_TABLE'
,
TABLE_PREFIX
.
'timezone'
);
#Global overwrite
if
(
$_SERVER
[
'HTTP_X_FORWARDED_FOR'
])
//Can contain multiple IPs - use the last one.
$_SERVER
[
'REMOTE_ADDR'
]
=
array_pop
(
explode
(
','
,
$_SERVER
[
'HTTP_X_FORWARDED_FOR'
]));
#Connect to the DB && get configuration from database
$ferror
=
null
;
if
(
!
db_connect
(
DBHOST
,
DBUSER
,
DBPASS
)
||
!
db_select_database
(
DBNAME
))
{
...
...
@@ -191,7 +204,7 @@
die
(
"<b>Fatal Error:</b> Contact system administrator."
);
exit
;
}
//Init
$session
=
$ost
->
getSession
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment