| 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/LiteMail/Controllers/ |
Upload File : |
<?php
/**
* Documentation
* @author keeper
* @category
* @package
* @subpackage
* @copyright Copyright (c) 2005-2009 ITCrimea Ukraine Inc. (http://www.itcrimea.com)
* @license
*/
class LiteMail_UnsubscribeController extends System_Controller_Db_Table
{
/**
* Logged in User_ID. Value setuped by init() function
* @var int
*/
private $UserID = null;
/**
* Documentation
* @author keeper
* @return mixed
*/
function init()
{
parent::init();
$this->UserID = $this->getRequest()->getParam('User_ID');
}
/**
* Documentation
* @author keeper
* @return mixed
*/
function indexAction()
{
}
/**
* Documentation
* @author keeper
* @return mixed
*/
function getAction()
{
throw new Zend_Exception('Under construction', 403);
}
/**
* Documentation
* @author
* @return mixed
*/
function getlistAction()
{
$this->_select->setIntegrityCheck(false);
$this->_selectCount->setIntegrityCheck(false);
//$this->getRequest()->setParam('results', 25);
$this->_select->joinLeft('users', 'mails_unsubscribes.User_ID = users.ID', array('Firstname'=>'Name', 'Lastname'=>'LastName'));
//$this->_select->where('User_ID = ?', $this->UserID);
//$this->_selectCount->where('User_ID = ?', $this->UserID);
$this->_select->order('mails_unsubscribes.Date DESC');
parent::getlistAction();
}
/**
* Documentation
* @author keeper
* @return mixed
*/
function addAction()
{
$objectUnsub = $this->_model->fetchNew();
$objectUnsub->Email = $this->getRequest()->getParam('Email');
$objectUnsub->Notes = $this->getRequest()->getParam('Notes');
$paramAgreement = intval($this->getRequest()->getParam('Agreement'));
if ($this->getRequest()->isPost()) {
$validator = new Zend_Validate_EmailAddress();
if (!$validator->isValid($objectUnsub->Email)) {
$errors = $validator->getMessages();
if ($errors && is_array($errors) && count($errors)) {
foreach ($errors as $error) $this->addErrorMessage($error);
} else {
$this->addErrorMessage('Email address is not valid...');
}
}
$objectExistUnsub = $this->_model->fetchRow( $this->_model->select()->where('Email = ?', $objectUnsub->Email) );
if (is_object($objectExistUnsub) && $objectExistUnsub->ID) {
$this->addErrorMessage($objectUnsub->Email . ' already exists in unsubscribes list');
}
if (!$paramAgreement) {
$this->addErrorMessage('Are you sure you want to unsubscribe prospects with same email address? If Yes - please, choose corresponding checkbox...');
}
if (!$this->isErrorMessages()) {
$tableUser = new User_Table();
$objectUser = $tableUser->fetchRow( $tableUser->select()->where('Email = ?', $objectUnsub->Email) );
if (is_object($objectUser) && $objectUser->ID) {
$objectUnsub->User_ID = $objectUser->ID;
}
$objectUnsub->Active = 1;
$objectUnsub->Creator_ID = $this->UserID;
$objectUnsub->save();
$this->addOkMessage($objectUnsub->Email . ' will not receive any more mails');
$this->view->EmailAdded = 1;
}
}
$this->view->form = $objectUnsub->toArray();
$this->view->Agreement = $paramAgreement;
}
/**
* Documentation
* @author keeper
* @return mixed
*/
function editAction()
{
throw new Zend_Exception('Under construction', 403);
}
/**
* Documentation
* @author keeper
* @return mixed
*/
function deleteAction()
{
//throw new Zend_Exception('Under construction', 403);
$paramArrayID = $this->getRequest()->getParam('id');
if (!is_array($paramArrayID) && $paramArrayID !== NULL) {
$paramArrayID = array($paramArrayID);
}
if (is_array($paramArrayID)){
foreach ($paramArrayID as $ID){
$objectUnsub = $this->_model->find($ID)->current();
if (is_object($objectUnsub)){
$objectUnsub->delete();
}
}
}
}
}