本文整理匯總了PHP中DEBUG函數的典型用法代碼示例。如果您正苦於以下問題:PHP DEBUG函數的具體用法?PHP DEBUG怎麽用?PHP DEBUG使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DEBUG函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
function __construct($connector, $pdo, $sm)
{
$this->db =& $connector;
$this->pdo =& $pdo;
$this->sm =& $sm;
DEBUG("AdminLogin: Constructed.");
}
示例2: executeQuery
function executeQuery($sql_commands)
{
if (!pg_send_query($this->link, $sql_commands)) {
throw new DatabaseException("PostgreSQL database query failed on following query:\n{$sql_commands}");
}
$this->res = pg_get_result($this->link);
DEBUG("DB: Query was: <em>{$sql_commands}</em>");
$this->executedQueries++;
return true;
}
示例3: CLinkClass
function CLinkClass($url, $description, $category, $createdTimestamp, $lastVisitedTimestamp, $visitCount, $index)
{
DEBUG("in CLinkClass constructor (\n {$url},\n {$description},\n {$category},\n {$createdTimestamp},\n {$lastVisitedTimestamp},\n {$visitCount},\n {$index}\n)\n");
$this->url = $url ? $url : '';
$this->description = $description ? $description : 'New link';
$this->category = $category ? $category : 'Unfiled';
$this->createdTimestamp = $createdTimestamp ? $createdTimestamp : time();
$this->lastVisitedTimestamp = $lastVisitedTimestamp ? $lastVisitedTimestamp : 0;
$this->visitCount = $visitCount ? $visitCount : 0;
$this->index = $index ? $index : 0;
}
示例4: list
}
}
}
}
}
}
}
list($browser_agent, $browser_version) = getBrowser();
if ($browser_agent == 'opera') {
$attachmentMIME = 'application/kml';
} else {
if ($browser_agent != 'ie' && $browser_agent != 'netscape' && $browser_agent != 'mozilla') {
$attachmentMIME = "application/octet-stream";
}
}
DEBUG("DL", 1, "browser_agent={$browser_agent}, browser version={$browser_version}<BR>");
// to debug
// DEBUG_END();exit;
if (!headers_sent()) {
/// martin jursa 19.6.2008
header("Pragma: public");
// required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
// required for certain browsers
header("Content-type: {$attachmentMIME}");
//header("Content-Disposition: attachment; filename=\"$kml_file_name\"", true);
header('Content-Disposition: inline; filename="' . htmlspecialchars($file_name) . '"');
header("Content-Transfer-Encoding: binary");
$size = strlen($xml);
示例5: get_browser_language
$config = session::global_get('config');
/* Language setup */
$lang = $config->get_cfg_value("core", "language");
if ($lang == "") {
$lang = get_browser_language();
}
$lang .= ".UTF-8";
putenv("LANGUAGE=");
putenv("LANG={$lang}");
setlocale(LC_ALL, $lang);
$GLOBALS['t_language'] = $lang;
$GLOBALS['t_gettext_message_dir'] = $BASE_DIR . '/locale/';
$domain = 'messages';
bindtextdomain($domain, LOCALE_DIR);
textdomain($domain);
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $lang, "Setting language to");
$smarty->compile_dir = $config->get_cfg_value("core", "templateCompileDirectory");
$smarty->assign("title", "GOsa - " . _("Help browser"));
/* HELP management starts here ...
*/
/* Generate helpobject */
if (session::global_is_set('helpobject')) {
$helpobject = session::global_get('helpobject');
} else {
$plist = session::global_get('plist');
$helpobject['lang'] = $lang;
$helpobject['helpconf'] = array();
$helpobject['currentplug'] = "";
$helpobject['file'] = "index.html";
$helpobject['helpconf'] = $plist->gen_headlines();
}
示例6: ReadCoords
function ReadCoords($Text) {
$Text=strtolower($Text);
// DEBUG("checkAirspace",128,"ReadCoords: Text=$Text");
// 53:26:09 N 009:45:46 E
if ( ! preg_match("/(\d+):(\d+):(\d+) +([ns]) +(\d+):(\d+):(\d+) +([we])/",$Text,$matches) ) {
if ( ! preg_match("/(\d+):(\d+)\.(\d+) +([ns]) +(\d+):(\d+)\.(\d+) +([we])/",$Text,$matches) ) {
DEBUG("checkAirspace",128,"ReadCoords2: #$Text# Not match ");
return array(0,0,0);
}
$Ydeg=$matches[1];
$Ymin=$matches[2];
$Ysec=$matches[3];
$Y = ($Ymin+ $Ysec/pow(10,strlen($Ysec)) ) / 60 + $Ydeg;
if ($matches[4]=='s') $Y = -$Y ;
$Xdeg=$matches[5];
$Xmin=$matches[6];
$Xsec=$matches[7];
$X = ( $Xmin+ $Xsec/pow(10,strlen($Xsec) ))/60 + $Xdeg;
if ($matches[8]=='w') $X = -$X ;
// DEBUG("checkAirspace",128,"ReadCoords: Text=$Text , X=$X, Y=$Y<BR>");
return array(1,$X,$Y);
}
$Ydeg=$matches[1];
$Ymin=$matches[2];
$Ysec=$matches[3];
$Y = $Ysec/3600 + $Ymin/60 + $Ydeg;
if ($matches[4]=='s') $Y = -$Y ;
$Xdeg=$matches[5];
$Xmin=$matches[6];
$Xsec=$matches[7];
$X = $Xsec/3600 + $Xmin/60 + $Xdeg;
if ($matches[8]=='w') $X = -$X ;
// DEBUG("checkAirspace",128,"ReadCoords: Text=$Text , X=$X, Y=$Y");
return array(1,$X,$Y);
}
示例7: getAirspaceFromDB
function getAirspaceFromDB($min_lon, $max_lon, $min_lat, $max_lat)
{
global $AirspaceArea, $NumberOfAirspaceAreas, $db, $airspaceTable;
$AirspaceArea = array();
$query = "SELECT * FROM {$airspaceTable} WHERE disabled=0 AND \n\t\t\t\t NOT ( maxx< {$min_lon} OR minx>{$max_lon} ) AND\t NOT ( maxy< {$min_lat} OR miny>{$max_lat} ) ";
$res = $db->sql_query($query);
if (!$res) {
echo "Error in gettig airspace from DB: {$query} <BR>";
return 0;
}
$i = 0;
while ($row = mysql_fetch_assoc($res)) {
if ($row['Shape'] == 1) {
$shape = "Area";
} else {
$shape = "Circle";
}
DEBUG("getAirspaceFromDB", 1, "Found {$shape} => " . $row['Name'] . '<BR>');
$AirspaceArea[$i]->id = $row['id'];
$AirspaceArea[$i]->Name = $row['Name'];
$AirspaceArea[$i]->Type = $row['Type'];
$AirspaceArea[$i]->Shape = $row['Shape'];
$AirspaceArea[$i]->Comments = $row['Comments'];
$AirspaceArea[$i]->minx = $row['minx'];
$AirspaceArea[$i]->miny = $row['miny'];
$AirspaceArea[$i]->maxx = $row['maxx'];
$AirspaceArea[$i]->maxy = $row['maxy'];
$AirspaceArea[$i]->Base = unserialize($row['Base']);
$AirspaceArea[$i]->Top = unserialize($row['Top']);
if ($row['Shape'] == 1) {
// area
$AirspaceArea[$i]->Points = unserialize($row['Points']);
// DEBUG("getAirspaceFromDB",1, "Area first point : ".$AirspaceArea[$i]->Points[0]->Latitude.",".
// $AirspaceArea[$i]->Points[0]->Longitude.
// " last point : ".$AirspaceArea[$i]->Points[count($AirspaceArea[$i]->Points)-1]->Latitude.",".
// $AirspaceArea[$i]->Points[count($AirspaceArea[$i]->Points)-1]->Longitude."<BR>");
if ($AirspaceArea[$i]->Points[0] != $AirspaceArea[$i]->Points[count($AirspaceArea[$i]->Points) - 1]) {
//DEBUG("getAirspaceFromDB",1, "Adding Last point == first point<BR>");
$AirspaceArea[$i]->Points[] = $AirspaceArea[$i]->Points[0];
}
$AirspaceArea[$i]->NumPoints = count($AirspaceArea[$i]->Points);
} else {
$AirspaceArea[$i]->Radius = $row['Radius'];
$AirspaceArea[$i]->Latitude = $row['Latitude'];
$AirspaceArea[$i]->Longitude = $row['Longitude'];
}
// DEBUG("getAirspaceFromDB",1,"<pre>".print_r($AirspaceArea[$i],1). "</pre><BR>");
$i++;
}
$NumberOfAirspaceAreas = count($AirspaceArea);
}
示例8: igc2kmz
function igc2kmz($file, $outputFile, $timezone, $flightID)
{
global $CONF, $CONF_tables_prefix, $baseInstallationPath, $db;
$str = "";
$version = $CONF['googleEarth']['igc2kmz']['version'];
$kmzFile = $outputFile . ".{$version}.kmz";
deleteOldKmzFiles($outputFile, $version);
// exit;
if (is_file($kmzFile)) {
return $version;
}
$python = $CONF['googleEarth']['igc2kmz']['python'];
putenv('PYTHON_EGG_CACHE=' . dirname(__FILE__) . '/data/tmp');
// put some env for python2.5?
// putenv("PATH=".$CONF['googleEarth']['igc2kmz']['python'] );
putenv("PATH=/usr/local/bin/");
$path = realpath($CONF['googleEarth']['igc2kmz']['path']);
if (!defined('SQL_LAYER')) {
define('SQL_LAYER', 'mysql');
}
global $phpbb3AbsPath, $dbhost, $dbname, $dbuser, $dbpasswd;
$dbpasswdCon = $dbpasswd;
if (!$dbpasswdCon) {
$dbpasswdCon = $db->password;
}
$dbhostCon = $dbhost;
if (!$dbhostCon) {
$dbhostCon = $db->server;
}
if (!$dbhostCon) {
$dbhostCon = 'localhost';
}
$engine = SQL_LAYER . "://" . $db->user . ':' . $dbpasswdCon . '@' . $dbhostCon . '/' . $db->dbname;
$cmd = "{$python} {$path}/bin/leonardo2kmz.py";
$cmd .= " --engine '{$engine}'";
$cmd .= " --table-prefix={$CONF_tables_prefix}";
$cmd .= " --directory '" . realpath(dirname(__FILE__)) . "'";
// $cmd.=" --igcpath '".dirname(__FILE__).'/'.$CONF['paths']['intermediate']."'";
// $cmd.=" --directory '".realpath(dirname(__FILE__).'/../..')."'";
$cmd .= " --url 'http://" . $_SERVER['SERVER_NAME'] . "{$baseInstallationPath}'";
// $cmd.=" --icon '$baseInstallationPath/templates/basic/tpl/leonardo_logo.gif' ";
// $cmd.=" --photos_path '".$CONF['paths']['photos']."' ";
// $cmd.=" --photos_url '$baseInstallationPath/'".$CONF['paths']['photos']."'' ";
//DEFAULT_PHOTOS_PATH = 'data/flights/photos/%YEAR%/%PILOTID%'
//DEFAULT_PHOTOS_URL = '/modules/leonardo/data/flights/photos/%YEAR%/%PILOTID%'
$cmd .= " --output '{$kmzFile}'";
$cmd .= " --tz-offset {$timezone}";
$cmd .= " --igc-path=" . $CONF['paths']['intermediate'] . " ";
// data/flights/intermediate/%YEAR%/%PILOTID%
$cmd .= " {$flightID}";
DEBUG('igc2kmz', 1, "igc2kmz: {$cmd} <BR>");
exec($cmd, $res);
if (0) {
//echo "timezone: $timezone<br>";
echo "cmd: {$cmd}<BR>";
print_r($res);
//print_r($db);
//echo "$dbhost , $dbname ,$dbuser ,$dbpasswd @";
exit;
}
return $version;
}
示例9: getAlt
function getAlt($lat, $lon)
{
global $CONF_DEMpath, $openDEMfiles, $missingDEMfiles;
if ($lat >= 0) {
$latSouth = floor($lat);
//$latNorth=$latSouth+1;
$latD = 1 - $lat + $latSouth;
$latStr = "N";
} else {
$latSouth = ceil(abs($lat));
// $latNorth=$latSouth-1;
$latD = -$lat - $latSouth + 1;
$latStr = "S";
}
if ($lon >= 0) {
$lonWest = floor($lon);
//$lonEast=$lonWest+1;
$lonD = $lon - $lonWest;
$lonStr = "E";
} else {
$lonWest = ceil(abs($lon));
//$lonEast=$lonWest-1;
$lonD = $lonWest + $lon;
$lonStr = "W";
}
// find the file to use!
// $demFile="N40E023";
$demFile = sprintf("%s%02d%s%03d.hgt.zip", $latStr, $latSouth, $lonStr, $lonWest);
$demZipFile = $CONF_DEMpath . '/' . $demFile;
if ($missingDEMfiles[$demFile]) {
return -9999;
}
// see if it already open
if (!$openDEMfiles[$demFile]) {
if (!is_file($demZipFile)) {
$missingDEMfiles[$demFile] = 1;
return -9999;
}
// $openDEMfiles[$demFile]=file_get_contents($CONF_DEMpath.$demFile);
require_once dirname(__FILE__) . '/lib/pclzip/pclzip.lib.php';
$archive = new PclZip($demZipFile);
$list = $archive->extract(PCLZIP_OPT_EXTRACT_AS_STRING);
if ($list == 0) {
DEBUG("DEM", 255, "DEM::getAlt : " . $archive->errorInfo(true) . "<BR>");
return -9999;
// die("Error : ".$archive->errorInfo(true));
} else {
$openDEMfiles[$demFile] = $list[0]['content'];
}
}
// find x,y inside the file
// 1 degree is 1201 points
$x = floor($lonD * 1201);
$y = floor($latD * 1201);
// point offeset in file
$pointOffset = ($x + $y * 1201) * 2;
$alt = ord($openDEMfiles[$demFile][$pointOffset]) * 256 + ord($openDEMfiles[$demFile][$pointOffset + 1]);
if ($alt > 10000) {
$alt = 0;
}
DEBUG("DEM", 255, "{$latD} {$lonD} {$x} {$y} {$pointOffset} alt={$alt}");
return $alt;
}
示例10: ReadAltitude
function ReadAltitude($Text, $field)
{
global $TempArea;
DEBUG("checkAirspace", 128, "ReadAltitude: {$Text} \n");
$fHasUnit = 0;
$Text = trim(strtoupper($Text));
$Text = str_replace("\t", "", $Text);
preg_match("/(\\d*)([ =]*)([A-Z]*)([ =]*)(\\d*)([ =]*)([A-Z]*)([ =]*)/", $Text, $parts);
//print_r($parts);
//echo "<HR>";
DEBUG("checkAirspace", 128, print_r($parts, 1) . "<BR>\n");
$TempArea->{$field}->Altitude = 0;
$TempArea->{$field}->FL = 0;
$TempArea->{$field}->Base = abUndef;
for ($i = 1; $i < count($parts); $i++) {
$pToken = $parts[$i];
if (!$pToken || $pToken == ' ') {
continue;
}
if (is_numeric($pToken)) {
if ($TempArea->{$field}->Base == abFL) {
$TempArea->{$field}->FL = $pToken;
$TempArea->{$field}->Altitude = AltitudeToQNHAltitude($TempArea->{$field}->FL * 100 / TOFEET);
} else {
$TempArea->{$field}->Altitude = $pToken;
}
} else {
if ($pToken == 'SFC' || $pToken == 'GND' && !$TempArea->{$field}->Altitude) {
$TempArea->{$field}->Base = abAGL;
$TempArea->{$field}->FL = 0;
$TempArea->{$field}->Altitude = 0;
$fHasUnit = 1;
} else {
if ($pToken == 'FL') {
// this parses "FL=150" and "FL150"
$TempArea->{$field}->Base = abFL;
$fHasUnit = true;
} else {
if ($pToken == 'FT' || $pToken == 'F') {
$TempArea->{$field}->Altitude = $TempArea->{$field}->Altitude / TOFEET;
$fHasUnit = true;
} else {
if ($pToken == 'M') {
$fHasUnit = true;
} else {
if ($pToken == 'MSL') {
$TempArea->{$field}->Base = abMSL;
} else {
if ($pToken == 'AGL' || $pToken == 'GND' && $TempArea->{$field}->Altitude > 0) {
$TempArea->{$field}->Base = abAGL;
} else {
if ($pToken == 'STD') {
if ($TempArea->{$field}->Base != abUndef) {
// warning! multiple base tags
}
$TempArea->{$field}->Base = abFL;
$TempArea->{$field}->FL = $TempArea->{$field}->Altitude * TOFEET / 100;
$TempArea->{$field}->Altitude = AltitudeToQNHAltitude($TempArea->{$field}->FL * 100 / TOFEET);
}
}
}
}
}
}
}
}
}
// end while
if (!$fHasUnit && $TempArea->{$field}->Base != abFL) {
// ToDo warning! no unit defined use feet or user alt unit
// Alt->Altitude = Units::ToSysAltitude(Alt->Altitude);
$TempArea->{$field}->Altitude = $TempArea->{$field}->Altitude / TOFEET;
}
if ($TempArea->{$field}->Base == abUndef) {
// ToDo warning! no base defined use MSL
$TempArea->{$field}->Base = abMSL;
}
DEBUG("checkAirspace", 128, "ReadAltitude: FL=" . $TempArea->{$field}->FL . ", Alt:" . $TempArea->{$field}->Altitude . ", Base:" . $TempArea->{$field}->Base . "<BR>\n");
// return $Alt;
}
示例11: drawFlight
function drawFlight()
{
global $gradientMap, $gradient_colors_num;
global $minAlt, $maxAlt;
$size = 1;
$startSize = 10;
$pointColor = imagecolorallocate($this->img, 255, 0, 0);
$startColor = imagecolorallocate($this->img, 0, 250, 0);
$endColor = imagecolorallocate($this->img, 252, 250, 66);
// yellow
$shadowColor = imagecolorallocate($this->img, 0, 0, 0);
$lines = file($this->IGCfilename);
$points = 0;
$minAlt = 10000;
$maxAlt = 0;
//first pass to find min/max
foreach ($lines as $line) {
$line = trim($line);
if (strlen($line) == 0) {
continue;
}
if ($line[0] == 'B') {
$thisPoint = new gpsPoint($line);
$thisAlt = $thisPoint->getAlt();
if ($thisAlt < $minAlt) {
$minAlt = $thisAlt;
}
if ($thisAlt > $maxAlt) {
$maxAlt = $thisAlt;
}
}
}
// Make shadow first
foreach ($lines as $line) {
// $line=trim($line);
if (strlen($line) == 0) {
continue;
}
if ($line[0] == 'B') {
$thisPoint = new gpsPoint($line);
$thisColor = $gradientMap[floor(($gradient_colors_num - 1) * $altRelPos)];
list($ptX, $ptY) = $this->lonlat2xy(-$thisPoint->lon, $thisPoint->lat);
//DEBUG("MAP",8,"lon:".$thisPoint->lon." lat:".$thisPoint->lat." -> X:$ptX, Y:$ptY <br>");
$ptY = $this->pixelHeight - $ptY;
if ($points == 0) {
$firstPoint = new gpsPoint($line);
} else {
list($lastptX, $lastptY) = $this->lonlat2xy(-$lastPoint->lon, $lastPoint->lat);
$lastptY = $this->pixelHeight - $lastptY;
imageline($this->img, $lastptX - 1, $lastptY - 1, $ptX - 1, $ptY - 1, $shadowColor);
imageline($this->img, $lastptX, $lastptY - 1, $ptX, $ptY - 1, $shadowColor);
imageline($this->img, $lastptX + 1, $lastptY - 1, $ptX + 1, $ptY - 1, $shadowColor);
imageline($this->img, $lastptX - 1, $lastptY, $ptX - 1, $ptY, $shadowColor);
// imageline($this->img,$lastptX,$lastptY,$ptX,$ptY,$shadowColor);
imageline($this->img, $lastptX + 1, $lastptY, $ptX + 1, $ptY, $shadowColor);
imageline($this->img, $lastptX - 1, $lastptY + 1, $ptX - 1, $ptY + 1, $shadowColor);
imageline($this->img, $lastptX, $lastptY + 1, $ptX, $ptY + 1, $shadowColor);
imageline($this->img, $lastptX + 1, $lastptY + 1, $ptX + 1, $ptY + 1, $shadowColor);
}
$lastPoint = new gpsPoint($line);
$points++;
}
}
DEBUG("MAP", 8, "<hr>");
$points = 0;
foreach ($lines as $line) {
// $line=trim($line);
if (strlen($line) == 0) {
continue;
}
if ($line[0] == 'B') {
$thisPoint = new gpsPoint($line);
if ($maxAlt - $minAlt) {
$altRelPos = ($thisPoint->getAlt() - $minAlt) / ($maxAlt - $minAlt);
} else {
$altRelPos = 0;
}
$thisColor = $gradientMap[floor(($gradient_colors_num - 1) * $altRelPos)];
list($ptX, $ptY) = $this->lonlat2xy(-$thisPoint->lon, $thisPoint->lat);
$ptY = $this->pixelHeight - $ptY;
if ($points == 0) {
$firstPoint = new gpsPoint($line);
} else {
list($lastptX, $lastptY) = $this->lonlat2xy(-$lastPoint->lon, $lastPoint->lat);
$lastptY = $this->pixelHeight - $lastptY;
imageline($this->img, $lastptX, $lastptY, $ptX, $ptY, $thisColor);
imageline($this->img, $lastptX, $lastptY + 1, $ptX, $ptY + 1, $thisColor);
// leave this for extra line width + shadow
// imageline($this->img,$lastptX+1,$lastptY,$ptX+1,$ptY,$shadowColor);
}
$lastPoint = new gpsPoint($line);
$points++;
}
}
list($ptX, $ptY) = $this->lonlat2xy(-$firstPoint->lon, $firstPoint->lat);
$ptY = $this->pixelHeight - $ptY;
imagearc($this->img, $ptX, $ptY, $startSize, $startSize, 0, 360, $startColor);
imagearc($this->img, $ptX, $ptY, $startSize - 1, $startSize - 1, 0, 360, $startColor);
list($ptX, $ptY) = $this->lonlat2xy(-$lastPoint->lon, $lastPoint->lat);
$ptY = $this->pixelHeight - $ptY;
//.........這裏部分代碼省略.........
示例12: DEBUG
// portait style
DEBUG("MAP", 1, "Portait style <BR>");
DEBUG("MAP", 1, "totalWidth: {$totalWidth}, totalHeight: {$totalHeight}, totalWidth/totalHeight: " . $totalWidth / $totalHeight . "<br>");
if ($totalWidth / $totalHeight < 3 / 4) {
$totalWidth = 3 / 4 * $totalHeight;
}
}
$marginHor = 2000 + floor($totalWidth / 20000) * 1000 + ($totalWidth - $totalWidth_initial) / 2;
//in meters
$marginVert = 1000 + floor($totalHeight / 20000) * 1000 + ($totalHeight - ($MAP_TOP - $MAP_BOTTOM)) / 2;
//in meters
if ($marginHor > $marginVert) {
// landscape style ...
if ($marginVert / $marginHor < 3 / 4) {
$marginVert = 3 / 4 * $marginHor;
}
} else {
// portait style
if ($marginHor / $marginVert < 3 / 4) {
$marginHor = 3 / 4 * $marginVert;
}
}
DEBUG("MAP", 1, "marginHor: {$marginHor}, marginVert:{$marginVert} <br>");
$flMap = new flightMap($UTMzone, $UTMlatZone, $MAP_TOP + $marginVert, $MAP_LEFT - $marginHor, $UTMzone2, $UTMlatZone2, $MAP_BOTTOM - $marginVert, $MAP_RIGHT + $marginHor, 600, 800, "", "", 0);
DEBUG("MAP", 1, "MAP Required m/pixel = " . $flMap->metersPerPixel . "<br>");
$flMap->showTrack = 0;
$flMap->showWaypoints = 0;
header('Content-Type: image/jpeg');
$flMap->drawFlightMap();
}
}
示例13: __construct
function __construct($connector, $pdo)
{
$this->db = $connector;
$this->pdo = $pdo;
DEBUG("AdminOverview: Constructed.");
}
示例14: exitPage
function exitPage($exitNow=1){
global $opMode,$noFooterMenu,$moduleRelPath,$PREFS,$CONF_use_own_template,$CONF;
global $sqlQueriesTime ,$sqlQueriesNum,$sqlFetchTime,$sqlFetchNum;
global $pageStart,$DBGlvl;
global $RUN;
echo "<br>";
if (!$noFooterMenu ) {
if ($RUN['view']!='print') {
echo "<br><div class='main_text' align=center><a href='#top_of_page'>"._RETURN_TO_TOP."</a></div>";
}
}
echo "</div>";
$pageEnd=leo_getmicrotime();
$pageTime=$pageEnd-$pageStart;
DEBUG("MAIN",1,"PAGE CREATION: $pageTime secs<BR>");
DEBUG_END();
require_once dirname(__FILE__)."/BLOCKS_end.php";
if ($opMode==1) {
CloseTable();
include("footer.php");
} else if (0 && ($opMode==3 || $opMode==4 || $opMode==6 || ($opMode==5 && $CONF_use_own_template )) ) {
require_once dirname(__FILE__)."/GUI_footer.php";
} else if ($opMode==3 || $opMode==4 || $opMode==6 || ($opMode==5 && $CONF_use_own_template ) ) {
global $Ltemplate;
$Ltemplate->set_filenames(array('overall_footer' => 'tpl/overall_footer.html'));
$Ltemplate->assign_vars(array(
'SIDE_BLOCKS_HTML' => $side_blocks_html,
'CUSTOM_FOOTER_CODE'=> $CONF['footer']['custom_code'],
) );
$Ltemplate->pparse('overall_footer');
// Close our DB connection.
//$db->sql_close();
}
if ($DBGlvl) {
// db execution time
echo "<div class='debugBoxTop'>";
printf("DB query: <b>%.4f</b> secs in %d queries <hr>",$sqlQueriesTime ,$sqlQueriesNum);
printf("DB fetch: <b>%.4f</b> secs in %d fetches <hr>",$sqlFetchTime,$sqlFetchNum);
printf("DB Total: <b>%.5f</b> secs<hr>",($sqlQueriesTime + $sqlFetchTime )) ;
printf("Page Total: <b>%.5f</b> secs<hr>",$pageTime) ;
echo "</div>";
// end db
}
statsLogger::Log($pageTime);
if ($exitNow) exit;
}
示例15: bootstrap
function bootstrap()
{
global $CONFIG, $SYSTEM_INFO, $output_started, $body_started, $console, $profiler, $ALLOWED_MGMT_FUNCS;
header("Content-type: application/xhtml+xml\r");
$console = new SystemConsole();
DEBUG("<strong>This is 29o3 " . $SYSTEM_INFO['SystemVersion'] . " Codename " . $SYSTEM_INFO['SystemCodename'] . "</strong>");
DEBUG("SYS: Bootstrapping started...");
$connector = new DatabaseConnector();
$connector->setupConnection($CONFIG['DatabaseHost'], $CONFIG['DatabaseUser'], $CONFIG['DatabasePassword'], $CONFIG['DatabaseName'], $CONFIG['DatabasePort']);
DEBUG("DB: Connected to database.");
$request = new PageRequest($connector);
$request->parseRequest();
// instanciate new cache object
$co = new cacheObject($connector, $request->getRequestedSite(), $request->getRequestedPage());
// check if we have content for current page cached
$cacheContent = $co->getCached();
if ($cacheContent === false) {
// construct header and body objects
$header = new XHTMLHeader();
$body = new XHTMLBody();
$pdo = new pageDescriptionObject($header, $body, $connector, $request->getWantAdmin(), $request->getAdminFuncParam());
$connector->executeQuery("SELECT * FROM " . mktablename("pages") . " WHERE name='" . $request->getRequestedPage() . "'");
/* lets see what the admin wants */
if ($request->getWantAdmin()) {
if ($request->getRequestedPage() == "overview") {
}
}
$pageInfo = $connector->fetchArray();
$pdo->setPageDescriptionA($pageInfo, $request->getRequestedSite());
$header->setTitle($pdo->getContent("title"));
if ($pdo->getContent("description") != "") {
$header->addMetaDCDescription($pdo->getContent('description'));
}
if ($pdo->getContent("subject") != "") {
$header->addMetaDCSubject($pdo->getContent("subject"));
}
if ($pdo->getContent("date") != 0) {
$header->addMetaDCDate(strftime("%Y-%m-%d", $pdo->getContent('date')));
}
if ($pdo->getContent("creator") != "") {
$header->addMetaDCCreator($pdo->getContent("creator"));
}
if ($pdo->getContent("contributors") != "") {
$c_arr = explode(";", $pdo->getContent('contributors'));
for ($i = 0; $i <= count($c_arr) - 1; $i++) {
$header->addMetaDCContributor($c_arr[$i]);
}
}
if ($pdo->getContent("type") != "") {
$header->addMetaDCType($pdo->getContent("type"));
}
if ($pdo->getContent("sources") != "") {
$sources_array = explode(";", $pdo->getContent('sources'));
for ($i = 0; $i <= count($sources_array) - 1; $i++) {
$header->addMetaDCSource($sources_array[$i]);
}
}
/*
!!! FIXME: THE FOLLOWING CODE CAUSES A RACE CONDITION ON BOTH APACHE2/PHP
!!! AND PHP-CLI.
!!! SEV: (5) - Causes server process to fill RAM and swap -> kill
!!! RES: Currently no resolution, commented out because of this.
!!! I'd say it has got something to do with the database for
!!! I cannot find an error elsewhere.
>!< *** FIXED ***
>!< FUCK YOU FUCK YOU DAMN CODER!!!! FUCK YOU!!!
*/
if ($pdo->getContent("language") != "") {
$header->addMetaDCLanguage($pdo->getContent('language'));
}
if ($pdo->getContent('copyright') != "") {
$header->addMetaDCRights($pdo->getContent("copyright"));
}
// this is the r0x0r1ng stylesheet which controls how system messages (errors, etc.) appear
$pdo->scheduleInsertion_ExternalStylesheet("n_style.css");
if ($pdo->getContent('no_cache') == 1) {
$co->setScheduleCaching(false);
DEBUG("CACHE: Caching deactivated on request.");
}
// now, get the page's stylesheet; it might be empty, but we'll add it if not :)
if ($request->getWantAdmin() <= 1) {
if ($request->getWantAdmin() == 1) {
$co->setScheduleCaching(false);
DEBUG("CACHE: Admin wanted, caching deactivated.");
}
$layoutManager = new LayoutManager($pdo);
$pdo->getAvailableBoxes();
$connector->executeQuery("SELECT * FROM " . mktablename("layouts") . " WHERE lname='" . $pageInfo['layout'] . "'");
if ($connector->getNumRows() != 0) {
$currentLayout = $connector->fetchArray();
$layoutManager->setLayoutFile($currentLayout['file']);
$layoutManager->parseLayout();
} else {
throw new GeneralException("No layout found. 29o3 cannot continue.");
}
if ($request->getWantAdmin()) {
require_once $CONFIG['LibDir'] . 'admin/adminFuncs.php';
$af = new adminFuncs($pdo, $request);
$pdo->scheduleInsertion_ExternalStylesheet($af->getAdminStylesheet());
}
//.........這裏部分代碼省略.........