| 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 : /Old Sites/ees_request/administrator/components/com_printme/controllers/ |
Upload File : |
<?php
/**
* @version 1.5
* @package Printme
* @author Dioscouri Design
* @link http://www.dioscouri.com
* @copyright Copyright (C) 2007 Dioscouri Design. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*/
/** ensure this file is being included by a parent file */
defined( '_JEXEC' ) or die( 'Restricted access' );
class PrintmeControllerConfig extends PrintmeController
{
/**
* constructor
*/
function __construct()
{
parent::__construct();
$this->set('suffix', 'config');
}
/**
* save a record
* @return void
*/
function save()
{
$error = false;
$errorMsg = "";
$model = $this->getModel( $this->get('suffix') );
$config = Printme::getInstance();
$properties = $config->getProperties();
$html_keys = array( 'header_html', 'footer_html' );
foreach (@$properties as $key => $value )
{
unset($row);
$row = $model->getTable( 'config' );
$newvalue = JRequest::getVar( $key );
$value_exists = array_key_exists( $key, $_POST );
if ( $value_exists && !empty($key) )
{
// proceed if newvalue present in request. prevents overwriting for non-existent values.
$row->load( array('config_name'=>$key) );
$row->config_name = $key;
$row->value = $newvalue;
if (in_array($row->config_name, $html_keys))
{
$row->value = JRequest::getVar( $row->config_name, '', 'post', 'string', JREQUEST_ALLOWRAW);;
}
if ( !$row->save() )
{
$error = true;
$errorMsg .= JText::_( "Could not store")." $key :: ".$row->getError()." - ";
}
}
}
if ( !$error )
{
$this->messagetype = 'message';
$this->message = JText::_( 'Saved' );
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger( 'onAfterSave'.$this->get('suffix'), array( $row ) );
}
else
{
$this->messagetype = 'notice';
$this->message = JText::_( 'Save Failed' )." - ".$errorMsg;
}
$redirect = "index.php?option=com_printme";
$task = JRequest::getVar('task');
switch ($task)
{
default:
$redirect .= "&view=".$this->get('suffix');
break;
}
$redirect = JRoute::_( $redirect, false );
$this->setRedirect( $redirect, $this->message, $this->messagetype );
}
}
?>