本文整理汇总了PHP中PHPWS_Core::log方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_Core::log方法的具体用法?PHP PHPWS_Core::log怎么用?PHP PHPWS_Core::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_Core
的用法示例。
在下文中一共展示了PHPWS_Core::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
public static function log($message)
{
if (class_exists('Current_User') && isset($_SESSION['User'])) {
$username = Current_User::getUsername();
} else {
$username = _('Unknown user');
}
$ip = $_SERVER['REMOTE_ADDR'];
if (isset($_SERVER['HTTP_REFERER'])) {
$via = sprintf(_('Coming from: %s'), $_SERVER['HTTP_REFERER']);
} else {
$via = _('Unknown source');
}
$infraction = sprintf('%s@%s %s -- %s', $username, $ip, $via, $message);
PHPWS_Core::log(escapeshellcmd($infraction), 'security.log', _('Warning'));
}
示例2: moduleWarning
public static function moduleWarning($module)
{
// disabling as it is broken
return;
if (!LOG_DEPRECATIONS) {
return;
}
$dep_name = $module . '_deprecated';
$last_warned = PHPWS_Settings::get('users', $dep_name);
$spacing = time() - 86400 * DEPRECATE_DAY_SPACING;
// It hasn't been long enough to log the warning.
if ($last_warned && $last_warned > $spacing) {
return;
}
$warning = "The {$module} module is deprecated and support is discontinued. Please consider uninstalling it.";
PHPWS_Core::log($warning, 'deprecated.log');
PHPWS_Settings::set('users', $dep_name, time());
PHPWS_Settings::save('users');
}
示例3: logScheduleCompletion
private static function logScheduleCompletion(PulseSchedule $schedule, $result)
{
$id = $schedule->getId();
$start_time = $schedule->getStartTime('%c');
$end_time = $schedule->getEndTime('%c');
$log = <<<EOF
Schedule #{$id} was executed at {$start_time} and completed at {$end_time}.
Returned result: {$result}
EOF;
\PHPWS_Core::log($log, 'pulse.log');
}
示例4: logRequest
/**
* Logs this request to PHPWS' soap.log file
*/
private function logRequest($functionName, $result, array $params)
{
$args = implode(', ', $params);
$msg = "{$functionName}({$args}) result: {$result}";
\PHPWS_Core::log($msg, 'soap.log', 'SOAP');
}
示例5: logSoap
/**
* Uses the PHPWS_Core log public function to 'manually' log soap requests
*
* @param String $function The name of the function that's doing the logging.
* @param String $result A string indicating the result of the function call. Could be anything (usually "success").
* @return void
*/
protected static function logSoap($function, $result, array $params)
{
$args = implode(', ', $params);
$msg = "{$function}({$args}) result: {$result}";
PHPWS_Core::log($msg, 'soap.log', 'SOAP');
}
示例6: sendEmail
private function sendEmail($subject, $student_id, $content)
{
$transport = $this->getSwiftTransport();
$student = StudentFactory::getById($student_id);
if (!is_object($student)) {
\PHPWS_Core::log("Student #{$student_id} does not exist.", 'tailgate_error.txt');
return;
}
$message = \Swift_Message::newInstance();
$message->setSubject($subject);
$message->setFrom(\Settings::get('tailgate', 'reply_to'));
$message->setTo($student->getEmail());
$message->setBody($content, 'text/html');
$mailer = \Swift_Mailer::newInstance($transport);
$log = "Subject: {$subject}, To: " . $student->getEmail();
\PHPWS_Core::log($log, 'tailgate_email.log');
$mailer->send($message);
}
示例7: addLog
public static function addLog($module, $message)
{
$message = dgettext('boost', 'Module') . ' - ' . $module . ' : ' . $message;
PHPWS_Core::log($message, 'boost.log');
}
示例8: logSwiftmailMessage
/**
* PHPWS_Email has a built-in simple logging function. This replicates
* the functionality of that function for SwiftMail.
*/
public static function logSwiftmailMessage(Swift_Message $message)
{
$id = 'id:' . $message->getId();
$from = 'from:' . $message->getSender();
$to = 'to:' . implode(',', array_keys($message->getTo()));
// Optional fields, If the message has them, implode the arrays to simple strings.
$cc = $message->getCc() != null ? 'cc:' . implode(',', array_keys($message->getCc())) : '';
$bcc = $message->getBcc() != null ? 'bcc:' . implode(',', array_keys($message->getBcc())) : '';
$replyto = $message->getReplyTo() != null ? 'reply-to:' . implode(',', array_keys($message->getReplyTo())) : '';
$subject = 'subject:' . $message->getSubject();
$module = 'module:' . PHPWS_Core::getCurrentModule();
$user = 'user:' . (Current_User::isLogged() ? Current_User::getUsername() : '');
PHPWS_Core::log("{$id} {$module} {$user} {$subject} {$from} {$to} {$cc} {$bcc} {$replyto}", 'phpws-mail.log', 'mail');
}
示例9: ignoreReport
private function ignoreReport($id)
{
\PHPWS_Core::initModClass('properties', 'Report.php');
\PHPWS_Core::initModClass('properties', 'Message.php');
$report = new Report($id);
$message = new Message($report->message_id);
try {
$report->delete();
} catch (\Exception $e) {
\PHPWS_Core::log($e->getMessage(), 'properties.log');
exit('Could not remove report');
}
$message->reported = 0;
$message->save();
}
示例10: logDB
public static function logDB($sql)
{
if (!defined('LOG_DB') || LOG_DB != true) {
return;
}
PHPWS_Core::log($sql, 'db.log');
}
示例11: trackAuthentication
/**
* Trying to find out why Users changes authentication script. If cause
* is found, this will be removed.
*/
public static function trackAuthentication($message)
{
$url = \Server::getCurrentUrl(false, false);
$request = \Server::getCurrentRequest();
if ($request->isPost()) {
$type = 'POST';
} else {
$type = 'GET';
}
$vars = $request->getVars();
if (empty($vars)) {
$variables = 'No variables';
} else {
foreach ($vars['vars'] as $k => $v) {
if (is_array($v)) {
$v = serialize($v);
}
$varlist[] = "{$k}: {$v}";
}
$variables = implode("\n", $varlist);
}
$content = <<<EOF
MESSAGE: {$message}
REQUEST TYPE: {$type}
VARIABLES:
{$variables}
----
EOF;
\PHPWS_Core::log($content, 'default_authorization.log');
}
示例12: post
public function post()
{
$this->setTitle($_POST['title']);
$this->setPropertyId($_POST['pid']);
$photo =& $_FILES['photo'];
if (!$this->pid) {
throw new \Exception('Photo missing property id');
}
\PHPWS_Core::initModClass('properties', 'Property.php');
$property = new Property($this->pid);
$this->setContactId($property->contact_id);
$destination_directory = 'images/properties/c' . $this->cid . '/';
if (!is_dir($destination_directory)) {
if (!@mkdir($destination_directory)) {
throw new \Exception('Could not create photo directory');
}
}
$filename = time() . '.' . \PHPWS_File::getFileExtension($photo['name']);
$path = $destination_directory . $filename;
if (!empty($photo['error'])) {
switch ($photo['error']) {
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
throw new \Exception('Image file size is too large.');
case UPLOAD_ERR_NO_FILE:
throw new \Exception('No file upload');
case UPLOAD_ERR_NO_TMP_DIR:
\PHPWS_Core::log('Temporary file directory is not writable', 'error.log', _('Error'));
throw new \Exception('File could not be written');
}
}
list($this->width, $this->height, $image_type, $image_attr) = getimagesize($photo['tmp_name']);
if (!in_array($image_type, array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
throw new \Exception('Unacceptable image file type.');
}
if (\PHPWS_File::scaleImage($photo['tmp_name'], $path, PROPERTIES_MAX_WIDTH, PROPERTIES_MAX_HEIGHT)) {
$this->path = $path;
$this->save();
$tn = Photo::thumbnailPath($path);
$this->resize($path, $tn, PROP_THUMBNAIL_WIDTH, PROP_THUMBNAIL_HEIGHT);
} else {
throw new \Exception('Could not save image');
}
}
示例13: __construct
public function __construct($message, $code = 0)
{
parent::__construct($message, $code);
PHPWS_Core::log('Room Swap failed! : ' . $message, 'error.log');
}
示例14: log
protected static function log($to, $headers, $result)
{
$id = 'id:' . $headers['Message-Id'];
$from = 'from:' . (isset($headers['From']) ? $headers['From'] : '');
$to = 'to:' . $to;
$cc = 'cc:' . (isset($headers['Cc']) ? $headers['Cc'] : '');
$bcc = 'bcc:' . (isset($headers['Bcc']) ? $headers['Bcc'] : '');
$replyto = 'reply-to:' . (isset($headers['Reply-To']) ? $headers['Reply-To'] : '');
$subject = 'subject:' . (isset($headers['Subject']) ? $headers['Subject'] : '');
$module = 'module:' . PHPWS_Core::getCurrentModule();
$user = 'user:' . (Current_User::isLogged() ? Current_User::getUsername() : '');
$result = 'result:' . (PHPWS_Error::isError($result) ? 'Failure' : 'Success');
PHPWS_Core::log("{$id} {$module} {$user} {$subject} {$from} {$to} {$cc} {$bcc} {$replyto} {$result}", 'phpws-mail.log', 'mail');
}
示例15: __construct
public function __construct($message, $code = 0, $functionName, $params)
{
parent::__construct($message, $code);
$errorMsg = $functionName . '(' . implode(',', $params) . '): ' . $code;
PHPWS_Core::log($errorMsg, 'soapError.log', 'BannerError');
}