| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/icd/administrator/components/com_jlogonalert/ |
Upload File : |
<?php
/*
* @package Joomla 1.5
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component jLogonAlert, version 1.3, 2010-05-11
* @copyright Copyright (C) Carlo Di Giuseppe - www.applejuice.it
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die ('Restricted Access');
JToolBarHelper::title (JText::_('jLogonAlert 1.3 - Configuration'),'generic.png');
switch($task)
{
case 'edit':
case 'add':
JToolBarHelper::save();
JToolBarHelper::apply();
JToolBarHelper::cancel();
break;
default:
JToolBarHelper::editList();
JToolBarHelper::deleteList('Confirm Delete ?');
JToolBarHelper::addNew();
break;
}
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
jimport('joomla.application.component.controller');
class LogonalertController extends JController
{
function __construct($config = array())
{
parent::__construct($config);
$this->registerTask('apply','save');
}
function add()
{
global $option;
$db =& JFactory::getDBO();
$db->setQuery('SELECT id, name from #__users where id not in (select id_utente from #__ajlaemails)');
$utente = $db->loadObjectList();
if (count($utente) == 0)
{
$this->setRedirect('index.php?option='.$option, JText::_('No more Joomla Users to add') );
}
else
{
JRequest::setVar('view','addemails');
$this->display();
}
}
function publish()
{
global $option;
$row =& JTable::getInstance('Alertemail','Table');
$cid = JRequest::getVar('cid',array(0),'','array');
$id = $cid[0];
if (!$row->publish($cid))
JError::raiseError(500,$row->getError());
$this->setRedirect('index.php?option='.$option);
}
function unpublish()
{
global $option;
$row =& JTable::getInstance('Alertemail','Table');
$cid = JRequest::getVar('cid',array(0),'','array');
$id = $cid[0];
if (!$row->publish($cid,0))
JError::raiseError(500,$row->getError());
$this->setRedirect('index.php?option='.$option);
}
function edit()
{
JRequest::setVar('view','addemails');
$this->display();
}
function save()
{
jimport('joomla.mail.helper');
JRequest::checkToken() or jexit('Invalid Token');
global $option;
global $mainframe;
$row =& JTable::getInstance('Alertemail','Table');
if (!$row->bind(JRequest::get('post')))
{
JError::raiseError(500,$row->getError());
}
$row->avviso_backend = JRequest::getVar('avviso_backend','','post','string',JREQUEST_ALLOWRAW);
$row->avviso_frontend = JRequest::getVar('avviso_frontend','','post','string',JREQUEST_ALLOWRAW);
if (!$row->data_creazione)
{
$row->data_creazione = date('Y-m-d H:i:s');
}
$e = JRequest::getVar('utente','','post','string',JREQUEST_ALLOWRAW);
$row->id_utente = $e;
if ($this->isExist($e) && $row->id == 0)
{
$this->setRedirect('index.php?option='.$option.'&task=edit&cid[]='.$row->id,'email '.$e. ' '. JText::_('already exist'));
}
else if ($row->id > 0 && $this->isExistEdit($e,$row->id))
{
$this->setRedirect('index.php?option='.$option.'&task=edit&cid[]='.$row->id,'email '.$e.' '. JText::_('already exist'));
}
else
{
if (!$row->check())
JError::raiseError(500,'Please specify a email');
$row->store();
if ($this->getTask() == 'apply')
$this->setRedirect('index.php?option='.$option.'&task=edit&cid[]='.$row->id,JText::_('successfully saved'));
else
$this->setRedirect('index.php?option='.$option,JText::_('successfully saved'));
}
}
function isExist($e)
{
// Get a database object
$db =& JFactory::getDBO();
$query = "SELECT email FROM #__ajlaemails WHERE email = '".$e."'";
$db->setQuery( $query );
$result = $db->loadObject();
return count($result) > 0;
}
function isExistEdit($e, $id)
{
// Get a database object
$db =& JFactory::getDBO();
$query = "SELECT email FROM #__ajlaemails WHERE email = '".$e."' AND ID <> '".$id."'";
$db->setQuery( $query );
$result = $db->loadObject();
return count($result) > 0;
}
function remove()
{
//JRequest::checkToken() or jexit('Invalid Token');
global $option;
$cid = JRequest::getVar('cid',array(0));
$row =& JTable::getInstance('Alertemail','Table');
foreach($cid as $id)
{
$id = (int)$id;
if (!$row->delete($id))
JError::raiseError(500,$row->getError());
}
$this->setRedirect('index.php?option='.$option,JText::_('deleted'));
}
function display()
{
$view = JRequest::getVar('view');
if (!$view)
{
JRequest::setVar('view','all');
}
parent::display();
}
}
$controller = new LogonalertController();
$controller->execute($task);
$controller->redirect();