本文整理汇总了PHP中Debug::LogEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP Debug::LogEntry方法的具体用法?PHP Debug::LogEntry怎么用?PHP Debug::LogEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debug
的用法示例。
在下文中一共展示了Debug::LogEntry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Layout Page Logic
* @return
* @param $db Object
*/
function __construct(database $db, user $user)
{
$this->db =& $db;
$this->user =& $user;
$this->sub_page = Kit::GetParam('sp', _GET, _WORD, 'view');
$this->layoutid = Kit::GetParam('layoutid', _REQUEST, _INT);
// If we have modify selected then we need to get some info
if ($this->layoutid != '') {
// get the permissions
Debug::LogEntry('audit', 'Loading permissions for layoutid ' . $this->layoutid);
$this->auth = $user->LayoutAuth($this->layoutid, true);
if (!$this->auth->edit) {
trigger_error(__("You do not have permissions to edit this layout"), E_USER_ERROR);
}
$this->sub_page = "edit";
$sql = " SELECT layout, description, userid, retired, xml FROM layout ";
$sql .= sprintf(" WHERE layoutID = %d ", $this->layoutid);
if (!($results = $db->query($sql))) {
trigger_error($db->error());
trigger_error(__("Cannot retrieve the Information relating to this layout. The layout may be corrupt."), E_USER_ERROR);
}
if ($db->num_rows($results) == 0) {
$this->has_permissions = false;
}
while ($aRow = $db->get_row($results)) {
$this->layout = Kit::ValidateParam($aRow[0], _STRING);
$this->description = Kit::ValidateParam($aRow[1], _STRING);
$this->retired = Kit::ValidateParam($aRow[3], _INT);
$this->xml = $aRow[4];
}
}
}
示例2: handle_form_data
protected function handle_form_data($file, $index)
{
// Handle form data, e.g. $_REQUEST['description'][$index]
// Link the file to the module
$name = $_REQUEST['name'][$index];
$duration = $_REQUEST['duration'][$index];
$layoutId = Kit::GetParam('layoutid', _REQUEST, _INT);
$type = Kit::GetParam('type', _REQUEST, _WORD);
Debug::LogEntry('audit', 'Upload complete for Type: ' . $type . ' and file name: ' . $file->name . '. Name: ' . $name . '. Duration:' . $duration);
// We want to create a module for each of the uploaded files.
// Do not pass in the region ID so that we only assign to the library and not to the layout
try {
$module = ModuleFactory::createForLibrary($type, $layoutId, $this->options['db'], $this->options['user']);
} catch (Exception $e) {
$file->error = $e->getMessage();
exit;
}
// We want to add this item to our library
if (!($storedAs = $module->AddLibraryMedia($file->name, $name, $duration, $file->name))) {
$file->error = $module->GetErrorMessage();
}
// Set new file details
$file->storedas = $storedAs;
// Delete the file
@unlink($this->get_upload_path($file->name));
}
示例3: Grid
function Grid()
{
$db =& $this->db;
$response = new ResponseManager();
$type = Kit::GetParam('filter_type', _POST, _WORD);
$fromDt = Kit::GetParam('filter_fromdt', _POST, _STRING);
setSession('sessions', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
setSession('sessions', 'filter_type', $type);
setSession('sessions', 'filter_fromdt', $fromDt);
$SQL = "SELECT session.userID, user.UserName, IsExpired, LastPage, session.LastAccessed, RemoteAddr, UserAgent ";
$SQL .= "FROM `session` LEFT OUTER JOIN user ON user.userID = session.userID ";
$SQL .= "WHERE 1 = 1 ";
if ($fromDt != '') {
// From Date is the Calendar Formatted DateTime in ISO format
$SQL .= sprintf(" AND session.LastAccessed < '%s' ", DateManager::getMidnightSystemDate(DateManager::getTimestampFromString($fromDt)));
}
if ($type == "active") {
$SQL .= " AND IsExpired = 0 ";
}
if ($type == "expired") {
$SQL .= " AND IsExpired = 1 ";
}
if ($type == "guest") {
$SQL .= " AND session.userID IS NULL ";
}
// Load results into an array
$log = $db->GetArray($SQL);
Debug::LogEntry('audit', $SQL);
if (!is_array($log)) {
trigger_error($db->error());
trigger_error(__('Error getting the log'), E_USER_ERROR);
}
$cols = array(array('name' => 'lastaccessed', 'title' => __('Last Accessed')), array('name' => 'isexpired', 'title' => __('Active'), 'icons' => true), array('name' => 'username', 'title' => __('User Name')), array('name' => 'lastpage', 'title' => __('Last Page')), array('name' => 'ip', 'title' => __('IP Address')), array('name' => 'browser', 'title' => __('Browser')));
Theme::Set('table_cols', $cols);
$rows = array();
foreach ($log as $row) {
$row['userid'] = Kit::ValidateParam($row['userID'], _INT);
$row['username'] = Kit::ValidateParam($row['UserName'], _STRING);
$row['isexpired'] = Kit::ValidateParam($row['IsExpired'], _INT) == 1 ? 0 : 1;
$row['lastpage'] = Kit::ValidateParam($row['LastPage'], _STRING);
$row['lastaccessed'] = DateManager::getLocalDate(strtotime(Kit::ValidateParam($row['LastAccessed'], _STRING)));
$row['ip'] = Kit::ValidateParam($row['RemoteAddr'], _STRING);
$row['browser'] = Kit::ValidateParam($row['UserAgent'], _STRING);
// Edit
$row['buttons'][] = array('id' => 'sessions_button_logout', 'url' => 'index.php?p=sessions&q=ConfirmLogout&userid=' . $row['userid'], 'text' => __('Logout'));
$rows[] = $row;
}
Theme::Set('table_rows', $rows);
$response->SetGridResponse(Theme::RenderReturn('table_render'));
$response->Respond();
}
示例4: SetError
/**
* Sets the Error for this Data object
* @return
* @param $errNo Object
* @param $errMessage Object
*/
protected function SetError($errNo, $errMessage = '')
{
$this->error = true;
// Is an error No provided?
if (!is_numeric($errNo)) {
$errMessage = $errNo;
$errNo = -1;
}
$this->errorNo = $errNo;
$this->errorMessage = $errMessage;
Debug::LogEntry('audit', sprintf('Data Class: Error Number [%d] Error Message [%s]', $errNo, $errMessage), 'Data Module', 'SetError');
// Return false so that we can use this method as the return call for parent methods
return false;
}
示例5: InitLocale
/**
* Gets and Sets the Local
* @return
*/
public static function InitLocale()
{
$localeDir = 'locale';
$default = Config::GetSetting('DEFAULT_LANGUAGE');
global $transEngine;
global $stream;
//Debug::LogEntry('audit', 'IN', 'TranslationEngine', 'InitLocal');
// Try to get the local firstly from _REQUEST (post then get)
$lang = Kit::GetParam('lang', _REQUEST, _WORD, '');
// Build an array of supported languages
$supportedLangs = scandir($localeDir);
if ($lang != '') {
// Set the language
Debug::LogEntry('audit', 'Set the Language from REQUEST [' . $lang . ']', 'TranslationEngine', 'InitLocal');
// Is this language supported?
// if not just use the default (eb_GB).
if (!in_array($lang . '.mo', $supportedLangs)) {
trigger_error(sprintf('Language not supported. %s', $lang));
// Use the default language instead.
$lang = $default;
}
} else {
$langs = Kit::GetParam('HTTP_ACCEPT_LANGUAGE', $_SERVER, _STRING);
if ($langs != '') {
//Debug::LogEntry('audit', ' HTTP_ACCEPT_LANGUAGE [' . $langs . ']', 'TranslationEngine', 'InitLocal');
$langs = explode(',', $langs);
foreach ($langs as $lang) {
// Remove any quality rating (as we aren't interested)
$rawLang = explode(';', $lang);
$lang = str_replace("-", "_", $rawLang[0]);
if (in_array($lang . '.mo', $supportedLangs)) {
//Debug::LogEntry('audit', 'Obtained the Language from HTTP_ACCEPT_LANGUAGE [' . $lang . ']', 'TranslationEngine', 'InitLocal');
break;
}
// Set lang as the default
$lang = $default;
}
} else {
$lang = $default;
}
}
// We have the language
//Debug::LogEntry('audit', 'Creating new file streamer for '. $localeDir . '/' . $lang . '.mo', 'TranslationEngine', 'InitLocal');
if (!($stream = new CachedFileReader($localeDir . '/' . $lang . '.mo'))) {
trigger_error('Unable to translate this language');
$transEngine = false;
return;
}
$transEngine = new gettext_reader($stream);
}
示例6: Edit
public function Edit($setting, $value)
{
try {
$dbh = PDOConnect::init();
$sth = $dbh->prepare('UPDATE setting SET value = :value WHERE setting = :setting');
$sth->execute(array('setting' => $setting, 'value' => $value));
return true;
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
if (!$this->IsError()) {
$this->SetError(25000, __('Update of settings failed'));
}
return false;
}
}
示例7: Log
public function Log($displayId, $type, $sizeInBytes)
{
try {
$dbh = PDOConnect::init();
$sth = $dbh->prepare('
INSERT INTO `bandwidth` (Month, Type, DisplayID, Size) VALUES (:month, :type, :displayid, :size)
ON DUPLICATE KEY UPDATE Size = Size + :size2
');
$sth->execute(array('month' => strtotime(date('m') . '/02/' . date('Y') . ' 00:00:00'), 'type' => $type, 'displayid' => $displayId, 'size' => $sizeInBytes, 'size2' => $sizeInBytes));
return true;
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
return false;
}
}
示例8: Delete
/**
* Deletes a Category
* @param <type> $categoryID
* @return <type>
*/
public function Delete($categoryID)
{
try {
$dbh = PDOConnect::init();
$sth = $dbh->prepare('DELETE FROM category WHERE categoryID = :categoryid');
$sth->execute(array('categoryid' => $categoryID));
return true;
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
if (!$this->IsError()) {
$this->SetError(25000, __('Cannot delete this category.'));
}
return false;
}
}
示例9: UnlinkAllFromMedia
/**
* Unlink all media from the provided media item
* @param int $mediaid The media item to unlink from
*/
public function UnlinkAllFromMedia($mediaid)
{
Debug::LogEntry('audit', 'IN', get_class(), __FUNCTION__);
try {
$dbh = PDOConnect::init();
$mediaid = Kit::ValidateParam($mediaid, _INT, false);
$sth = $dbh->prepare('DELETE FROM `lkmediadisplaygroup` WHERE mediaid = :mediaid');
$sth->execute(array('mediaid' => $mediaid));
return true;
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage(), get_class(), __FUNCTION__);
if (!$this->IsError()) {
$this->SetError(1, __('Unknown Error'));
}
return false;
}
}
示例10: Add
public function Add($type, $fromDT, $toDT, $scheduleID, $displayID, $layoutID, $mediaID, $tag)
{
try {
$dbh = PDOConnect::init();
// Lower case the type for consistancy
$type = strtolower($type);
// Prepare a statement
$sth = $dbh->prepare('INSERT INTO stat (Type, statDate, start, end, scheduleID, displayID, layoutID, mediaID, Tag) VALUES (:type, :statdate, :start, :end, :scheduleid, :displayid, :layoutid, :mediaid, :tag)');
// Construct a parameters array to execute
$params = array();
$params['statdate'] = date("Y-m-d H:i:s");
$params['type'] = $type;
$params['start'] = $fromDT;
$params['end'] = $toDT;
$params['scheduleid'] = $scheduleID;
$params['displayid'] = $displayID;
$params['layoutid'] = $layoutID;
// Optional parameters
$params['mediaid'] = null;
$params['tag'] = null;
// We should run different SQL depending on what Type we are
switch ($type) {
case 'media':
$params['mediaid'] = $mediaID;
break;
case 'layout':
// Nothing additional to do
break;
case 'event':
$params['layoutid'] = 0;
$params['tag'] = $tag;
break;
default:
// Nothing to do, just exit
return true;
}
$sth->execute($params);
return true;
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
if (!$this->IsError()) {
$this->SetError(25000, 'Stat Insert Failed.');
}
return false;
}
}
示例11: ChangePassword
/**
* Change a users password
* @param <type> $userId
* @param <type> $oldPassword
* @param <type> $newPassword
* @param <type> $retypedNewPassword
* @return <type>
*/
public function ChangePassword($userId, $oldPassword, $newPassword, $retypedNewPassword, $forceChange = false)
{
try {
$dbh = PDOConnect::init();
// Validate
if ($userId == 0) {
$this->ThrowError(26001, __('User not selected'));
}
// We can force the users password to change without having to provide the old one.
// Is this a potential security hole - we must have validated that we are an admin to get to this point
if (!$forceChange) {
// Get the stored hash
$sth = $dbh->prepare('SELECT UserPassword FROM `user` WHERE UserID = :userid');
$sth->execute(array('userid' => $userId));
if (!($row = $sth->fetch())) {
$this->ThrowError(26000, __('Incorrect Password Provided'));
}
$good_hash = Kit::ValidateParam($row['UserPassword'], _STRING);
// Check the Old Password is correct
if ($this->validate_password($oldPassword, $good_hash) === false) {
$this->ThrowError(26000, __('Incorrect Password Provided'));
}
}
// Check the New Password and Retyped Password match
if ($newPassword != $retypedNewPassword) {
$this->ThrowError(26001, __('New Passwords do not match'));
}
// Check password complexity
if (!$this->TestPasswordAgainstPolicy($newPassword)) {
throw new Exception("Error Processing Request", 1);
}
// Generate a new SALT and Password
$hash = $this->create_hash($newPassword);
$sth = $dbh->prepare('UPDATE `user` SET UserPassword = :hash, CSPRNG = 1 WHERE UserID = :userid');
$sth->execute(array('hash' => $hash, 'userid' => $userId));
return true;
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
if (!$this->IsError()) {
$this->SetError(25000, __('Could not edit Password'));
}
return false;
}
}
示例12: ErrorHandler
public function ErrorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
// timestamp for the error entry
$dt = date("Y-m-d H:i:s (T)");
// define an assoc array of error string
// in reality the only entries we should
// consider are E_WARNING, E_NOTICE, E_USER_ERROR,
// E_USER_WARNING and E_USER_NOTICE
$errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Recoverable Error', 8192 => 'Deprecated Call');
// set of errors for which a var trace will be saved
$user_errors_halt = array(E_USER_ERROR);
$user_errors_inline = array(E_USER_WARNING);
$err = "<errormsg>" . $errmsg . "</errormsg>\n";
$err .= "<errornum>" . $errno . "</errornum>\n";
$err .= "<errortype>" . $errortype[$errno] . "</errortype>\n";
$err .= "<scriptname>" . $filename . "</scriptname>\n";
$err .= "<scriptlinenum>" . $linenum . "</scriptlinenum>\n";
// Log everything
Debug::LogEntry("error", $err);
// Test to see if this is a HALT error or not (we do the same if we are in production or not!)
if (in_array($errno, $user_errors_halt)) {
// We have a halt error
Debug::LogEntry('audit', 'Creating a Response Manager to deal with the HALT Error.');
$response = new ResponseManager();
$response->SetError($errmsg);
$response->Respond();
}
// Is Debug Enabled? (i.e. Development or Support)
if (error_reporting() != 0) {
if (in_array($errno, $user_errors_inline)) {
// This is an inline error - therefore we really want to pop up a message box with this in it - so we know?
// For now we treat this like a halt error? Or do we just try and output some javascript to pop up an error
// surely the javascript idea wont work in ajax?
// or prehaps we add this to the session errormessage so we see it at a later date?
echo $errmsg;
die;
}
}
// Must return false
return false;
}
示例13: __construct
/**
* Module constructor.
* @return
* @param $db Object
*/
function __construct(database $db, user $user)
{
$this->db =& $db;
$this->user =& $user;
$mod = Kit::GetParam('mod', _REQUEST, _WORD);
// If we have the module - create an instance of the module class
// This will only be true when we are displaying the Forms
if ($mod != '') {
require_once "modules/{$mod}.module.php";
// Try to get the layout, region and media id's
$layoutid = Kit::GetParam('layoutid', _REQUEST, _INT);
$regionid = Kit::GetParam('regionid', _REQUEST, _STRING);
$mediaid = Kit::GetParam('mediaid', _REQUEST, _STRING);
$lkid = Kit::GetParam('lkid', _REQUEST, _INT);
Debug::LogEntry('audit', 'Creating new module with MediaID: ' . $mediaid . ' LayoutID: ' . $layoutid . ' and RegionID: ' . $regionid);
if (!($this->module = new $mod($db, $user, $mediaid, $layoutid, $regionid, $lkid))) {
trigger_error($this->module->GetErrorMessage(), E_USER_ERROR);
}
}
return true;
}
示例14: __construct
function __construct(database $db, user $user)
{
$this->db =& $db;
$this->user =& $user;
$this->layoutid = Kit::GetParam('layoutid', _REQUEST, _INT);
//if we have modify selected then we need to get some info
if ($this->layoutid != '') {
// get the permissions
Debug::LogEntry('audit', 'Loading permissions for layoutid ' . $this->layoutid);
$layout = $this->user->LayoutList(NULL, array('layoutId' => $this->layoutid));
if (count($layout) <= 0) {
trigger_error(__('You do not have permissions to view this layout'), E_USER_ERROR);
}
$layout = $layout[0];
$this->layout = $layout['layout'];
$this->description = $layout['description'];
$this->retired = $layout['retired'];
$this->tags = $layout['tags'];
$this->xml = $layout['xml'];
}
}
示例15: add
public function add($tag)
{
try {
$dbh = PDOConnect::init();
// See if it exists
$sth = $dbh->prepare('SELECT * FROM `tag` WHERE tag = :tag');
$sth->execute(array('tag' => $tag));
if ($row = $sth->fetch()) {
return Kit::ValidateParam($row['tagId'], _INT);
}
// Insert if not
$sth = $dbh->prepare('INSERT INTO `tag` (tag) VALUES (:tag)');
$sth->execute(array('tag' => $tag));
return $dbh->lastInsertId();
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage(), get_class(), __FUNCTION__);
if (!$this->IsError()) {
$this->SetError(1, __('Unknown Error'));
}
return false;
}
}