Viewing file: global.inc.php (4.02 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/*
############################################################################
# DWmail
# - version 4.0
# - Copyright (c) 2003-2006 Dominion Web Design
# - http://www.dominion-web.com/products/dwmail/
############################################################################
#
# The contents of this file are subject to the DWmail License version
# 2.2 ('License'). You may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.dominion-web.com/products/dwmail/license.php
# Software distributed under the License is distributed on an "AS IS" basis,
# without warranty of any kind, either express or implied.
#
# This code is Copyright (c) 2003-2006 Dominion Web Design.
# All rights reserved.
#
# This software may not be redistributed outside the terms of the
# license agreement.
#
############################################################################
*/
class GlobalInit {
var $_versioncheck;
var $_sid_enabled;
function GlobalInit() {
ini_set ( "arg_separator.output", "&");
ini_set ( "session.use_cookies", 0);
ini_set ( "url_rewriter.tags", "a=href,area=href,frame=src,input=src,form=fakeentry");
session_name("sessionid");
set_magic_quotes_runtime(0);
$this->_sid_enabled = true;
// If PHP version is below 4.2.0 --enable-trans-sid is not loaded by default
// So we need to check both the version and whether session.use_trans_sid is
// is actually a loaded function in the session extension
$this->version_check("4.2.0");
if ($this->_versioncheck == true) {
$this->check_trans_sid();
}
}
function INIGet($WhichSetting) {
return ini_get($WhichSetting);
}
function SessAppend($TransIDEnabled, $querybegin) {
if (($TransIDEnabled == 0) || ($this->_sid_enabled == false)) {
if ($querybegin == 1) {
$sessappendreturn = "?";
}
else {
$sessappendreturn = "&";
}
$sessappendreturn .= strip_tags(SID);
}
else {
$sessappendreturn = "";
}
echo $sessappendreturn;
$sessappendreturn = null;
}
function SessAppend_noecho($TransIDEnabled, $querybegin) {
if (($TransIDEnabled == 0) || ($this->_sid_enabled == false)) {
if ($querybegin == 1) {
$sessappendreturn = "?";
}
else {
$sessappendreturn = "&";
}
$sessappendreturn .= strip_tags(SID);
}
else {
$sessappendreturn = "";
}
return $sessappendreturn;
$sessappendreturn = null;
}
function SessAppend_form($TransIDEnabled) {
if (($TransIDEnabled == 0) || ($this->_sid_enabled == false)) {
$sessappendreturn = "<input type=\"hidden\" name=\"" . session_name() . "\" value=\"" . session_id() . "\" />";
}
else {
$sessappendreturn = "";
}
return $sessappendreturn;
$sessappendreturn = null;
}
function version_check($vercheck) {
$versioncompare = version_compare (phpversion(), $vercheck);
if ($versioncompare == -1) {
$this->_versioncheck = true;
}
else {
$this->_versioncheck = false;
}
return $this->_versioncheck;
}
// Function for to check session.use_trans_sid if PHP < 4.2.0
function check_trans_sid() {
ob_start();
phpinfo(INFO_GENERAL);
$val_phpinfo .= ob_get_contents();
ob_end_clean();
if (strstr($val_phpinfo, "--enable-trans-sid")) {
$this->_sid_enabled = true;
}
else {
$this->_sid_enabled = false;
}
return $this->_sid_enabled;
}
function GetCRLF() {
$crlf = stristr(PHP_OS, 'WIN') ? "\r\n" : "\n";
return $crlf;
}
function IsWindows() {
if (stristr(PHP_OS, 'WIN')) {
return true;
}
else {
return false;
}
}
function CheckSlashes($string) {
if(get_magic_quotes_gpc()) {
$string = stripslashes($string);
}
return $string;
}
function CheckSessionLogged($checkvar) {
if (!isset($_SESSION[$checkvar])) {
$location = urlencode(substr($_SERVER["REQUEST_URI"], 1));
//header("./index.php?redir=" . $location);
//exit;
// Logged out so do something
}
}
}
?>
|