| Server IP : 172.67.178.83 / Your IP : 216.73.217.141 Web Server : Apache System : Linux hosting01.arsenalhost.com 4.18.0-425.13.1.lve.el8.x86_64 #1 SMP Mon Feb 27 15:23:24 EST 2023 x86_64 User : corbizre ( 1013) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/corbizre/gotofindhomes.com/components/LogSystem/Controllers/ |
Upload File : |
<?php
/**
* Documentation
* @author [email protected]
* @category
* @package
* @subpackage
* @copyright Copyright (c) 2005-2009 ITCrimea Ukraine Inc. (http://www.itcrimea.com)
* @license
*/
class LogSystem_IndexController extends System_Controller_Db_Table
{
/**
* Documentation
* @author [email protected]
* @return mixed
*/
function init()
{
$helperContextSwitch = Zend_Controller_Action_HelperBroker::getStaticHelper('ContextSwitch');
$helperContextSwitch->addActionContext('getreporter', array('xml', 'json', 'table', 'options', 'ul'));
parent::init();
$this->_select->setIntegrityCheck(false);
//$this->_select->from('logsystem');
}
/**
* Documentation
* @author [email protected]
* @return mixed
*/
function indexAction()
{
}
/**
* Documentation
* @author [email protected]
* @return mixed
*/
function addAction()
{
$objectReporter = LogSystem_Reporter::getReporter();
if(is_object($objectReporter)) {
$this->getRequest()->setParam('Log_Reporter', $objectReporter->Name);
$this->getRequest()->setParam('Log_Subsystem_ID', $objectReporter->ID);
$message = $this->localaddAction();
} else {
$message = 'FAILURE: Access Denied.';
}
$this->view->message = $message;
$this->_helper->layout->disableLayout();
}
/**
* Documentation
* @author [email protected]
* @return mixed
*/
function getlistAction()
{
$paramDateStart = $this->getRequest()->getParam('DateStart', 0);
$paramDateEnd = $this->getRequest()->getParam('DateEnd', 0);
$paramReporter = $this->getRequest()->getParam('Reporter', 0);
$paramStatus = (int)$this->getRequest()->getParam('Status', 0);
$this->getRequest()->setParam('sort', $this->getRequest()->getParam('sort', 'Date') );
$this->getRequest()->setParam('dir', $this->getRequest()->getParam('dir', 'desc') );
if($paramDateStart) {
$paramDateStart = date('Y-m-d', strtotime($paramDateStart));
$this->_selectCount->where('Date >= ?', $paramDateStart.' 00:00:00');
$this->_select->where('Date >= ?', $paramDateStart.' 00:00:00');
}
if($paramDateEnd) {
$paramDateEnd = date('Y-m-d', strtotime($paramDateEnd));
$this->_selectCount->where('Date <= ?', $paramDateEnd.' 23:59:00');
$this->_select->where('Date <= ?', $paramDateEnd.' 23:59:00');
}
if($paramReporter) {
$this->_selectCount->where('Reporter = ?', $paramReporter);
$this->_select->where('Reporter = ?', $paramReporter);
}
$this->_selectCount->where('Status = ?', $paramStatus);
$this->_select->where('Status = ?', $paramStatus);
$this->getRequest()->setParam('results', $this->getRequest()->getParam('results', 25));
parent::getlistAction();
$this->view->DateStart = ($paramDateStart == '') ? 0 : $paramDateStart;
$this->view->DateEnd = ($paramDateEnd == '') ? 0 : $paramDateEnd;
$this->view->Status = $paramStatus;
$this->view->Reporter = $paramReporter;
}
/**
* delete one log or several logs (requested param 'id' can be string or array)
* @author [email protected]
* @return mixed
*/
function deleteAction()
{
$paramID = $this->getRequest()->getParam('ID', $this->getRequest()->getParam('id'));
if ($paramID === NULL){
throw new Zend_Exception('Log ID is not provided');
}
if (!is_array($paramID)) {
$arrayID = array($paramID);
} else {
$arrayID = $paramID;
}
foreach ($arrayID as $paramID) {
$object = $this->_model->find($paramID)->current();
if (is_object($object)){
$object->delete();
} else {
//throw new Zend_Exception('Trying to delete non existing object');
}
}
$this->_forward('getlist');
}
/**
* Documentation
* @author [email protected]
* @return mixed
*/
function getreporterAction()
{
$paramReporterList = array();
$this->_select->where('Reporter != ""');
$this->_select->group('Reporter');
$objectRows = $this->_model->fetchAll($this->_select);
if(is_object($objectRows)){
$paramReporterList = $objectRows->toArray();
}
$this->view->rows = $paramReporterList;
$this->view->selected = $this->getRequest()->getParam('selected');
}
/**
* Documentation
* @author [email protected]
* @return mixed
*/
function changestatusAction()
{
$paramField = 'Status';//$this->getRequest()->getParam('field');
$paramValue = $this->getRequest()->getParam('value');
$paramID = $this->getRequest()->getParam('id');
$this->getRequest()->setParam('format', 'table');
$this->_helper->actionStack('getlist', 'index', 'log-system', $this->getRequest()->getParams());
$this->_helper->actionStack('change', 'index', 'log-system', array('field' => $paramField,
'value' => $paramValue,
'ID' => $paramID,
));
}
/**
* Documentation
* @author [email protected]
* @return mixed
*/
function localaddAction()
{
//$this->_helper->layout->disableLayout();
$Reporter = $this->getRequest()->getParam('Log_Reporter');
$System = $this->getRequest()->getParam('Log_System');
$Subsystem = $this->getRequest()->getParam('Log_Subsystem');
$Subsystem_ID = $this->getRequest()->getParam('Log_Subsystem_ID');
$Severity = (int)$this->getRequest()->getParam('Log_Severity');
$Message = $this->getRequest()->getParam('Log_Message');
$Details = $this->getRequest()->getParam('Log_Details');
if (!$System) {
return 'WARNING: Parameter Log_System undefined.';
}
if(!$Subsystem){
return 'WARNING: Parameter Log_Subsystem undefined.';
}
if(!$Message){
return 'WARNING: Parameter Log_Message undefined.';
}
if (!$Severity) {
$Severity = LogSystem::SEVERITY_INFO;
}
LogSystem::addLog($Reporter,$System,$Subsystem,$Subsystem_ID,$Severity,$Message,$Details);
return 'OK';
}
function clearAction()
{
$Limit = intval(Settings::get('LogTableMaxLength', 100000));
if ($Limit < 1) exit();
$this->_select->reset();
$this->_select->
from('logsystem', array('ID'=>'ID'))->
order('ID DESC')->limit(1,$Limit-1);
$obj = $this->_model->fetchAll($this->_select)->current();
if (is_object($obj)) {
$ID = $obj->ID;
if ($ID) {
$this->_model->delete('ID < '.$ID);
}
}
exit();
}
}