?
Path : /home/admin/public_html/old/administrator/components/com_xijc/controllers/ |
Current File : /home/admin/public_html/old/administrator/components/com_xijc/controllers/manager.php |
<?php // no direct access defined('_JEXEC') or die('Restricted access'); class XiJCControllerManager extends JController { function __construct($config = array()) { parent::__construct($config); } function display() { parent::display(); } function publish() { global $mainframe; // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); // Initialize variables $ids = JRequest::getVar( 'cid', array(0), 'post', 'array' ); $total = count( $ids ); if (empty( $ids )) { return JError::raiseWarning( 500, JText::_( 'NO ITEMS SELECTED' ) ); } $mModel = XiJCFactory::getModel( 'manager' ); $counter = 0; /* * Get the list of all components with id and option pair. */ $helper = XiJCPluginhandlerLibrary::getObject(0); $componentList = $helper->getComponentsIdWithName(); foreach($ids as $id) { $option = $componentList[$id]; $success = $mModel->updateEnable($option,1); if($success) $counter++; } $msg = sprintf(JText::_('ITEMS ENABLED'),$counter); $link = JRoute::_('index.php?option=com_xijc&view=manager', false); $mainframe->redirect($link, $msg); } function unpublish() { global $mainframe; // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); // Initialize variables $ids = JRequest::getVar( 'cid', array(0), 'post', 'array' ); $total = count( $ids ); if (empty( $ids )) { return JError::raiseWarning( 500, JText::_( 'NO ITEMS SELECTED' ) ); } $mModel = XiJCFactory::getModel( 'manager' ); $counter = 0; /* * Get the list of all components with id and option pair. */ $helper = XiJCPluginhandlerLibrary::getObject(0); $componentList = $helper->getComponentsIdWithName(); foreach($ids as $id) { $option = $componentList[$id]; $success = $mModel->updateEnable($option,0); if($success) $counter++; } $msg = sprintf(JText::_('ITEMS DISABLED'),$counter); $link = JRoute::_('index.php?option=com_xijc&view=manager', false); $mainframe->redirect($link, $msg); } }