<?php

/**
 * @license		GNU General Public License, see LICENSE.php
 */
// No direct access.
defined('_JEXEC') or die;

class SPStgSrvControllerLog extends JControllerLegacy {

    public function __construct($config = array()) {
        parent::__construct($config);
    }

    public function delete() {
        // Check for request forgeries
        JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

        $eid = JFactory::getApplication()->input->get('cid', array(), '', 'array');
        $model = $this->getModel('log');

        JArrayHelper::toInteger($eid, array());
        $result = $model->delete($eid);
        $this->setRedirect(JRoute::_('index.php?option=com_spstgsrv&view=log', false));
    }
    
    public function mass_delete() {
        // Check for request forgeries
        JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

        $model = $this->getModel('log');
        $model->mass_delete();
        $this->setRedirect(JRoute::_('index.php?option=com_spstgsrv&view=log', false));
    }

    public function export() {
        // Check for request forgeries
        JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
        
        $model = $this->getModel('Log', 'SPStgSrvModel');
        $model->export();                
        
        $this->setRedirect(JRoute::_('index.php?option=com_spstgsrv&view=log', false));        
    }

    public function show_manifest() {
                jimport('spcyend.utilities.remoteupdate');
                $remoteupdate = CYENDModelRemoteUpdate::getInstance('RemoteUpdate', 'CYENDModel');
                $msg = $remoteupdate->getManifest();
                $this->setRedirect('index.php?option=com_spstgsrv&view=log', $msg);
        }
}
