添加到 trunk
+YUCHENG HU+ git-svn-id: https://svn.code.sf.net/p/hawebs/svn@316 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<config>
|
||||
<params>
|
||||
<param name="show_comp_description" type="radio" default="1" label="Description" description="Show/Hide the Description below">
|
||||
<option value="0">Hide</option>
|
||||
<option value="1">Show</option>
|
||||
</param>
|
||||
<param name="comp_description" type="textarea" default="" label="Weblinks Intro" rows="3" cols="50" description="WEBLINKS_INTRO_DESC" />
|
||||
<param name="@spacer" type="spacer" default="" label="" description="" />
|
||||
<param name="show_link_hits" type="radio" default="1" label="Hits" description="TIPIFSETTOSHOWHITS">
|
||||
<option value="0">Hide</option>
|
||||
<option value="1">Show</option>
|
||||
</param>
|
||||
<param name="show_link_description" type="radio" default="1" label="Link Descriptions" description="PARAMSHOWHIDELINKS">
|
||||
<option value="0">Hide</option>
|
||||
<option value="1">Show</option>
|
||||
</param>
|
||||
<param name="show_other_cats" type="radio" default="1" label="Other Categories" description="PARAMWHENVIEWCAT">
|
||||
<option value="0">Hide</option>
|
||||
<option value="1">Show</option>
|
||||
</param>
|
||||
<param name="show_headings" type="radio" default="1" label="Table Headings" description="Show/Hide the Table Headings">
|
||||
<option value="0">Hide</option>
|
||||
<option value="1">Show</option>
|
||||
</param>
|
||||
<param name="@spacer" type="spacer" default="" label="" description="" />
|
||||
<param name="target" type="list" default="0" label="Target" description="Target window when the link is clicked">
|
||||
<option value="0">Parent Window With Browser Navigation</option>
|
||||
<option value="1">New Window With Browser Navigation</option>
|
||||
<option value="2">New Window Without Browser Navigation</option>
|
||||
</param>
|
||||
<param name="link_icons" type="imagelist" directory="/images/M_images" default="" label="Icon" description="PARAMICONIMG" />
|
||||
</params>
|
||||
</config>
|
||||
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: controller.php 11002 2008-10-07 01:12:20Z ian $
|
||||
* @package Joomla
|
||||
* @subpackage Content
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant to the
|
||||
* GNU General Public License, and as distributed it includes or is derivative
|
||||
* of works licensed under the GNU General Public License or other free or open
|
||||
* source software licenses. See COPYRIGHT.php for copyright notices and
|
||||
* details.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is included in Joomla!
|
||||
defined('_JEXEC') or die( 'Restricted access' );
|
||||
|
||||
jimport( 'joomla.application.component.controller' );
|
||||
|
||||
/**
|
||||
* Weblinks Weblink Controller
|
||||
*
|
||||
* @package Joomla
|
||||
* @subpackage Weblinks
|
||||
* @since 1.5
|
||||
*/
|
||||
class WeblinksController extends JController
|
||||
{
|
||||
function __construct($config = array())
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
// Register Extra tasks
|
||||
$this->registerTask( 'add', 'display' );
|
||||
$this->registerTask( 'edit', 'display' );
|
||||
}
|
||||
|
||||
function display( )
|
||||
{
|
||||
switch($this->getTask())
|
||||
{
|
||||
case 'add' :
|
||||
{
|
||||
JRequest::setVar( 'hidemainmenu', 1 );
|
||||
JRequest::setVar( 'layout', 'form' );
|
||||
JRequest::setVar( 'view' , 'weblink');
|
||||
JRequest::setVar( 'edit', false );
|
||||
|
||||
// Checkout the weblink
|
||||
$model = $this->getModel('weblink');
|
||||
$model->checkout();
|
||||
} break;
|
||||
case 'edit' :
|
||||
{
|
||||
JRequest::setVar( 'hidemainmenu', 1 );
|
||||
JRequest::setVar( 'layout', 'form' );
|
||||
JRequest::setVar( 'view' , 'weblink');
|
||||
JRequest::setVar( 'edit', true );
|
||||
|
||||
// Checkout the weblink
|
||||
$model = $this->getModel('weblink');
|
||||
$model->checkout();
|
||||
} break;
|
||||
}
|
||||
|
||||
parent::display();
|
||||
}
|
||||
|
||||
function save()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JRequest::checkToken() or jexit( 'Invalid Token' );
|
||||
|
||||
$post = JRequest::get('post');
|
||||
$cid = JRequest::getVar( 'cid', array(0), 'post', 'array' );
|
||||
$post['id'] = (int) $cid[0];
|
||||
|
||||
$model = $this->getModel('weblink');
|
||||
|
||||
if ($model->store($post)) {
|
||||
$msg = JText::_( 'Weblink Saved' );
|
||||
} else {
|
||||
$msg = JText::_( 'Error Saving Weblink' );
|
||||
}
|
||||
|
||||
// Check the table in so it can be edited.... we are done with it anyway
|
||||
$model->checkin();
|
||||
$link = 'index.php?option=com_weblinks';
|
||||
$this->setRedirect($link, $msg);
|
||||
}
|
||||
|
||||
function remove()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JRequest::checkToken() or jexit( 'Invalid Token' );
|
||||
|
||||
$cid = JRequest::getVar( 'cid', array(), 'post', 'array' );
|
||||
JArrayHelper::toInteger($cid);
|
||||
|
||||
if (count( $cid ) < 1) {
|
||||
JError::raiseError(500, JText::_( 'Select an item to delete' ) );
|
||||
}
|
||||
|
||||
$model = $this->getModel('weblink');
|
||||
if(!$model->delete($cid)) {
|
||||
echo "<script> alert('".$model->getError(true)."'); window.history.go(-1); </script>\n";
|
||||
}
|
||||
|
||||
$this->setRedirect( 'index.php?option=com_weblinks' );
|
||||
}
|
||||
|
||||
|
||||
function publish()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JRequest::checkToken() or jexit( 'Invalid Token' );
|
||||
|
||||
$cid = JRequest::getVar( 'cid', array(), 'post', 'array' );
|
||||
JArrayHelper::toInteger($cid);
|
||||
|
||||
if (count( $cid ) < 1) {
|
||||
JError::raiseError(500, JText::_( 'Select an item to publish' ) );
|
||||
}
|
||||
|
||||
$model = $this->getModel('weblink');
|
||||
if(!$model->publish($cid, 1)) {
|
||||
echo "<script> alert('".$model->getError(true)."'); window.history.go(-1); </script>\n";
|
||||
}
|
||||
|
||||
$this->setRedirect( 'index.php?option=com_weblinks' );
|
||||
}
|
||||
|
||||
|
||||
function unpublish()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JRequest::checkToken() or jexit( 'Invalid Token' );
|
||||
|
||||
$cid = JRequest::getVar( 'cid', array(), 'post', 'array' );
|
||||
JArrayHelper::toInteger($cid);
|
||||
|
||||
if (count( $cid ) < 1) {
|
||||
JError::raiseError(500, JText::_( 'Select an item to unpublish' ) );
|
||||
}
|
||||
|
||||
$model = $this->getModel('weblink');
|
||||
if(!$model->publish($cid, 0)) {
|
||||
echo "<script> alert('".$model->getError(true)."'); window.history.go(-1); </script>\n";
|
||||
}
|
||||
|
||||
$this->setRedirect( 'index.php?option=com_weblinks' );
|
||||
}
|
||||
|
||||
function cancel()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JRequest::checkToken() or jexit( 'Invalid Token' );
|
||||
|
||||
// Checkin the weblink
|
||||
$model = $this->getModel('weblink');
|
||||
$model->checkin();
|
||||
|
||||
$this->setRedirect( 'index.php?option=com_weblinks' );
|
||||
}
|
||||
|
||||
|
||||
function orderup()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JRequest::checkToken() or jexit( 'Invalid Token' );
|
||||
|
||||
$model = $this->getModel('weblink');
|
||||
$model->move(-1);
|
||||
|
||||
$this->setRedirect( 'index.php?option=com_weblinks');
|
||||
}
|
||||
|
||||
function orderdown()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JRequest::checkToken() or jexit( 'Invalid Token' );
|
||||
|
||||
$model = $this->getModel('weblink');
|
||||
$model->move(1);
|
||||
|
||||
$this->setRedirect( 'index.php?option=com_weblinks');
|
||||
}
|
||||
|
||||
function saveorder()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JRequest::checkToken() or jexit( 'Invalid Token' );
|
||||
|
||||
$cid = JRequest::getVar( 'cid', array(), 'post', 'array' );
|
||||
$order = JRequest::getVar( 'order', array(), 'post', 'array' );
|
||||
JArrayHelper::toInteger($cid);
|
||||
JArrayHelper::toInteger($order);
|
||||
|
||||
$model = $this->getModel('weblink');
|
||||
$model->saveorder($cid, $order);
|
||||
|
||||
$msg = JText::_( 'New ordering saved' );
|
||||
$this->setRedirect( 'index.php?option=com_weblinks', $msg );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<model>
|
||||
<params>
|
||||
<param name="target" type="list" default="" label="Target" description="Target window when the link is clicked">
|
||||
<option value="">Use Global</option>
|
||||
<option value="0">Parent Window With Browser Navigation</option>
|
||||
<option value="1">New Window With Browser Navigation</option>
|
||||
<option value="2">New Window Without Browser Navigation</option>
|
||||
</param>
|
||||
</params>
|
||||
</model>
|
||||
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: weblinks.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @subpackage Content
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant to the
|
||||
* GNU General Public License, and as distributed it includes or is derivative
|
||||
* of works licensed under the GNU General Public License or other free or open
|
||||
* source software licenses. See COPYRIGHT.php for copyright notices and
|
||||
* details.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is included in Joomla!
|
||||
defined('_JEXEC') or die( 'Restricted access' );
|
||||
|
||||
jimport('joomla.application.component.model');
|
||||
|
||||
/**
|
||||
* Weblinks Component Weblink Model
|
||||
*
|
||||
* @package Joomla
|
||||
* @subpackage Content
|
||||
* @since 1.5
|
||||
*/
|
||||
class WeblinksModelWeblinks extends JModel
|
||||
{
|
||||
/**
|
||||
* Category ata array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $_data = null;
|
||||
|
||||
/**
|
||||
* Category total
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
var $_total = null;
|
||||
|
||||
/**
|
||||
* Pagination object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
var $_pagination = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
global $mainframe, $option;
|
||||
|
||||
// Get the pagination request variables
|
||||
$limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );
|
||||
$limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' );
|
||||
|
||||
// In case limit has been changed, adjust limitstart accordingly
|
||||
$limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0);
|
||||
|
||||
$this->setState('limit', $limit);
|
||||
$this->setState('limitstart', $limitstart);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get weblinks item data
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
function getData()
|
||||
{
|
||||
// Lets load the content if it doesn't already exist
|
||||
if (empty($this->_data))
|
||||
{
|
||||
$query = $this->_buildQuery();
|
||||
$this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
|
||||
}
|
||||
|
||||
return $this->_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the total number of weblink items
|
||||
*
|
||||
* @access public
|
||||
* @return integer
|
||||
*/
|
||||
function getTotal()
|
||||
{
|
||||
// Lets load the content if it doesn't already exist
|
||||
if (empty($this->_total))
|
||||
{
|
||||
$query = $this->_buildQuery();
|
||||
$this->_total = $this->_getListCount($query);
|
||||
}
|
||||
|
||||
return $this->_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a pagination object for the weblinks
|
||||
*
|
||||
* @access public
|
||||
* @return integer
|
||||
*/
|
||||
function getPagination()
|
||||
{
|
||||
// Lets load the content if it doesn't already exist
|
||||
if (empty($this->_pagination))
|
||||
{
|
||||
jimport('joomla.html.pagination');
|
||||
$this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') );
|
||||
}
|
||||
|
||||
return $this->_pagination;
|
||||
}
|
||||
|
||||
function _buildQuery()
|
||||
{
|
||||
// Get the WHERE and ORDER BY clauses for the query
|
||||
$where = $this->_buildContentWhere();
|
||||
$orderby = $this->_buildContentOrderBy();
|
||||
|
||||
$query = ' SELECT a.*, cc.title AS category, u.name AS editor '
|
||||
. ' FROM #__weblinks AS a '
|
||||
. ' LEFT JOIN #__categories AS cc ON cc.id = a.catid '
|
||||
. ' LEFT JOIN #__users AS u ON u.id = a.checked_out '
|
||||
. $where
|
||||
. $orderby
|
||||
;
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function _buildContentOrderBy()
|
||||
{
|
||||
global $mainframe, $option;
|
||||
|
||||
$filter_order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'a.ordering', 'cmd' );
|
||||
$filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' );
|
||||
|
||||
if ($filter_order == 'a.ordering'){
|
||||
$orderby = ' ORDER BY category, a.ordering '.$filter_order_Dir;
|
||||
} else {
|
||||
$orderby = ' ORDER BY '.$filter_order.' '.$filter_order_Dir.' , category, a.ordering ';
|
||||
}
|
||||
|
||||
return $orderby;
|
||||
}
|
||||
|
||||
function _buildContentWhere()
|
||||
{
|
||||
global $mainframe, $option;
|
||||
$db =& JFactory::getDBO();
|
||||
$filter_state = $mainframe->getUserStateFromRequest( $option.'filter_state', 'filter_state', '', 'word' );
|
||||
$filter_catid = $mainframe->getUserStateFromRequest( $option.'filter_catid', 'filter_catid', 0, 'int' );
|
||||
$filter_order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'a.ordering', 'cmd' );
|
||||
$filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' );
|
||||
$search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' );
|
||||
$search = JString::strtolower( $search );
|
||||
|
||||
$where = array();
|
||||
|
||||
if ($filter_catid > 0) {
|
||||
$where[] = 'a.catid = '.(int) $filter_catid;
|
||||
}
|
||||
if ($search) {
|
||||
$where[] = 'LOWER(a.title) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false );
|
||||
}
|
||||
if ( $filter_state ) {
|
||||
if ( $filter_state == 'P' ) {
|
||||
$where[] = 'a.published = 1';
|
||||
} else if ($filter_state == 'U' ) {
|
||||
$where[] = 'a.published = 0';
|
||||
}
|
||||
}
|
||||
|
||||
$where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' );
|
||||
|
||||
return $where;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: weblink.php 11253 2008-11-10 23:38:48Z ircmaxell $
|
||||
* @package Joomla
|
||||
* @subpackage Weblinks
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* Weblink Table class
|
||||
*
|
||||
* @package Joomla
|
||||
* @subpackage Weblinks
|
||||
* @since 1.0
|
||||
*/
|
||||
class TableWeblink extends JTable
|
||||
{
|
||||
/**
|
||||
* Primary Key
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
var $id = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
var $catid = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
var $sid = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
var $title = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
var $alias = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
var $url = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
var $description = null;
|
||||
|
||||
/**
|
||||
* @var datetime
|
||||
*/
|
||||
var $date = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
var $hits = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
var $published = null;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
var $checked_out = 0;
|
||||
|
||||
/**
|
||||
* @var time
|
||||
*/
|
||||
var $checked_out_time = 0;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
var $ordering = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
var $archived = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
var $approved = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
var $params = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Database connector object
|
||||
* @since 1.0
|
||||
*/
|
||||
function __construct(& $db) {
|
||||
parent::__construct('#__weblinks', 'id', $db);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded bind function
|
||||
*
|
||||
* @acces public
|
||||
* @param array $hash named array
|
||||
* @return null|string null is operation was satisfactory, otherwise returns an error
|
||||
* @see JTable:bind
|
||||
* @since 1.5
|
||||
*/
|
||||
function bind($array, $ignore = '')
|
||||
{
|
||||
if (key_exists( 'params', $array ) && is_array( $array['params'] ))
|
||||
{
|
||||
$registry = new JRegistry();
|
||||
$registry->loadArray($array['params']);
|
||||
$array['params'] = $registry->toString();
|
||||
}
|
||||
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded check method to ensure data integrity
|
||||
*
|
||||
* @access public
|
||||
* @return boolean True on success
|
||||
* @since 1.0
|
||||
*/
|
||||
function check()
|
||||
{
|
||||
if (JFilterInput::checkAttribute(array ('href', $this->url))) {
|
||||
$this->setError( JText::_('Please provide a valid URL'));
|
||||
return false;
|
||||
}
|
||||
|
||||
//Remove all HTML tags from the title and description
|
||||
$filter = new JFilterInput(array(), array(), 0, 0);
|
||||
$this->description = $filter->clean($this->description);
|
||||
$this->title = $filter->clean($this->title);
|
||||
|
||||
/** check for valid name */
|
||||
if (trim($this->title) == '') {
|
||||
$this->setError(JText::_('Your Weblink must contain a title.'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(eregi('http://', $this->url) || (eregi('https://', $this->url)) || (eregi('ftp://', $this->url)))) {
|
||||
$this->url = 'http://'.$this->url;
|
||||
}
|
||||
|
||||
/** 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::sprintf('WARNNAMETRYAGAIN', JText::_('Web Link')));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(empty($this->alias)) {
|
||||
$this->alias = $this->title;
|
||||
}
|
||||
$this->alias = JFilterOutput::stringURLSafe($this->alias);
|
||||
if(trim(str_replace('-','',$this->alias)) == '') {
|
||||
$datenow =& JFactory::getDate();
|
||||
$this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,148 @@
|
||||
<?php defined('_JEXEC') or die('Restricted access'); ?>
|
||||
|
||||
<?php JHTML::_('behavior.tooltip'); ?>
|
||||
|
||||
<?php
|
||||
// Set toolbar items for the page
|
||||
$edit = JRequest::getVar('edit',true);
|
||||
$text = !$edit ? JText::_( 'New' ) : JText::_( 'Edit' );
|
||||
JToolBarHelper::title( JText::_( 'Weblink' ).': <small><small>[ ' . $text.' ]</small></small>' );
|
||||
JToolBarHelper::save();
|
||||
if (!$edit) {
|
||||
JToolBarHelper::cancel();
|
||||
} else {
|
||||
// for existing items the button is renamed `close`
|
||||
JToolBarHelper::cancel( 'cancel', 'Close' );
|
||||
}
|
||||
JToolBarHelper::help( 'screen.weblink.edit' );
|
||||
?>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
function submitbutton(pressbutton) {
|
||||
var form = document.adminForm;
|
||||
if (pressbutton == 'cancel') {
|
||||
submitform( pressbutton );
|
||||
return;
|
||||
}
|
||||
|
||||
// do field validation
|
||||
if (form.title.value == ""){
|
||||
alert( "<?php echo JText::_( 'Weblink item must have a title', true ); ?>" );
|
||||
} else if (form.catid.value == "0"){
|
||||
alert( "<?php echo JText::_( 'You must select a category', true ); ?>" );
|
||||
} else if (form.url.value == ""){
|
||||
alert( "<?php echo JText::_( 'You must have a url.', true ); ?>" );
|
||||
} else {
|
||||
submitform( pressbutton );
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style type="text/css">
|
||||
table.paramlist td.paramlist_key {
|
||||
width: 92px;
|
||||
text-align: left;
|
||||
height: 30px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<form action="index.php" method="post" name="adminForm" id="adminForm">
|
||||
<div class="col width-50">
|
||||
<fieldset class="adminform">
|
||||
<legend><?php echo JText::_( 'Details' ); ?></legend>
|
||||
|
||||
<table class="admintable">
|
||||
<tr>
|
||||
<td width="100" align="right" class="key">
|
||||
<label for="title">
|
||||
<?php echo JText::_( 'Name' ); ?>:
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="text_area" type="text" name="title" id="title" size="32" maxlength="250" value="<?php echo $this->weblink->title;?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="100" align="right" class="key">
|
||||
<label for="alias">
|
||||
<?php echo JText::_( 'Alias' ); ?>:
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="text_area" type="text" name="alias" id="alias" size="32" maxlength="250" value="<?php echo $this->weblink->alias;?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right" class="key">
|
||||
<?php echo JText::_( 'Published' ); ?>:
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $this->lists['published']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right" class="key">
|
||||
<label for="catid">
|
||||
<?php echo JText::_( 'Category' ); ?>:
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $this->lists['catid']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right" class="key">
|
||||
<label for="url">
|
||||
<?php echo JText::_( 'URL' ); ?>:
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="text_area" type="text" name="url" id="url" value="<?php echo $this->weblink->url; ?>" size="32" maxlength="250" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" align="right" class="key">
|
||||
<label for="ordering">
|
||||
<?php echo JText::_( 'Ordering' ); ?>:
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $this->lists['ordering']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="col width-50">
|
||||
<fieldset class="adminform">
|
||||
<legend><?php echo JText::_( 'Parameters' ); ?></legend>
|
||||
|
||||
<table class="admintable">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<?php echo $this->params->render();?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="col width-50">
|
||||
<fieldset class="adminform">
|
||||
<legend><?php echo JText::_( 'Description' ); ?></legend>
|
||||
|
||||
<table class="admintable">
|
||||
<tr>
|
||||
<td>
|
||||
<textarea class="text_area" cols="44" rows="9" name="description" id="description"><?php echo $this->weblink->description; ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
|
||||
<input type="hidden" name="option" value="com_weblinks" />
|
||||
<input type="hidden" name="cid[]" value="<?php echo $this->weblink->id; ?>" />
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHTML::_( 'form.token' ); ?>
|
||||
</form>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: view.html.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @subpackage Weblinks
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is included in Joomla!
|
||||
defined('_JEXEC') or die( 'Restricted access' );
|
||||
|
||||
jimport( 'joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* HTML View class for the WebLinks component
|
||||
*
|
||||
* @static
|
||||
* @package Joomla
|
||||
* @subpackage Weblinks
|
||||
* @since 1.0
|
||||
*/
|
||||
class WeblinksViewWeblink extends JView
|
||||
{
|
||||
function display($tpl = null)
|
||||
{
|
||||
global $mainframe;
|
||||
|
||||
if($this->getLayout() == 'form') {
|
||||
$this->_displayForm($tpl);
|
||||
return;
|
||||
}
|
||||
|
||||
//get the weblink
|
||||
$weblink =& $this->get('data');
|
||||
|
||||
if ($weblink->url) {
|
||||
// redirects to url if matching id found
|
||||
$mainframe->redirect($weblink->url);
|
||||
}
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
function _displayForm($tpl)
|
||||
{
|
||||
global $mainframe, $option;
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
$uri =& JFactory::getURI();
|
||||
$user =& JFactory::getUser();
|
||||
$model =& $this->getModel();
|
||||
|
||||
|
||||
$lists = array();
|
||||
|
||||
//get the weblink
|
||||
$weblink =& $this->get('data');
|
||||
$isNew = ($weblink->id < 1);
|
||||
|
||||
// fail if checked out not by 'me'
|
||||
if ($model->isCheckedOut( $user->get('id') )) {
|
||||
$msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The weblink' ), $weblink->title );
|
||||
$mainframe->redirect( 'index.php?option='. $option, $msg );
|
||||
}
|
||||
|
||||
// Edit or Create?
|
||||
if (!$isNew)
|
||||
{
|
||||
$model->checkout( $user->get('id') );
|
||||
}
|
||||
else
|
||||
{
|
||||
// initialise new record
|
||||
$weblink->published = 1;
|
||||
$weblink->approved = 1;
|
||||
$weblink->order = 0;
|
||||
$weblink->catid = JRequest::getVar( 'catid', 0, 'post', 'int' );
|
||||
}
|
||||
|
||||
// build the html select list for ordering
|
||||
$query = 'SELECT ordering AS value, title AS text'
|
||||
. ' FROM #__weblinks'
|
||||
. ' WHERE catid = ' . (int) $weblink->catid
|
||||
. ' ORDER BY ordering';
|
||||
|
||||
$lists['ordering'] = JHTML::_('list.specificordering', $weblink, $weblink->id, $query );
|
||||
|
||||
// build list of categories
|
||||
$lists['catid'] = JHTML::_('list.category', 'catid', $option, intval( $weblink->catid ) );
|
||||
// build the html select list
|
||||
$lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $weblink->published );
|
||||
|
||||
//clean weblink data
|
||||
JFilterOutput::objectHTMLSafe( $weblink, ENT_QUOTES, 'description' );
|
||||
|
||||
$file = JPATH_COMPONENT.DS.'models'.DS.'weblink.xml';
|
||||
$params = new JParameter( $weblink->params, $file );
|
||||
|
||||
$this->assignRef('lists', $lists);
|
||||
$this->assignRef('weblink', $weblink);
|
||||
$this->assignRef('params', $params);
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
<?php defined('_JEXEC') or die('Restricted access'); ?>
|
||||
|
||||
<?php JHTML::_('behavior.tooltip'); ?>
|
||||
|
||||
<?php
|
||||
// Set toolbar items for the page
|
||||
JToolBarHelper::title( JText::_( 'Weblink Manager' ), 'generic.png' );
|
||||
JToolBarHelper::publishList();
|
||||
JToolBarHelper::unpublishList();
|
||||
JToolBarHelper::deleteList();
|
||||
JToolBarHelper::editListX();
|
||||
JToolBarHelper::addNewX();
|
||||
JToolBarHelper::preferences('com_weblinks', '380');
|
||||
JToolBarHelper::help( 'screen.weblink' );
|
||||
$ordering = ($this->lists['order'] == 'a.ordering');
|
||||
?>
|
||||
<form action="index.php" method="post" name="adminForm">
|
||||
<table>
|
||||
<tr>
|
||||
<td align="left" width="100%">
|
||||
<?php echo JText::_( 'Filter' ); ?>:
|
||||
<input type="text" name="search" id="search" value="<?php echo $this->lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" />
|
||||
<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
|
||||
<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_catid').value='0';this.form.getElementById('filter_state').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
|
||||
</td>
|
||||
<td nowrap="nowrap">
|
||||
<?php
|
||||
echo $this->lists['catid'];
|
||||
echo $this->lists['state'];
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="editcell">
|
||||
<table class="adminlist">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5">
|
||||
<?php echo JText::_( 'NUM' ); ?>
|
||||
</th>
|
||||
<th width="20">
|
||||
<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->items ); ?>);" />
|
||||
</th>
|
||||
<th class="title">
|
||||
<?php echo JHTML::_('grid.sort', 'Title', 'a.title', $this->lists['order_Dir'], $this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th width="5%" nowrap="nowrap">
|
||||
<?php echo JHTML::_('grid.sort', 'Published', 'a.published', $this->lists['order_Dir'], $this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th width="8%" nowrap="nowrap">
|
||||
<?php echo JHTML::_('grid.sort', 'Order', 'a.ordering', $this->lists['order_Dir'], $this->lists['order'] ); ?>
|
||||
<?php if ($ordering) echo JHTML::_('grid.order', $this->items ); ?>
|
||||
</th>
|
||||
<th width="15%" class="title">
|
||||
<?php echo JHTML::_('grid.sort', 'Category', 'category', $this->lists['order_Dir'], $this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th width="5%">
|
||||
<?php echo JHTML::_('grid.sort', 'Hits', 'a.hits', $this->lists['order_Dir'], $this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th width="1%" nowrap="nowrap">
|
||||
<?php echo JHTML::_('grid.sort', 'ID', 'a.id', $this->lists['order_Dir'], $this->lists['order'] ); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
<?php echo $this->pagination->getListFooter(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<?php
|
||||
$k = 0;
|
||||
for ($i=0, $n=count( $this->items ); $i < $n; $i++)
|
||||
{
|
||||
$row = &$this->items[$i];
|
||||
|
||||
$link = JRoute::_( 'index.php?option=com_weblinks&view=weblink&task=edit&cid[]='. $row->id );
|
||||
|
||||
$checked = JHTML::_('grid.checkedout', $row, $i );
|
||||
$published = JHTML::_('grid.published', $row, $i );
|
||||
|
||||
$row->cat_link = JRoute::_( 'index.php?option=com_categories§ion=com_weblinks&task=edit&type=other&cid[]='. $row->catid );
|
||||
?>
|
||||
<tr class="<?php echo "row$k"; ?>">
|
||||
<td>
|
||||
<?php echo $this->pagination->getRowOffset( $i ); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $checked; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if ( JTable::isCheckedOut($this->user->get ('id'), $row->checked_out ) ) {
|
||||
echo $this->escape($row->title);
|
||||
} else {
|
||||
?>
|
||||
<span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit Weblinks' );?>::<?php echo $this->escape($row->title); ?>">
|
||||
<a href="<?php echo $link; ?>">
|
||||
<?php echo $this->escape($row->title); ?></a></span>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<?php echo $published;?>
|
||||
</td>
|
||||
<td class="order">
|
||||
<span><?php echo $this->pagination->orderUpIcon( $i, ($row->catid == @$this->items[$i-1]->catid),'orderup', 'Move Up', $ordering ); ?></span>
|
||||
<span><?php echo $this->pagination->orderDownIcon( $i, $n, ($row->catid == @$this->items[$i+1]->catid), 'orderdown', 'Move Down', $ordering ); ?></span>
|
||||
<?php $disabled = $ordering ? '' : 'disabled="disabled"'; ?>
|
||||
<input type="text" name="order[]" size="5" value="<?php echo $row->ordering;?>" <?php echo $disabled ?> class="text_area" style="text-align: center" />
|
||||
</td>
|
||||
<td>
|
||||
<span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit Category' );?>::<?php echo $this->escape($row->category); ?>">
|
||||
<a href="<?php echo $row->cat_link; ?>" >
|
||||
<?php echo $this->escape($row->category); ?></a></span>
|
||||
</td>
|
||||
<td align="center">
|
||||
<?php echo $row->hits; ?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<?php echo $row->id; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$k = 1 - $k;
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="option" value="com_weblinks" />
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
|
||||
<?php echo JHTML::_( 'form.token' ); ?>
|
||||
</form>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: view.html.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @subpackage Weblinks
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is included in Joomla!
|
||||
defined('_JEXEC') or die( 'Restricted access' );
|
||||
|
||||
jimport( 'joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* HTML View class for the WebLinks component
|
||||
*
|
||||
* @static
|
||||
* @package Joomla
|
||||
* @subpackage Weblinks
|
||||
* @since 1.0
|
||||
*/
|
||||
class WeblinksViewWeblinks extends JView
|
||||
{
|
||||
function display($tpl = null)
|
||||
{
|
||||
global $mainframe, $option;
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
$uri =& JFactory::getURI();
|
||||
|
||||
$filter_state = $mainframe->getUserStateFromRequest( $option.'filter_state', 'filter_state', '', 'word' );
|
||||
$filter_catid = $mainframe->getUserStateFromRequest( $option.'filter_catid', 'filter_catid', 0, 'int' );
|
||||
$filter_order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'a.ordering', 'cmd' );
|
||||
$filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' );
|
||||
$search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' );
|
||||
$search = JString::strtolower( $search );
|
||||
|
||||
// Get data from the model
|
||||
$items = & $this->get( 'Data');
|
||||
$total = & $this->get( 'Total');
|
||||
$pagination = & $this->get( 'Pagination' );
|
||||
|
||||
// build list of categories
|
||||
$javascript = 'onchange="document.adminForm.submit();"';
|
||||
$lists['catid'] = JHTML::_('list.category', 'filter_catid', $option, intval( $filter_catid ), $javascript );
|
||||
|
||||
// state filter
|
||||
$lists['state'] = JHTML::_('grid.state', $filter_state );
|
||||
|
||||
// table ordering
|
||||
$lists['order_Dir'] = $filter_order_Dir;
|
||||
$lists['order'] = $filter_order;
|
||||
|
||||
// search filter
|
||||
$lists['search']= $search;
|
||||
|
||||
$this->assignRef('user', JFactory::getUser());
|
||||
$this->assignRef('lists', $lists);
|
||||
$this->assignRef('items', $items);
|
||||
$this->assignRef('pagination', $pagination);
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: weblinks.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @subpackage Weblinks
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
/*
|
||||
* Make sure the user is authorized to view this page
|
||||
*/
|
||||
$user = & JFactory::getUser();
|
||||
if (!$user->authorize( 'com_weblinks', 'manage' )) {
|
||||
$mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') );
|
||||
}
|
||||
|
||||
// Require the base controller
|
||||
require_once (JPATH_COMPONENT.DS.'controller.php');
|
||||
|
||||
$controller = new WeblinksController( );
|
||||
|
||||
// Perform the Request task
|
||||
$controller->execute( JRequest::getCmd('task'));
|
||||
$controller->redirect();
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<install type="component" version="1.5.0">
|
||||
<name>Weblinks</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>April 2006</creationDate>
|
||||
<copyright>(C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>1.5.0</version>
|
||||
<description>This component shows a listing of Weblinks</description>
|
||||
</install>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: admin.xmap.php 10 2008-09-20 22:36:33Z guilleva $
|
||||
* $LastChangedDate: 2008-09-20 16:36:33 -0600 (sáb, 20 sep 2008) $
|
||||
* $LastChangedBy: guilleva $
|
||||
* Xmap by Guillermo Vargas
|
||||
* a sitemap component for Joomla! CMS (http://www.joomla.org)
|
||||
* Author Website: http://joomla.vargas.co.cr
|
||||
* Project License: GNU/GPL http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
defined( '_JEXEC' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
$cid = JRequest::getVar('cid', array(0),"POST" );
|
||||
$task = JRequest::getVar('task', '' ,"REQUEST");
|
||||
|
||||
$live_site = substr_replace(JURI::root(), "", -1, 1);
|
||||
|
||||
jimport('joomla.filesystem.path');
|
||||
jimport('joomla.filesystem.file');
|
||||
|
||||
global $xmapComponentURL,$xmapSiteURL,$xmapComponentPath,$xmapAdministratorURL,$xmapLang,$xmapAdministratorPath;
|
||||
|
||||
$lang =& JFactory::getLanguage();
|
||||
$xmapLang = strtolower($lang->getBackwardLang());
|
||||
$xmapComponentPath = JPATH_ADMINISTRATOR.DS.'components'.DS.'com_xmap';
|
||||
$xmapComponentURL = $live_site.'/administrator/components/com_xmap';
|
||||
$xmapAdministratorPath = JPATH_ADMINISTRATOR;
|
||||
$xmapAdministratorURL = $live_site.'/administrator';
|
||||
$xmapSiteURL = $live_site;
|
||||
|
||||
// load language file
|
||||
if( file_exists( $xmapComponentPath.DS.'language'.DS . $xmapLang . '.php') ) {
|
||||
require_once( $xmapComponentPath.DS.'language'.DS.$xmapLang.'.php' );
|
||||
} else {
|
||||
if ($task != 'ajax_request') {
|
||||
echo 'Language file [ '. $xmapLang .' ] not found, using default language: english<br />';
|
||||
}
|
||||
$xmapLang = 'english';
|
||||
require_once( $xmapComponentPath.DS.'language'.DS.'english.php' );
|
||||
}
|
||||
|
||||
require_once( $xmapComponentPath.DS.'classes'.DS.'XmapAdmin.php' );
|
||||
|
||||
JToolBarHelper::title ( 'Xmap', 'generic' );
|
||||
|
||||
// load settings from database
|
||||
require_once( $xmapComponentPath.DS.'classes'.DS.'XmapConfig.php' );
|
||||
require_once( $xmapComponentPath.DS.'admin.xmap.html.php' );
|
||||
$config = new XmapConfig;
|
||||
if( !$config->load() ) {
|
||||
$text = _XMAP_ERR_NO_SETTINGS."<br />\n";
|
||||
$link = 'index2.php?option=com_xmap&task=create';
|
||||
echo sprintf( $text, $link );
|
||||
}
|
||||
|
||||
$admin = new XmapAdmin();
|
||||
$admin->show( $config, $task, $cid );
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: XmapCache.php 95 2010-04-14 18:38:36Z guilleva $
|
||||
* $LastChangedDate: 2010-04-14 12:38:36 -0600 (mié, 14 abr 2010) $
|
||||
* $LastChangedBy: guilleva $
|
||||
* Xmap by Guillermo Vargas
|
||||
* a sitemap component for Joomla! CMS (http://www.joomla.org)
|
||||
* Author Website: http://joomla.vargas.co.cr
|
||||
* Project License: GNU/GPL http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
defined( '_JEXEC' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
class XmapCache {
|
||||
/**
|
||||
* @return object A function cache object
|
||||
*/
|
||||
function &getCache( &$sitemap ) {
|
||||
$cache = &JFactory::getCache('com_xmap_'.$sitemap->id);
|
||||
$cache->setCaching($sitemap->usecache);
|
||||
$cache->setLifeTime($sitemap->cachelifetime);
|
||||
return $cache;
|
||||
}
|
||||
/**
|
||||
* Cleans the cache
|
||||
*/
|
||||
function cleanCache( &$sitemap ) {
|
||||
$cache =&XmapCache::getCache( $sitemap );
|
||||
if (class_exists('JFactory')) {
|
||||
return $cache->clean();
|
||||
} else {
|
||||
return $cache->clean( $cache->_group );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,284 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: XmapConfig.php 95 2010-04-14 18:38:36Z guilleva $
|
||||
* $LastChangedDate: 2010-04-14 12:38:36 -0600 (mié, 14 abr 2010) $
|
||||
* $LastChangedBy: guilleva $
|
||||
* Xmap by Guillermo Vargas
|
||||
* a sitemap component for Joomla! CMS (http://www.joomla.org)
|
||||
* Author Website: http://joomla.vargas.co.cr
|
||||
* Project License: GNU/GPL http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
/** Wraps all configuration functions for Xmap */
|
||||
|
||||
defined( '_JEXEC' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_xmap'.DS.'classes'.DS.'XmapSitemap.php');
|
||||
require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_xmap'.DS.'classes'.DS.'XmapPlugin.php');
|
||||
|
||||
class XmapConfig {
|
||||
var $version = '1.1';
|
||||
var $classname = 'sitemap';
|
||||
var $expand_category = 1;
|
||||
var $expand_section = 1;
|
||||
var $show_menutitle = 1;
|
||||
var $columns = 1;
|
||||
var $exlinks = 1;
|
||||
var $ext_image = 'img_grey.gif';
|
||||
var $exclmenus = '';
|
||||
var $includelink = 1;
|
||||
var $sitemap_default = 1;
|
||||
var $exclude_css = 0;
|
||||
var $exclude_xsl = 0;
|
||||
|
||||
function XmapConfig () {
|
||||
$version = '1.2';
|
||||
$classname = 'sitemap';
|
||||
$expand_category = 1;
|
||||
$expand_section = 1;
|
||||
$show_menutitle = 1;
|
||||
$columns = 1;
|
||||
$exlinks = 1;
|
||||
$ext_image = 'img_grey.gif';
|
||||
$exclmenus = '';
|
||||
$includelink = 1;
|
||||
$sitemap_default = 1;
|
||||
$exclude_css = 0;
|
||||
$exclude_xsl = 0;
|
||||
|
||||
}
|
||||
|
||||
/** Return $menus as an associative array */
|
||||
function &getSitemaps() {
|
||||
$db = & JFactory::getDBO();
|
||||
|
||||
$query = "SELECT id FROM #__xmap_sitemap";
|
||||
$db->setQuery($query);
|
||||
$ids = $db->loadResultArray();
|
||||
$sitemaps = array();
|
||||
foreach ($ids as $id ) {
|
||||
$sitemap = new XmapSitemap($db);
|
||||
$sitemap->load($id);
|
||||
$sitemaps[] = $sitemap;
|
||||
}
|
||||
return $sitemaps;
|
||||
|
||||
}
|
||||
|
||||
/** Create the settings table for Xmap and add initial default values */
|
||||
function create() {
|
||||
$db = & JFactory::getDBO();
|
||||
jimport('joomla.filesystem.file');
|
||||
|
||||
$fields = array();
|
||||
$fields[] = "`name` varchar(30) not null primary key";
|
||||
$fields[] = "`value` varchar(100)";
|
||||
|
||||
|
||||
$query = "CREATE TABLE IF NOT EXISTS #__xmap (". implode(', ', $fields) .")";
|
||||
$db->setQuery( $query );
|
||||
if( $db->query() === FALSE ) {
|
||||
echo _XMAP_ERR_NO_CREATE . "<br />\n";
|
||||
echo stripslashes($db->getErrorMsg());
|
||||
return false;
|
||||
}
|
||||
|
||||
$fields = array();
|
||||
$fields[] = "`id` int not null primary key auto_increment";
|
||||
$fields[] = "`extension` varchar(100) not null";
|
||||
$fields[] = "`published` int(1) default 0";
|
||||
$fields[] = "`params` text";
|
||||
|
||||
$query = "CREATE TABLE IF NOT EXISTS #__xmap_ext (". implode(', ', $fields) .")";
|
||||
$db->setQuery( $query );
|
||||
if( $db->query() === FALSE ) {
|
||||
echo _XMAP_ERR_NO_CREATE . "<br />\n";
|
||||
echo stripslashes($db->getErrorMsg());
|
||||
return false;
|
||||
}
|
||||
|
||||
$extensions = array (
|
||||
// name published
|
||||
array( 'com_agora', 1),
|
||||
array( 'com_contact', 1),
|
||||
array( 'com_content', 1),
|
||||
array( 'com_eventlist', 1),
|
||||
array( 'com_g2bridge', 1),
|
||||
array( 'com_glossary', 1),
|
||||
array( 'com_hotproperty', 1),
|
||||
array( 'com_jcalpro', 1),
|
||||
array( 'com_jdownloads', 1),
|
||||
array( 'com_jevents', 1),
|
||||
array( 'com_jmovies', 1),
|
||||
array( 'com_jomres', 1),
|
||||
array( 'com_joomdoc', 1),
|
||||
array( 'com_joomgallery', 1),
|
||||
array( 'com_kb', 1),
|
||||
array( 'com_kunena', 1),
|
||||
array( 'com_mtree', 1),
|
||||
array( 'com_myblog', 1),
|
||||
array( 'com_rapidrecipe', 1),
|
||||
array( 'com_remository', 1),
|
||||
array( 'com_resource', 1),
|
||||
array( 'com_rokdownloads', 1),
|
||||
array( 'com_rsgallery2', 1),
|
||||
array( 'com_sectionex', 1),
|
||||
array( 'com_cmsshopbuilder', 1),
|
||||
array( 'com_sobi2', 1),
|
||||
array( 'com_virtuemart', 1),
|
||||
array( 'com_weblinks', 1)
|
||||
);
|
||||
|
||||
foreach ( $extensions as $ext ) {
|
||||
$query = "SELECT COUNT(*) FROM `#__xmap_ext` WHERE extension='{$ext[0]}'";
|
||||
$db->setQuery($query);
|
||||
$extension = new XmapPlugin($db);
|
||||
$extension->extension = $ext[0];
|
||||
$extension->published = $ext[1];
|
||||
$xmlfile = $extension->getXmlPath();
|
||||
JFile::move("$xmlfile.txt",$xmlfile);
|
||||
$extension->setParams($extension->loadDefaultsParams(true),'-1');
|
||||
if ( $db->loadResult() == 0 ) {
|
||||
$extension->store();
|
||||
}
|
||||
}
|
||||
|
||||
$vars = get_class_vars('XmapSitemap');
|
||||
$fields = '';
|
||||
foreach($vars as $name => $value) {
|
||||
if ($name[0]!=='_') {
|
||||
if ($name == 'id') {
|
||||
$fields[] = 'id INT NOT NULL PRIMARY KEY AUTO_INCREMENT';
|
||||
} else {
|
||||
switch( gettype( $value ) ) {
|
||||
case 'integer':
|
||||
$fields[] = "`$name` INTEGER NULL";
|
||||
break;
|
||||
case 'string':
|
||||
if( $name == 'menus' || $name == 'excluded_items')
|
||||
$fields[] = "`$name` TEXT NULL";
|
||||
else
|
||||
$fields[] = "`$name` VARCHAR(255) NULL";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$query = "CREATE TABLE IF NOT EXISTS #__xmap_sitemap (". implode(', ', $fields) .")";
|
||||
$db->setQuery( $query );
|
||||
if( $db->query() === FALSE ) {
|
||||
echo _XMAP_ERR_NO_CREATE . "<br />\n";
|
||||
echo stripslashes($db->getErrorMsg());
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = "CREATE TABLE IF NOT EXISTS #__xmap_items ( uid varchar(100) not null, itemid int not null, view varchar(10) not null, sitemap_id int not null, properties varchar(300), primary key (uid,itemid,view,sitemap_id),index (uid,itemid),index (view));";
|
||||
$db->setQuery( $query );
|
||||
if( $db->query() === FALSE ) {
|
||||
echo _XMAP_ERR_NO_CREATE . "<br />\n";
|
||||
echo stripslashes($db->getErrorMsg());
|
||||
return false;
|
||||
}
|
||||
|
||||
echo _XMAP_MSG_SET_DB_CREATED . "<br />\n";
|
||||
|
||||
|
||||
// Insert default Settings
|
||||
|
||||
$query = "SELECT COUNT(*) from `#__xmap_sitemap`";
|
||||
$db->setQuery($query);
|
||||
if ( $db->loadResult() == 0 ) {
|
||||
$sitemap = new XmapSitemap($db);
|
||||
$sitemap->save();
|
||||
}
|
||||
|
||||
$query = "SELECT COUNT(*) from `#__xmap`";
|
||||
$db->setQuery($query);
|
||||
if ( $db->loadResult() == 0 ) {
|
||||
$fields = array();
|
||||
$vars = get_class_vars('XmapConfig');
|
||||
foreach($vars as $name => $value) {
|
||||
if ($name == 'sitemap_default') {
|
||||
$value = $sitemap->id;
|
||||
}
|
||||
$query = "INSERT INTO #__xmap (`name`,`value`) values ('$name','$value')";
|
||||
$db->setQuery( $query );
|
||||
if( $db->query() === FALSE ) {
|
||||
echo _XMAP_ERR_NO_DEFAULT_SET . "<br />\n";
|
||||
echo stripslashes($db->getErrorMsg());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo _XMAP_MSG_SET_DEF_INSERT . "<br />\n";
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Remove the settings table */
|
||||
function remove() {
|
||||
$db = & JFactory::getDBO();
|
||||
$querys[] = "DROP TABLE IF EXISTS #__xmap";
|
||||
$querys[] = "DROP TABLE IF EXISTS #__xmap_sitemap";
|
||||
$querys[] = "DROP TABLE IF EXISTS #__xmap_ext";
|
||||
$querys[] = "DROP TABLE IF EXISTS #__xmap_items";
|
||||
foreach ($querys as $query) {
|
||||
$db->setQuery( $query );
|
||||
if( $db->query() === FALSE ) {
|
||||
echo _XMAP_ERR_NO_DROP_DB . "<br />\n";
|
||||
echo stripslashes($db->getErrorMsg());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
echo "Xmap's tables have been saved!<br />\n";
|
||||
|
||||
}
|
||||
|
||||
/** Load settings from the database into this instance */
|
||||
function load() {
|
||||
$db = & JFactory::getDBO();
|
||||
|
||||
$query = "SELECT * FROM #__xmap";
|
||||
$db->setQuery( $query );
|
||||
if ($result = $db->loadAssocList('name') ) {
|
||||
foreach ($result as $name => $row) {
|
||||
$this->$name = $row['value'];
|
||||
}
|
||||
return true; // defaults are still set, though
|
||||
}
|
||||
$this->_sitemaps = array();
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Save current settings to the database */
|
||||
function save() {
|
||||
$db = & JFactory::getDBO();
|
||||
|
||||
$vars = get_object_vars( $this );
|
||||
$query = "DELETE FROM `#__xmap`";
|
||||
$db->setQuery( $query );
|
||||
$db->query();
|
||||
foreach($vars as $name => $value) {
|
||||
if ( substr($name,0,1) !== '_' ) {
|
||||
$query = "INSERT INTO #__xmap (`name`,`value`) values ('$name','$value')";
|
||||
$db->setQuery( $query );
|
||||
if ( $db->query() === FALSE ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Debug output of current settings */
|
||||
function dump() {
|
||||
$vars = get_object_vars( $this );
|
||||
echo '<pre style="text-align:left">';
|
||||
foreach( $vars as $name => $value ) {
|
||||
echo $name.': '.$value."\n";
|
||||
}
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: XmapNav.php 67 2009-11-26 18:56:32Z guilleva $
|
||||
* $LastChangedDate: 2009-11-26 12:56:32 -0600 (jue, 26 nov 2009) $
|
||||
* $LastChangedBy: guilleva $
|
||||
* Xmap by Guillermo Vargas
|
||||
* A Sitemap component for Joomla! CMS (http://www.joomla.org)
|
||||
* Author Website: http://joomla.vargas.co.cr
|
||||
* Project License: GNU/GPL http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
class XmapNav {
|
||||
var $_list;
|
||||
/** @var XmapConfig Configuration settings */
|
||||
var $config;
|
||||
/** @var XmapSitemap Configuration settings */
|
||||
var $sitemap;
|
||||
/** @var integer The current user's access level */
|
||||
var $gid;
|
||||
/** @var boolean Is authentication disabled for this website? */
|
||||
var $noauth;
|
||||
/** @var string Current time as a ready to use SQL timeval */
|
||||
var $now;
|
||||
/** @var object Access restrictions for user */
|
||||
var $access;
|
||||
/** @var string Type of sitemap to be generated */
|
||||
var $view;
|
||||
/** @var string count of links on sitemap */
|
||||
var $count=0;
|
||||
var $isNews = 0;
|
||||
|
||||
function XmapNav(&$config, &$sitemap) {
|
||||
$this->_list=array();
|
||||
$this->view='navigator';
|
||||
global $mainframe;
|
||||
|
||||
jimport('joomla.utilities.date');
|
||||
|
||||
$user =& JFactory::getUser();
|
||||
|
||||
$access = new stdClass();
|
||||
$access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all');
|
||||
$access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own');
|
||||
$access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all');
|
||||
$this->access = &$access;
|
||||
|
||||
$date = new JDate();
|
||||
|
||||
$this->noauth = $mainframe->getCfg( 'shownoauth' );
|
||||
$this->gid = $user->get('gid');
|
||||
$this->now = $date->toUnix();
|
||||
$this->config = &$config;
|
||||
$this->sitemap = &$sitemap;
|
||||
$this->isNews = false;
|
||||
$this->_isAdmin = ($this->gid == "25");
|
||||
|
||||
}
|
||||
|
||||
function printNode( &$node ) {
|
||||
if (!isset($node->selectable )) {
|
||||
$node->selectable=true;
|
||||
}
|
||||
// For extentions that doesn't set this property as this is new in Xmap 1.2.3
|
||||
if (!isset($node->expandible )) {
|
||||
$node->expandible = true;
|
||||
}
|
||||
if ( empty($this->_list[$node->uid]) ) { // Avoid duplicated items
|
||||
$this->_list[$node->uid] = $node;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function startOutput( &$menus, &$config ) {
|
||||
}
|
||||
function endOutput( &$menus ) {
|
||||
}
|
||||
|
||||
function startMenu(&$menu) {
|
||||
return true;
|
||||
}
|
||||
function changeLevel($level){
|
||||
return true;
|
||||
}
|
||||
function endMenu(&$menu) {
|
||||
return true;
|
||||
}
|
||||
function &expandLink(&$parent,&$extensions) {
|
||||
$items = &JSite::getMenu();
|
||||
$rows = null;
|
||||
if (strpos($parent->link,'-menu-') === 0 ) {
|
||||
$menutype = str_replace('-menu-','',$parent->link);
|
||||
// Get Menu Items
|
||||
$rows = $items->getItems('menutype', $menutype);
|
||||
} elseif ($parent->id) {
|
||||
$rows = $items->getItems('parent', $parent->id);
|
||||
}
|
||||
if ( $rows ) {
|
||||
$router = JSite::getRouter();
|
||||
foreach ($rows as $item) {
|
||||
if ($item->parent == $parent->id) {
|
||||
$item->mid = $item->id;
|
||||
if ($item->type == 'menulink') {
|
||||
$menu = &JSite::getMenu();
|
||||
$params = new JParameter($item->params);
|
||||
if ($newItem = $menu->getItem($params->get('menu_item'))) {
|
||||
$item->type = $newItem->type;
|
||||
$item->mid = $newItem->id;
|
||||
$item->parent = $newItem->parent;
|
||||
$item->link = $newItem->link;
|
||||
}
|
||||
}
|
||||
|
||||
$node = new stdclass;
|
||||
$node->name = $item->name;
|
||||
$node->id = $item->id;
|
||||
$node->uid = 'itemid'.$item->id;
|
||||
$node->link = $item->link;
|
||||
$node->expandible = true;
|
||||
$node->selectable=true;
|
||||
// Prepare the node link
|
||||
XmapPlugins::prepareMenuItem($node,$extensions);
|
||||
if ( $item->home ) {
|
||||
$node->link = JURI::root();
|
||||
} elseif (substr($item->link,0,9) == 'index.php' && $item->type != 'url' && $item->type != 'separator') {
|
||||
if ( strpos($node->link,'Itemid=') === FALSE ){
|
||||
$node->link = $router->getMode() == JROUTER_MODE_SEF ? 'index.php?Itemid='.$node->id : $node->link.'&Itemid='.$node->id;
|
||||
}
|
||||
}
|
||||
$this->printNode($node); // Add to the internal list
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($parent->id) {
|
||||
$option = null;
|
||||
if ( preg_match('#^/?index.php.*option=(com_[^&]+)#',$parent->link,$matches) ) {
|
||||
$option = $matches[1];
|
||||
}
|
||||
$Itemid = JRequest::getInt('Itemid');
|
||||
if (!$option && $Itemid) {
|
||||
$item = $items->getItem($Itemid);
|
||||
if ( preg_match('#^/?index.php.*option=(com_[^&]+)#',$item->link,$matches) ) {
|
||||
$option = $matches[1];
|
||||
$parent->link = $item->link;
|
||||
}
|
||||
}
|
||||
if ( $option ) {
|
||||
if ( !empty($extensions[$option]) ) {
|
||||
$parent->uid = $option;
|
||||
$className = 'xmap_'.$option;
|
||||
$result = call_user_func_array(array($className, 'getTree'),array(&$this,&$parent,$extensions[$option]->getParams()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->_list;;
|
||||
}
|
||||
|
||||
function &getParam($arr, $name, $def) {
|
||||
$var = JArrayHelper::getValue( $arr, $name, $def, '' );
|
||||
return $var;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/**
|
||||
* The XmapPlugin
|
||||
* @author Guillermo Vargas, http://joomla.vargas.co.cr
|
||||
* @email [email protected], http://joomla.vargas.co.cr
|
||||
* @package Xmap
|
||||
*/
|
||||
|
||||
defined( '_JEXEC' ) or die( 'Direct Access to this location is not allowed.' );
|
||||
|
||||
/** Wraps all configuration functions for Xmap */
|
||||
class XmapPlugin extends JTable {
|
||||
var $id = '';
|
||||
var $extension = '';
|
||||
var $published = 0;
|
||||
var $params = '';
|
||||
var $_params = '';
|
||||
|
||||
function XmapPlugin(&$_db,$id=NULL) {
|
||||
parent::__construct( '#__xmap_ext', 'id', $_db );
|
||||
if ($id) {
|
||||
$this->load($id);
|
||||
}
|
||||
}
|
||||
|
||||
function &getParams($Itemid='-1',$asTXT=0) {
|
||||
if (!is_array($this->_params)) {
|
||||
$this->parseParams();
|
||||
}
|
||||
if (!empty($this->_params[$Itemid])) {
|
||||
$params = $this->_params[$Itemid];
|
||||
} else {
|
||||
$params = $this->_params[-1];
|
||||
}
|
||||
if ($asTXT) {
|
||||
return $params['__TXT__'];
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
function parseParams() {
|
||||
$this->_params =array('-1'=>array());
|
||||
if ($this->params) {
|
||||
preg_match_all('/(.?[0-9]+){([^}]+)}/',$this->params,$paramsList);
|
||||
$count = count($paramsList[1]);
|
||||
for ($i=0; $i < $count; $i++) {
|
||||
$this->_params[$paramsList[1][$i]] = $this->paramsToArray($paramsList[2][$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function &loadDefaultsParams ($asText) {
|
||||
global $mosConfig_absolute_path;
|
||||
$path = $this->getXmlPath();
|
||||
$xmlDoc = new DOMIT_Lite_Document();
|
||||
$xmlDoc->resolveErrors( true );
|
||||
|
||||
$params=null;
|
||||
if ($xmlDoc->loadXML( $path, false, true )) {
|
||||
$root =& $xmlDoc->documentElement;
|
||||
|
||||
$tagName = $root->getTagName();
|
||||
$isParamsFile = ($tagName == 'mosinstall' || $tagName == 'install' || $tagName == 'mosparams');
|
||||
if ($isParamsFile && $root->getAttribute( 'type' ) == 'xmap_ext') {
|
||||
$params = &$root->getElementsByPath( 'params', 1 );
|
||||
}
|
||||
}
|
||||
|
||||
$result = ($asText)? '' : array();
|
||||
|
||||
if (is_object( $params )) {
|
||||
foreach ($params->childNodes as $param) {
|
||||
$name = $param->getAttribute( 'name' );
|
||||
$label = $param->getAttribute( 'label' );
|
||||
|
||||
$key = $name ? $name : $label;
|
||||
if ( $label != '@spacer' && $name != '@spacer') {
|
||||
$value = str_replace("\n",'\n',$param->getAttribute( 'default' ));
|
||||
if ($asText) {
|
||||
$result.="$key=$value\n";
|
||||
} else {
|
||||
$result[$key]=$value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/** convert a menuitem's params field to an array */
|
||||
function paramsToArray( &$menuparams ) {
|
||||
$tmp = explode("\n", $menuparams);
|
||||
$res = array();
|
||||
foreach($tmp AS $a) {
|
||||
@list($key, $val) = explode('=', $a, 2);
|
||||
$res[$key] = str_replace('\n',"\n",$val);
|
||||
}
|
||||
$res['__TXT__'] = $menuparams;
|
||||
return $res;
|
||||
}
|
||||
|
||||
function setParams($params,$itemid) {
|
||||
$this->_params[$itemid] = $params;
|
||||
}
|
||||
|
||||
function getXmlPath () {
|
||||
return JPATH_ADMINISTRATOR.DS.'components'.DS.'com_xmap'.DS.'extensions'.DS.$this->extension.'.xml';
|
||||
}
|
||||
|
||||
function store() {
|
||||
if (is_array($this->_params)) {
|
||||
$this->params='';
|
||||
foreach ($this->_params as $itemid => $params) {
|
||||
if ($params) {
|
||||
$this->params .= $itemid . '{' . $params . '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
return JTable::store();
|
||||
}
|
||||
|
||||
function restore() {
|
||||
$database = & JFactory::getDBO();
|
||||
$query = "select * from #__xmap_ext where extension='".$this->extension.".bak'";
|
||||
$database->setQuery($query);
|
||||
if ($row = $database->loadObject()) {
|
||||
$this->params=$row->params;
|
||||
JTable::store();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user