| Server IP : 104.21.17.213 / 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_ReporterController extends System_Controller_Db_Table
{
/**
* Модель для работы контроллера
*
* @var LogSystem_Reporter_Table
*/
protected $_model;
/**
* Documentation
* @author [email protected]
* @return mixed
*/
function init()
{
parent::init();
$this->_select->setIntegrityCheck(false);
$this->_select->from('logsystem_reporter');
}
/**
* Documentation
* @author [email protected]
* @return mixed
*/
function indexAction()
{
}
/**
* Documentation
* @author [email protected]
* @return mixed
*/
function editAction()
{
$paramID = $this->getRequest()->getParam('ID', $this->getRequest()->getParam('id'));
if($paramID){
$objectReporter = $this->_model->find($paramID)->current();
if (!is_object($objectReporter)){
throw new Zend_Exception('Object Reporter with ID = ' . $paramID . ' not found in DB');
}
}else{
$objectReporter = $this->_model->fetchNew();
}
$form = $this->getForm();
if ($this->getRequest()->isPost()) {
$validForm = $form->isValid($_POST);
$confirm = true;
$IP[0] = $form->getValue('IP_0');
$IP[1] = $form->getValue('IP_1');
$IP[2] = $form->getValue('IP_2');
$IP[3] = $form->getValue('IP_3');
if(!is_numeric($IP[0]) || $IP[0] > 255){
$form->IP_0->addError('Incorrect');
$confirm = false;
}
if(!is_numeric($IP[1]) || $IP[1] > 255){
$form->IP_1->addError('Incorrect');
$confirm = false;
}
if(!is_numeric($IP[2]) || $IP[2] > 255){
$form->IP_2->addError('Incorrect');
$confirm = false;
}
if(!is_numeric($IP[3]) || $IP[3] > 255){
$form->IP_3->addError('Incorrect');
$confirm = false;
}
if($confirm && $validForm){
foreach (array_keys($this->_modelMetaData) as $ColumnName){
if ($form->getValue($ColumnName)){
$objectReporter->$ColumnName = $form->getValue($ColumnName);
}
}
$objectReporter->IP = implode('.', $IP);
$objectReporter->save();
$this->addOkMessage('Information of Reporter have been successfully saved');
}else{
$this->addErrorMessage('Some information is incorrect or missing. Please correct your entries and try again.');
}
}else{
$form->setDefaults($objectReporter->toArray());
}
$this->view->reporter = $objectReporter->toArray();
$this->view->form = $form;
}
/**
* Documentation
* @author [email protected]
* @return mixed
*/
function getlistAction()
{
$paramSort = $this->getRequest()->getParam('sort', 'ID');
$this->getRequest()->setParam('results', $this->getRequest()->getParam('results', 5));
parent::getlistAction();
$this->view->sort = $paramSort;
}
/**
* Delete reporter
* @author [email protected]
* @return mixed
*/
function deleteAction()
{
$paramID = $this->getRequest()->getParam('ID', $this->getRequest()->getParam('id'));
if ($paramID === NULL){
throw new Zend_Exception('Reporter ID is not provided');
}
$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('index');
}
}