【php开源代码栏目提醒】:网学会员为需要php开源代码的朋友们搜集整理了globalfunctions.php相关资料,希望对各位网友有所帮助!
<?php
global $nucleus, $CONF, $DIR_LIBS, $DIR_LANG, $manager, $member;
checkVars(array('nucleus', 'CONF', 'DIR_LIBS', 'MYSQL_HOST', 'MYSQL_USER', 'MYSQL_PASSWORD', 'MYSQL_DATABASE', 'DIR_LANG', 'DIR_PLUGINS', 'HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_ENV_VARS', 'HTTP_SESSION_VARS', 'HTTP_POST_FILES', 'HTTP_SERVER_VARS', 'GLOBALS', 'argv', 'argc', '_GET', '_POST', '_COOKIE', '_ENV', '_SESSION', '_SERVER', '_FILES'));
$CONF['debug'] = 0;
$nucleus['version'] = 'v3.24';
if (getNucleusPatchLevel() > 0)
{
$nucleus['version'] .= '/' . getNucleusPatchLevel();
}
/*
Indicates when Nucleus should display startup errors. Set to 1 if you want
the error enabled (default), false otherwise
alertOnHeadersSent
Displays an error when visiting a public Nucleus page and headers have
been sent out to early. This usually indicates an error in either a
configuration file or a language file, and could cause Nucleus to
malfunction
alertOnSecurityRisk
Displays an error only when visiting the admin area, and when one or
more of the installation files (install.php, install.sql, upgrades/
directory) are still on the server.
*/
$CONF['alertOnHeadersSent'] = 1;
$CONF['alertOnSecurityRisk'] = 0;
/**
* returns the currently used version (100 = 1.00, 101 = 1.01, etc...)
*/
function getNucleusVersion() {
return 324;
}
/**
* power users can install patches in between nucleus releases. These patches
* usually add new functionality in the plugin API and allow those to
* be tested without having to install CVS.
*/
function getNucleusPatchLevel() {
return 0;
}
if ($CONF['debug']) {
error_reporting(E_ALL & ~E_NOTICE); // report almost all errors!
// (no uninitialized vars and such)
} else {
error_reporting(E_ERROR | E_WARNING | E_PARSE);
}
// we will use postVar, getVar, ... methods instead of HTTP_GET_VARS or _GET
if ($CONF['installscript']!=1){ // vars were already included in install.php
if (phpversion() >= '4.1.0')
include_once($DIR_LIBS . 'vars4.1.0.php');
else
include_once($DIR_LIBS . 'vars4.0.6.php');
}
function intPostVar($name) { return intval(postVar($name));}
function intGetVar($name) { return intval(getVar($name));}
function intRequestVar($name) { return intval(requestVar($name)); }
function intCookieVar($name) { return intval(cookieVar($name)); }
// get all variables that can come from the request and put them in the global scope
$blogid = requestVar('blogid');
$itemid = intRequestVar('itemid');
$catid = intRequestVar('catid');
$skinid = requestVar('skinid');
$memberid = requestVar('memberid');
$archivelist = requestVar('archivelist');
$imagepopup = requestVar('imagepopup');
$archive = requestVar('archive');
$query = requestVar('query');
$highlight = requestVar('highlight');
$amount = requestVar('amount');
$action = requestVar('action');
$nextaction = requestVar('nextaction');
$maxresults = requestVar('maxresults');
$startpos = intRequestVar('startpos');
$errormessage = '';
$error = '';
if (!headers_sent())
header('Generator: Nucleus CMS ' . $nucleus['version']);
// include core classes that are needed for login & plugin handling
include($DIR_LIBS . 'MEMBER.php');
include($DIR_LIBS . 'ACTIONLOG.php');
include($DIR_LIBS . 'MANAGER.php');
include($DIR_LIBS . 'PLUGIN.php');
$manager =& MANAGER::instance();
// make sure there's no unnecessary escaping:
set_magic_quotes_runtime(0);
// only needed when updating logs
if ($CONF['UsingAdminArea']) {
include($DIR_LIBS . '
xmlrpc.inc.php'); // XML-RPC client classes
include_once($DIR_LIBS . 'ADMIN.php');
}
// connect to sql
sql_connect();
// makes sure database connection gets closed on script termination
register_shutdown_function('sql_disconnect');
// read config
getConfig();
// automatically use simpler toolbar for mozilla
if (($CONF['DisableJsTools'] == 0) && strstr(serverVar('HTTP_USER_AGENT'),'Mozilla/5.0') && strstr(serverVar('HTTP_USER_AGENT'),'Gecko'))
$CONF['DisableJsTools'] = 2;
// login if cookies set
$member =& new MEMBER();
// login/logout when required or renew cookies
if ($action == 'login') {
// Form Authentication
$login = postVar('login');
$pw = postVar('password');
$shared = intPostVar('shared'); // shared computer or not
if ($member->login($login,$pw)) {
$member->newCookieKey();
$member->setCookies($shared);
// allows direct access to parts of the admin area after logging in
if ($next