Skip to content

Commit

Permalink
Cosmetical changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fastslack committed Mar 7, 2012
1 parent 59a5d1b commit 5345685
Showing 1 changed file with 29 additions and 57 deletions.
86 changes: 29 additions & 57 deletions admin/controllers/sites.php
Expand Up @@ -7,8 +7,6 @@
* @url http://www.matware.com.ar/
* @license GNU/GPL
*/


// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();

Expand All @@ -24,46 +22,21 @@ function __construct()

require_once(JPATH_COMPONENT.DS.'tables'.DS.'sites.php');
require_once(JPATH_COMPONENT.DS.'tables'.DS.'extensions.php');

// Register Extra tasks
//$this->registerTask( 'add' , 'edit' );
}

function display() {

JRequest::setVar( 'view', 'sites' );
function display() {
JRequest::setVar( 'view', 'sites' );

//echo $task;

parent::display();
parent::display();
}

function add() {

JRequest::setVar( 'view', 'sites' );
JRequest::setVar( 'layout', 'form' );
JRequest::setVar( 'view', 'sites' );
JRequest::setVar( 'layout', 'form' );

parent::display();
parent::display();
}

function apply() {

$model = $this->getModel('config');

$data = JRequest::get( 'post' );

if ($model->saveConfig($data)) {
$msg = JText::_( 'Configuration Applied!' );
} else {
$msg = JText::_( 'Error Applying Configuration' );
}

JRequest::setVar( 'view', 'config' );

$link = 'index.php?option=com_mtwmultiple&controller=config';
$this->setRedirect($link, $msg);
}

/**
* save a record (and redirect to main page)
* @return void
Expand Down Expand Up @@ -129,31 +102,30 @@ function cancel()
*/
function remove()
{
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );

//$this->setRedirect( 'index.php?option=com_mtwmultiple&controller=sites' );

// Initialize variables
$db =& JFactory::getDBO();
$hid = JRequest::getVar( 'cid', array(), 'post', 'array' );
$n = count( $hid );

$model = $this->getModel('sites');
for($count = 0; $count < $n; $count++) {
$element = $hid[$count];
$model->removeSiteDB($hid[$count]);
$model->removeSiteFiles($hid[$count]);
$query = 'DELETE FROM #__mtwmultiple_sites'
. ' WHERE id = ' . implode( ' OR id = ', $hid );

$db->setQuery( $query );
if (!$db->query()) {
JError::raiseWarning( 500, $db->getError() );
}
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );

$this->setRedirect( 'index.php?option=com_mtwmultiple&controller=sites' );

// Initialize variables
$db =& JFactory::getDBO();
$hid = JRequest::getVar( 'cid', array(), 'post', 'array' );
$n = count( $hid );

$model = $this->getModel('sites');
for($count = 0; $count < $n; $count++) {
$element = $hid[$count];
$model->removeSiteDB($hid[$count]);
$model->removeSiteFiles($hid[$count]);
$query = 'DELETE FROM #__mtwmultiple_sites'
. ' WHERE id = ' . implode( ' OR id = ', $hid );

$db->setQuery( $query );
if (!$db->query()) {
JError::raiseWarning( 500, $db->getError() );
}
}

$this->setMessage( JText::sprintf( 'Items removed', $n ) );
$this->setMessage( JText::sprintf( 'Items removed', $n ) );
}
}
?>

0 comments on commit 5345685

Please sign in to comment.