| Current Path : /home/sunflowe/www2/j15/administrator/components/com_easycaptcha/controllers/ |
| Current File : /home/sunflowe/www2/j15/administrator/components/com_easycaptcha/controllers/captcha.php |
<?php
/**
* @version $Id: captcha.php 639 2008-03-18 09:23:41Z snipersister $
* @package EasyCaptcha
* @link http://www.easy-joomla.org
* @license GNU/GPL
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.application.component.controller');
/**
* EasyCaptcha Component Controller
*
* @package EasyCaptcha
*/
class EasyCaptchaControllerCaptcha extends EasyCaptchaController
{
function uninstall()
{
JRequest::checkToken() or jexit( 'Invalid Token' );
$model = &$this->getModel( 'captcha' );
$result = $model->uninstall();
$link = 'index.php?option=com_easycaptcha';
JRequest::setVar( 'view', 'easycaptcha' );
JRequest::setVar( 'layout', 'default' );
parent::display();
}
function edit()
{
$view =& $this->getView('captcha', 'html');
$model =& $this->getModel( 'captcha' );
$view->setModel( $model, true );
$view->editForm(null);
}
function install()
{
JRequest::checkToken() or jexit( 'Invalid Token' );
$model = &$this->getModel( 'captcha' );
$result = $model->install();
$link = 'index.php?option=com_easycaptcha';
JRequest::setVar( 'view', 'easycaptcha' );
JRequest::setVar( 'layout', 'upload' );
parent::display();
}
function upload()
{
$view =& $this->getView('captcha', 'html');
$view->uploadForm(null);
}
function publish() {
JRequest::checkToken() or jexit( 'Invalid Token' );
$model = $this->getModel( 'captcha' );
if($model->publish()) {
$msg = JText::_( 'Captcha activated' );
$type = 'message';
}
else
{
$msg = JText::_( 'Error: Could not change publish status' )." - " .$model->getError();
$type = 'error';
}
$this->setRedirect( JRoute::_( 'index.php?option=com_easycaptcha', false ), $msg, $type );
}
function save()
{
JRequest::checkToken() or jexit( 'Invalid Token' );
$post = JRequest::get('post');
$cid = JRequest::getVar( 'cid', array(0), 'post', 'array' );
$post['id'] = (int) $cid[0];
$model = $this->getModel('captcha');
if ($model->store($post)) {
$msg = JText::_( 'Configuration Saved' );
$type = 'message';
} else {
$msg = JText::_( 'Error Saving Configuration:' . $model->getError() );
$type = 'error';
}
$link = 'index.php?option=com_easycaptcha';
$this->setRedirect($link, $msg, $type);
}
function cancel()
{
$msg = JText::_( 'Operation Cancelled' );
$this->setRedirect( 'index.php?option=com_easycaptcha', $msg, 'notice' );
}
}
?>