예제 #1
0
 public function publish(&$pks, $value = 1)
 {
     $table = $this->getTable('Comment', 'JUDownloadTable');
     $new_pks = array();
     while (!empty($pks)) {
         $pk = array_shift($pks);
         $new_pks[] = $pk;
         $table->reset();
         if (!$table->load($pk)) {
             if ($error = $table->getError()) {
                 $this->setError($error);
             }
             return false;
         }
         $db = $this->getDbo();
         $query = $db->getQuery(true);
         $query->clear();
         $query->select('id');
         $query->from('#__judownload_comments');
         $query->where('lft > ' . (int) $table->lft);
         $query->where('rgt < ' . (int) $table->rgt);
         $db->setQuery($query);
         $childIds = $db->loadColumn();
         foreach ($childIds as $childId) {
             if (!in_array($childId, $pks)) {
                 array_push($pks, $childId);
             }
         }
         $commentId = $pk;
         if (!parent::publish($pk, $value)) {
             return false;
         }
         JUDownloadFrontHelperMail::sendEmailByEvent('comment.editstate', $commentId);
         $logData = array('user_id' => $table->user_id, 'event' => 'comment.editstate', 'item_id' => $commentId, 'doc_id' => $table->doc_id, 'value' => $value, 'reference' => '');
         JUDownloadFrontHelperLog::addLog($logData);
     }
     $pks = $new_pks;
     return true;
 }
예제 #2
0
 /**
  * Method to change the published state of one or more records.
  *
  * @param   array    $pks    A list of the primary keys to change.
  * @param   integer  $value  The value of the published state.
  *
  * @return  boolean  True on success.
  *
  * @since   2.5
  */
 function publish(&$pks, $value = 1)
 {
     if (parent::publish($pks, $value)) {
         // Initialise variables.
         $dispatcher = JDispatcher::getInstance();
         $extension = JRequest::getCmd('extension');
         // Include the content plugins for the change of category state event.
         JPluginHelper::importPlugin('content');
         // Trigger the onCategoryChangeState event.
         $dispatcher->trigger('onCategoryChangeState', array($extension, $pks, $value));
         return true;
     }
 }
예제 #3
0
 /**
  * Checks that the current user matches the message recipient and calls the parent publish method
  *
  * @param   array    &$pks   A list of the primary keys to change.
  * @param   integer  $value  The value of the published state.
  *
  * @return  boolean  True on success.
  *
  * @since   3.1
  */
 public function publish(&$pks, $value = 1)
 {
     $user = JFactory::getUser();
     $table = $this->getTable();
     $pks = (array) $pks;
     // Check that the recipient matches the current user
     foreach ($pks as $i => $pk) {
         $table->reset();
         if ($table->load($pk)) {
             if ($table->user_id_to != $user->id) {
                 // Prune items that you can't change.
                 unset($pks[$i]);
                 JLog::add(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), JLog::WARNING, 'jerror');
                 return false;
             }
         }
     }
     return parent::publish($pks, $value);
 }
예제 #4
0
파일: item.php 프로젝트: akksi/jcg
 /**
  * Method to change the published state of one or more records.
  *
  * @param	array	$pks	A list of the primary keys to change.
  * @param	int		$value	The value of the published state.
  *
  * @return	boolean	True on success.
  * @since	1.6
  */
 function publish(&$pks, $value = 1)
 {
     // Initialise variables.
     $table = $this->getTable();
     $pks = (array) $pks;
     // Default menu item existence checks.
     if ($value != 1) {
         foreach ($pks as $i => $pk) {
             if ($table->load($pk) && $table->home && $table->language == '*') {
                 // Prune items that you can't change.
                 JError::raiseWarning(403, JText::_('JLIB_DATABASE_ERROR_MENU_UNPUBLISH_DEFAULT_HOME'));
                 unset($pks[$i]);
                 break;
             }
         }
     }
     // Clean the cache
     $this->cleanCache();
     return parent::publish($pks, $value);
 }
