/**
  * Removes a comment.
  *
  * @return  void
  *
  * @since   11.1
  */
 public function status()
 {
     // Check for request forgeries
     JRequest::checkToken() or JRequest::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
     // Get items to remove from the request.
     $cid = JRequest::getVar('cid', array(), '', 'array');
     if (!is_array($cid) || count($cid) < 1) {
         JError::raiseWarning(500, JText::_('COM_COMMENTS_NO_COMMENTS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel('comments');
         $user = JFactory::getUser();
         // Make sure the item ids are integers
         jimport('joomla.utilities.arrayhelper');
         JArrayHelper::toInteger($cid);
         // Remove the items.
         try {
             switch ($this->task) {
                 // Not actually a status change but it remain here to avoid code repetition
                 case 'delete':
                     if (!$user->authorise('edit', 'com_slicomments')) {
                         throw new JException(JText::_('COM_COMMENTS_NO_AUTH'), 403, E_WARNING);
                     }
                     $model->delete($cid);
                     $message = 'COM_COMMENTS_N_COMMENTS_DELETED';
                     break;
                 case 'unflag':
                     if (!$user->authorise('manage', 'com_slicomments')) {
                         throw new JException(JText::_('COM_COMMENTS_NO_AUTH'), 403, E_WARNING);
                     }
                     $model->unflag($cid);
                     $message = 'COM_COMMENTS_N_COMMENTS_UNFLAGGED';
                     break;
                 case 'approve':
                 case 'unapprove':
                 case 'trash':
                 case 'spam':
                     if (!$user->authorise('manage', 'com_slicomments')) {
                         throw new JException(JText::_('COM_COMMENTS_NO_AUTH'), 403, E_WARNING);
                     }
                     $model->status($cid, $this->task);
                     $message = 'COM_COMMENTS_N_COMMENTS_' . strtoupper($this->task);
                     break;
             }
             JFactory::getApplication()->enqueueMessage(JText::plural($message, count($cid)));
         } catch (JException $e) {
             JError::throwError($e);
         }
     }
     $this->setRedirect('index.php?option=com_slicomments');
 }
예제 #2
0
 /**
  * Create a new JException object given the passed arguments
  *
  * @param   integer  $level      The error level - use any of PHP's own error levels for
  *                               this: E_ERROR, E_WARNING, E_NOTICE, E_USER_ERROR,
  *                               E_USER_WARNING, E_USER_NOTICE.
  * @param   string   $code       The application-internal error code for this error
  * @param   string   $msg        The error message, which may also be shown the user if need be.
  * @param   mixed    $info       Optional: Additional error information (usually only
  *                               developer-relevant information that the user should never see,
  *                               like a database DSN).
  * @param   boolean  $backtrace  Add a stack backtrace to the exception.
  *
  * @return  mixed    The JException object
  *
  * @since       11.1
  * @deprecated  12.1  Use PHP Exception
  * @see         JException
  */
 public static function raise($level, $code, $msg, $info = null, $backtrace = false)
 {
     // Deprecation warning.
     JLog::add('JError::raise() is deprecated.', JLog::WARNING, 'deprecated');
     jimport('joomla.error.exception');
     // Build error object
     $exception = new JException($msg, $code, $level, $info, $backtrace);
     return JError::throwError($exception);
 }
예제 #3
0
 /**
  * Create a new JException object given the passed arguments
  *
  * @param   integer  $level     The error level - use any of PHP's own error levels for this: E_ERROR, E_WARNING, E_NOTICE, E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE.
  * @param   string   $code      The application-internal error code for this error
  * @param   string   $msg       The error message, which may also be shown the user if need be.
  * @param   mixed    $info      Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN).
  * @param   boolean  $backtrace
  *
  * @return  mixed    The JException object
  *
  * @deprecated
  * @see     JException
  * @since   11.1
  */
 public static function raise($level, $code, $msg, $info = null, $backtrace = false)
 {
     jimport('joomla.error.exception');
     // Build error object
     $exception = new JException($msg, $code, $level, $info, $backtrace);
     return JError::throwError($exception);
 }
예제 #4
0
파일: common.php 프로젝트: Rikisha/proj
 /**
  * Check the structure of a exported/imported tables
  *
  * @param array - the list to import
  *
  * @return bool
  * @since  1.0
  */
 public function isValid()
 {
     JError::throwError('isValid should be implemented (' . $this->getName() . ')');
 }