本文整理汇总了PHP中writeErrorLog函数的典型用法代码示例。如果您正苦于以下问题:PHP writeErrorLog函数的具体用法?PHP writeErrorLog怎么用?PHP writeErrorLog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writeErrorLog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addProduct
public function addProduct($product)
{
if ($product->yourprice > 0) {
$this->prods[$product->productid] = $product;
} else {
writeErrorLog('Won\'t add a line-item with a price <= 0 for: ', $product->productid);
}
}
示例2: createDBInstance
public function createDBInstance()
{
// always use the db version, no support for the simple file based storage
include CARTREVISION . '/phphosted/fbase.cls.php';
if (!class_exists('HostedFBase')) {
writeErrorLog('Tried to include "phphosted/fbase.cls.php", but "HostedFBase" still doesn\'t exist.');
return false;
}
return new HostedFBase(TTRANS);
}
示例3: _do_call
function _do_call($fields = '')
{
if (!$this->base_url) {
return;
}
curl_setopt($this->curl, CURLOPT_URL, $this->base_url);
curl_setopt($this->curl, CURLOPT_POSTFIELDS, $this->base_fields . $fields);
curl_setopt($this->curl, CURLOPT_CONNECTTIMEOUT, 1);
// ensure the page won't wait too long
$response = curl_exec($this->curl);
if (curl_errno($this->curl)) {
$effurl = curl_getinfo($this->curl, CURLINFO_EFFECTIVE_URL);
writeErrorLog('Stats Reporter error - ' . curl_errno($this->curl) . ': ' . curl_error($this->curl), $effurl . ' ' . $this->base_fields . $fields);
return false;
}
#echo $this->base_fields;
#writeErrorLog( 'Stats Reporter success - ' . $response, $fields );
return true;
}
示例4: _Connect
private function _Connect()
{
// connect to the database
if ($this->db === false) {
if (Config::GetInstance()->sdrive) {
$this->db = new DataAccessSQLite('save_sqlite');
// attach the transaction database if the form uses payments
if (Config::GetInstance()->UsePayments()) {
$dbfile = TransactionLogger::GetInstance()->GetSqliteFile();
if (empty($dbfile) || !file_exists($dbfile)) {
writeErrorLog('Tried to attach transaction log, but file is not defined or doesn\'t exist:', $dbfile);
} else {
$this->transacts = $this->db->AttachTransActions($dbfile);
}
}
} else {
$this->db = new DataAccessMySQL('save_database');
}
}
}
示例5: _CheckSubmitLimitReset
private function _CheckSubmitLimitReset()
{
$upgrade_date = Config::GetInstance()->getSubmitLimitUpgradeDate();
if ($upgrade_date && $upgrade_date != $this->GetSetting(FB_SETTING_SUBMITLIMIT)) {
// store the new date so that we know if it changed or not
$this->SetSetting(array(FB_SETTING_SUBMITLIMIT => $upgrade_date));
// clear the flags for the month that the date is set
$qry = 'UPDATE ' . $this->_EscapeName($this->table) . ' SET _flags_ = _flags_&' . ~FLAG_OVERSUBMITLIMIT . ' WHERE strftime(\'%Y-%m\', _submitted_) = \'' . substr($upgrade_date, 0, 7) . '\';';
$count = $this->db->exec($qry);
}
if ($count === false) {
writeErrorLog(__METHOD__, $this->db->errorInfo());
return 0;
}
return $count;
}
示例6: _MoveFile
function _MoveFile($fieldname, $filedata)
{
$fp = fopen($filedata['tmp_name'], 'r');
$content = fread($fp, $filedata['size']);
$sql = 'INSERT INTO ' . $this->_EscapeName($this->table . CC_FB_FILEUPLOAD_EXT) . ' (name, fdata) VALUES (?,?)';
$sth = $this->db->prepare($sql);
if ($sth === false) {
writeErrorLog('Failed compile query:', $sql);
} else {
if (!$sth->execute(array($fieldname, $content))) {
writeErrorLog('Failed to insert file data:', $sth->errorInfo());
} else {
// remember the id
$res = $this->db->query('SELECT LAST_INSERT_ID();');
if ($res !== false) {
$this->stored_file_rowids[] = $res->fetchColumn(0);
$res->closeCursor();
}
}
}
}
示例7: writeErrorLog
@(include_once 'SdriveConfig.php');
// initialize the singleton with the form-name
// the global $myPage is used in older code, don't remove it!
$myPage = FormPage::GetInstance($myName);
if (isset($sdrive_config)) {
$errorLoggingType = 0;
// better send writeErrorLog output to the server log
// $myPage->sdrive is initialized to false
Config::GetInstance()->LoadConfig($sdrive_config);
if (isset($sdrive_model)) {
Config::GetInstance()->sdrive_model = $sdrive_model;
}
// on S-Drive the cart scripts are taken directly from the resources
$buildnum = Config::GetInstance()->GetConfig('resource_version');
if (!$buildnum) {
writeErrorLog('Parameter missing or empty in form.cfg.dat', 'resource_version');
}
$cartpath = CC_HOSTING_RESOURCES . DIRECTORY_SEPARATOR . 'FB' . DIRECTORY_SEPARATOR . $buildnum . DIRECTORY_SEPARATOR . 'fb';
set_include_path(get_include_path() . PATH_SEPARATOR . $cartpath);
// add this constant to the file names to include instead of adding it to the include path
// as a type of name spacing
define('CARTREVISION', 'cartapp');
} else {
// A version number is added to the folder name for forward compatibility. FB increments this
// number if changes are NOT backward compatible. FB must also create the corrresponding
// folder (leaving the old folder for forms made and uploaded with a previous version).
define('CARTREVISION', 'cartapp_v1');
Config::GetInstance()->LoadConfig();
}
// catch warnings with our own error handler to ignore them as appropriate
set_error_handler('myErrorHandler', E_WARNING);
示例8: sqlGetServerStats
function sqlGetServerStats($mySQLiConn)
{
$ServerStats["GameID"] = 0;
$ServerStats["ServerState"] = 0;
$ServerStats["SessionStart"] = 0;
$ServerStats["SessionID"] = 0;
$ServerStats["SessionState"] = 0;
$ServerStats["SessionTime"] = 0;
$ServerStats["SessionEnd"] = 0;
$ServerStats["CurLaps"] = 0;
$ServerStats["MaxLaps"] = 0;
$ServerStats["NumVehicles"] = 0;
$ServerStats["TrackName"] = "No Session";
$ServerStats["AmbientTemp"] = 0;
$ServerStats["TrackTemp"] = 0;
if (!$mySQLiConn->connect_error) {
$selectSessionInfos = "SELECT SQL_CACHE * FROM `sessioninfos` LIMIT 1";
if ($resultSessionInfos = $mySQLiConn->query($selectSessionInfos)) {
if ($resultSessionInfos->num_rows == 1) {
while ($rowSessionInfos = $resultSessionInfos->fetch_assoc()) {
$ServerStats["GameID"] = $rowSessionInfos["GameID"];
$ServerStats["ServerState"] = $rowSessionInfos["ServerState"];
$ServerStats["SessionStart"] = $rowSessionInfos["SessionStart"];
$ServerStats["SessionID"] = $rowSessionInfos["SessionID"];
$ServerStats["SessionState"] = $rowSessionInfos["SessionState"];
$ServerStats["SessionTime"] = $rowSessionInfos["SessionTime"];
$ServerStats["SessionEnd"] = $rowSessionInfos["SessionEnd"];
$ServerStats["CurLaps"] = $rowSessionInfos["CurLaps"];
$ServerStats["MaxLaps"] = $rowSessionInfos["MaxLaps"];
$ServerStats["NumVehicles"] = $rowSessionInfos["NumVehicles"];
$ServerStats["TrackName"] = $rowSessionInfos["TrackName"];
$ServerStats["AmbientTemp"] = $rowSessionInfos["AmbientTemp"];
$ServerStats["TrackTemp"] = $rowSessionInfos["TrackTemp"];
}
}
$resultSessionInfos->free();
} else {
writeErrorLog("inc.common.php", "sqlGetServerStats()", "Error: (" . $mySQLiConn->error . ") Query: (" . $selectSessionInfos . ")");
}
} else {
writeErrorLog("inc.common.php", "sqlGetServerStats()", "Error: (" . $mySQLiConn->connect_error . ")");
}
return $ServerStats;
}
示例9: _Archive
function _Archive()
{
$i = 1;
do {
$newname = str_replace('.', $i . '.', $this->output_file);
$i++;
} while (file_exists($newname));
if (!rename($this->output_file, $newname)) {
writeErrorLog('Failed to archive ' . $this->output_file . ' to:', $newname);
$this->errors[] = array('err' => _T('Failed to archive data file.'));
return false;
}
return true;
}
示例10: SaveUploadAsFile
function SaveUploadAsFile($dest, $filedata)
{
if (!is_dir($dest) && !mkdir($dest, 0755, true)) {
writeErrorLog('Could not create file upload directory \'' . $dest . '\'');
return false;
}
// filename may or may not have an extension that must be preserved
$pos = strrpos($filedata['name'], '.');
$basename = $filedata['name'];
// replace any dots left with a _ for scripts diguised as an image (e.g. exploit-db.php.jpg)
if ($pos !== false) {
$tmp = substr($basename, 0, $pos);
$basename = str_replace('.', '_', $tmp) . substr($basename, $pos);
}
// try the org name first, only if it exists add the random string
$uploadname = $basename;
while (file_exists($dest . $uploadname)) {
$rand = makeRandomString();
if ($pos === false) {
$uploadname = $basename . '_' . $rand;
} else {
$uploadname = substr($basename, 0, $pos) . '_' . $rand . substr($basename, $pos);
}
}
if (empty($filedata['tmp_name'])) {
writeErrorLog('Could not move uploaded file because the tmp_name is empty.');
return false;
}
$rc = move_uploaded_file($filedata["tmp_name"], $dest . $uploadname);
if ($rc) {
return $uploadname;
}
writeErrorLog('Moving file ' . $filedata['tmp_name'] . ' to ' . $uploadname . ' failed.');
return false;
}
示例11: _SubstituteAddress
function _SubstituteAddress($name)
{
$matches = array();
$r = preg_match_all('\'\\[([^\\]]+)\\]\'', $name, $matches, PREG_PATTERN_ORDER);
if ($r === false) {
writeErrorLog('Error in regex parsing:', $name);
}
if (!$r) {
return trim($name);
}
foreach ($matches[1] as $match) {
// check if this is an email field and get its value if it is
$match = strtolower($match);
if ((Config::GetInstance()->GetConfig('rules', $match, 'fieldtype') == 'email' || Config::GetInstance()->GetConfig('rules', $match, 'contactList')) && isset(FormPage::GetInstance()->post[$match])) {
$name = str_ireplace('[' . $match . ']', FormPage::GetInstance()->post[$match], $name);
}
}
return trim($name);
}
示例12: SetSelection
function SetSelection($selection, $with_limit_exceeded = -1)
{
// don't use any alias field names in this where clause because they won't
// be defined when counting the records with a select count(*) from ... where ...
switch ((int) $with_limit_exceeded) {
case -1:
$this->where = '1';
break;
case 0:
$this->where = '(_flags_&' . FLAG_OVERSUBMITLIMIT . '=0)';
break;
case 1:
$this->where = '_flags_&' . FLAG_OVERSUBMITLIMIT;
break;
}
if ($selection === false) {
return true;
}
// check the syntax and build a where clause
// possible formats are:
// 3days last 3 days
// from20to40 from row 20 to row 40
// from2011-07-29 10:27:18to2011-07-30 10:27:18
// from date_time to date_time
// new rows that don't have the _read_ flag set
// starred rows that have the _starred_ flag set
// 1,2,3 rows with ids 1, 2 and 3
$matches = array();
if ($selection == 'new') {
$this->where .= ' AND (_flags_&' . FLAG_READ . ')=0';
} else {
if ($selection == 'starred') {
$this->where .= ' AND _flags_&' . FLAG_STARRED;
} else {
if ($selection == 'all') {
// nothing needed
} else {
if (preg_match('/(\\d+)days?/', $selection, $matches) == 1) {
$start = time() - $matches[1] * 24 * 60 * 60;
$this->where .= ' AND _submitted_ >=\'' . date('Y-m-d', $start) . ' 00:00:00\'';
} else {
if (preg_match('/from(\\d+)to(\\d+)/', $selection, $matches) == 1) {
$this->where .= ' AND _rowid_>=' . $matches[1] . ' AND ' . '_rowid_<=' . $matches[2];
} else {
if (preg_match('/from([ \\d-:]+)to([ \\d-:]+)/', $selection, $matches) == 1) {
$this->where .= ' AND _submitted_ >=\'' . Config::GetInstance()->MakeUTC($matches[1]) . '\' AND _submitted_ <\'' . Config::GetInstance()->MakeUTC($matches[2]) . '\'';
} else {
if (preg_match('/[\\d,]/', $selection)) {
$this->where .= ' AND rowid IN (' . $selection . ')';
} else {
writeErrorLog('Failed to interpret record selector:', $selection);
$this->error = 'Failed to interpret record selector. Allowed formats are: "all", "4,6,7", "new", "starred", "3days", "from20to40" and "from2011-07-29 10:27:18to2011-07-30 10:27:18"';
return false;
}
}
}
}
}
}
}
return true;
}
示例13: _makePublicUrl
private function _makePublicUrl($fieldname, $filename)
{
// ensure the publicly visible folder exists
if (!file_exists(Config::GetInstance()->getStorageFolder(4))) {
mkdir(Config::GetInstance()->getStorageFolder(4));
}
// use the rules to find out where the file is
if (Config::GetInstance()->GetRulePropertyByName($fieldname, 'files') == true) {
if (!copy(Config::GetInstance()->getStorageFolder(1) . $filename, Config::GetInstance()->getStorageFolder(4) . $filename)) {
writeErrorLog('MailChimp plugin couldn\'t copy the uploaded file to a public folder', $filename);
$this->setError(_T('Failed to copy the uploaded file %s to a publicly visible folder.', $filename));
return;
}
} else {
// look for it in the uploads table
if (isset($_FILES[$fieldname]) && file_exists($_FILES[$fieldname]['tmp_name'])) {
$filename = SaveUploadAsFile(Config::GetInstance()->getStorageFolder(4), $_FILES[$fieldname]);
if ($filename == false) {
writeErrorLog('MailChimp plugin couldn\'t move the uploaded file to a public folder', $filename);
$this->setError(_T('Failed to move the uploaded file %s to a publicly visible folder.', $filename));
return;
}
}
}
$servername = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
$path = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF'];
$path = substr($path, 0, strrpos($path, '/'));
// encode the folders, not the '/'!
$tmp = explode('/', $path);
for ($i = 0; $i < count($tmp); ++$i) {
$tmp[$i] = rawurlencode($tmp[$i]);
}
$path = implode('/', $tmp);
// windows servers may set [HTTPS] => off, linux server usually don't set [HTTPS] at all
if (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
$protocol = 'https';
} else {
$protocol = 'http';
}
$url = $protocol . '://' . $servername;
// only add the serverport when it differs from the default
if (strpos($servername, ':') === false && ($_SERVER['SERVER_PORT'] != '80' || $protocol != 'http')) {
$url .= ':' . $_SERVER['SERVER_PORT'];
}
return $url . $path . '/' . FormPage::GetInstance()->GetFormName() . CC_FB_STORAGE_FOLDER . CC_FB_PUBLIC_DIRECTORY . $filename;
}
示例14: callBack
public function callBack()
{
$callback_data = $this->input['data'];
$shift = json_decode(html_entity_decode($callback_data), 1);
/*****************************根据时移反馈的信息,更新时移日志的状态*******************************/
$sql = 'SELECT * FROM ' . DB_PREFIX . 'time_shift_log WHERE id = ' . (int) $shift['id'];
$shift_info = $this->db->query_first($sql);
if (empty($shift_info)) {
$this->errorOutput('时移数据不存在');
}
if ($shift) {
switch ($shift['exit_status']) {
case 0:
$status = 0;
break;
case 1:
$status = 1;
break;
}
//更新时移状态
$this->mode->update($shift['id'], array('status' => $status));
}
if (!$status) {
writeErrorLog("时移失败:\n" . var_export($shift, 1));
$this->errorOutput('时移失败');
}
/*****************************根据时移反馈的信息,更新时移日志的状态*******************************/
/****************************将时移好的视频提交到mediaserver进行转码*****************************/
if (!$this->settings['App_mediaserver']) {
$this->errorOutput('未安装mediaserver');
}
$curl = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
$curl->setSubmitType('post');
$curl->initPostData();
//构建需要提交的数据
$data = array('filepath' => $shift['file_path'], 'vod_sort_id' => $shift['vod_sort_id'], 'vod_leixing' => 3, 'start' => '0', 'duration' => '');
if ($shift_info['live_split_callback']) {
$data['app_uniqueid'] = 'live_split_data';
$data['mod_uniqueid'] = 'live_split_data';
}
if (!empty($shift) && $shift['extend']) {
$shift['extend'] = json_decode(base64_decode($shift['extend']), 1);
foreach ($shift['extend'] as $k => $v) {
$curl->addRequestData($k, $v);
}
}
foreach ($data as $k => $v) {
$curl->addRequestData($k, $v);
}
$ret = $curl->request('create.php');
/****************************将时移好的视频提交到mediaserver进行转码*****************************/
/****************************提交之后的回调处理************************************************/
if ($ret && $ret[0]['id']) {
//更新时移的视频id
$this->mode->update($shift['id'], array('video_id' => $ret[0]['id']));
$shift_info['live_split_callback'] && $this->live_split_callback($shift_info['live_split_callback'], $callback_data, $ret[0]['id']);
} else {
//时移成功,但是提交mediserver失败
$this->mode->update($shift['id'], array('status' => 3));
$shift_info['live_split_callback'] && $this->live_split_callback($shift_info['live_split_callback'], $callback_data, 0);
writeErrorLog("时移成功,提交转码失败:\n" . var_export($ret, 1));
}
$this->addItem($ret);
$this->output();
}
示例15: AddAttachment
/**
* Adds an attachment from a path on the filesystem.
* Returns false if the file could not be found
* or accessed.
* @param string $path Path to the attachment.
* @param string $name Overrides the attachment name.
* @param string $encoding File encoding (see $Encoding).
* @param string $type File extension (MIME) type.
* @return bool
*/
public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream')
{
try {
if (!@is_file($path)) {
throw new phpmailerException($this->Lang('file_access') . $path, self::STOP_CONTINUE);
}
$filename = basename($path);
if ($name == '') {
$name = $filename;
}
$this->attachment[] = array(0 => $path, 1 => $filename, 2 => $name, 3 => $encoding, 4 => $type, 5 => false, 6 => 'attachment', 7 => 0);
} catch (phpmailerException $e) {
$this->SetError($e->getMessage());
if ($this->exceptions) {
throw $e;
}
writeErrorLog($e->getMessage());
if ($e->getCode() == self::STOP_CRITICAL) {
return false;
}
}
return true;
}