english/administrator/components/com_users/controllers/users.php
/**
	 * Method to run batch opterations.
	 *
	 * @return	void
	 * @since	1.6
	 */
Method to run batch opterations.
Method to run batch opterations .
function batch()
	{
		JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
		$app	= JFactory::getApplication();
		$model	= $this->getModel('User');
		$vars	= JRequest::getVar('batch', array(), 'post', 'array');
		$cid	= JRequest::getVar('cid', array(), 'post', 'array');
		$cid = array_unique($cid);
		JArrayHelper::toInteger($cid);
		if (array_search(0, $cid, true)) {
			unset($cid[array_search(0, $cid, true)]);
		}
		if (!$model->batch($vars, $cid)) {
			$message = JText::sprintf('COM_USERS_USER_BATCH_FAILED', $model->getError());
			$this->setRedirect('index.php?option=com_users&view=users', $message, 'error');
			return false;
		}
		$message = JText::_('COM_USERS_USER_BATCH_SUCCESS');
		$this->setRedirect('index.php?option=com_users&view=users', $message);
		return true;
	}
function batch ( ) { JRequest :: checkToken ( ) or jexit ( JText :: _ ( 'JINVALID_TOKEN' ) ) ; $ app = JFactory :: getApplication ( ) ; $ model = $ this -> getModel ( 'User' ) ; $ vars = JRequest :: getVar ( 'batch' , array ( ) , 'post' , 'array' ) ; $ cid = JRequest :: getVar ( 'cid' , array ( ) , 'post' , 'array' ) ; $ cid = array_unique ( $ cid ) ; JArrayHelper :: toInteger ( $ cid ) ; if ( array_search ( 0 , $ cid , true ) ) { unset ( $ cid [ array_search ( 0 , $ cid , true ) ] ) ; } if ( ! $ model -> batch ( $ vars , $ cid ) ) { $ message = JText :: sprintf ( 'COM_USERS_USER_BATCH_FAILED' , $ model -> getError ( ) ) ; $ this -> setRedirect ( 'index.php?option=com_users&view=users' , $ message , 'error' ) ; return false ; } $ message = JText :: _ ( 'COM_USERS_USER_BATCH_SUCCESS' ) ; $ this -> setRedirect ( 'index.php?option=com_users&view=users' , $ message ) ; return true ; }
Method to run batch opterations.
Method to run batch opterations .
// Check for request forgeries. // Initialise variables. // Sanitize user ids. // Remove any values of zero. // Attempt to run the batch operation. // Batch operation failed, go back to the users list and display a notice.