예제 #5
0
파일: newsfeed.php 프로젝트: ronildo/minima
	/**
	 * Method to change the published state of one or more records.
	 *
	 * @param	array	$pks	A list of the primary keys to change.
	 * @param	int		$value	The value of the published state.
	 *
	 * @return	boolean	True on success.
	 * @since	1.6
	 */
	function publish(&$pks, $value = 1)
	{
		$result = parent::publish($pks, $value);
		
		// Clean extra cache for newsfeeds
		$this->cleanCache('feed_parser');

		return $result;
	}
 /**
  * Method to change the published state of one or more records.
  *
  * @param   array    &$pks   A list of the primary keys to change.
  * @param   integer  $value  The value of the published state.
  *
  * @return  boolean  True on success.
  *
  * @since   12.2
  */
 public function publish(&$pks, $value = 1)
 {
     if (!parent::publish($pks, $value)) {
         return false;
     }
     return true;
 }
예제 #7
0
 public function publish(&$pks, $value = 1)
 {
     $session = JFactory::getSession();
     $fields = array('state', 'published_once');
     $pk_key = true;
     $olddata = $this->getItems($pks, $fields, $pk_key);
     $publish = parent::publish($pks, $value);
     if (!$publish) {
         return false;
     }
     $fields = '*';
     $newdata = $this->getItemsExtended($pks, $fields, $pk_key);
     //igualando os itens ja que a diferenca consiste somente em 'state' e 'published_once'
     foreach ($olddata as $k => $old_item) {
         $copy = $newdata[$k];
         $copy->state = $old_item->state;
         $copy->published_once = $old_item->published_once;
         $old_item = (array) $copy;
         $new_item = (array) $newdata[$k];
         $new_item['state'] = $value;
         $compromissoAlterado = $this->isCompromissoAlterado($new_item, $old_item);
         if ($compromissoAlterado) {
             $this->updateAgendaAlteradaInfo($new_item);
         }
         if (!$this->updateCompromissosDirigentes($new_item, $compromissoAlterado, $old_item)) {
             $session->set('msg_ao_menos_um_sobreposto', 0);
             $session->set('msg_sobreposicoes_na_publicacao', 0);
             return false;
         }
     }
     $session->set('msg_ao_menos_um_sobreposto', 0);
     $session->set('msg_sobreposicoes_na_publicacao', 0);
     return true;
 }
예제 #8
0
 /**
  * Method to publish a recordset
  * @param array $pks array of id's
  * @param boolean $value wether to publish or unpublish
  * @return type
  */
 public function publish(&$pks, $value = 1)
 {
     $pks = (array) $pks;
     // Look for restrictions.
     foreach ($pks as $i => $pk) {
         $restrictions = $this->getRestrictions($pk);
         if (is_array($restrictions) && count($restrictions) > 0) {
             //Give an error message
             JFactory::getApplication()->enqueueMessage(JText::sprintf("COM_VISFORMS_FIELD_HAS_RESTICTIONS", $pk), 'warning');
             //unset the pk
             unset($pks[$i]);
         }
     }
     return parent::publish($pks, $value);
 }
예제 #9
0
 /**
  * Method to change the published state of one or more records.
  *
  * @param	array	$pks	A list of the primary keys to change.
  * @param	int		$value	The value of the published state.
  *
  * @return	boolean	True on success.
  * @since	1.6
  */
 function publish(&$pks, $value = 1)
 {
     // Initialise variables.
     $table = $this->getTable();
     $pks = (array) $pks;
     // Clean the cache
     $this->cleanCache();
     return parent::publish($pks, $value);
 }
