AAAAPK @B\Uf f
access.xmlnu W+A
PK @B\) tables/.htaccessnu W+A
Order allow,deny
Deny from all
PK @B\V tables/index.htmlnu W+A
PK @B\U+ + tables/weblink.phpnu W+A loadArray($array['params']);
$array['params'] = (string)$registry;
}
if (isset($array['metadata']) && is_array($array['metadata'])) {
$registry = new JRegistry();
$registry->loadArray($array['metadata']);
$array['metadata'] = (string)$registry;
}
return parent::bind($array, $ignore);
}
/**
* Overload the store method for the Weblinks table.
*
* @param boolean Toggle whether null values should be updated.
* @return boolean True on success, false on failure.
* @since 1.6
*/
public function store($updateNulls = false)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
if ($this->id) {
// Existing item
$this->modified = $date->toSql();
$this->modified_by = $user->get('id');
} else {
// New weblink. A weblink created and created_by field can be set by the user,
// so we don't touch either of these if they are set.
if (!intval($this->created)) {
$this->created = $date->toSql();
}
if (empty($this->created_by)) {
$this->created_by = $user->get('id');
}
}
// Verify that the alias is unique
$table = JTable::getInstance('Weblink', 'WeblinksTable');
if ($table->load(array('alias'=>$this->alias, 'catid'=>$this->catid)) && ($table->id != $this->id || $this->id==0)) {
$this->setError(JText::_('COM_WEBLINKS_ERROR_UNIQUE_ALIAS'));
return false;
}
// Attempt to store the user data.
return parent::store($updateNulls);
}
/**
* Overloaded check method to ensure data integrity.
*
* @return boolean True on success.
*/
public function check()
{
if (JFilterInput::checkAttribute(array ('href', $this->url))) {
$this->setError(JText::_('COM_WEBLINKS_ERR_TABLES_PROVIDE_URL'));
return false;
}
// check for valid name
if (trim($this->title) == '') {
$this->setError(JText::_('COM_WEBLINKS_ERR_TABLES_TITLE'));
return false;
}
// check for existing name
$query = 'SELECT id FROM #__weblinks WHERE title = '.$this->_db->Quote($this->title).' AND catid = '.(int) $this->catid;
$this->_db->setQuery($query);
$xid = intval($this->_db->loadResult());
if ($xid && $xid != intval($this->id)) {
$this->setError(JText::_('COM_WEBLINKS_ERR_TABLES_NAME'));
return false;
}
if (empty($this->alias)) {
$this->alias = $this->title;
}
$this->alias = JApplication::stringURLSafe($this->alias);
if (trim(str_replace('-', '', $this->alias)) == '') {
$this->alias = JFactory::getDate()->format("Y-m-d-H-i-s");
}
// Check the publish down date is not earlier than publish up.
if ($this->publish_down > $this->_db->getNullDate() && $this->publish_down < $this->publish_up) {
$this->setError(JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH'));
return false;
}
// clean up keywords -- eliminate extra spaces between phrases
// and cr (\r) and lf (\n) characters from string
if (!empty($this->metakey)) {
// only process if not empty
$bad_characters = array("\n", "\r", "\"", "<", ">"); // array of characters to remove
$after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); // remove bad characters
$keys = explode(',', $after_clean); // create array using commas as delimiter
$clean_keys = array();
foreach($keys as $key) {
if (trim($key)) { // ignore blank keywords
$clean_keys[] = trim($key);
}
}
$this->metakey = implode(", ", $clean_keys); // put array back together delimited by ", "
}
return true;
}
/**
* Method to set the publishing state for a row or list of rows in the database
* table. The method respects checked out rows by other users and will attempt
* to checkin rows that it can after adjustments are made.
*
* @param mixed An optional array of primary key values to update. If not
* set the instance property value is used.
* @param integer The publishing state. eg. [0 = unpublished, 1 = published]
* @param integer The user id of the user performing the operation.
* @return boolean True on success.
* @since 1.0.4
*/
public function publish($pks = null, $state = 1, $userId = 0)
{
// Initialise variables.
$k = $this->_tbl_key;
// Sanitize input.
JArrayHelper::toInteger($pks);
$userId = (int) $userId;
$state = (int) $state;
// If there are no primary keys set check to see if the instance key is set.
if (empty($pks))
{
if ($this->$k) {
$pks = array($this->$k);
}
// Nothing to set publishing state on, return false.
else {
$this->setError(JText::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED'));
return false;
}
}
// Build the WHERE clause for the primary keys.
$where = $k.'='.implode(' OR '.$k.'=', $pks);
// Determine if there is checkin support for the table.
if (!property_exists($this, 'checked_out') || !property_exists($this, 'checked_out_time')) {
$checkin = '';
}
else {
$checkin = ' AND (checked_out = 0 OR checked_out = '.(int) $userId.')';
}
// Update the publishing state for rows with the given primary keys.
$this->_db->setQuery(
'UPDATE '.$this->_db->quoteName($this->_tbl) .
' SET '.$this->_db->quoteName('state').' = '.(int) $state .
' WHERE ('.$where.')' .
$checkin
);
$this->_db->query();
// Check for a database error.
if ($this->_db->getErrorNum()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// If checkin is supported and all rows were adjusted, check them in.
if ($checkin && (count($pks) == $this->_db->getAffectedRows()))
{
// Checkin the rows.
foreach($pks as $pk)
{
$this->checkin($pk);
}
}
// If the JTable instance value is in the list of primary keys that were set, set the instance.
if (in_array($this->$k, $pks)) {
$this->state = $state;
}
$this->setError('');
return true;
}
}
PK @B\Kh h
config.xmlnu W+A
PK @B\V
index.htmlnu W+A
PK @B\ Oн- - weblinks.phpnu W+A authorise('core.manage', 'com_weblinks')) {
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
$controller = JControllerLegacy::getInstance('Weblinks');
$controller->execute(JRequest::getCmd('task'));
$controller->redirect();
PK @B\j~Q Q weblinks.xmlnu W+A
com_weblinksJoomla! ProjectApril 2006(C) 2005 - 2014 Open Source Matters. All rights reserved.
GNU General Public License version 2 or later; see
LICENSE.txtadmin@joomla.orgwww.joomla.org2.5.0COM_WEBLINKS_XML_DESCRIPTIONsql/install.mysql.utf8.sqlsql/uninstall.mysql.utf8.sqlindex.htmlweblinks.phpcontroller.phprouter.phpmetadata.xmlviewsmodelscontrollershelperslanguage/en-GB.com_weblinks.iniaccess.xmlconfig.xmlcontroller.phpindex.htmlweblinks.phpcontrollershelpersmodelssqltablesviewslanguage/en-GB.com_weblinks.inilanguage/en-GB.com_weblinks.sys.ini
PK @B\) .htaccessnu W+A
Order allow,deny
Deny from all
PK @B\.fP P models/weblink.phpnu W+A id)) {
if ($record->state != -2) {
return ;
}
$user = JFactory::getUser();
if ($record->catid) {
return $user->authorise('core.delete', 'com_weblinks.category.'.(int) $record->catid);
}
else {
return parent::canDelete($record);
}
}
}
/**
* Method to test whether a record can have its state changed.
*
* @param object A record object.
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
* @since 1.6
*/
protected function canEditState($record)
{
$user = JFactory::getUser();
if (!empty($record->catid)) {
return $user->authorise('core.edit.state', 'com_weblinks.category.'.(int) $record->catid);
}
else {
return parent::canEditState($record);
}
}
/**
* Returns a reference to the a Table object, always creating it.
*
* @param type The table type to instantiate
* @param string A prefix for the table class name. Optional.
* @param array Configuration array for model. Optional.
* @return JTable A database object
* @since 1.6
*/
public function getTable($type = 'Weblink', $prefix = 'WeblinksTable', $config = array())
{
return JTable::getInstance($type, $prefix, $config);
}
/**
* Method to get the record form.
*
* @param array $data An optional array of data for the form to interogate.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @return JForm A JForm object on success, false on failure
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Initialise variables.
$app = JFactory::getApplication();
// Get the form.
$form = $this->loadForm('com_weblinks.weblink', 'weblink', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
// Determine correct permissions to check.
if ($this->getState('weblink.id')) {
// Existing record. Can only edit in selected categories.
$form->setFieldAttribute('catid', 'action', 'core.edit');
} else {
// New record. Can only create in selected categories.
$form->setFieldAttribute('catid', 'action', 'core.create');
}
// Modify the form based on access controls.
if (!$this->canEditState((object) $data)) {
// Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('state', 'disabled', 'true');
$form->setFieldAttribute('publish_up', 'disabled', 'true');
$form->setFieldAttribute('publish_down', 'disabled', 'true');
// Disable fields while saving.
// The controller has already verified this is a record you can edit.
$form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('state', 'filter', 'unset');
$form->setFieldAttribute('publish_up', 'filter', 'unset');
$form->setFieldAttribute('publish_down', 'filter', 'unset');
}
return $form;
}
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
* @since 1.6
*/
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState('com_weblinks.edit.weblink.data', array());
if (empty($data)) {
$data = $this->getItem();
// Prime some default values.
if ($this->getState('weblink.id') == 0) {
$app = JFactory::getApplication();
$data->set('catid', JRequest::getInt('catid', $app->getUserState('com_weblinks.weblinks.filter.category_id')));
}
}
return $data;
}
/**
* Method to get a single record.
*
* @param integer The id of the primary key.
*
* @return mixed Object on success, false on failure.
* @since 1.6
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk)) {
// Convert the params field to an array.
$registry = new JRegistry;
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
}
return $item;
}
/**
* Prepare and sanitise the table prior to saving.
*
* @since 1.6
*/
protected function prepareTable(&$table)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
$table->alias = JApplication::stringURLSafe($table->alias);
if (empty($table->alias)) {
$table->alias = JApplication::stringURLSafe($table->title);
}
if (empty($table->id)) {
// Set the values
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$db = JFactory::getDbo();
$db->setQuery('SELECT MAX(ordering) FROM #__weblinks');
$max = $db->loadResult();
$table->ordering = $max+1;
}
}
else {
// Set the values
}
}
/**
* A protected method to get a set of ordering conditions.
*
* @param object A record object.
* @return array An array of conditions to add to add to ordering queries.
* @since 1.6
*/
protected function getReorderConditions($table)
{
$condition = array();
$condition[] = 'catid = '.(int) $table->catid;
return $condition;
}
}
PK @B\V models/index.htmlnu W+A
PK @B\) models/fields/.htaccessnu W+A
Order allow,deny
Deny from all
PK @B\V models/fields/index.htmlnu W+A
PK @B\7 models/fields/ordering.phpnu W+A element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
// Initialize JavaScript field attributes.
$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
// Get some field values from the form.
$weblinkId = (int) $this->form->getValue('id');
$categoryId = (int) $this->form->getValue('catid');
// Build the query for the ordering list.
$query = 'SELECT ordering AS value, title AS text' .
' FROM #__weblinks' .
' WHERE catid = ' . (int) $categoryId .
' ORDER BY ordering';
// Create a read-only list (no name) with a hidden input to store the value.
if ((string) $this->element['readonly'] == 'true') {
$html[] = JHtml::_('list.ordering', '', $query, trim($attr), $this->value, $weblinkId ? 0 : 1);
$html[] = '';
}
// Create a regular list.
else {
$html[] = JHtml::_('list.ordering', $this->name, $query, trim($attr), $this->value, $weblinkId ? 0 : 1);
}
return implode($html);
}
}
PK @B\) models/.htaccessnu W+A
Order allow,deny
Deny from all
PK @B\V models/forms/index.htmlnu W+A
PK @B\) models/forms/.htaccessnu W+A
Order allow,deny
Deny from all
PK @B\4 models/forms/weblink.xmlnu W+A
PK @B\. models/weblinks.phpnu W+A getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$accessId = $this->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int');
$this->setState('filter.access', $accessId);
$published = $this->getUserStateFromRequest($this->context.'.filter.state', 'filter_published', '', 'string');
$this->setState('filter.state', $published);
$categoryId = $this->getUserStateFromRequest($this->context.'.filter.category_id', 'filter_category_id', '');
$this->setState('filter.category_id', $categoryId);
$language = $this->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
// Load the parameters.
$params = JComponentHelper::getParams('com_weblinks');
$this->setState('params', $params);
// List state information.
parent::populateState('a.title', 'asc');
}
/**
* Method to get a store id based on model configuration state.
*
* This is necessary because the model is used by the component and
* different modules that might need different sets of data or different
* ordering requirements.
*
* @param string $id A prefix for the store id.
* @return string A store id.
* @since 1.6
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id.= ':' . $this->getState('filter.search');
$id.= ':' . $this->getState('filter.access');
$id.= ':' . $this->getState('filter.state');
$id.= ':' . $this->getState('filter.category_id');
$id.= ':' . $this->getState('filter.language');
return parent::getStoreId($id);
}
/**
* Build an SQL query to load the list data.
*
* @return JDatabaseQuery
* @since 1.6
*/
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
$user = JFactory::getUser();
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.id, a.title, a.alias, a.checked_out, a.checked_out_time, a.catid,' .
'a.hits,' .
'a.state, a.access, a.ordering,'.
'a.language, a.publish_up, a.publish_down'
)
);
$query->from($db->quoteName('#__weblinks').' AS a');
// Join over the language
$query->select('l.title AS language_title');
$query->join('LEFT', $db->quoteName('#__languages').' AS l ON l.lang_code = a.language');
// Join over the users for the checked out user.
$query->select('uc.name AS editor');
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
// Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Join over the categories.
$query->select('c.title AS category_title');
$query->join('LEFT', '#__categories AS c ON c.id = a.catid');
// Filter by access level.
if ($access = $this->getState('filter.access')) {
$query->where('a.access = '.(int) $access);
}
// Implement View Level Access
if (!$user->authorise('core.admin'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN ('.$groups.')');
}
// Filter by published state
$published = $this->getState('filter.state');
if (is_numeric($published)) {
$query->where('a.state = '.(int) $published);
} elseif ($published === '') {
$query->where('(a.state IN (0, 1))');
}
// Filter by category.
$categoryId = $this->getState('filter.category_id');
if (is_numeric($categoryId)) {
$query->where('a.catid = '.(int) $categoryId);
}
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search)) {
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
} else {
$search = $db->Quote('%'.$db->escape($search, true).'%');
$query->where('(a.title LIKE '.$search.' OR a.alias LIKE '.$search.')');
}
}
// Filter on the language.
if ($language = $this->getState('filter.language')) {
$query->where('a.language = ' . $db->quote($language));
}
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
if ($orderCol == 'a.ordering' || $orderCol == 'category_title') {
$orderCol = 'c.title '.$orderDirn.', a.ordering';
}
$query->order($db->escape($orderCol.' '.$orderDirn));
//echo nl2br(str_replace('#__','jos_',$query));
return $query;
}
}
PK @B\ nF F controller.phpnu W+A checkEditId('com_weblinks.edit.weblink', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_weblinks&view=weblinks', false));
return false;
}
parent::display();
return $this;
}
}
PK @B\আ views/weblinks/view.html.phpnu W+A state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->addToolbar();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT.'/helpers/weblinks.php';
$state = $this->get('State');
$canDo = WeblinksHelper::getActions($state->get('filter.category_id'));
$user = JFactory::getUser();
JToolBarHelper::title(JText::_('COM_WEBLINKS_MANAGER_WEBLINKS'), 'weblinks.png');
if (count($user->getAuthorisedCategories('com_weblinks', 'core.create')) > 0) {
JToolBarHelper::addNew('weblink.add');
}
if ($canDo->get('core.edit')) {
JToolBarHelper::editList('weblink.edit');
}
if ($canDo->get('core.edit.state')) {
JToolBarHelper::divider();
JToolBarHelper::publish('weblinks.publish', 'JTOOLBAR_PUBLISH', true);
JToolBarHelper::unpublish('weblinks.unpublish', 'JTOOLBAR_UNPUBLISH', true);
JToolBarHelper::divider();
JToolBarHelper::archiveList('weblinks.archive');
JToolBarHelper::checkin('weblinks.checkin');
}
if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
JToolBarHelper::deleteList('', 'weblinks.delete', 'JTOOLBAR_EMPTY_TRASH');
JToolBarHelper::divider();
} elseif ($canDo->get('core.edit.state')) {
JToolBarHelper::trash('weblinks.trash');
JToolBarHelper::divider();
}
if ($canDo->get('core.admin')) {
JToolBarHelper::preferences('com_weblinks');
JToolBarHelper::divider();
}
JToolBarHelper::help('JHELP_COMPONENTS_WEBLINKS_LINKS');
}
}
PK @B\) views/weblinks/tmpl/.htaccessnu W+A
Order allow,deny
Deny from all
PK @B\V views/weblinks/tmpl/index.htmlnu W+A
PK @B\e % views/weblinks/tmpl/default_batch.phpnu W+A state->get('filter.published');
?>
PK @B\4! ! views/weblinks/tmpl/default.phpnu W+A get('id');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$canOrder = $user->authorise('core.edit.state', 'com_weblinks.category');
$saveOrder = $listOrder == 'a.ordering';
?>
PK @B\V views/weblinks/index.htmlnu W+A
PK @B\) views/weblinks/.htaccessnu W+A
Order allow,deny
Deny from all
PK @B\Jv v " views/weblink/tmpl/edit_params.phpnu W+A form->getFieldsets('params');
foreach ($fieldSets as $name => $fieldSet) :
echo JHtml::_('sliders.panel', JText::_($fieldSet->label), $name.'-params');
if (isset($fieldSet->description) && trim($fieldSet->description)) :
echo '