本文整理汇总了PHP中debugMsg函数的典型用法代码示例。如果您正苦于以下问题:PHP debugMsg函数的具体用法?PHP debugMsg怎么用?PHP debugMsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debugMsg函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connectDB
function connectDB()
{
global $con, $_DB;
$con = mysql_connect($_DB['server'], $_DB['username'], $_DB['password']);
$source = mysql_select_db($_DB['source'], $con);
if (!$con) {
debugMsg("db connection error");
} else {
debugMsg("db connected");
}
if (!$source) {
debugMsg("source connection error");
} else {
debugMsg("source connected");
}
}
示例2: readFileHeader
/**
* Concrete classes must use this method to read the file header
* @return bool True if reading the file was successful, false if an error occured or we reached end of archive
*/
protected function readFileHeader()
{
// If the current part is over, proceed to the next part please
if ($this->isEOF(true)) {
$this->nextFile();
}
if ($this->expectDataDescriptor) {
// The last file had bit 3 of the general purpose bit flag set. This means that we have a
// 12 byte data descriptor we need to skip. To make things worse, there might also be a 4
// byte optional data descriptor header (0x08074b50).
$junk = @fread($this->fp, 4);
$junk = unpack('Vsig', $junk);
if ($junk['sig'] == 0x8074b50) {
// Yes, there was a signature
$junk = @fread($this->fp, 12);
if (defined('KSDEBUG')) {
debugMsg('Data descriptor (w/ header) skipped at ' . (ftell($this->fp) - 12));
}
} else {
// No, there was no signature, just read another 8 bytes
$junk = @fread($this->fp, 8);
if (defined('KSDEBUG')) {
debugMsg('Data descriptor (w/out header) skipped at ' . (ftell($this->fp) - 8));
}
}
// And check for EOF, too
if ($this->isEOF(true)) {
if (defined('KSDEBUG')) {
debugMsg('EOF before reading header');
}
$this->nextFile();
}
}
// Get and decode Local File Header
$headerBinary = fread($this->fp, 30);
$headerData = unpack('Vsig/C2ver/vbitflag/vcompmethod/vlastmodtime/vlastmoddate/Vcrc/Vcompsize/Vuncomp/vfnamelen/veflen', $headerBinary);
// Check signature
if (!($headerData['sig'] == 0x4034b50)) {
if (defined('KSDEBUG')) {
debugMsg('Not a file signature at ' . (ftell($this->fp) - 4));
}
// The signature is not the one used for files. Is this a central directory record (i.e. we're done)?
if ($headerData['sig'] == 0x2014b50) {
if (defined('KSDEBUG')) {
debugMsg('EOCD signature at ' . (ftell($this->fp) - 4));
}
// End of ZIP file detected. We'll just skip to the end of file...
while ($this->nextFile()) {
}
@fseek($this->fp, 0, SEEK_END);
// Go to EOF
return false;
} else {
if (defined('KSDEBUG')) {
debugMsg('Invalid signature ' . dechex($headerData['sig']) . ' at ' . ftell($this->fp));
}
$this->setError(AKText::_('ERR_CORRUPT_ARCHIVE'));
return false;
}
}
// If bit 3 of the bitflag is set, expectDataDescriptor is true
$this->expectDataDescriptor = ($headerData['bitflag'] & 4) == 4;
$this->fileHeader = new stdClass();
$this->fileHeader->timestamp = 0;
// Read the last modified data and time
$lastmodtime = $headerData['lastmodtime'];
$lastmoddate = $headerData['lastmoddate'];
if ($lastmoddate && $lastmodtime) {
// ----- Extract time
$v_hour = ($lastmodtime & 0xf800) >> 11;
$v_minute = ($lastmodtime & 0x7e0) >> 5;
$v_seconde = ($lastmodtime & 0x1f) * 2;
// ----- Extract date
$v_year = (($lastmoddate & 0xfe00) >> 9) + 1980;
$v_month = ($lastmoddate & 0x1e0) >> 5;
$v_day = $lastmoddate & 0x1f;
// ----- Get UNIX date format
$this->fileHeader->timestamp = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
}
$isBannedFile = false;
$this->fileHeader->compressed = $headerData['compsize'];
$this->fileHeader->uncompressed = $headerData['uncomp'];
$nameFieldLength = $headerData['fnamelen'];
$extraFieldLength = $headerData['eflen'];
// Read filename field
$this->fileHeader->file = fread($this->fp, $nameFieldLength);
// Handle file renaming
$isRenamed = false;
if (is_array($this->renameFiles) && count($this->renameFiles) > 0) {
if (array_key_exists($this->fileHeader->file, $this->renameFiles)) {
$this->fileHeader->file = $this->renameFiles[$this->fileHeader->file];
$isRenamed = true;
}
}
// Handle directory renaming
$isDirRenamed = false;
//.........这里部分代码省略.........
示例3: mysql_query
*
*/
include_once "header.php";
$classid = $_REQUEST['classid'];
$leconid = $_REQUEST['lecon'];
echo $leconid;
echo "<br>";
echo $classid;
// Get Lecture List for class
$sql_str = "SELECT ID\r\n\t\t\tFROM lecturetable\r\n\t\t\tWHERE classid = {$classid}";
$lec_result = mysql_query($sql_str);
debugMsg($sql_str);
// Update Lecture Details
while ($row = mysql_fetch_array($lec_result)) {
$lecid = $row['ID'];
$lecpw = $_REQUEST["lecpw_{$lecid}"];
if ($leconid == $lecid) {
$lecon = 1;
} else {
$lecon = 0;
}
debugMsg("lecid = {$lecid}; lecpw = {$lecpw} ; lecon = {$lecon};");
$sql_str = "UPDATE lecturetable SET Password='{$lecpw}', \r\n\t\t\t\tActive='{$lecon}' WHERE ID = {$lecid}";
debugMsg($sql_str);
if ($result = mysql_query($sql_str)) {
debugMsg("DB UPDATE OK");
} else {
debugMsg("DB UPDATE ERROR");
}
}
redirect("displayclass.php?classid={$classid}");
示例4: getTopCreators2
function getTopCreators2($dbw, $cutoff, $start)
{
global $table, $join, $where, $cond, $andcond;
$result = "<ol>";
$sql = "select nap_page from newarticlepatrol left join page on nap_page = page_id where page_namespace = 0\n\t\t\tand nap_timestamp > '{$cutoff}' and nap_timestamp < '{$start}'; ";
wfDebug("Dashboard top creators: {$sql}\n");
debugMsg("getting nap {$nap} ");
$res = $dbw->query($sql, __METHOD__);
$pages = array();
$revisions = array();
while ($row = $dbw->fetchObject($res)) {
$pages[] = $row->nap_page;
}
debugMsg("getting min revisions on pages " . sizeof($pages) . " pages ");
$count = 0;
foreach ($pages as $page_id) {
$revisions[$page_id] = selectField($table, array("min(rev_id)"), array("rev_page" => $page_id));
$count++;
if ($count % 100 == 0) {
debugMsg("done {$count}");
}
}
$users = array();
debugMsg("getting users on newly created pages " . sizeof($revisions) . " revisions ");
$count = 0;
foreach ($revisions as $page_id => $rev_id) {
if (empty($rev_id)) {
#echo "<!---uh oh: {$page_id} has no min rev!-->";
continue;
}
$u = selectField($dbw, "select rev_user_text from {$table} where rev_id={$rev_id}");
if (!isset($users[$u])) {
$users[$u] = 1;
} else {
$users[$u]++;
}
$count++;
if ($count % 100 == 0) {
debugMsg("done {$count}");
}
}
debugMsg("sorting " . sizeof($users) . " users");
asort($users, SORT_NUMERIC);
$users = array_reverse($users);
array_splice($users, 20);
$yy = 0;
debugMsg("outputting all of this now " . sizeof($users) . " users");
foreach ($users as $u => $c) {
$x = User::newFromName($u);
$c = nf($c);
if (!$x) {
$result .= "<li>{$u} - {$c} new articles created</li>\n";
} else {
$result .= "<li> " . getUserLink($x) . " - {$c} new articles created" . getUserToolLinks($x) . "</li>\n";
}
$yy++;
if ($yy == 20) {
break;
}
}
$result .= "</ol>";
return $result;
}
示例5: hasArrived
function hasArrived($pickup, $taxi, $client)
{
debugMsg("HAS ARIVED");
//TODO Pickup update, cleanup
$time = time();
$stime = date("Y-M-d H:i:s");
$sqlStmnt3 = "update pickups set status = 1 completedTime = " . $stime . " where pickupId = " . $pickupId;
debugMsg($sqlStmnt3);
//$result2 = mysql_query($sqlStmnt3,$conn);
createMessage($client, "PICKARR" . $pickup);
createMessage($taxi, "PICKARR" . $pickup);
//Write app first
//notify client
//update pickups as success
}
示例6: urlimport
public function urlimport($params)
{
$this->params = $params;
// Fetch data
$filename = $this->getParam('file');
$frag = $this->getParam('frag', -1);
$totalSize = $this->getParam('totalSize', -1);
$doneSize = $this->getParam('doneSize', -1);
debugMsg('Importing from URL');
debugMsg(' file : ' . $filename);
debugMsg(' frag : ' . $frag);
debugMsg(' totalSize : ' . $totalSize);
debugMsg(' doneSize : ' . $doneSize);
// Init retArray
$retArray = array("status" => true, "error" => '', "frag" => $frag, "totalSize" => $totalSize, "doneSize" => $doneSize, "percent" => 0);
try {
AKFactory::set('kickstart.tuning.max_exec_time', '5');
AKFactory::set('kickstart.tuning.run_time_bias', '75');
$timer = new AKCoreTimer();
$start = $timer->getRunningTime();
// Mark the start of this download
$break = false;
// Don't break the step
while ($timer->getTimeLeft() > 0 && !$break) {
// Figure out where on Earth to put that file
$local_file = KSROOTDIR . '/' . basename($filename);
debugMsg("- Importing from {$filename}");
// Do we have to initialize the file?
if ($frag == -1) {
debugMsg("-- First frag, killing local file");
// Currently downloaded size
$doneSize = 0;
// Delete and touch the output file
@unlink($local_file);
$fp = @fopen($local_file, 'wb');
if ($fp !== false) {
@fclose($fp);
}
// Init
$frag = 0;
}
// Calculate from and length
$length = 1048576;
$from = $frag * $length;
$to = $length + $from - 1;
//if($from == 0) $from = 1;
// Try to download the first frag
$temp_file = $local_file . '.tmp';
@unlink($temp_file);
$required_time = 1.0;
debugMsg("-- Importing frag {$frag}, byte position from/to: {$from} / {$to}");
$filesize = 0;
try {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $filename);
curl_setopt($ch, CURLOPT_RANGE, "{$from}-{$to}");
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($ch);
$errno = curl_errno($ch);
$errmsg = curl_error($ch);
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($result === false) {
$error = "cURL error {$errno}: {$errmsg}";
} elseif ($http_status > 299) {
$result = false;
$error = "HTTP status {$http_status}";
} else {
$result = file_put_contents($temp_file, $result);
if ($result === false) {
$error = "Could not open temporary file {$temp_file} for writing";
}
}
curl_close($ch);
} catch (Exception $e) {
$error = $e->getMessage();
}
if (!$result) {
@unlink($temp_file);
// Failed download
if ($frag == 0) {
// Failure to download first frag = failure to download. Period.
$retArray['status'] = false;
$retArray['error'] = $error;
debugMsg("-- Download FAILED");
return $retArray;
} else {
// Since this is a staggered download, consider this normal and finish
$frag = -1;
debugMsg("-- Import complete");
$doneSize = $totalSize;
$break = true;
continue;
}
}
// Add the currently downloaded frag to the total size of downloaded files
if ($result) {
clearstatcache();
$filesize = (int) @filesize($temp_file);
//.........这里部分代码省略.........
示例7: run_tripwire
function run_tripwire($dir = false)
{
global $config, $filelist;
// If no Directory Specified, Default to the Root of the Site the script is executed under
if (!$dir) {
$dir = $_SERVER['DOCUMENT_ROOT'];
}
// If last character is a slash, strip it off the end
if (substr($dir, -1) == '/') {
$dir = substr($dir, 0, -1);
}
// If the supplied variable is not a Directory, terminate
if (!is_dir($dir)) {
debugMsg("Directory '{$dir}' does not exist.\n");
return false;
}
debugMsg("Checking directory '{$dir}'\n");
$temp = array();
$d = dir($dir);
if ($d) {
// Loop through the files
while (false !== ($entry = $d->read())) {
// Full Entry (including Directory)
$entry_full = $dir . '/' . $entry;
// Debugging
debugMsg("<tr><th align='left'>{$entry_full}</th>");
// Symbolic Link - Excluded
if (@is_link($entry)) {
debugMsg("<td><em>Symbolic Link</em></td></tr>\n");
continue;
}
// Excluded File/Folder
if ($f1 = in_array($entry, $config['exclude']['files']) || in_array($entry_full, $config['exclude']['files'])) {
debugMsg("<td><em>Excluded File/Folder (" . array_search(isset($f1) && $f1 ? $entry : $entry_full, $config['exclude']['files']) . ")</em></td></tr>\n");
continue;
}
// Excluded File Extension
if (in_array(pathinfo($entry, PATHINFO_EXTENSION), $config['exclude']['extensions'])) {
debugMsg("<td><em>Excluded File Extension (" . array_search(pathinfo($entry, PATHINFO_EXTENSION), $config['exclude']['extensions']) . ")</em></td></tr>\n");
continue;
}
if (is_dir($dir . '/' . $entry)) {
// Recurse
debugMsg("<td>Directory - Recursing</td></tr>\n");
$temp = array_merge($temp, run_tripwire($dir . '/' . $entry));
} else {
$md5 = @md5_file($dir . '/' . $entry);
debugMsg("<td>{$md5}</td></tr>\n");
if (!$md5) {
debugMsg("<td><strong>Unreadable. Adding to Unreadable List.</strong></td></tr>\n");
file_put_contents('tripwire_unreadable.txt', "{$dir}/{$entry} - Unreadable\n", FILE_APPEND);
} else {
$temp[$dir . '/' . $entry] = $md5;
}
}
}
}
if ($d) {
$d->close();
}
return $temp;
}