本文整理汇总了PHP中LogActions类的典型用法代码示例。如果您正苦于以下问题:PHP LogActions类的具体用法?PHP LogActions怎么用?PHP LogActions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LogActions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_valid_cookie
/**
* Used when checking if there is a client or user logged in via cookie.
*
* @see check_for_session
*/
function check_valid_cookie()
{
if (isset($_COOKIE['password']) && isset($_COOKIE['loggedin']) && isset($_COOKIE['userlevel'])) {
$cookie_pass = mysql_real_escape_string($_COOKIE['password']);
$cookie_user = mysql_real_escape_string($_COOKIE['loggedin']);
$cookie_level = mysql_real_escape_string($_COOKIE['userlevel']);
/**
* Compare the cookies to the database information. Level
* and active are compared in case the cookie exists but
* the client has been deactivated, or the user level has
* changed.
*/
$sql_cookie = mysql_query("SELECT * FROM tbl_users WHERE user='{$cookie_user}' AND password='{$cookie_pass}' AND level='{$cookie_level}' AND active = '1'");
$count = mysql_num_rows($sql_cookie);
if ($count > 0) {
if (!isset($_SESSION['loggedin'])) {
/** Set SESSION values */
$_SESSION['loggedin'] = $_COOKIE['loggedin'];
$_SESSION['userlevel'] = $_COOKIE['userlevel'];
$_SESSION['access'] = $_COOKIE['access'];
while ($row = mysql_fetch_array($sql_cookie)) {
$log_id = $row['id'];
$log_name = $row['name'];
}
/** Record the action log */
$new_log_action = new LogActions();
$log_action_args = array('action' => 24, 'owner_id' => $log_id, 'owner_user' => $log_name);
$new_record_action = $new_log_action->log_action_save($log_action_args);
}
return true;
}
}
}
示例2: check_valid_cookie
/**
* Used when checking if there is a client or user logged in via cookie.
*
* @see check_for_session
*/
function check_valid_cookie()
{
global $dbh;
if (isset($_COOKIE['password']) && isset($_COOKIE['loggedin']) && isset($_COOKIE['userlevel'])) {
$statement = $dbh->prepare("SELECT * FROM " . TABLE_USERS . " WHERE user= :cookie_user AND password= :cookie_pass AND level= :cookie_level AND active = '1'");
$statement->execute(array(':cookie_user' => $_COOKIE['loggedin'], ':cookie_pass' => $_COOKIE['password'], ':cookie_level' => $_COOKIE['userlevel']));
$count = $statement->rowCount();
/**
* Compare the cookies to the database information. Level
* and active are compared in case the cookie exists but
* the client has been deactivated, or the user level has
* changed.
*/
if ($count > 0) {
if (!isset($_SESSION['loggedin'])) {
/** Set SESSION values */
$_SESSION['loggedin'] = $_COOKIE['loggedin'];
$_SESSION['userlevel'] = $_COOKIE['userlevel'];
$_SESSION['access'] = $_COOKIE['access'];
$statement->setFetchMode(PDO::FETCH_ASSOC);
while ($row = $statement->fetch()) {
$log_id = $row['id'];
$log_name = $row['name'];
}
/** Record the action log */
$new_log_action = new LogActions();
$log_action_args = array('action' => 24, 'owner_id' => $log_id, 'owner_user' => $log_name);
$new_record_action = $new_log_action->log_action_save($log_action_args);
}
return true;
}
}
}
示例3: Miscellaneous
function Miscellaneous()
{
$this->MakeSafe();
$tmpDCEventLog = new DCEventLog();
$tmpDCEventLog->DataCenterID = $this->DataCenterID;
class_exists('LogActions') ? LogActions::LogThis($this, $tmpDCEventLog) : '';
}
示例4: LogActions
<?php
require_once 'db.inc.php';
require_once 'facilities.inc.php';
if (isset($_POST['refresh'])) {
$log = new LogActions();
foreach ($log as $prop => $val) {
if (isset($_POST[$prop])) {
$log->{$prop} = $_POST[$prop];
}
}
$data_array = array();
if (isset($_POST['ListUnique'])) {
$data_array = $log->ListUnique($_POST['ListUnique']);
}
if (isset($_POST['BuildTable'])) {
echo BuildDataTable($log);
exit;
}
header('Content-Type: application/json');
echo json_encode($data_array);
exit;
}
$subversion = __("Logging View/Export");
$datacenter = new DataCenter();
$dcList = $datacenter->GetDCList();
$templ = new DeviceTemplate();
$dept = new Department();
$dev = new Device();
$log = new LogActions();
function BuildDataTable($log_object)
示例5: RemoveFromTemplatesAndDevices
function RemoveFromTemplatesAndDevices()
{
global $dbh;
$this->AttributeID = intval($this->AttributeID);
$sql = "DELETE FROM fac_DeviceTemplateCustomValue WHERE AttributeID={$this->AttributeID};";
if (!$dbh->query($sql)) {
$info = $dbh->errorInfo();
error_log("RemoveDeviceCustomAttribute::PDO Error: {$info[2]} SQL={$sql}");
return false;
}
$sql = "DELETE FROM fac_DeviceCustomValue WHERE AttributeID={$this->AttributeID};";
if (!$dbh->query($sql)) {
$info = $dbh->errorInfo();
error_log("RemoveDeviceCustomAttribute::PDO Error: {$info[2]} SQL={$sql}");
return false;
}
class_exists('LogActions') ? LogActions::LogThis($this) : '';
return true;
}
示例6: CreateDevice
function CreateDevice()
{
global $dbh;
$this->MakeSafe();
$this->Label = transform($this->Label);
$this->SerialNo = transform($this->SerialNo);
$this->AssetTag = transform($this->AssetTag);
$sql = "INSERT INTO fac_Device SET Label=\"{$this->Label}\", SerialNo=\"{$this->SerialNo}\", AssetTag=\"{$this->AssetTag}\", \n\t\t\t\t\tPrimaryIP=\"{$this->PrimaryIP}\", SNMPCommunity=\"{$this->SNMPCommunity}\", ESX={$this->ESX}, Owner={$this->Owner}, \n\t\t\t\t\tEscalationTimeID={$this->EscalationTimeID}, EscalationID={$this->EscalationID}, PrimaryContact={$this->PrimaryContact}, \n\t\t\t\t\tCabinet={$this->Cabinet}, Position={$this->Position}, Height={$this->Height}, Ports={$this->Ports}, \n\t\t\t\t\tFirstPortNum={$this->FirstPortNum}, TemplateID={$this->TemplateID}, NominalWatts={$this->NominalWatts}, \n\t\t\t\t\tPowerSupplyCount={$this->PowerSupplyCount}, DeviceType=\"{$this->DeviceType}\", ChassisSlots={$this->ChassisSlots}, \n\t\t\t\t\tRearChassisSlots={$this->RearChassisSlots},ParentDevice={$this->ParentDevice}, \n\t\t\t\t\tMfgDate=\"" . date("Y-m-d", strtotime($this->MfgDate)) . "\", \n\t\t\t\t\tInstallDate=\"" . date("Y-m-d", strtotime($this->InstallDate)) . "\", WarrantyCo=\"{$this->WarrantyCo}\", \n\t\t\t\t\tWarrantyExpire=\"" . date("Y-m-d", strtotime($this->WarrantyExpire)) . "\", Notes=\"{$this->Notes}\", \n\t\t\t\t\tReservation={$this->Reservation}, HalfDepth={$this->HalfDepth}, BackSide={$this->BackSide};";
if (!$dbh->exec($sql)) {
$info = $dbh->errorInfo();
error_log("PDO Error: {$info[2]} SQL={$sql}");
return false;
}
$this->DeviceID = $dbh->lastInsertId();
class_exists('LogActions') ? LogActions::LogThis($this) : '';
return $this->DeviceID;
}
示例7: __
}
print "</fieldset>\n";
}
?>
</div><!-- END div.right -->
<div class="table" id="pandn">
<div><div>
<div class="table style">
<?php
// Operational log
// This is an optional block if logging is enabled
if (class_exists('LogActions') && $dev->DeviceID > 0) {
print "\t<div>\n\t\t <div><a>" . __("Operational Log") . "</a></div>\n\t\t <div><div id=\"olog\" class=\"table border\">\n\t\t\t<div><div>" . __("Date") . "</div></div>\n";
// Wrapping the actual log events with a table of their own and a div that we can style
print "\t<div><div><div><div class=\"table\">\n";
foreach (LogActions::GetLog($dev, false) as $logitem) {
if ($logitem->Property == "OMessage") {
print "\t\t\t<div><div>{$logitem->Time}</div><div>{$logitem->UserID}</div><div>{$logitem->NewVal}</div></div>\n";
}
}
// Closing the row, table for the log events, and the stylable div
print "\t</div></div></div></div>\n";
// The input box and button
print "\t\t\t<div><div><button type=\"button\">Add note</button><div><input /></div></div></div>\n";
print "\t\t </div></div>\n\t\t</div>\n";
print "\t\t<!-- Spacer --><div><div> </div><div></div></div><!-- END Spacer -->\n";
// spacer row
}
//HTML content condensed for PHP logic clarity.
// If $pwrCords is null then we're creating a device record. Skip power checking.
if (!is_null($pwrCords) && (isset($_POST['action']) && $_POST['action'] != 'Child' || !isset($_POST['action'])) && !in_array($dev->DeviceType, array('Physical Infrastructure', 'Patch Panel'))) {
示例8: MakeConnection
function MakeConnection()
{
global $dbh;
$this->MakeSafe();
$sql = "INSERT INTO fac_PanelSchedule SET PanelID={$this->PanelID}, \n\t\t\tPolePosition={$this->PolePosition}, NumPoles={$this->NumPoles}, \n\t\t\tLabel=\"{$this->Label}\" ON DUPLICATE KEY UPDATE Label=\"{$this->Label}\", \n\t\t\tNumPoles={$this->NumPoles};";
class_exists('LogActions') ? LogActions::LogThis($this) : '';
return $dbh->query($sql);
}
示例9: logout
function logout()
{
header("Cache-control: private");
unset($_SESSION['loggedin']);
unset($_SESSION['access']);
unset($_SESSION['userlevel']);
session_destroy();
/** If there is a cookie, unset it */
setcookie("loggedin", "", time() - COOKIE_EXP_TIME);
setcookie("password", "", time() - COOKIE_EXP_TIME);
setcookie("access", "", time() - COOKIE_EXP_TIME);
setcookie("userlevel", "", time() - COOKIE_EXP_TIME);
/** Record the action log */
$new_log_action = new LogActions();
$log_action_args = array('action' => 31, 'owner_id' => $logged_id, 'affected_account_name' => $global_name);
$new_record_action = $new_log_action->log_action_save($log_action_args);
header("location:index.php");
}
示例10: UpdatePeriod
function UpdatePeriod()
{
$this->MakeSafe();
$oldperiod = new EscalationTimes();
$oldperiod->EscalationTimeID = $this->EscalationTimeID;
$oldperiod->GetEscalationTime();
$sql = "UPDATE fac_EscalationTimes SET TimePeriod=\"{$this->TimePeriod}\" WHERE \n\t\t\tEscalationTimeID={$this->EscalationTimeID};";
class_exists('LogActions') ? LogActions::LogThis($this, $oldperiod) : '';
return $this->query($sql);
}
示例11: FilesActions
$process_assignment = $this_upload->upload_add_assignment($add_arguments);
/**
* 3- Hide for everyone if checked
*/
if (!empty($file['hideall'])) {
$this_file = new FilesActions();
$hide_file = $this_file->hide_for_everyone($this_file_id);
}
/**
* 4- Add the notifications to the database
*/
if ($send_notifications == true) {
$process_notifications = $this_upload->upload_add_notifications($add_arguments);
}
}
$new_log_action = new LogActions();
$log_action_args = array('action' => $action_log_number, 'owner_id' => $global_id, 'owner_user' => $global_user, 'affected_file' => $process_file['new_file_id'], 'affected_file_name' => $file['name']);
$new_record_action = $new_log_action->log_action_save($log_action_args);
$msg = __('The file has been edited succesfuly.', 'cftp_admin');
echo system_message('ok', $msg);
include ROOT_DIR . '/upload-send-notifications.php';
}
}
}
}
/** Validations OK, show the editor */
?>
<form action="edit-file.php?file_id=<?php
echo $this_file_id;
?>
" method="post" name="edit_file" id="edit_file">
示例12: Search
function Search($num_rec_per_page = 0, $page = 1)
{
$this->MakeSafe();
// This will store all our extended sql
$sqlextend = "";
function findit($prop, $val, &$sql)
{
if ($sql) {
$sql .= " AND {$prop}=\"{$val}\"";
} else {
$sql .= " WHERE {$prop} LIKE \"%{$val}%\"";
}
}
foreach ($this as $prop => $val) {
if ($val && $val != "1969-12-31") {
findit($prop, $val, $sqlextend);
}
}
$sqlextend .= " ORDER BY Time DESC";
// Make sure someone didn't do something crazy with the input
$page = intval($page);
$num_rec_per_page = intval($num_rec_per_page);
if ($page && $num_rec_per_page) {
$start_from = ($page - 1) * $num_rec_per_page;
$sqlextend .= " LIMIT {$start_from}, {$num_rec_per_page}";
}
$sql = "SELECT * FROM fac_GenericLog{$sqlextend};";
$events = array();
foreach ($this->query($sql) as $dbRow) {
$events[] = LogActions::RowToObject($dbRow);
}
return $events;
}
示例13: checkAccess
function checkAccess()
{
global $db, $survey;
switch ($survey->getAccessType()) {
case LOGIN_ANONYMOUS:
return true;
break;
case LOGIN_DIRECT:
return true;
break;
case LOGIN_LOGINCODE:
$logincode = loadvarSurvey('primkey');
$result = $db->selectQuery('select count(*), primkey from ' . Config::dbSurvey() . '_respondents where aes_decrypt(logincode, \'' . Config::loginCodeKey() . '\') = \'' . prepareDatabaseString($logincode) . '\'');
//echo 'select count(*), primkey from ' . Config::dbSurvey() . '_respondents where aes_decrypt(logincode, "' . Config::loginCodeKey() . '") = "' . prepareDatabaseString($logincode) . '"';
$row = $db->getRow($result);
if ($row[0] == 1) {
$_SESSION['PRIMKEY'] = $row['primkey'];
return true;
} else {
$logactions = new LogActions();
$logactions->addAction('', '', "loginwrong", USCIC_SURVEY);
}
break;
}
return false;
}
示例14: removePort
function removePort()
{
/* Remove a single port from a template */
global $dbh;
if (!$this->getport()) {
return false;
}
$sql = "DELETE FROM fac_TemplatePowerPorts WHERE TemplateID={$this->TemplateID} AND PortNumber={$this->PortNumber};";
if (!$dbh->query($sql)) {
//delete failed, wtf
return false;
} else {
class_exists('LogActions') ? LogActions::LogThis($this) : '';
return true;
}
}
示例15: surveyEntry
function surveyEntry()
{
global $engine;
if ($this->checkDateTime() == false) {
/* get whatever the language is (either post or default) and use it */
$l = getSurveyLanguage();
if (file_exists("language/language" . getSurveyLanguagePostFix($l) . ".php")) {
require_once 'language' . getSurveyLanguagePostFix($l) . '.php';
// language
} else {
require_once 'language_en.php';
// fall back on english language file
}
$login = new Login(session_id());
return $login->getClosedScreen();
}
$logactions = new LogActions();
$nosessionactions = $logactions->getNumberOfSurveyActionsBySession($this->phpid, USCIC_SURVEY);
/* no entry yet, then ask for prim_key in login screen */
if ($nosessionactions == 0 || loadvarSurvey(POST_PARAM_NEW_PRIMKEY) == '1') {
//no entry yet: ask for prim_key!
if (loadvarSurvey(POST_PARAM_NEW_PRIMKEY) == '1') {
$logactions->deleteLoggedInSurveySession($this->phpid);
}
/* get whatever the language is (either post or default) and use it */
$l = getSurveyLanguage();
if (file_exists("language/language" . getSurveyLanguagePostFix($l) . ".php")) {
require_once 'language' . getSurveyLanguagePostFix($l) . '.php';
// language
} else {
require_once 'language_en.php';
// fall back on english language file
}
$logactions->addAction('', '', "loginstart", USCIC_SURVEY, 1);
$login = new Login($this->phpid);
return $login->getLoginScreen();
} else {
//entry: is this person logged in?
$loggedin = $logactions->getLoggedInSurveySession($this->phpid);
// gets the last logged in action
/* no prim_key assigned to this sessionid. Assign if given (and check for pwd etc??)! */
if ($loggedin["count"] == 0) {
/* we don't have active session, so take the template we can get */
global $survey;
require_once "display/templates/displayquestion_" . getSurveyTemplate() . ".php";
// we don't have an active session, so fall back to whatever was passed along as language in post OR is the default language
$l = getSurveyLanguage();
if (file_exists("language/language" . getSurveyLanguagePostFix($l) . ".php")) {
//echo 'well done';
require_once 'language' . getSurveyLanguagePostFix($l) . '.php';
// language
} else {
require_once 'language_en.php';
// fall back on english language file
}
$primkey = loadvarSurvey(POST_PARAM_PRIMKEY);
$_SESSION['PRIMKEY'] = $primkey;
if ($primkey != '' && strlen($primkey) < 20) {
// make sure primkey is not encrypted!
//check!!!!!!
$login = new Login($this->phpid);
if ($login->checkAccess()) {
$primkey = $_SESSION['PRIMKEY'];
$logactions->addAction($primkey, '', "loggedin", USCIC_SURVEY, 1);
// pass along primkey to load correct engine!
$engine = loadEngine(getSurvey(), $primkey, $this->phpid, getSurveyVersion(), getSurveySection(getSurvey(), $primkey));
$engine->setFirstForm(true);
return $engine->getNextQuestion();
} else {
// incorrect login..start new session
endSession();
session_start();
session_regenerate_id(true);
$logactions->addAction('', '', "loginempty", USCIC_SURVEY, 1);
$login = new Login(session_id());
global $survey;
return $login->getLoginScreen($survey->getLoginError());
}
} else {
$logactions->addAction('', '', "loginempty", USCIC_SURVEY, 1);
$login = new Login($this->phpid);
global $survey;
if ($survey->getAccessType() == LOGIN_ANONYMOUS) {
return $login->getLoginScreen(Language::messageEnterPrimKey());
} else {
if ($survey->getAccessType() == LOGIN_LOGINCODE) {
return $login->getLoginScreen($survey->getLoginError());
} else {
return $login->getLoginScreen(Language::messageEnterPrimKeyDirectAccess());
}
}
}
} else {
//continue interview! EXTRA CHECK!!!
/* update survey info with what we know from the last session action */
setSurvey($loggedin["suid"]);
/* include survey template now that we know which survey we are in */
global $survey;
require_once "display/templates/displayquestion_" . getSurveyTemplate() . ".php";
/* update interview mode with what we know from the last session action
//.........这里部分代码省略.........