本文整理汇总了PHP中LogError函数的典型用法代码示例。如果您正苦于以下问题:PHP LogError函数的具体用法?PHP LogError怎么用?PHP LogError使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LogError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test
public function test()
{
pr(App::themePath('purple'));
pr(App::path('Model'));
debug(App::paths());
pr(App::path('Component', 'DebugKit'));
debug(env('document_root'));
debug(h('fengjie ; fengjie '));
LogError('fengjie');
pr(array('fengjie', 'fengjie'));
debug(h('fengjie ; fengjie '));
pr(YEAR);
pr(HOUR);
}
示例2: mysql_query
/**
* Query the data source.
* <p>This class makes no assumption about the content of the query
* object, but the behavior of the resulting Cursor object should be
* consistent between data source implementations.
* @param mixed $query Some sort of query that will be understood by
* the implemented data source.
* @return Cursor The result of the query, FALSE otherwise (though this
* is unlikely to occur because of the fatal error event when a query
* fails).
*/
function &query($query)
{
if (!($rv =& parent::query($query))) {
$result = mysql_query($query, $this->myLink);
if ($result) {
$rv = new MySQLCursor($result, $this);
} else {
LogError("MySQL query failed: \n" . $query . "\n" . mysql_error());
LogFatal("MySQL query failed");
$rv = FALSE;
}
}
return $rv;
}
示例3: LogDebug
/**
* Query the data source.
* <p>This class makes no assumption about the content of the query
* object, but the behavior of the resulting Cursor object should be
* consistent between data source implementations.
* @param mixed $query Some sort of query that will be understood by
* the implemented data source.
* @return Cursor The result of the query, FALSE if the query failed.
*/
function &query($query)
{
if ($this->isConnected) {
if (IsLogEnabled('DEBUG')) {
LogDebug("querying for: \n" . print_r($query, TRUE), $this);
}
$rv = FALSE;
return $rv;
} else {
if (IsLogEnabled('ERROR')) {
LogError("Cannot run query: \n" . print_r($query, TRUE) . "\ndata source is not connected: " . print_r($this, TRUE));
}
LogFatal("Error running query.");
}
}
示例4: ErrorHandler
function ErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
{
LogError(debug_backtrace());
/*
echo 'Into '.__FUNCTION__.'() at line '.__LINE__.
"\n\n---ERRNO---\n". print_r( $errno, true).
"\n\n---ERRSTR---\n". print_r( $errstr, true).
"\n\n---ERRFILE---\n". print_r( $errfile, true).
"\n\n---ERRLINE---\n". print_r( $errline, true).
"\n\n---ERRCONTEXT---\n".print_r( $errcontext, true).
"\n\nBacktrace of errorHandler()\n".
print_r( debug_backtrace(), true);
*/
return true;
}
示例5: encryptData
function encryptData($text, $key, $compress = true)
{
if (!function_exists('mcrypt_get_iv_size')) {
MSGError("Encryption error -- mcrypt not installed -- contact an admin (" . getFunctionName() . ")");
LogError("Encryption error -- mcrypt not installed -- contact an admin (" . getFunctionName() . ")");
return "";
}
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$key = myhash($key . "123456789012345678901234567890");
// . myhash($key);
$grade = '##';
if ($compress) {
$text = zipstr($text);
$grade = '@#';
}
$crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, substr(pack("H*", $key), 0, 32), $text . myshorthash($text) . $grade, MCRYPT_MODE_CBC, $iv);
return base64_encode($crypttext . $iv);
}
示例6: error
/**
* Log an error message.
* @param string $message The message.
*/
function error($message)
{
LogError($message, $this);
}
示例7: LogWarning
$sql .= "WHERE plPlayerID = {$admin_player_id}";
//Run UPDATE query
if (ba_db_query($link, $sql)) {
//Query should affect exactly one row. Log a warning if it affected more
if (ba_db_affected_rows($link) > 1) {
LogWarning("More than one row updated during admin OOC update (admin_edit_ooc.php). Player ID: {$admin_player_id}");
}
//Do not redirect if there are any warnings (required fields not filled in, etc)
if ($sWarn == '') {
//Make up URL & redirect
$sURL = fnSystemURL() . "admin_viewdetails.php?pid={$admin_player_id}&green=" . urlencode("OOC details updated");
header("Location: {$sURL}");
}
} else {
$sWarn = "There was a problem updating the OOC details";
LogError("Error updating OOC information (admin_edit_ooc.php). Player ID: {$admin_player_id}");
}
}
//Get existing details if there are any
$sql = "SELECT plFirstName, " . "plSurname, " . "AES_DECRYPT(pleAddress1, '{$key}') AS dAddress1, " . "AES_DECRYPT(pleAddress2, '{$key}') AS dAddress2, " . "AES_DECRYPT(pleAddress3, '{$key}') AS dAddress3, " . "AES_DECRYPT(pleAddress4, '{$key}') AS dAddress4, " . "AES_DECRYPT(plePostcode, '{$key}') AS dPostcode, " . "AES_DECRYPT(pleTelephone, '{$key}') AS dTelephone, " . "AES_DECRYPT(pleMobile, '{$key}') AS dMobile, " . "plEmail, " . "plDOB, " . "AES_DECRYPT(pleMedicalInfo, '{$key}') AS dMedicalInfo, " . "plEmergencyName, " . "AES_DECRYPT(pleEmergencyNumber, '{$key}') AS dEmergencyNumber, " . "plEmergencyRelationship, " . "plCarRegistration, " . "plDietary, " . "plNotes, " . "plAdminNotes, " . "plEventPackByPost, " . "plRefNumber, " . "plMarshal " . "FROM {$db_prefix}players WHERE plPlayerID = {$admin_player_id}";
$result = ba_db_query($link, $sql);
$playerrow = ba_db_fetch_assoc($result);
include '../inc/inc_head_html.php';
include '../inc/inc_js_forms.php';
?>
<h1><?php
echo TITLE;
?>
- Admin OOC Edit</h1>
示例8: error
function error($msg)
{
LogError($msg);
}
示例9: DBGetFullProblemData
function DBGetFullProblemData($contestnumber, $freeproblems = false)
{
$c = DBConnect();
DBExec($c, "begin work", "GetFullProblemData");
$r = DBExec($c, "select p.problemnumber as number, p.problemname as name, p.problemfullname as fullname, " . "p.problembasefilename as basefilename, p.fake as fake, " . "p.problemcolor as color, p.problemcolorname as colorname, " . "p.probleminputfilename as inputfilename, p.probleminputfile as inputoid, p.probleminputfilehash as inputhash " . " from problemtable as p " . "where p.contestnumber={$contestnumber} order by p.problemnumber", "DBGetFullProblemData(get problem)");
// and p.problemfullname !~ '(DEL)'
$n = DBnlines($r);
if ($n == 0) {
LOGLevel("No problems defined in the database ({$contestnumber})", 1);
}
$cf = globalconf();
$a = array();
$ds = DIRECTORY_SEPARATOR;
if ($ds == "") {
$ds = "/";
}
for ($i = 0; $i < $n; $i++) {
$a[$i] = array_merge(array(), DBRow($r, $i));
if (strpos($a[$i]['fullname'], '(DEL)') !== false) {
continue;
}
$nn = $a[$i]['number'];
$ptmp = $_SESSION["locr"] . $ds . "private" . $ds . "problemtmp" . $ds . "contest" . $contestnumber . "-problem" . $nn;
$ck = myshorthash('');
if (is_readable($ptmp . ".hash")) {
$ck = trim(file_get_contents($ptmp . ".hash"));
}
if ($ck != $a[$i]['inputhash']) {
@unlink($ptmp . ".name");
@unlink($ptmp . ".hash");
$a[$i]['basefilename'] = '';
$a[$i]['descfilename'] = '';
$a[$i]['fullname'] = '';
}
if ($freeproblems && $a[$i]['fake'] != 't') {
if (is_readable($ptmp . ".name")) {
$a[$i]['descfilename'] = trim(file_get_contents($ptmp . ".name"));
if ($a[$i]['descfilename'] != '') {
$a[$i]['descoid'] = -1;
}
} else {
@unlink($ptmp . ".name");
@unlink($ptmp . ".hash");
$randnum = session_id() . "_" . rand();
$dir = $ptmp . '-' . $randnum;
@mkdir($dir, 0770, true);
$failed = 0;
if (($ret = DB_lo_export($contestnumber, $c, $a[$i]["inputoid"], $dir . $ds . "tmp.zip")) === false) {
LogError("FreeProblems: Unable to read problem package from database (problem={$nn}, contest={$contestnumber})");
$failed = 1;
}
if (!$failed) {
$zip = new ZipArchive();
if ($zip->open($dir . $ds . "tmp.zip") === true) {
$zip->extractTo($dir);
$zip->close();
if (($info = @parse_ini_file($dir . $ds . "description" . $ds . 'problem.info')) === false) {
$failed = 2;
}
if (!$failed) {
$descfile = '';
if (isset($info['descfile'])) {
$descfile = trim(sanitizeText($info['descfile']));
}
$basename = trim(sanitizeText($info['basename']));
$fullname = trim(sanitizeText($info['fullname']));
if ($basename == '' || $fullname == '') {
$failed = 3;
}
}
} else {
$failed = 4;
}
if (!$failed) {
@mkdir($ptmp);
if ($descfile != '') {
if (file_put_contents($ptmp . $ds . $descfile, encryptData(file_get_contents($dir . $ds . "description" . $ds . $descfile), $cf['key']), LOCK_EX) === FALSE) {
$failed = 5;
}
if (!$failed) {
file_put_contents($ptmp . ".name", $ptmp . $ds . $descfile);
file_put_contents($ptmp . ".hash", $a[$i]['inputhash']);
if (is_readable($ptmp . ".name")) {
$a[$i]['descfilename'] = trim(file_get_contents($ptmp . ".name"));
if ($a[$i]['descfilename'] != '') {
$a[$i]['descoid'] = -1;
}
}
}
} else {
@unlink($ptmp . ".name");
@unlink($ptmp . ".hash");
}
if (!$failed) {
DBExec($c, "update problemtable set problemfullname='{$fullname}', problembasefilename='{$basename}' where problemnumber={$nn} and contestnumber={$contestnumber}", "DBGetFullProblemData(free problem)");
$a[$i]['basefilename'] = $basename;
$a[$i]['fullname'] = $fullname;
}
}
}
//.........这里部分代码省略.........
示例10: WriteFragment
function WriteFragment($download, &$opt)
{
$this->frags[$download['id']] = $download;
$available = count($this->frags);
for ($i = 0; $i < $available; $i++) {
if (isset($this->frags[$this->lastFrag + 1])) {
$frag = $this->frags[$this->lastFrag + 1];
if ($frag['response'] !== false) {
LogDebug("Writing fragment " . $frag['id'] . " to flv file");
if (!isset($opt['file'])) {
$opt['debug'] = false;
if ($this->play) {
$outFile = STDOUT;
} else {
if ($this->outFile) {
if ($opt['filesize']) {
$outFile = JoinUrl($this->outDir, $this->outFile . '-' . $this->fileCount++ . ".flv");
} else {
$outFile = JoinUrl($this->outDir, $this->outFile . ".flv");
}
} else {
if ($opt['filesize']) {
$outFile = JoinUrl($this->outDir, $this->baseFilename . '-' . $this->fileCount++ . ".flv");
} else {
$outFile = JoinUrl($this->outDir, $this->baseFilename . ".flv");
}
}
}
$this->InitDecoder();
$this->DecodeFragment($frag['response'], $frag['id'], $opt);
$opt['file'] = WriteFlvFile($outFile, $this->audio, $this->video);
if ($this->metadata) {
WriteMetadata($this, $opt['file']);
}
$opt['debug'] = $this->debug;
$this->InitDecoder();
}
$flvData = $this->DecodeFragment($frag['response'], $frag['id'], $opt);
if (strlen($flvData)) {
$status = fwrite($opt['file'], $flvData, strlen($flvData));
if (!$status) {
LogError("Failed to write flv data");
}
if (!$this->play) {
$this->filesize = ftell($opt['file']) / (1024 * 1024);
}
}
$this->lastFrag = $frag['id'];
} else {
$this->lastFrag += 1;
LogDebug("Skipping failed fragment " . $this->lastFrag);
}
unset($this->frags[$this->lastFrag]);
} else {
break;
}
if ($opt['tDuration'] and $opt['duration'] + $this->duration >= $opt['tDuration']) {
LogInfo("");
LogInfo($opt['duration'] + $this->duration . " seconds of content has been recorded successfully.", true);
return STOP_PROCESSING;
}
if ($opt['filesize'] and $this->filesize >= $opt['filesize']) {
$this->filesize = 0;
$opt['duration'] += $this->duration;
fclose($opt['file']);
unset($opt['file']);
}
}
if (!count($this->frags)) {
unset($this->frags);
}
return true;
}
示例11: ba_db_query
$sql_select = "SELECT plFirstName, plSurname, plEmail FROM {$db_prefix}players WHERE plPlayerID = " . $item_number;
$result = ba_db_query($link, $sql_select);
$row = ba_db_fetch_assoc($result);
//Send e-mail
$sBody = "Your payment for the upcoming event has been received.\n";
if (PAYPAL_AUTO_MARK_PAID) {
$sBody .= "You are now fully booked.\n\n";
} else {
$sBody .= "You will be fully booked once your booking has been confirmed by a system administrator.\n\n";
}
$sBody .= "Thank you.\n\n";
$sBody .= "Player ID: " . PID_PREFIX . sprintf('%03s', $iPlayerID) . "\n";
$sBody .= "OOC Name: " . $row['plFirstName'] . " " . $row['plSurname'];
if ($bEmailPaymentReceived) {
mail($row['plEmail'], SYSTEM_NAME . ' - payment received', $sBody, "From:" . SYSTEM_NAME . " <" . EVENT_CONTACT_MAIL . ">");
}
//Clear any payment requests for this booking
$sql = "delete from {$db_prefix}paymentrequests where prBookingID = " . $custom;
$result = ba_db_query($link, $sql);
}
} else {
if (strcmp($res, "INVALID") == 0) {
// log for manual investigation
LogError("There was a problem with PayPal payment - PayPal returned 'INVALID' when verifying payment.\n" . "Item name; '{$item_name}'");
fnMailer("There was a problem with PayPal payment - PayPal returned 'INVALID' when verifying payment." . "Payment will have to be manually processed.\n" . "Item name; '{$item_name}'", True);
}
}
}
fclose($fp);
}
include 'inc/inc_foot.php';
示例12: ForwardData
function ForwardData(&$pcGPS, $ExtraModuleData)
{
//In this function we extract and forward the information we want from the
//module data.
//Notice @ usage in this function to avoid HTML error/warning output
//because any text output will be sent to the module that called the script
//and will not appear on screen in a browser.
//Do *NOT* abort the script or generate output
//(e.g. exit/die/echo/print/PHP-errors/...) because then the module will
//not receive a proper response.
//Also do *NOT* make the module wait too long either for a response,
//because that too will make it time-out waiting and will retry sending the
//same data (possibly over and over) again.
//Assuming that you only want to forward position information from the
//module, you need check the Switch value (CGPS:GetSwitch() function) to
//determine if the received data actually contains position information.
//In this example we simply use the CanGet...() functions of the CGPS class
//to determine which information is available.
//Then we forward the extracted data if available or the text that you put
//in the $NotAvailable variable below instead.
$NotAvailable = "";
//### NOTE/CHANGE ### An empty string should be sufficient, but can be anything that the receiving side likes.
global $ForwardHost, $ForwardScript, $ForwardPort, $ForwardAcknowledgeResponse;
$ProcessedDataParts = 0;
//Create a variable starting at value 0 that we increase per processed data part
for (; $ProcessedDataParts < $pcGPS->GetDataPartCount(); $ProcessedDataParts++) {
//Select next data part in the class if the module combined multiple transmissions.
if (!$pcGPS->SelectDataPart($ProcessedDataParts) || !$pcGPS->IsValid()) {
LogError($pcGPS->GetLastError() . '. Data string: ' . $pcGPS->GetHttpData());
continue;
}
//Now extract those items from the received module data with the CGPS
//class that you want to forward.
//When the CanGet...() function returns false, the variable is filled
//with "NotAvailable" that you have set above.
//Otherwise, the variable is filled with the result of the same
//Get...() function of the same type.
//See CGPS class API documentation for detailed information about the
//information that is returned by the Get...() functions that are used
//above.
//You might see functions that return information that you want to
//forward too.
//This can be easily done by adding some extra items to the extraction
//part below.
$Imei = $pcGPS->GetImei();
//Unique serial number which you can use to identify the module.
$DateTime = $pcGPS->GetUtcTimeMySQL();
//UTC date/time as yyyymmddhhmmss text.
$Switch = $pcGPS->GetSwitch();
//The Switch value that tells which info is available.
$Latitude = $pcGPS->CanGetLatLong() ? $pcGPS->GetLatitudeFloat() : $NotAvailable;
//Latitude position as floating point coordinate.
$Longitude = $pcGPS->CanGetLatLong() ? $pcGPS->GetLongitudeFloat() : $NotAvailable;
//Longitude position as floating point coordinate.
$Heading = $pcGPS->CanGetHeading() ? $pcGPS->GetHeading() : $NotAvailable;
//Heading direction in degrees.
$Speed = $pcGPS->CanGetSpeed() ? $pcGPS->GetSpeedKPH() : $NotAvailable;
//Speed in kilometers per hour.
$IO = $pcGPS->CanGetIO() ? $pcGPS->GetIO() : $NotAvailable;
//Status of the digital IO lines.
//When needed, the module includes extra data with a transmission.
//This example already forwards this extra module data together with
//your preferred extractions above via an HTTP POST below.
//But if the receiver of the forwarded data does not support HTTP POST
//or you need something dedicated, you could save this extra module
//data to a disk file and forward the name of that file instead.
//Here is an example that shows you how to write the extra module data
//that are JPEG photos to disk.
/***** Begin of example to save extra module data directly to a file *****
$JpegPhoto=$NotAvailable; //Same system as used above.
if(($pcGPS->GetSwitch()==SV_Photo) || ($pcGPS->GetSwitch()==SV_PhotoGps)) //SV_Photo or SV_PhotoGps type Switch?
{
//Received JPEG picture data as extra module data, so create disk file name "<Module IMEI number> <Date/Time>.jpg" and write the extra module data in it.
$FileName=$pcGPS->GetImei()." ".$pcGPS->GetUtcTimeMySQL().".jpg"; //Construct the file name.
if($hFile=@fopen($FileName, 'wb')) //Create a new file with this name.
{
if(@fwrite($hFile, $ExtraModuleData)==strlen($ExtraModuleData)) //Write extra module data into the created file.
$JpegPhoto=$FileName; //Success, so change "NotAvailable" into the disk file name.
else LogError("Error writing to picture file '$FileName' (are server settings properly set to allow this script to write to files?)");
@fclose($hFile); //Close the file.
} else LogError("Error creating picture file '$FileName' (are server settings properly set to allow this script to create files?)");
}
***** End of example to save extra module data directly to a file *****/
//Now we combine all module data extracted above together in a HTTP URL
//compatible way.
//The variable $HttpData will be filled with something like:
// "Imei=123456789012345&DateTime=...&Switch=...&Latitude=........."
//Even the original module data string is included in this example as
//"Data=...", so you can store it too.
//If you later decide that you need extra info from old receptions, you
//still have all the data.
$HttpData = 'Imei=' . urlencode($Imei) . '&DateTime=' . urlencode($DateTime) . '&Switch=' . urlencode($Switch) . '&Latitude=' . urlencode($Latitude) . '&Longitude=' . urlencode($Longitude) . '&Heading=' . urlencode($Heading) . '&Speed=' . urlencode($Speed) . '&IO=' . urlencode($IO) . '&Data=' . $pcGPS->GetHttpData();
//Now forward the extracted information and if extra module data was
//received, include that too.
//On the receiving side, the type of extra data in the HTTP POST
//(if any), can be determined from the Switch value.
//With a Switch value of SV_Photo or SV_PhotoGps for example, the extra
//binary data is a photo in JPEG format.
//Notice the @ usage below to suppress error/warning output in case any
//occurs because the module would receive it.
//.........这里部分代码省略.........
示例13: LogError
/**
* Get a configuration object.
* @param mixed $initialConfig The external configuration object or array to
* use for setting up initial values. May be an existing Configuration
* object, in which case no other is constructed.
*/
function &GetConfigurationRef(&$initialConfig)
{
global $GETCONFIGURATION_HELPER;
if (is_a($initialConfig, "AtsumiObject")) {
$chelp = $initialConfig;
} else {
$GETCONFIGURATION_HELPER->setref($initialConfig);
$chelp = $GETCONFIGURATION_HELPER;
}
if ($chelp->has('configuration-class')) {
$configclass = $chelp->get('configuration-class');
} else {
$configclass = 'Configuration';
}
if (!class_exists($configclass)) {
if (IsLogEnabled('ERROR')) {
LogError("Configuration class {$configclass} is not defined:\n" . print_r($initialConfig, TRUE));
}
LogFatal("Invalid configuration");
$rv = FALSE;
return $rv;
} else {
if (is_a($initialConfig, $configclass)) {
$rv =& $initialConfig;
} elseif (is_a($initialConfig, 'Configuration')) {
$ic =& $initialConfig->get();
$rv = new $configclass($ic);
} else {
$rv = new $configclass($initialConfig);
}
if (!is_a($rv, 'Configuration')) {
if (IsLogEnabled('ERROR')) {
LogError("{$configclass} is not a Configuration subclass:\n" . print_r($initialConfig, TRUE));
}
LogFatal("Invalid configuration");
$rv = FALSE;
}
return $rv;
}
}
示例14: ForceLoad
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////////////
// Last modified 05/aug/2012 by cassio@ime.usp.br
require 'header.php';
if (($ct = DBContestInfo($_SESSION["usertable"]["contestnumber"])) == null) {
ForceLoad("{$loc}/index.php");
}
if (isset($_GET["delete"]) && is_numeric($_GET["delete"])) {
$param["number"] = $_GET["delete"];
if (!DBDeleteAnswer($_SESSION["usertable"]["contestnumber"], $param)) {
MSGError('Error deleting answer');
LogError('Error deleting answer');
}
ForceLoad("answer.php");
}
if (isset($_POST["Submit3"]) && isset($_POST["answernumber"]) && is_numeric($_POST["answernumber"]) && isset($_POST["answername"]) && $_POST["answername"] != "" && isset($_POST["answeryes"])) {
if ($_POST["confirmation"] == "confirm") {
$param["number"] = $_POST["answernumber"];
$param["name"] = $_POST["answername"];
$param["yes"] = $_POST["answeryes"];
DBNewAnswer($_SESSION["usertable"]["contestnumber"], $param);
}
ForceLoad("answer.php");
}
?>
<br>
<script language="javascript">
示例15: remove
/**
* Remove an object.
* @param ChunsuObject $removeme The object to remove.
* @param DataSource $source The data source to remove the object from.
* @return bool TRUE is successful, FALSE otherwise.
*/
function remove(&$removeme, $source)
{
parent::remove($removeme, $source);
$gen = new SQLGenerator($removeme->getCore());
$removequeries = $gen->delete($this->config);
foreach ($removequeries as $rq) {
$cursor =& $source->query($rq);
$rv = $cursor->getNext();
if (!$rv) {
LogError("remove query failed! removing " . print_r($removeme, TRUE));
return FALSE;
}
}
$rv = $cursor->getNext();
if (!$rv) {
LogError("Remove failed! Removing " . print_r($removeme, TRUE));
return FALSE;
}
if ($rows = $cursor->get('affected-rows') > 1) {
LogWarning("{$rows} records deleted removing " . print_r($removeme, TRUE));
}
$removeme->is_new = $removeme->config->get('create-on-save');
return TRUE;
}