PHP 代码:
<?php
define( "SWIFTDEBUG", true );
@ini_set( "session.use_trans_sid", false );
@ini_set( "session.bug_compat_42", true );
error_reporting( E_ALL & ~E_NOTICE );
if ( PHP_VERSION < "4.1.0" )
{
$_GET =& $HTTP_GET_VARS;
$_POST =& $HTTP_POST_VARS;
$_COOKIE =& $HTTP_COOKIE_VARS;
$_SERVER =& $HTTP_SERVER_VARS;
$_ENV =& $HTTP_ENV_VARS;
$_FILES =& $HTTP_POST_FILES;
$GLOBALS['_REQUEST'] = array_merge( $_GET, $_POST, $_COOKIE );
}
if ( defined( "SWIFTCUSTOMPATH" ) )
{
chdir( SWIFTCUSTOMPATH );
}
else
{
chdir( dirname( __FILE__ ) );
}
function processgpc( &$arrayvar )
{
if ( is_array( $arrayvar ) == true )
{
foreach ( $arrayvar as $key => $val )
{
if ( is_string( $val ) == true )
{
$arrayvar[$key] = stripslashes( $val );
}
else if ( is_array( $val ) )
{
$arrayvar[$key] = processgpc( $val );
}
}
}
return $arrayvar;
}
if ( !defined( "ISMODERNBILL" ) && !defined( "ISMODERNBILLV5" ) && !defined( "ISWHMCS" ) )
{
$_reserved = array( "_reserved", "GLOBALS", "_GET", "_POST", "_COOKIE", "_SERVER", "_ENV", "_REQUEST", "_FILES", "argv" );
if ( is_array( $GLOBALS ) )
{
reset( $GLOBALS['GLOBALS'] );
while ( list( $_key, $_val ) = each( $GLOBALS['GLOBALS'] ) )
{
if ( !in_array( $_key, $_reserved ) && (( $_key != "_key" ) && ( $_key != "_val" ) ))
{
unset( $GLOBALS->$_key );
}
}
}
unset( $GLOBALS['_key'] );
unset( $GLOBALS['_val'] );
}
if ( get_magic_quotes_gpc( ) == true )
{
$GLOBALS['_GET'] = processgpc( $GLOBALS['_GET'] );
$GLOBALS['_POST'] = processgpc( $GLOBALS['_POST'] );
$GLOBALS['_COOKIE'] = processgpc( $GLOBALS['_COOKIE'] );
if ( is_array( $_FILES ) )
{
foreach ( $GLOBALS['_FILES'] as $key => $val )
{
$GLOBALS['_FILES'][$key]['tmp_name'] = str_replace( "\\", "\\\\", $val['tmp_name'] );
}
}
$GLOBALS['_FILES'] = processgpc( $GLOBALS['_FILES'] );
$GLOBALS['_REQUEST'] = array_merge( $_POST, $_GET, $_COOKIE );
}
set_magic_quotes_runtime( 0 );
unset( $_SWIFT );
if ( defined( "ISMODERNBILLV5" ) || defined( "ISWHMCS" ) )
{
global $_SWIFT,$interface,$template,$departments,$staffauth;
global $module,$grid,$xml,$staff,$settings,
$dbCore, $events, $session;
global $loginshare,
$cookie,
$errormessage,
$infomessage,
$permissions,
$mimelist,
$registry,
$datastore,
$_MODULES;
}
require_once( "./includes/functions.php" );
$_SWIFT['starttime'] = fetchmicrotime( );
$_SWIFT['cwd'] = getcwd( );
$_SWIFT['timezone'] = 0;
require_once( "./config/config.php" );
$GLOBALS['_MODULES'] = $_MODULES;
require_once( "./includes/SmartyLight/class.template.php" );
$dbCore = new dbcore( $_DB['hostname'], $_DB['username'], $_DB['password'], $_DB['name'], $_DB['type'], false, $_DB['port'], $_DB['charset'] );
$registry = new registry( );
$datastore = new datastore( );
$cookie = new cookie( );
$template = new template( );
if ( SWIFT_AREA != SWIFT_CLIENT && SWIFT_AREA != SWIFT_VISITOR )
{
$template->languagetabletype = "file";
$_SWIFT['theme'] = "admin_".cleanvar( $_SWIFT['admintheme'] );
$template->assign( "languagecode", $_SWIFT['adminlanguage'] );
$template->defaultLanguage = $_SWIFT['adminlanguage'];
$template->loadlanguagetable( );
}
$events = new events( );
$module = new module( );
$interface = new cpinterface( );
if ( SWIFT_AREA == SWIFT_ADMIN || SWIFT_AREA == SWIFT_STAFF || SWIFT_AREA == SWIFT_WINAPP || SWIFT_AREA == SWIFT_SYNCWORKS || SWIFT_AREA == SWIFT_SYNCML || SWIFT_AREA == SWIFT_MONITOR || SWIFT_AREA == SWIFT_RSS || SWIFT_AREA == SWIFT_PDA || SWIFT_AREA == SWIFT_INSTAALERT || SWIFT_AREA == SWIFT_MOBILE || SWIFT_AREA == SWIFT_WAP || SWIFT_AREA == SWIFT_API )
{
$staffauth = new staffauth( );
$datastore->cache( "gridcache" );
$datastore->cache( "groupsettingcache" );
$datastore->cache( "departmentcache" );
$datastore->cache( "commentcache" );
}
else if ( SWIFT_AREA == SWIFT_CLIENT || SWIFT_AREA == SWIFT_VISITOR )
{
$datastore->cache( "languagecache" );
$datastore->cache( "usergroupsettingcache" );
require_once( "./includes/functions_users.php" );
}
else if ( SWIFT_AREA == SWIFT_CLI )
{
$datastore->cache( "prioritycache" );
$datastore->cache( "statuscache" );
$datastore->cache( "queuecache" );
$datastore->cache( "breaklinecache" );
$datastore->cache( "staffcache" );
$datastore->cache( "ticketcountcache" );
$datastore->cache( "parserbanscache" );
$datastore->cache( "parsercatchallcache" );
$datastore->cache( "departmentcache" );
$datastore->cache( "attachmenttypescache" );
$datastore->cache( "slaplancache" );
$datastore->cache( "slaschedulecache" );
}
$datastore->cache( "staffassigncache" );
$datastore->cache( "groupassigncache" );
$datastore->cache( "staffcache" );
$datastore->cache( "tgroupassigncache" );
$datastore->cache( "settingscache" );
$datastore->cache( "tgroupcache" );
$datastore->cache( "languagecache" );
$datastore->loaddata( );
if ( !is_array( $_SWIFT['settingscache'] ) )
{
echo "<BR /><font face='verdana,arial,helvetica' size='2' color='red'><B>".SWIFTPRODUCT." is not installed, Please run setup/index.php to run ".SWIFTPRODUCT."</B></font>";
exit( );
}
$settings = new settings( );
$_SWIFT['timezone'] = iif( !empty( $_SWIFT['settings']['dt_timezone'] ), $_SWIFT['settings']['dt_timezone'], 0 );
$_SWIFT['daylightsavings'] = iif( $_SWIFT['settings']['dt_daylightsavings'] == 1, true, false );
$_SWIFT['stopwords'] = array( "GAY", "ASS", "SEX", "POO", "NIG", "SUK", "SUC", "WTF", "KKK", "FAG", "FUK", "FUC", "FFS", "LOL", "VAG", "DIK", "DIC", "FCK", "JIG", "KIL", "JEW", "CUM", "PUS", "POS", "JPG", "PNG", "GIF", "PHP", "PSP", "ASP", "DVD", "SQL", "ABC", "CPP", "NBC", "TXT", "DOC", "CNN", "PDF", "GOD", "BBC", "GOO", "PPT", "MSN", "AOL", "ICQ", "SWF", "AIM", "MEX", "JAP", "AZN", "PIG", "COW", "NIP", "CNT", "KFC", "DIE", "TOE", "HOE", "USA", "JPN", "DOG", "SOL", "PIS", "TIT", "STD", "WAP", "DED", "COK", "FAP", "HIV" );
$domaindata = parse_url( $_SWIFT['settings']['general_producturl'] );
$module->registered = $settings->getsection( "registeredmodules" );
$module->registered['core'] = "1";
$session = new session( );
if ( SWIFT_AREA == SWIFT_CLIENT || SWIFT_AREA == SWIFT_VISITOR || SWIFT_AREA == SWIFT_RSS )
{
unset( $_tgroupid );
require_once( "./includes/LoginShare/loginshare.php" );
$loginshare = new loginsharecore( );
$_SWIFT['theme'] = "client_".cleanvar( $_SWIFT['clienttheme'] );
$_SWIFT['user'] = array( );
$_SWIFT['user']['loggedin'] = false;
$cookie->parsecookie( "client" );
if ( trim( $_REQUEST['group'] ) != "" )
{
foreach ( $_SWIFT['tgroupcache'] as $key => $val )
{
if ( ( $val['title'] == strtolower( $_REQUEST['group'] ) ) )
{
$template->assign( "tgroupname", $val['title'] );
$_tgroupid = $val['tgroupid'];
break;
}
}
}
$cookiegroup = $cookie->getkey( "client", "groupid" );
$cookielanguageid = $cookie->getkey( "client", "languageid" );
$_buildcookie = false;
if ( !empty( $_tgroupid ) )
{
$cookie->addcookie( "client", "groupid", $_tgroupid );
$_SWIFT['tgroup'] = $_SWIFT['tgroupcache'][$_tgroupid];
$template->setgroup( $_tgroupid );
$_buildcookie = true;
}
else if ( defined( "ISMODERNBILLV5" ) && !empty( $_SWIFT['settings']['g_mbtgroup'] ) )
{
$_SWIFT['tgroup'] = $_SWIFT['tgroupcache'][$_SWIFT['settings']['g_mbtgroup']];
$template->setgroup( $_SWIFT['tgroup']['tgroupid'] );
}
else if ( defined( "ISWHMCS" ) && !empty( $_SWIFT['settings']['g_whmcstgroup'] ) )
{
$_SWIFT['tgroup'] = $_SWIFT['tgroupcache'][$_SWIFT['settings']['g_whmcstgroup']];
$template->setgroup( $_SWIFT['tgroup']['tgroupid'] );
}
else if ( $cookiegroup != "" && isset( $_SWIFT['tgroupcache'][$cookiegroup] ) )
{
$_SWIFT['tgroup'] = $_SWIFT['tgroupcache'][$cookiegroup];
$template->setgroup( $_SWIFT['tgroup']['tgroupid'] );
}
else
{
foreach ( $_SWIFT['tgroupcache'] as $key => $val )
{
if ( ( $val['isdefault'] == 1 ) )
{
$_SWIFT['tgroup'] = $_SWIFT['tgroupcache'][$val['tgroupid']];
$_tisdefault = $val['tgroupid'];
break;
}
}
$template->setgroup( $_tisdefault );
}
$template->assign( "tgroupname", $_SWIFT['tgroup']['title'] );
$template->assign( "tgroup", $_SWIFT['tgroup'] );
if ( !empty( $_SWIFT['tgroup']['companyname'] ) )
{
$_SWIFT['settings']['general_companyname'] = $_SWIFT['tgroup']['companyname'];
}
if ( !empty( $_GET['languageid'] ) && !empty( $_SWIFT['languagecache'][$_GET['languageid']]['languageid'] ) )
{
$languagecode = $_SWIFT['languagecache'][$_GET['languageid']]['languagecode'];
$cookie->addcookie( "client", "languageid", $_GET['languageid'] );
$_buildcookie = true;
}
else if ( !empty( $cookielanguageid ) && !empty( $_SWIFT['languagecache'][$cookielanguageid]['languageid'] ) )
{
$languagecode = $_SWIFT['languagecache'][$cookielanguageid]['languagecode'];
}
else
{
$languagecode = $_SWIFT['languagecache'][$_SWIFT['tgroup']['languageid']]['languagecode'];
if ( empty( $languagecode ) )
{
$languagecode = "en-us";
}
}
if ( $_buildcookie )
{
$cookie->buildcookie( "client", true );
}
$template->defaultLanguage = $languagecode;
$template->activeLanguage = $languagecode;
$template->assign( "languagecode", $languagecode );
$template->languagetabletype = "db";
$_SWIFT['clientlanguage'] = $languagecode;
if ( empty( $_REQUEST['_m'] ) )
{
$datastore->cachelanguagesection( "index" );
}
$template->loadlanguagetable( );
$datastore->loaddata( true );
$template->assign( "languagelist", $_SWIFT['languagecache'] );
if ( defined( "ISMODERNBILL" ) )
{
$_SWIFT['tgroup']['loginapi_moduleid'] = LOGINAPI_MODERNBILL;
}
else if ( defined( "ISMODERNBILLV5" ) )
{
$_SWIFT['tgroup']['loginapi_moduleid'] = LOGINAPI_MODERNBILLV5;
}
else if ( defined( "ISWHMCS" ) )
{
$_SWIFT['tgroup']['loginapi_moduleid'] = LOGINAPI_WHMCSINTEGRATION;
}
$loginshare->loadmodule( );
if ( $_SWIFT['tgroup']['grouppassword'] != ""){
if ( !isset( $_SERVER['PHP_AUTH_USER'] ) || md5( $_SERVER['PHP_AUTH_PW'] ) != $_SWIFT['tgroup']['grouppassword'] )
{
header( "WWW-Authenticate: Basic realm=\"".$_SWIFT['language']['groupaccess']."\"" );
header( "HTTP/1.0 401 Unauthorized" );
echo $_SWIFT['language']['groupaccessmsg'];
exit( );
}
}
if ( $module->isregistered( MODULE_KNOWLEDGEBASE ) )
{
$template->assign( "kbisregistered", true );
}
if ( $module->isregistered( MODULE_DOWNLOADS ) )
{
$template->assign( "dlisregistered", true );
}
if ( $module->isregistered( MODULE_TROUBLESHOOTER ) )
{
$template->assign( "trisregistered", true );
}
}
$_SWIFT['themepath'] = $settings->getkey( "settings", "general_producturl" )."themes/".$_SWIFT['theme']."/";
$_SWIFT['swiftpath'] = $settings->getkey( "settings", "general_producturl" );
$_SWIFT['IP'] = $_SERVER['REMOTE_ADDR'];
$_SWIFT['localepath'] = $_SWIFT['swiftpath']."locale/".$_SWIFT['adminlanguage']."/";
$template->register_function( "displaytemplate", "tpl_function_displayTemplate" );
$template->register_function( "urlencode", "tpl_function_urlencode" );
$template->register_function( "includeURL", "tpl_function_includeURL" );
$template->template_dir = "./themes/".$_SWIFT['theme']."/";
$template->compile_dir = "./cache";
$template->caching = false;
$template->setpath( "./themes/".$_SWIFT['theme']."/" );
$template->assign( "_SWIFT", $_SWIFT );
$template->assign( "settings", $_SWIFT['settings'] );
$self_url = sprintf( "http%s://%s%s", isset( $_SERVER['HTTPS'] ) && intval( $_SERVER['HTTPS'] ) == TRUE ? "s" : "", $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'] );
$domaindata = array( );
if ( SWIFT_AREA == SWIFT_CLIENT )
{
$domaindata = parse_url( $self_url );
}
if ( !empty( $domaindata['user'] ) )
{
$_swiftpath = $domaindata['scheme']."://".$domaindata['user'].":".$domaindata['password']."@".$domaindata['host'].$domaindata['path'];
}
else
{
$_swiftpath = $domaindata['scheme']."://".$domaindata['host'].$domaindata['path'];
}
if ( substr( strtolower( $_swiftpath ), -3 ) == "php" )
{
$_swiftpath = substr( strtolower( $_swiftpath ), 0, strrpos( $_swiftpath, "/" ) );
}
else
{
$_swiftpath = strtolower( $_swiftpath );
}
if ( substr( $_swiftpath, -1 ) != "/" )
{
$_swiftpath .= "/";
}
if ( $_SWIFT['settings']['g_overrideswiftpath'] == 1 && SWIFT_AREA == SWIFT_CLIENT )
{
$_SWIFT['swiftpath'] = $_swiftpath;
$_SWIFT['themepath'] = $_swiftpath."themes/".$_SWIFT['theme']."/";
}
$_SWIFT['_swiftpath'] = $_swiftpath;
$template->assign( "themepath", $_SWIFT['themepath'] );
$template->assign( "swiftpath", $_SWIFT['swiftpath'] );
$template->assign( "_swiftpath", $_SWIFT['_swiftpath'] );
$template->assign( "localepath", $_SWIFT['localepath'] );
$template->assign( "version", $settings->getkey( "core", "version" ) );
$template->assign( "product", strtolower( SWIFTPRODUCT ) );
$template->assign( "productname", SWIFTPRODUCT );
$template->assign( "poweredbytitle", sprintf( $_SWIFT['language']['poweredbytitle'], SWIFTPRODUCT, SWIFTVERSION ) );
$template->assign( "poweredby", sprintf( $_SWIFT['language']['poweredby'], SWIFTPRODUCT, SWIFTVERSION ) );
$template->assign( "copyright", sprintf( $_SWIFT['language']['copyright'], date( "Y" ) ) );
$template->assign( "date", edate( $_SWIFT['settings']['dt_dateformat'] ) );
$template->assign( "xmlheader", "<?xml version=\"1.0\"?>" );
if ( SWIFT_AREA == SWIFT_STAFF )
{
$template->assign( "jscachefile", $_SWIFT['settingscache']['fileid']['jscachefile'] );
}
if ( defined( "ISMODERNBILL" ) )
{
$template->assign( "basepath", "user.php" );
$_SWIFT['tgroup']['loginapi_moduleid'] = LOGINAPI_MODERNBILL;
if ( MBAREA == "news" )
{
$template->assign( "formextension", "<input type=\"hidden\" name=\"op\" value=\"menu\" /><input type=\"hidden\" name=\"tile\" value=\"mynews_tab\" />" );
$template->assign( "baseurl", "user.php?op=menu&tile=mynews_tab&" );
}
else if ( MBAREA == "knowledgebase" )
{
$template->assign( "formextension", "<input type=\"hidden\" name=\"op\" value=\"menu\" /><input type=\"hidden\" name=\"tile\" value=\"faq\" />" );
$template->assign( "baseurl", "user.php?op=menu&tile=faq&" );
}
else if ( MBAREA == "ticketsubmit" )
{
$template->assign( "formextension", "<input type=\"hidden\" name=\"op\" value=\"menu\" /><input type=\"hidden\" name=\"tile\" value=\"getsupport_tab\" />" );
$template->assign( "baseurl", "user.php?op=menu&tile=getsupport_tab&" );
}
else if ( MBAREA == "ticketlist" )
{
$template->assign( "formextension", "<input type=\"hidden\" name=\"op\" value=\"menu\" /><input type=\"hidden\" name=\"tile\" value=\"mysupport\" />" );
$template->assign( "baseurl", "user.php?op=menu&tile=mysupport&" );
}
else
{
$template->assign( "baseurl", "user.php?" );
}
$template->assign( "ismodernbill", true );
}
else if ( defined( "ISMODERNBILLV5" ) )
{
$template->assign( "basepath", "helpdesk.php" );
$_SWIFT['tgroup']['loginapi_moduleid'] = LOGINAPI_MODERNBILLV5;
if ( !( MBAREA == "ticketlist" ) )
{
if ( MBAREA == "knowledgebase" )
{
$template->assign( "formextension", "<input type=\"hidden\" name=\"action\" value=\"".getactionid( "ShowFAQs" )."\" /><input type=\"hidden\" name=\"sid\" value=\"".$CONF['user']['sessionID']."\" />" );
$template->assign( "basepath", "faqs.php" );
$template->assign( "baseurl", "faqs.php?action=".getactionid( "ShowFAQs" )."&sid=".$CONF['user']['sessionID']."&" );
}
else
{
$template->assign( "baseurl", "user.php?" );
}
}
$template->assign( "ismodernbillv5", true );
}
else if ( defined( "ISWHMCS" ) )
{
$template->assign( "whmcsfullname", $clientsdetails['firstname']." ".$clientsdetails['lastname'] );
$template->assign( "basepath", "index.php" );
$_SWIFT['tgroup']['loginapi_moduleid'] = LOGINAPI_WHMCSINTEGRATION;
if ( WHMCSAREA == "submitticket" )
{
$template->assign( "formextension", "" );
$template->assign( "basepath", "submitticket.php" );
$template->assign( "baseurl", "submitticket.php?" );
}
else if ( WHMCSAREA == "viewlist" )
{
$template->assign( "formextension", "" );
$template->assign( "basepath", "supporttickets.php" );
$template->assign( "baseurl", "supporttickets.php?" );
}
else if ( WHMCSAREA == "viewticket" )
{
$template->assign( "formextension", "" );
$template->assign( "basepath", "viewticket.php" );
$template->assign( "baseurl", "viewticket.php?" );
}
else if ( WHMCSAREA == "knowledgebase" )
{
$template->assign( "formextension", "" );
$template->assign( "basepath", "knowledgebase.php" );
$template->assign( "baseurl", "knowledgebase.php?" );
}
else if ( WHMCSAREA == "downloads" )
{
$template->assign( "formextension", "" );
$template->assign( "basepath", "downloads.php" );
$template->assign( "baseurl", "downloads.php?" );
}
else if ( WHMCSAREA == "news" )
{
$template->assign( "formextension", "" );
$template->assign( "basepath", "announcements.php" );
$template->assign( "baseurl", "announcements.php?" );
}
else
{
$template->assign( "baseurl", "index.php?" );
}
$template->assign( "iswhmcs", true );
$template->assign( "whmcsuser", $whmcsuser );
}
else
{
$template->assign( "basepath", $_SWIFT['swiftpath']."index.php" );
$template->assign( "baseurl", $_SWIFT['swiftpath']."index.php?" );
$template->assign( "ismodernbill", false );
}
if ( $_SWIFT['settings']['t_scanirs'] == 1 && $module->isregistered( MODULE_KNOWLEDGEBASE ) && SWIFT_AREA == SWIFT_STAFF )
{
$template->assign( "staffirs", true );
}
else
{
$template->assign( "staffirs", false );
}
if ( $settings->getkey( "cron", "nextrun" ) <= time( ) )
{
$template->assign( "runcron", true );
}
if ( SWIFTVERSION != $_SWIFT['settingscache']['core']['version'] )
{
echo "<center><b><font color='red' face='verdana, arial, helvetica' size='2'>[WARNING]: Database Version Tag (".$_SWIFT['settingscache']['core']['version'].") and File (".SWIFTVERSION.") Mismatch!</font></b><BR /><font color='black' face='verdana, arial, helvetica' size='1'>Please update your files to the latest revision, This error happens when your database structure is different than the PHP files you are using.</font></center>\n<BR />";
}
$queuecount = $settings->getkey( "mail", "queuecount" );
if ( 0 < $queuecount )
{
if ( !defined( "USESHUTDOWNFUNC" ) )
{
processmailqueue( );
}
else
{
registershutdown( "mail" );
}
}
if ( file_exists( "./setup" ) && is_dir( "./setup" ) && $_SERVER['REMOTE_ADDR'] != "192.168.0.47" && $_SERVER['REMOTE_ADDR'] != "192.168.0.19" && $_SERVER['REMOTE_ADDR'] != "" && $_SERVER['REMOTE_ADDR'] != "127.0.0.1" )
{
echo "<center><b><font color='red' face='verdana, arial, helvetica' size='2'>[WARNING]: Setup Directory not Deleted</font></b><BR /><font color='black' face='verdana, arial, helvetica' size='1'>Please delete the setup directory before using the product. Keeping it on the server can result in security breaches!</font></center>\n<BR />";
}
?>