예제 #10
0
 /**
  * Checks that the current user matches the message recipient and calls the parent publish method
  *
  * @param   array    &$pks   A list of the primary keys to change.
  * @param   integer  $value  The value of the published state.
  *
  * @return  boolean  True on success.
  *
  * @since   3.1
  */
 public function publish(&$pks, $value = 1)
 {
     $table = $this->getTable();
     $pks = (array) $pks;
     // Check that the recipient matches the current user
     foreach ($pks as $i => $pk) {
         $table->reset();
         if ($table->load($pk)) {
             if ($table->user_id_to !== \User::get('id')) {
                 // Prune items that you can't change.
                 unset($pks[$i]);
                 \Notify::warning(\Lang::txt('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
                 return false;
             }
         }
     }
     return parent::publish($pks, $value);
 }
예제 #11
0
파일: comment.php 프로젝트: Tommar/remate
 public function publish(&$pks, $value = 1)
 {
     if (parent::publish($pks, $value)) {
         $this->updateCounter();
         return true;
     } else {
         return false;
     }
 }
예제 #12
0
파일: module.php 프로젝트: ForAEdesWeb/AEW3
 public function publish(&$pks, $value = 1)
 {
     $table = $this->getTable();
     $pks = (array) $pks;
     // Clean the cache
     $this->cleanCache();
     // Ensure that previous checks doesn't empty the array
     if (empty($pks)) {
         return true;
     }
     return parent::publish($pks, $value);
 }
예제 #13
0
 /**
  * Method to change the published state of one or more records.
  *
  * @param   array    $pks    A list of the primary keys to change.
  * @param   integer  $value  The value of the published state.
  *
  * @return  boolean  True on success.
  *
  * @since   2.5
  */
 function publish(&$pks, $value = 1)
 {
     if (parent::publish($pks, $value)) {
         // Initialise variables.
         $extension = Request::getCmd('extension');
         // Trigger the onCategoryChangeState event.
         Event::trigger('content.onCategoryChangeState', array($extension, $pks, $value));
         return true;
     }
 }
예제 #14
0
 /**
  * Method to change the published state of one or more records.
  *
  * @param   array    &$pks   A list of the primary keys to change.
  * @param   integer  $value  The value of the published state.
  *
  * @return  boolean  True on success.
  *
  * @since   2.5
  */
 public function publish(&$pks, $value = 1)
 {
     if (parent::publish($pks, $value)) {
         $dispatcher = JEventDispatcher::getInstance();
         $extension = JFactory::getApplication()->input->get('extension');
         // Include the content plugins for the change of category state event.
         JPluginHelper::importPlugin('content');
         // Trigger the onCategoryChangeState event.
         $dispatcher->trigger('onCategoryChangeState', array($extension, $pks, $value));
         return true;
     }
 }
예제 #15
0
 /**
  * Method to change the published state of one or more records.
  *
  * @param   array       &$pks   A list of the primary keys to change.
  * @param   integer     $value  The value of the published state.
  *
  * @return  boolean  True on success.
  *
  * @since   1.6
  */
 public function publish(&$pks, $value = 1)
 {
     $table = $this->getTable();
     $pks = (array) $pks;
     // Default menu item existence checks.
     if ($value != 1) {
         foreach ($pks as $i => $pk) {
             if ($table->load($pk) && $table->home && $table->language == '*') {
                 // Prune items that you can't change.
                 JFactory::getApplication()->enqueueMessage(JText::_('JLIB_DATABASE_ERROR_MENU_UNPUBLISH_DEFAULT_HOME'), 'error');
                 unset($pks[$i]);
                 break;
             }
         }
     }
     // Clean the cache
     $this->cleanCache();
     // Ensure that previous checks doesn't empty the array
     if (empty($pks)) {
         return true;
     }
     return parent::publish($pks, $value);
 }
예제 #16
0
파일: teamnaam.php 프로젝트: esorone/efcpw
 /**
  * Method to change the published state of one or more records.
  *
  * @param   array    &$pks   A list of the primary keys to change.
  * @param	integer  $value  The value of the published state.
  *
  * @return  boolean  True on success.
  */
 public function publish(&$pks, $value = 1)
 {
     // Include the knvbapi2 plugins for the change of state event.
     JPluginHelper::importPlugin('knvbapi2');
     return parent::publish($pks, $value);
 }
예제 #17
0
 /**
  * (non-PHPdoc)
  * @see JModelAdmin::publish()
  */
 public function publish(&$pks, $value = 1)
 {
     $success = parent::publish($pks, $value);
     JModelLegacy::getInstance(JOOMDOC_DOCUMENTS, JOOMDOC_MODEL_PREFIX)->flat(null, $pks);
     return $success;
 }