english/administrator/components/com_redirect/models/link.php
/**
	 * Method to activate links.
	 *
	 * @param	array	An array of link ids.
	 * @param	string	The new URL to set for the redirect.
	 * @param	string	A comment for the redirect links.
	 * @return	boolean	Returns true on success, false on failure.
	 * @since	1.6
	 */
Method to activate links.
@param       array   An array of link ids.
@param       string  The new URL to set for the redirect.
@param       string  A comment for the redirect links.
@return      boolean Returns true on success, false on failure.
Method to activate links . @param array An array of link ids . @param string The new URL to set for the redirect . @param string A comment for the redirect links . @return boolean Returns true on success false on failure .
public function activate(&$pks, $url, $comment = null)
	{
		$user	= JFactory::getUser();
		$db		= $this->getDbo();
		$pks = (array) $pks;
		JArrayHelper::toInteger($pks);
		$comment = (!empty($comment)) ? $comment : JText::sprintf('COM_REDIRECT_REDIRECTED_ON', JHtml::_('date',time()));
		if (!$user->authorise('core.admin', 'com_redirect')) {
			$pks = array();
			$this->setError(JText::_('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED'));
			return false;
		}
		if (!empty($pks)) {
			$db->setQuery(
				'UPDATE `#__redirect_links`' .
				' SET `new_url` = '.$db->Quote($url).', `published` = 1, `comment` = '.$db->Quote($comment) .
				' WHERE `id` IN ('.implode(',', $pks).')'
			);
			$db->query();
			if ($error = $this->_db->getErrorMsg())
			{
				$this->setError($error);
				return false;
			}
		}
		return true;
	}
public function activate ( & $ pks , $ url , $ comment = null ) { $ user = JFactory :: getUser ( ) ; $ db = $ this -> getDbo ( ) ; $ pks = ( array ) $ pks ; JArrayHelper :: toInteger ( $ pks ) ; $ comment = ( ! empty ( $ comment ) ) ? $ comment : JText :: sprintf ( 'COM_REDIRECT_REDIRECTED_ON' , JHtml :: _ ( 'date' , time ( ) ) ) ; if ( ! $ user -> authorise ( 'core.admin' , 'com_redirect' ) ) { $ pks = array ( ) ; $ this -> setError ( JText :: _ ( 'JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED' ) ) ; return false ; } if ( ! empty ( $ pks ) ) { $ db -> setQuery ( 'UPDATE `#__redirect_links`' . ' SET `new_url` = ' . $ db -> Quote ( $ url ) . ', `published` = 1, `comment` = ' . $ db -> Quote ( $ comment ) . ' WHERE `id` IN (' . implode ( ',' , $ pks ) . ')' ) ; $ db -> query ( ) ; if ( $ error = $ this -> _db -> getErrorMsg ( ) ) { $ this -> setError ( $ error ) ; return false ; } } return true ; }
Method to activate links.
Method to activate links .
// Initialise variables. // Sanitize the ids. // Populate default comment if necessary. // Access checks. // Update the link rows. // Check for a database error.