添加到 trunk
+YUCHENG HU+ git-svn-id: https://svn.code.sf.net/p/hawebs/svn@332 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: groups.php 47 2009-05-26 18:06:30Z happynoodleboy $
|
||||
* @package Joomla.Framework
|
||||
* @subpackage Table
|
||||
* @copyright Copyright (C) 2005 - 2007 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 within the rest of the framework
|
||||
defined('JPATH_BASE') or die();
|
||||
|
||||
/**
|
||||
* Plugin table
|
||||
*
|
||||
* @package Joomla.Framework
|
||||
* @subpackage Table
|
||||
* @since 1.0
|
||||
*/
|
||||
class JCETableGroups extends JTable
|
||||
{
|
||||
/**
|
||||
* Primary Key
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
var $id = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var varchar
|
||||
*/
|
||||
var $name = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var varchar
|
||||
*/
|
||||
var $description = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var varchar
|
||||
*/
|
||||
var $components = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var varchar
|
||||
*/
|
||||
var $users = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var varchar
|
||||
*/
|
||||
var $types = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var varchar
|
||||
*/
|
||||
var $rows = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var varchar
|
||||
*/
|
||||
var $plugins = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var tinyint
|
||||
*/
|
||||
var $published = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var tinyint
|
||||
*/
|
||||
var $ordering = 1;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var int unsigned
|
||||
*/
|
||||
var $checked_out = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var datetime
|
||||
*/
|
||||
var $checked_out_time = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var text
|
||||
*/
|
||||
var $params = null;
|
||||
|
||||
function __construct(& $db) {
|
||||
parent::__construct('#__jce_groups', 'id', $db);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded bind function
|
||||
*
|
||||
* @access 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 (isset( $array['params'] ) && is_array($array['params']))
|
||||
{
|
||||
$registry = new JRegistry();
|
||||
$registry->loadArray($array['params']);
|
||||
$array['params'] = $registry->toString();
|
||||
}
|
||||
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
class JCEGroupsHelper {
|
||||
function getUserGroupFromId( $id ){
|
||||
$db =& JFactory::getDBO();
|
||||
|
||||
$query = 'SELECT *'
|
||||
. ' FROM #__jce_groups'
|
||||
. ' WHERE '.$id.' IN (users)'
|
||||
;
|
||||
$db->setQuery( $query );
|
||||
$groups = $db->loadObjectList();
|
||||
return $groups[0];
|
||||
}
|
||||
function getUserGroupFromType( $type ){
|
||||
$db =& JFactory::getDBO();
|
||||
|
||||
if(!is_int($type)){
|
||||
$query = 'SELECT id'
|
||||
. ' FROM #__core_acl_aro_groups'
|
||||
. ' WHERE name = "'.$type.'"'
|
||||
;
|
||||
$db->setQuery( $query );
|
||||
$id = $db->loadResult();
|
||||
}
|
||||
|
||||
$query = 'SELECT *'
|
||||
. ' FROM #__jce_groups'
|
||||
. ' WHERE '.$type.' IN (types)'
|
||||
;
|
||||
$db->setQuery( $query );
|
||||
$groups = $db->loadObjectList();
|
||||
return $groups[0];
|
||||
}
|
||||
function getRowArray($rows){
|
||||
$out = array();
|
||||
$rows = explode(';', $rows);
|
||||
$i = 1;
|
||||
foreach($rows as $row){
|
||||
$out[$i] = $row;
|
||||
$i++;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
@@ -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 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: view.html.php 100 2009-06-21 19:19:46Z happynoodleboy $
|
||||
* @package JCE
|
||||
* @copyright Copyright (C) 2009 Ryan Demmer. All rights reserved.
|
||||
* @license GNU/GPL
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
jimport( 'joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* HTML View class for the Plugins component
|
||||
*
|
||||
* @static
|
||||
* @package Joomla
|
||||
* @subpackage Plugins
|
||||
* @since 1.0
|
||||
*/
|
||||
class GroupsViewGroup extends JView
|
||||
{
|
||||
function display( $tpl = null )
|
||||
{
|
||||
global $option;
|
||||
|
||||
require_once( JPATH_ADMINISTRATOR .DS. 'components' .DS. 'com_jce' .DS. 'groups' .DS. 'helper.php' );
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
$user =& JFactory::getUser();
|
||||
|
||||
JHTML::_('behavior.tooltip');
|
||||
JHTML::_('behavior.modal');
|
||||
|
||||
$cid = JRequest::getVar( 'cid', array(0), '', 'array' );
|
||||
JArrayHelper::toInteger( $cid, array(0) );
|
||||
|
||||
$lists = array();
|
||||
$row =& JTable::getInstance('groups', 'JCETable');
|
||||
|
||||
// load the row from the db table
|
||||
$row->load( $cid[0] );
|
||||
|
||||
// fail if checked out not by 'me'
|
||||
|
||||
if( $row->isCheckedOut( $user->get('id') ) ){
|
||||
$msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The Group' ), $row->name );
|
||||
$this->setRedirect( 'index.php?option='. $option .'&type=group', $msg, 'error' );
|
||||
return false;
|
||||
}
|
||||
// Load editor
|
||||
$editor =& JPluginHelper::getPlugin('editors', 'jce');
|
||||
|
||||
// Load Language
|
||||
$lang =& JFactory::getLanguage();
|
||||
$lang->load( 'com_jce', JPATH_SITE );
|
||||
|
||||
// Get all plugins/commands
|
||||
$query = 'SELECT *'
|
||||
. ' FROM #__jce_plugins'
|
||||
. ' WHERE published = 1'
|
||||
;
|
||||
|
||||
$db->setQuery( $query );
|
||||
$plugins = $db->loadObjectList();
|
||||
|
||||
// load the row from the db table
|
||||
if( $cid[0] ){
|
||||
$row->checkout( $user->get('id') );
|
||||
}else{
|
||||
$query = 'SELECT COUNT(id)'
|
||||
. ' FROM #__jce_groups'
|
||||
;
|
||||
$db->setQuery( $query );
|
||||
$total = $db->loadResult();
|
||||
|
||||
$row->name = '';
|
||||
$row->description = '';
|
||||
$row->types = '';
|
||||
$row->components = '';
|
||||
$row->types = '';
|
||||
$row->rows = '';
|
||||
$row->plugins = '';
|
||||
$row->published = 1;
|
||||
$row->ordering = 0;
|
||||
$row->params = '';
|
||||
|
||||
$row->params .= $editor->params;
|
||||
|
||||
foreach( $plugins as $plugin ){
|
||||
if( $plugin->type == 'plugin' ){
|
||||
$row->params .= $plugin->params;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// build the html select list for ordering
|
||||
$query = 'SELECT ordering AS value, name AS text'
|
||||
. ' FROM #__jce_groups'
|
||||
. ' WHERE published = 1'
|
||||
. ' AND ordering > -10000'
|
||||
. ' AND ordering < 10000'
|
||||
. ' ORDER BY ordering'
|
||||
;
|
||||
$order = JHTML::_('list.genericordering', $query );
|
||||
$lists['ordering'] = JHTML::_('select.genericlist', $order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval( $row->ordering ) );
|
||||
$lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published );
|
||||
|
||||
// Get components list
|
||||
$query = "SELECT *"
|
||||
. " FROM #__components"
|
||||
. " WHERE link <> ''"
|
||||
. " AND parent = 0"
|
||||
. " AND enabled = 1"
|
||||
. " ORDER BY name";
|
||||
$db->setQuery( $query );
|
||||
$components = $db->loadObjectList();
|
||||
|
||||
$options = array();
|
||||
$options[] = JHTML::_('select.option', '', JText::_( 'All Components' ) );
|
||||
foreach( $components as $component ){
|
||||
$options[] = JHTML::_('select.option', $component->option, JText::_( $component->name ) );
|
||||
}
|
||||
$lists['components'] = JHTML::_('select.genericlist', $options, 'components[]', 'class="inputbox levels" size="10" multiple="multiple"', 'value', 'text', $row->components == '' ? '' : explode( ',', $row->components ) );
|
||||
|
||||
$query = 'SELECT types'
|
||||
. ' FROM #__jce_groups'
|
||||
// Exclude ROOT, USERS, Super Administrator, Public Frontend, Public Backend
|
||||
. ' WHERE id NOT IN (17,28,29,30)'
|
||||
;
|
||||
$db->setQuery( $query );
|
||||
$types = $db->loadResultArray();
|
||||
|
||||
// get list of Groups for dropdown filter
|
||||
$query = 'SELECT id AS value, name AS text'
|
||||
. ' FROM #__core_acl_aro_groups'
|
||||
// Exclude ROOT, USERS, Super Administrator, Public Frontend, Public Backend
|
||||
. ' WHERE id NOT IN (17,28,29,30)'
|
||||
;
|
||||
$db->setQuery( $query );
|
||||
$types = $db->loadObjectList();
|
||||
|
||||
$i = '-';
|
||||
$options = array( JHTML::_('select.option', '0', JText::_( 'Guest' ) ) );
|
||||
foreach( $types as $type ){
|
||||
$options[] = JHTML::_('select.option', $type->value, $i . JText::_( $type->text ) );
|
||||
$i .= '-';
|
||||
}
|
||||
$lists['types'] = JHTML::_('select.genericlist', $options, 'types[]', 'class="inputbox levels" size="8" multiple="multiple"', 'value', 'text', $row->types == '' ? '' : explode( ',', $row->types ) );
|
||||
|
||||
$options = array();
|
||||
if( $row->id && $row->users ){
|
||||
$query = 'SELECT id as value, username as text'
|
||||
. ' FROM #__users'
|
||||
. ' WHERE id IN ('.$row->users.')'
|
||||
;
|
||||
|
||||
$db->setQuery( $query );
|
||||
$gusers = $db->loadObjectList();
|
||||
if( $gusers ){
|
||||
foreach( $gusers as $guser ){
|
||||
$options[] = JHTML::_('select.option', $guser->value, $guser->text );
|
||||
}
|
||||
}
|
||||
}
|
||||
$lists['users'] = JHTML::_('select.genericlist', $options, 'users[]', 'class="inputbox users" size="10" multiple="multiple"', 'value', 'text', '' );
|
||||
|
||||
// get params definitions
|
||||
$xml = JCE_LIBRARIES.DS.'xml'.DS.'config'.DS.'config.xml';
|
||||
if (!file_exists($xml)) {
|
||||
$xml = JPATH_PLUGINS.DS.'editors'.DS.'jce.xml';
|
||||
}
|
||||
|
||||
$params = new JParameter( $row->params, $xml );
|
||||
|
||||
$params->addElementPath( JPATH_COMPONENT . DS . 'elements' );
|
||||
|
||||
$rows = str_replace( ';', ',', $row->rows );
|
||||
|
||||
$this->assignRef('lists', $lists);
|
||||
$this->assignRef('group', $row);
|
||||
$this->assignRef('params', $params);
|
||||
$this->assignRef('plugins', $plugins);
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
<?php defined('_JEXEC') or die('Restricted access'); ?>
|
||||
|
||||
<?php JHTML::_('behavior.tooltip'); ?>
|
||||
<?php JHTML::stylesheet('icons.css', 'administrator/components/com_jce/css/'); ?>
|
||||
|
||||
<?php
|
||||
$rows =& $this->items;
|
||||
|
||||
JToolBarHelper::title( JText::_( 'JCE Group Manager' ), 'user.png' );
|
||||
|
||||
JToolBarHelper::editListX();
|
||||
JToolBarHelper::addNewX();
|
||||
JToolBarHelper::custom( 'copy', 'copy.png', 'copy_f2.png', JText::_('Copy'), true );
|
||||
if( count( $rows ) > 1 ){
|
||||
JToolBarHelper::publishList();
|
||||
JToolBarHelper::unpublishList();
|
||||
JToolBarHelper::deleteList();
|
||||
}
|
||||
JToolBarHelper::cancel( 'cancel', JText::_( 'Close' ) );
|
||||
jceToolbarHelper::help( 'groups' );
|
||||
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function submitbutton(pressbutton) {
|
||||
var form = document.adminForm;
|
||||
// Cancel button
|
||||
if (pressbutton == "cancelEdit") {
|
||||
submitform(pressbutton);
|
||||
return;
|
||||
}
|
||||
// validation
|
||||
if (form.name.value == "") {
|
||||
alert( "<?php echo JText::_( 'Group must have a name', true ); ?>" );
|
||||
} else {
|
||||
submitform(pressbutton);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<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.submit();"><?php echo JText::_( 'Reset' ); ?></button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="adminlist">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="1%">
|
||||
<?php echo JText::_( 'Num' ); ?>
|
||||
</th>
|
||||
<th width="1%">
|
||||
<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows );?>);" />
|
||||
</th>
|
||||
<th class="title" width="20%">
|
||||
<?php echo JHTML::_('grid.sort', 'Name', 'g.name', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th class="title">
|
||||
<?php echo JHTML::_('grid.sort', 'Description', 'g.description', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th nowrap="nowrap" width="5%">
|
||||
<?php echo JHTML::_('grid.sort', 'Published', 'g.published', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th nowrap="nowrap" width="8%" >
|
||||
<?php echo JHTML::_('grid.sort', 'Priority', 'g.ordering', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
<?php if( count( $rows ) > 1 ){ echo JHTML::_('grid.order', $rows );}?>
|
||||
</th>
|
||||
<th nowrap="nowrap" width="1%" class="title">
|
||||
<?php echo JHTML::_('grid.sort', 'ID', 'g.id', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="12">
|
||||
<?php echo $this->pagination->getListFooter(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<?php
|
||||
$k = 0;
|
||||
for ($i=0, $n=count( $rows ); $i < $n; $i++) {
|
||||
$row = $rows[$i];
|
||||
|
||||
$link = JRoute::_( 'index.php?option=com_jce&type=group&task=edit&cid[]='. $row->id );
|
||||
if( $n == 1){
|
||||
$published = JHTMLImage::administrator('tick.png');
|
||||
}else{
|
||||
$published = JHTML::_('grid.published', $row, $i );
|
||||
}
|
||||
$checked = JHTML::_('grid.checkedout', $row, $i );
|
||||
$ordering = ($this->lists['order'] == 'g.ordering');
|
||||
?>
|
||||
<tr class="<?php echo "row$k"; ?>">
|
||||
<td align="right">
|
||||
<?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 $row->name;
|
||||
} else {
|
||||
?>
|
||||
<span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit Group' );?>::<?php echo $row->name; ?>">
|
||||
<a href="<?php echo $link; ?>">
|
||||
<?php echo $row->name; ?></a></span>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $row->description;?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<?php echo $published;?>
|
||||
</td>
|
||||
<td class="order">
|
||||
<span><?php echo $this->pagination->orderUpIcon( $i, ($row->ordering > -10000 && $row->ordering < 10000), 'orderup', 'Move Up', $ordering ); ?></span>
|
||||
<span><?php echo $this->pagination->orderDownIcon( $i, $n, ($row->ordering > -10000 && $row->ordering < 10000), 'orderdown', 'Move Down', $ordering ); ?></span>
|
||||
<?php $disabled = $n > 1? '' : '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 align="center">
|
||||
<?php echo $row->id;?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$k = 1 - $k;
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="hidden" name="option" value="com_jce" />
|
||||
<input type="hidden" name="task" value="view" />
|
||||
<input type="hidden" name="type" value="group" />
|
||||
<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,105 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: view.html.php 47 2009-05-26 18:06:30Z happynoodleboy $
|
||||
* @package Joomla
|
||||
* @subpackage Config
|
||||
* @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' );
|
||||
|
||||
jimport( 'joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* HTML View class for the Plugins component
|
||||
*
|
||||
* @static
|
||||
* @package Joomla
|
||||
* @subpackage Plugins
|
||||
* @since 1.0
|
||||
*/
|
||||
class GroupsViewGroups extends JView
|
||||
{
|
||||
function display( $tpl = null )
|
||||
{
|
||||
global $mainframe, $option;
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
|
||||
$client = 'admin';
|
||||
$type = JRequest::getWord( 'type' );
|
||||
$task = JRequest::getWord( 'task' );
|
||||
|
||||
$filter_order = $mainframe->getUserStateFromRequest( "$option.$type.$task.$client.filter_order", 'filter_order', 'g.name', 'cmd' );
|
||||
$filter_order_Dir = $mainframe->getUserStateFromRequest( "$option.$type.$task.$client.filter_order_Dir", 'filter_order_Dir', '', 'word' );
|
||||
$filter_state = $mainframe->getUserStateFromRequest( "$option.$type.$task.$client.filter_state", 'filter_state', '', 'word' );
|
||||
$search = $mainframe->getUserStateFromRequest( "$option.$type.$task.$client.search", 'search', '', 'string' );
|
||||
$search = JString::strtolower( $search );
|
||||
|
||||
$limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );
|
||||
$limitstart = $mainframe->getUserStateFromRequest( '$option.$type.$task.$client.limitstart', 'limitstart', 0, 'int' );
|
||||
|
||||
$limitstart = isset( $limitstart->group ) ? $limitstart->group : 0;
|
||||
|
||||
$where = array();
|
||||
|
||||
if ( $search ) {
|
||||
$where[] = 'LOWER( g.name ) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false );
|
||||
}
|
||||
if ( $filter_state ) {
|
||||
if ( $filter_state == 'P' ) {
|
||||
$where[] = 'g.published = 1';
|
||||
} else if ($filter_state == 'U' ) {
|
||||
$where[] = 'g.published = 0';
|
||||
}
|
||||
}
|
||||
$where = ( count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : '' );
|
||||
$orderby = ' ORDER BY g.ordering ASC';
|
||||
|
||||
// get the total number of records
|
||||
$query = 'SELECT COUNT(g.id)'
|
||||
. ' FROM #__jce_groups AS g'
|
||||
. $where
|
||||
;
|
||||
$db->setQuery( $query );
|
||||
$total = $db->loadResult();
|
||||
|
||||
jimport('joomla.html.pagination');
|
||||
$pagination = new JPagination( $total, $limitstart, $limit );
|
||||
|
||||
$query = 'SELECT g.*, u.name AS editor'
|
||||
. ' FROM #__jce_groups AS g'
|
||||
. ' LEFT JOIN #__users AS u ON u.id = g.checked_out'
|
||||
. $where
|
||||
. ' GROUP BY g.id'
|
||||
. $orderby
|
||||
;
|
||||
$db->setQuery( $query, $pagination->limitstart, $pagination->limit );
|
||||
$rows = $db->loadObjectList();
|
||||
if ($db->getErrorNum()) {
|
||||
echo $db->stderr();
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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', $rows);
|
||||
$this->assignRef('pagination', $pagination);
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<?php defined('_JEXEC') or die('Restricted access'); ?>
|
||||
|
||||
<?php
|
||||
JHTML::_('behavior.tooltip');
|
||||
?>
|
||||
<form action="index.php?option=com_jce" method="post" name="adminForm">
|
||||
<fieldset>
|
||||
<div class="configuration" >
|
||||
<?php echo JText::_( 'Icon Legend' );?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<table class="adminlist">
|
||||
<thead>
|
||||
<th nowrap="nowrap" width="20%" class="title">
|
||||
<?php echo JText::_( 'Name' ); ?>:
|
||||
</th>
|
||||
<th nowrap="nowrap" class="title">
|
||||
<?php echo JText::_( 'Icon' ); ?>:
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach( $this->icons as $icon ){
|
||||
$path = $icon->type == 'command' ? '../plugins/editors/jce/tiny_mce/themes/advanced/img/'. $icon->layout .'.gif' : '../plugins/editors/jce/tiny_mce/plugins/'. $icon->name .'/img/'. $icon->layout .'.gif';
|
||||
?>
|
||||
<tr>
|
||||
<td width="50%"><?php echo $icon->title;?></td>
|
||||
<td width="50%"><img src="<?php echo $path;?>" alt="<?php echo $icon->title;?>" title="<?php echo $icon->title;?>" /></td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
<input type="hidden" name="option" value="com_jce" />
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="type" value="group" />
|
||||
<?php echo JHTML::_( 'form.token' ); ?>
|
||||
</form>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: view.html.php 47 2009-05-26 18:06:30Z happynoodleboy $
|
||||
* @package Joomla
|
||||
* @subpackage Users
|
||||
* @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 Users component
|
||||
*
|
||||
* @static
|
||||
* @package Joomla
|
||||
* @subpackage Users
|
||||
* @since 1.0
|
||||
*/
|
||||
class GroupsViewLegend extends JView
|
||||
{
|
||||
function display($tpl = null)
|
||||
{
|
||||
global $mainframe, $option;
|
||||
$db =& JFactory::getDBO();
|
||||
|
||||
$query = 'SELECT title, name, type, layout, icon'
|
||||
. ' FROM #__jce_plugins'
|
||||
. ' WHERE published = 1'
|
||||
. ' AND row > 0'
|
||||
. ' ORDER BY title'
|
||||
;
|
||||
$db->setQuery( $query );
|
||||
$icons = $db->loadObjectList();
|
||||
|
||||
$this->assignRef('icons', $icons);
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
<?php defined('_JEXEC') or die('Restricted access'); ?>
|
||||
|
||||
<?php
|
||||
JHTML::_('behavior.tooltip');
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function checkUser(s, v){
|
||||
var a = [];
|
||||
$each(s, function(n){
|
||||
a.push(n.value);
|
||||
});
|
||||
return a.contains(v);
|
||||
}
|
||||
function selectUsers(){
|
||||
var u = [], v, s, o, h;
|
||||
if(document.adminForm.boxchecked.value == 0){
|
||||
alert('Please select at least 1 user!');
|
||||
return false;
|
||||
}else{
|
||||
s = window.parent.document.getElementById('users').options;
|
||||
$ES('input[type=checkbox]').each(function(el){
|
||||
if(el.name == 'cid[]' && el.checked){
|
||||
v = el.value;
|
||||
h = $('username_' + v).innerHTML.trim();
|
||||
|
||||
if(checkUser(s, v))
|
||||
return;
|
||||
|
||||
|
||||
o = new Option(h, v);
|
||||
s[s.length] = o;
|
||||
}
|
||||
});
|
||||
window.parent.document.getElementById('sbox-window').close();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<form action="index.php?option=com_jce&tmpl=component" method="post" name="adminForm">
|
||||
<fieldset>
|
||||
<div style="float: right">
|
||||
<button type="button" onclick="selectUsers();"><?php echo JText::_( 'Select' );?></button>
|
||||
<button type="button" onclick="window.parent.document.getElementById('sbox-window').close();"><?php echo JText::_( 'Cancel' );?></button>
|
||||
</div>
|
||||
<div class="configuration" >
|
||||
<?php echo JText::_( 'Group Users' );?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<table>
|
||||
<tr>
|
||||
<td 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.submit();"><?php echo JText::_( 'Reset' ); ?></button>
|
||||
</td>
|
||||
<td nowrap="nowrap">
|
||||
<?php echo $this->lists['group'];?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="adminlist" cellpadding="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="2%" class="title">
|
||||
<?php echo JText::_( 'NUM' ); ?>
|
||||
</th>
|
||||
<th width="3%" class="title">
|
||||
<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->items); ?>);" />
|
||||
</th>
|
||||
<th class="title">
|
||||
<?php echo JHTML::_('grid.sort', 'Name', 'a.name', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th width="15%" class="title" >
|
||||
<?php echo JHTML::_('grid.sort', 'Username', 'a.username', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th width="15%" class="title">
|
||||
<?php echo JHTML::_('grid.sort', 'Type', 'groupname', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th width="15%" class="title">
|
||||
<?php echo JHTML::_('grid.sort', 'E-Mail', 'a.email', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th width="1%" class="title" nowrap="nowrap">
|
||||
<?php echo JHTML::_('grid.sort', 'ID', 'a.id', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="10">
|
||||
<?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];
|
||||
|
||||
$task = $row->block ? 'unblock' : 'block';
|
||||
$alt = $row->block ? JText::_( 'Enabled' ) : JText::_( 'Blocked' );
|
||||
|
||||
//$group = JCEGroupsHelper::getUserGroupFromId($row->id);
|
||||
//$checked = $group->id ? '<img src="images/disabled.png"/>' : JHTML::_('grid.id', $i, $row->id );
|
||||
?>
|
||||
<tr class="<?php echo "row$k"; ?>">
|
||||
<td>
|
||||
<?php echo $i+1+$this->pagination->limitstart;?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo JHTML::_('grid.id', $i, $row->id );?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $row->name; ?>
|
||||
</td>
|
||||
<td>
|
||||
<span id="username_<?php echo $row->id;?>"><?php echo $row->username; ?></span>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo JText::_( $row->groupname ); ?>
|
||||
</td>
|
||||
<td><?php echo $row->email; ?></a></td>
|
||||
<td>
|
||||
<?php echo $row->id; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$k = 1 - $k;
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="hidden" name="option" value="com_jce" />
|
||||
<input type="hidden" name="task" value="addusers" />
|
||||
<input type="hidden" name="type" value="group" />
|
||||
<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,130 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: view.html.php 47 2009-05-26 18:06:30Z happynoodleboy $
|
||||
* @package Joomla
|
||||
* @subpackage Users
|
||||
* @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 Users component
|
||||
*
|
||||
* @static
|
||||
* @package Joomla
|
||||
* @subpackage Users
|
||||
* @since 1.0
|
||||
*/
|
||||
class GroupsViewUsers extends JView
|
||||
{
|
||||
function display($tpl = null)
|
||||
{
|
||||
global $mainframe, $option;
|
||||
|
||||
require_once( JPATH_ADMINISTRATOR .DS. 'components' .DS. 'com_jce' .DS. 'groups' .DS. 'helper.php' );
|
||||
|
||||
$client = 'admin';
|
||||
$type = JRequest::getWord( 'type' );
|
||||
$task = JRequest::getWord( 'task' );
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
$currentUser =& JFactory::getUser();
|
||||
$acl =& JFactory::getACL();
|
||||
|
||||
$filter_order = $mainframe->getUserStateFromRequest( "$option.$type.$task.$client.filter_order", 'filter_order', 'a.name', 'cmd' );
|
||||
$filter_order_Dir = $mainframe->getUserStateFromRequest( "$option.$type.$task.$client.filter_order_Dir", 'filter_order_Dir', '', 'word' );
|
||||
$filter_type = $mainframe->getUserStateFromRequest( "$option.$type.$task.$client.filter_type", 'filter_type', 0, 'string' );
|
||||
$search = $mainframe->getUserStateFromRequest( "$option.$type.$task.$client.search", 'search', '', 'string' );
|
||||
$search = JString::strtolower( $search );
|
||||
|
||||
$limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );
|
||||
$limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' );
|
||||
|
||||
$where = array();
|
||||
if (isset( $search ) && $search!= '')
|
||||
{
|
||||
$searchEscaped = $db->Quote( '%'.$db->getEscaped( $search, true ).'%', false );
|
||||
$where[] = 'a.username LIKE '.$searchEscaped.' OR a.email LIKE '.$searchEscaped.' OR a.name LIKE '.$searchEscaped;
|
||||
}
|
||||
if ( $filter_type )
|
||||
{
|
||||
$where[] = 'a.usertype = LOWER( '.$db->Quote($filter_type).' ) ';
|
||||
}
|
||||
|
||||
// exclude any child group id's for this user
|
||||
$pgids = $acl->get_group_children( $currentUser->get('gid'), 'ARO', 'RECURSE' );
|
||||
|
||||
if (is_array( $pgids ) && count( $pgids ) > 0)
|
||||
{
|
||||
JArrayHelper::toInteger($pgids);
|
||||
$where[] = 'a.gid NOT IN (' . implode( ',', $pgids ) . ')';
|
||||
}
|
||||
// Exclude ROOT, USERS, Super Administrator, Public Frontend, Public Backend
|
||||
$where[] = 'a.gid NOT IN (17,28,29,30)';
|
||||
// Only unblocked users
|
||||
$where[] = 'a.block = 0';
|
||||
|
||||
$orderby = ' ORDER BY '. $filter_order .' '. $filter_order_Dir;
|
||||
$where = ( count( $where ) ? ' WHERE (' . implode( ') AND (', $where ) . ')' : '' );
|
||||
|
||||
$query = 'SELECT COUNT(a.id)'
|
||||
. ' FROM #__users AS a'
|
||||
. $where
|
||||
;
|
||||
$db->setQuery( $query );
|
||||
$total = $db->loadResult();
|
||||
|
||||
jimport('joomla.html.pagination');
|
||||
$pagination = new JPagination( $total, $limitstart, $limit );
|
||||
|
||||
$query = 'SELECT a.*, g.name AS groupname'
|
||||
. ' FROM #__users AS a'
|
||||
. ' INNER JOIN #__core_acl_aro AS aro ON aro.value = a.id'
|
||||
. ' INNER JOIN #__core_acl_groups_aro_map AS gm ON gm.aro_id = aro.id'
|
||||
. ' INNER JOIN #__core_acl_aro_groups AS g ON g.id = gm.group_id'
|
||||
. $where
|
||||
. ' GROUP BY a.id'
|
||||
. $orderby
|
||||
;
|
||||
$db->setQuery( $query, $pagination->limitstart, $pagination->limit );
|
||||
$rows = $db->loadObjectList();
|
||||
|
||||
// get list of Groups for dropdown filter
|
||||
$query = 'SELECT name AS value, name AS text'
|
||||
. ' FROM #__core_acl_aro_groups'
|
||||
// Exclude ROOT, USERS, Super Administrator, Public Frontend, Public Backend
|
||||
. ' WHERE id NOT IN (17,28,29,30)'
|
||||
;
|
||||
$db->setQuery( $query );
|
||||
$types[] = JHTML::_('select.option', '0', '- '. JText::_( 'Select Group' ) .' -' );
|
||||
foreach( $db->loadObjectList() as $obj )
|
||||
{
|
||||
$types[] = JHTML::_('select.option', $obj->value, JText::_( $obj->text ) );
|
||||
}
|
||||
$lists['group'] = JHTML::_('select.genericlist', $types, 'filter_type', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', "$filter_type" );
|
||||
|
||||
// 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', $rows);
|
||||
$this->assignRef('pagination', $pagination);
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,211 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: language.php 97 2009-06-21 19:18:07Z happynoodleboy $
|
||||
* @package JCE
|
||||
* @copyright Copyright (C) 2009 Ryan Demmer. All rights reserved.
|
||||
* @copyright Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is within the rest of the framework
|
||||
defined('JPATH_BASE') or die ();
|
||||
|
||||
/**
|
||||
* Language installer
|
||||
*
|
||||
* @package JCE
|
||||
* @subpackage Installer
|
||||
* @since 1.5
|
||||
*/
|
||||
class JCEInstallerLanguage extends JObject
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access protected
|
||||
* @param object $parent Parent object [JInstaller instance]
|
||||
* @return void
|
||||
* @since 1.5
|
||||
*/
|
||||
function __construct( & $parent)
|
||||
{
|
||||
$this->parent = & $parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom install method
|
||||
*
|
||||
* @access public
|
||||
* @return boolean True on success
|
||||
* @since 1.5
|
||||
*/
|
||||
function install()
|
||||
{
|
||||
// Get database connector object
|
||||
$manifest = & $this->parent->getManifest();
|
||||
$this->manifest = & $manifest->document;
|
||||
|
||||
// Get the language name
|
||||
// Set the extensions name
|
||||
$name = & $this->manifest->getElementByPath('name');
|
||||
$name = JFilterInput::clean($name->data(), 'cmd');
|
||||
$this->set('name', $name);
|
||||
|
||||
// Get the Language tag [ISO tag, eg. en-GB]
|
||||
$tag = & $this->manifest->getElementByPath('tag');
|
||||
|
||||
// Check if we found the tag - if we didn't, we may be trying to install from an older language package
|
||||
if (!$tag)
|
||||
{
|
||||
$this->parent->abort(JText::_('Language').' '.JText::_('Install').': '.JText::_('NO LANGUAGE TAG?'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->set('tag', $tag->data());
|
||||
$folder = $tag->data();
|
||||
|
||||
$sitePath = JPATH_SITE.DS."language".DS.$folder;
|
||||
$adminPath = JPATH_ADMINISTRATOR.DS."language".DS.$folder;
|
||||
$tinyPath = JPATH_PLUGINS.DS."editors".DS."jce".DS."tiny_mce";
|
||||
|
||||
// Set the installation target paths
|
||||
$this->parent->setPath('extension_site', $sitePath);
|
||||
$this->parent->setPath('extension_administrator', $adminPath);
|
||||
|
||||
$this->adminElement = & $this->manifest->getElementByPath('administration');
|
||||
$this->siteElement = & $this->manifest->getElementByPath('site');
|
||||
$this->tinyElement = & $this->manifest->getElementByPath('tinymce');
|
||||
|
||||
// Set overwrite flag if not set by Manifest
|
||||
if (!$this->parent->getOverwrite()) {
|
||||
$this->parent->setOverwrite(true);
|
||||
}
|
||||
|
||||
// Copy site files
|
||||
foreach ($this->siteElement->children() as $child)
|
||||
{
|
||||
if (is_a($child, 'JSimpleXMLElement') && $child->name() == 'files') {
|
||||
if ($this->parent->parseFiles($child) === false) {
|
||||
// Install failed, rollback any changes
|
||||
$this->parent->abort();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Copy admin files
|
||||
foreach ($this->adminElement->children() as $child)
|
||||
{
|
||||
if (is_a($child, 'JSimpleXMLElement') && $child->name() == 'files') {
|
||||
if ($this->parent->parseFiles($child, 1) === false) {
|
||||
// Install failed, rollback any changes
|
||||
$this->parent->abort();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Copy tinymce files
|
||||
$this->parent->setPath('extension_site', $tinyPath);
|
||||
foreach ($this->tinyElement->children() as $child)
|
||||
{
|
||||
if (is_a($child, 'JSimpleXMLElement') && $child->name() == 'files') {
|
||||
if ($this->parent->parseFiles($child) === false) {
|
||||
// Install failed, rollback any changes
|
||||
$this->parent->abort();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set path back to site for manifest
|
||||
$this->parent->setPath('extension_site', $sitePath);
|
||||
// Lastly, we will copy the manifest file to its appropriate place.
|
||||
if (!$this->parent->copyManifest(0)) {
|
||||
// Install failed, rollback changes
|
||||
$this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('Could not copy setup file'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the language description
|
||||
$description = & $this->manifest->getElementByPath('description');
|
||||
if (is_a($description, 'JSimpleXMLElement')) {
|
||||
$this->parent->set('message', $description->data());
|
||||
} else {
|
||||
$this->parent->set('message', '');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom uninstall method
|
||||
*
|
||||
* @access public
|
||||
* @param string $tag The tag of the language to uninstall
|
||||
* @param int $clientId The id of the client (unused)
|
||||
* @return mixed Return value for uninstall method in component uninstall file
|
||||
* @since 1.5
|
||||
*/
|
||||
function uninstall($tag, $clientId)
|
||||
{
|
||||
$path = trim($tag);
|
||||
if (!JFolder::exists($path)) {
|
||||
JError::raiseWarning(100, 'Language Uninstall: '.JText::_('Language path is empty, cannot uninstall files'));
|
||||
return false;
|
||||
}
|
||||
$tag = basename($path);
|
||||
|
||||
// Because JCE languages don't have their own folders we cannot use the standard method of finding an installation manifest
|
||||
$manifestFile = JPATH_ROOT.DS.'language'.DS.$tag.DS.$tag.'.com_jce.xml';
|
||||
if (file_exists($manifestFile))
|
||||
{
|
||||
$xml = & JFactory::getXMLParser('Simple');
|
||||
|
||||
// If we cannot load the xml file return null
|
||||
if (!$xml->loadFile($manifestFile)) {
|
||||
JError::raiseWarning(100, JText::_('Language').' '.JText::_('Uninstall').': '.JText::_('Could not load manifest file'));
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for a valid XML root tag.
|
||||
*/
|
||||
$root = & $xml->document;
|
||||
if ($root->name() != 'install' && $root->attributes('type') != 'language') {
|
||||
JError::raiseWarning(100, JText::_('Language').' '.JText::_('Uninstall').': '.JText::_('Invalid manifest file'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the admin and site paths for the component
|
||||
$sitePath = JPATH_SITE.DS."language".DS.$tag;
|
||||
$adminPath = JPATH_ADMINISTRATOR.DS."language".DS.$tag;
|
||||
$tinyPath = JPATH_PLUGINS.DS."editors".DS."jce".DS."tiny_mce";
|
||||
|
||||
// Set the installation target paths
|
||||
$this->parent->setPath('extension_site', $sitePath);
|
||||
$this->parent->setPath('extension_administrator', $adminPath);
|
||||
|
||||
if (!$this->parent->removeFiles($root->getElementByPath('site/files'))) {
|
||||
JError::raiseWarning(100, JText::_('Language').' '.JText::_('Uninstall').': '.JText::_('Unable to delete files'));
|
||||
return false;
|
||||
}
|
||||
if (!$this->parent->removeFiles($root->getElementByPath('administration/files'), 1)) {
|
||||
JError::raiseWarning(100, JText::_('Language').' '.JText::_('Uninstall').': '.JText::_('Unable to delete files'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->parent->setPath('extension_site', $tinyPath);
|
||||
if (!$this->parent->removeFiles($root->getElementByPath('tinymce/files'))) {
|
||||
JError::raiseWarning(100, JText::_('Language').' '.JText::_('Uninstall').': '.JText::_('Unable to delete files'));
|
||||
return false;
|
||||
}
|
||||
JFile::delete($manifestFile);
|
||||
} else {
|
||||
JError::raiseWarning(100, 'Language Uninstall: Manifest File invalid or not found');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: controller.php 47 2009-05-26 18:06:30Z happynoodleboy $
|
||||
* @package Joomla
|
||||
* @subpackage Installer
|
||||
* @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();
|
||||
// wrapper for com_installer controller
|
||||
$language =& JFactory::getLanguage();
|
||||
$language->load( 'com_installer', JPATH_ADMINISTRATOR );
|
||||
require_once( JPATH_ADMINISTRATOR .DS. 'components' .DS. 'com_installer' .DS. 'controller.php' );
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: installer.php 96 2009-06-21 19:15:38Z happynoodleboy $
|
||||
* @package JCE
|
||||
* @copyright Copyright (C) 2009 Ryan Demmer. All rights reserved.
|
||||
* @copyright Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is within the rest of the framework
|
||||
defined('JPATH_BASE') or die();
|
||||
|
||||
jimport('joomla.installer.installer');
|
||||
|
||||
class JCEInstaller extends JInstaller
|
||||
{
|
||||
/**
|
||||
* Returns a reference to the global Installer object, only creating it
|
||||
* if it doesn't already exist.
|
||||
*
|
||||
* @static
|
||||
* @return object An installer object
|
||||
* @since 1.5
|
||||
*/
|
||||
function &getInstance()
|
||||
{
|
||||
static $instance;
|
||||
|
||||
if (!isset ($instance)) {
|
||||
$instance = new JCEInstaller();
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an installer adapter by name
|
||||
*
|
||||
* @access public
|
||||
* @param string $name Adapter name
|
||||
* @param object $adapter Installer adapter object
|
||||
* @return boolean True if successful
|
||||
* @since 1.5
|
||||
*/
|
||||
function setAdapter($name, $adapter = null)
|
||||
{
|
||||
// Check if valid extension type
|
||||
if( $name == 'plugin' || $name == 'language' || $name == 'extension' ){
|
||||
if (!is_object($adapter))
|
||||
{
|
||||
// Try to load the adapter object
|
||||
require_once(dirname(__FILE__).DS.'adapters'.DS.strtolower($name).'.php');
|
||||
$class = 'JCEInstaller'.ucfirst($name);
|
||||
if (!class_exists($class)) {
|
||||
return false;
|
||||
}
|
||||
$adapter = new $class($this);
|
||||
$adapter->parent =& $this;
|
||||
}
|
||||
$this->_adapters[$name] =& $adapter;
|
||||
return true;
|
||||
}else{
|
||||
$this->abort(JText::_('Incorrect version!'));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Method to parse the variables of a plugin, build the INI
|
||||
* string for it's default variables, and return the INI string.
|
||||
*
|
||||
* @access public
|
||||
* @return string INI string of parameter values
|
||||
* @since 1.5
|
||||
*/
|
||||
function getVariables()
|
||||
{
|
||||
// Get the manifest document root element
|
||||
$root = & $this->_manifest->document;
|
||||
|
||||
// Get the element of the tag names
|
||||
$element =& $root->getElementByPath('variables');
|
||||
if (!is_a($element, 'JSimpleXMLElement') || !count($element->children())) {
|
||||
// Either the tag does not exist or has no children therefore we return zero files processed.
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get the array of variable nodes to process
|
||||
$vars = $element->children();
|
||||
if (count($vars) == 0) {
|
||||
// No variables to process
|
||||
return null;
|
||||
}
|
||||
|
||||
// Process each variable in the $vars array.
|
||||
$ini = null;
|
||||
foreach ($vars as $var) {
|
||||
if (!$name = $var->attributes('name')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$value = $var->attributes('default')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ini .= $name."=".$value."\n";
|
||||
}
|
||||
return $ini;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: extension.php 47 2009-05-26 18:06:30Z happynoodleboy $
|
||||
* @package Joomla
|
||||
* @subpackage Menus
|
||||
* @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.
|
||||
*/
|
||||
|
||||
// Import library dependencies
|
||||
require_once(dirname(__FILE__).DS.'extensions.php');
|
||||
|
||||
/**
|
||||
* Installer Plugins Model
|
||||
*
|
||||
* @package Joomla
|
||||
* @subpackage Installer
|
||||
* @since 1.5
|
||||
*/
|
||||
class InstallerModelExtension extends InstallerModel
|
||||
{
|
||||
/**
|
||||
* Extension Type
|
||||
* @var string
|
||||
*/
|
||||
var $_type = 'extension';
|
||||
|
||||
/**
|
||||
* Overridden constructor
|
||||
* @access protected
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
global $mainframe;
|
||||
|
||||
// Call the parent constructor
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function _loadItems()
|
||||
{
|
||||
global $mainframe, $option;
|
||||
|
||||
// Get a database connector
|
||||
$db = & JFactory::getDBO();
|
||||
|
||||
$query = 'SELECT e.id as id, e.name as name, e.extension as extension, e.folder as folder, p.name as file, p.title as plugin' .
|
||||
' FROM #__jce_extensions AS e' .
|
||||
' INNER JOIN #__jce_plugins as p ON e.pid = p.id' .
|
||||
' ORDER BY e.name';
|
||||
$db->setQuery($query);
|
||||
$rows = $db->loadObjectList();
|
||||
|
||||
$numRows = count($rows);
|
||||
|
||||
for ($i = 0; $i < $numRows; $i ++) {
|
||||
$row = & $rows[$i];
|
||||
|
||||
$plugin = $row->plugin;
|
||||
$name = $row->name;
|
||||
$folder = $row->folder;
|
||||
|
||||
// Get the plugin base path
|
||||
$baseDir = JPATH_PLUGINS.DS.'editors'.DS.'jce'.DS.'tiny_mce'.DS.'plugins';
|
||||
// Get the plugin xml file
|
||||
$xmlfile = $baseDir .DS. $row->file .DS. 'extensions' .DS. $row->folder .DS. $row->extension .".xml";
|
||||
|
||||
if (file_exists($xmlfile)) {
|
||||
if ($data = JApplicationHelper::parseXMLInstallFile($xmlfile)) {
|
||||
foreach($data as $key => $value)
|
||||
{
|
||||
$row->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
$row->name = $name;
|
||||
$row->plugin = $plugin;
|
||||
}
|
||||
|
||||
$this->setState('pagination.total', $numRows);
|
||||
if($this->_state->get('pagination.limit') > 0) {
|
||||
$this->_items = array_slice( $rows, $this->_state->get('pagination.offset'), $this->_state->get('pagination.limit') );
|
||||
} else {
|
||||
$this->_items = $rows;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: extensions.php 47 2009-05-26 18:06:30Z happynoodleboy $
|
||||
* @package Joomla
|
||||
* @subpackage Installer
|
||||
* @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();
|
||||
|
||||
jimport( 'joomla.application.component.model' );
|
||||
|
||||
/**
|
||||
* Extension Manager Abstract Extension Model
|
||||
*
|
||||
* @abstract
|
||||
* @package Joomla
|
||||
* @subpackage Installer
|
||||
* @since 1.5
|
||||
*/
|
||||
class InstallerModel extends JModel
|
||||
{
|
||||
/** @var array Array of installed components */
|
||||
var $_items = array();
|
||||
|
||||
/** @var object JPagination object */
|
||||
var $_pagination = null;
|
||||
|
||||
/**
|
||||
* Overridden constructor
|
||||
* @access protected
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
global $mainframe, $option;
|
||||
|
||||
// Call the parent constructor
|
||||
parent::__construct();
|
||||
|
||||
$client = 'admin';
|
||||
$type = JRequest::getWord( 'type' );
|
||||
$task = JRequest::getWord( 'task' );
|
||||
|
||||
// Set state variables from the request
|
||||
$this->setState('pagination.limit', $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'));
|
||||
$this->setState('pagination.offset',$mainframe->getUserStateFromRequest('$option.$type.$task.$client.limitstart.'.$this->_type, 'limitstart', 0, 'int'));
|
||||
$this->setState('pagination.total', 0);
|
||||
}
|
||||
|
||||
function &getItems()
|
||||
{
|
||||
if (empty($this->_items)) {
|
||||
// Load the items
|
||||
$this->_loadItems();
|
||||
}
|
||||
return $this->_items;
|
||||
}
|
||||
|
||||
function &getPagination()
|
||||
{
|
||||
if (empty($this->_pagination)) {
|
||||
// Make sure items are loaded for a proper total
|
||||
if (empty($this->_items)) {
|
||||
// Load the items
|
||||
$this->_loadItems();
|
||||
}
|
||||
// Load the pagination object
|
||||
jimport('joomla.html.pagination');
|
||||
$this->_pagination = new JPagination($this->_state->get('pagination.total'), $this->_state->get('pagination.offset'), $this->_state->get('pagination.limit'));
|
||||
}
|
||||
return $this->_pagination;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove (uninstall) an extension
|
||||
*
|
||||
* @static
|
||||
* @param array An array of identifiers
|
||||
* @return boolean True on success
|
||||
* @since 1.0
|
||||
*/
|
||||
function remove($eid=array())
|
||||
{
|
||||
global $mainframe;
|
||||
|
||||
// Initialize variables
|
||||
$failed = array ();
|
||||
|
||||
/*
|
||||
* Ensure eid is an array of extension ids in the form id => client_id
|
||||
* TODO: If it isn't an array do we want to set an error and fail?
|
||||
*/
|
||||
if (!is_array($eid)) {
|
||||
$eid = array($eid => 0);
|
||||
}
|
||||
|
||||
// Get a database connector
|
||||
$db =& JFactory::getDBO();
|
||||
|
||||
// Get an installer object for the extension type
|
||||
//jimport('joomla.installer.installer');
|
||||
require_once( JPATH_COMPONENT .DS. 'installer' .DS. 'installer.php' );
|
||||
$installer = & JCEInstaller::getInstance();
|
||||
|
||||
// Uninstall the chosen extensions
|
||||
foreach ($eid as $id => $clientId)
|
||||
{
|
||||
$id = trim( $id );
|
||||
$result = $installer->uninstall($this->_type, $id, $clientId );
|
||||
|
||||
// Build an array of extensions that failed to uninstall
|
||||
if ($result === false) {
|
||||
$failed[] = $id;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($failed)) {
|
||||
// There was an error in uninstalling the package
|
||||
$msg = JText::sprintf('UNINSTALLEXT', JText::_($this->_type), JText::_('Error'));
|
||||
$result = false;
|
||||
} else {
|
||||
// Package uninstalled sucessfully
|
||||
$msg = JText::sprintf('UNINSTALLEXT', JText::_($this->_type), JText::_('Success'));
|
||||
$result = true;
|
||||
}
|
||||
|
||||
$mainframe->enqueueMessage($msg);
|
||||
$this->setState('action', 'remove');
|
||||
$this->setState('name', $installer->get('name'));
|
||||
$this->setState('message', $installer->message);
|
||||
$this->setState('extension.message', $installer->get('extension.message'));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function _loadItems()
|
||||
{
|
||||
return JError::raiseError( 500, JText::_('Method Not Implemented'));
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user