添加到 trunk

+YUCHENG HU+

git-svn-id: https://svn.code.sf.net/p/hawebs/svn@317 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
YuCheng Hu
2010-06-13 23:12:44 +00:00
parent de85e88b41
commit 7e063dd1b5
20 changed files with 1345 additions and 0 deletions
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<params>
<param name="allowUserRegistration" type="radio" default="1" label="Allow User Registration" description="TIPALLOWUSERREG">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="new_usertype" type="list" default="Registered" label="New User Registration Type" description="TIPNEWUSERTYPE">
<option value="Registered">Registered</option>
<option value="Author">Author</option>
<option value="Editor">Editor</option>
<option value="Publisher">Publisher</option>
</param>
<param name="useractivation" type="radio" default="1" label="New User Account Activation" description="TIPIFYESUSERMAILEDLINK">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="frontend_userparams" type="radio" default="1" label="Front-end User Params" description="TIPFRONTENDUSERPARAMS">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
</params>
</config>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<name>Author User Type</name>
<params>
<param name="language" type="languages" client="site" default="" label="Front-end Language" description="paramLanguage" />
<param name="editor" type="editors" default="" label="User Editor" description="WYSIWYG Editor for this User" />
<param name="helpsite" type="helpsites" default="" label="Help Site" description="Help Site for this User" />
<param name="timezone" type="timezones" default="" label="Time Zone" description="Time Zone for this User" />
</params>
</form>
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<name>Registered User Type</name>
<params>
<param name="language" type="languages" client="site" default="" label="Front-end Language" description="paramLanguage" />
<param name="timezone" type="timezones" default="" label="Time Zone" description="Time Zone for this User" />
</params>
</form>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<params>
<param name="admin_language" type="languages" client="administrator" default="" label="Back-end Language" description="paramAdminLanguage" />
<param name="language" type="languages" client="site" default="" label="Front-end Language" description="paramLanguage" />
<param name="editor" type="editors" default="" label="User Editor" description="WYSIWYG Editor for this User" />
<param name="helpsite" type="helpsites" default="" label="Help Site" description="Help Site for this User" />
<param name="timezone" type="timezones" default="" label="Time Zone" description="Time Zone for this User" />
</params>
</form>
@@ -0,0 +1,30 @@
<?php
/**
* @version $Id: users.class.php 10381 2008-06-01 03:35:53Z pasamio $
* @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.html.parameter');
/**
* Legacy class, use JParameter instead
* @deprecated As of version 1.5
*/
class mosUserParameters extends JParameter
{
function __construct($text, $file = '', $type = 'component')
{
parent::__construct($text, $file);
}
}
@@ -0,0 +1,34 @@
<?php
/**
* @version $Id: users.php 10381 2008-06-01 03:35:53Z pasamio $
* @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.
*/
// 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_users', 'manage' )) {
$mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') );
}
// Require the base controller
require_once (JPATH_COMPONENT.DS.'controller.php');
// Create the controller
$controller = new UsersController( );
// 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>User Manager</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>User Manager</description>
</install>
@@ -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,141 @@
<?php
/**
* @version $Id: view.html.php 10496 2008-07-03 07:08:39Z ircmaxell $
* @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 UsersViewUser extends JView
{
function display($tpl = null)
{
$cid = JRequest::getVar( 'cid', array(0), '', 'array' );
$edit = JRequest::getVar('edit',true);
$me = JFactory::getUser();
JArrayHelper::toInteger($cid, array(0));
$db =& JFactory::getDBO();
if($edit)
$user =& JUser::getInstance( $cid[0] );
else
$user =& JUser::getInstance();
$myuser =& JFactory::getUser();
$acl =& JFactory::getACL();
// Check for post data in the event that we are returning
// from a unsuccessful attempt to save data
$post = JRequest::get('post');
if ( $post ) {
$user->bind($post);
}
if ( $user->get('id'))
{
$query = 'SELECT *'
. ' FROM #__contact_details'
. ' WHERE user_id = '.(int) $cid[0]
;
$db->setQuery( $query );
$contact = $db->loadObjectList();
}
else
{
$contact = NULL;
// Get the default group id for a new user
$config = &JComponentHelper::getParams( 'com_users' );
$newGrp = $config->get( 'new_usertype' );
$user->set( 'gid', $acl->get_group_id( $newGrp, null, 'ARO' ) );
}
$userObjectID = $acl->get_object_id( 'users', $user->get('id'), 'ARO' );
$userGroups = $acl->get_object_groups( $userObjectID, 'ARO' );
$userGroupName = strtolower( $acl->get_group_name( $userGroups[0], 'ARO' ) );
$myObjectID = $acl->get_object_id( 'users', $myuser->get('id'), 'ARO' );
$myGroups = $acl->get_object_groups( $myObjectID, 'ARO' );
$myGroupName = strtolower( $acl->get_group_name( $myGroups[0], 'ARO' ) );;
// ensure user can't add/edit group higher than themselves
/* NOTE : This check doesn't work commented out for the time being
if ( is_array( $myGroups ) && count( $myGroups ) > 0 )
{
$excludeGroups = (array) $acl->get_group_children( $myGroups[0], 'ARO', 'RECURSE' );
}
else
{
$excludeGroups = array();
}
if ( in_array( $userGroups[0], $excludeGroups ) )
{
echo 'not auth';
$mainframe->redirect( 'index.php?option=com_users', JText::_('NOT_AUTH') );
}
*/
/*
if ( $userGroupName == 'super administrator' )
{
// super administrators can't change
$lists['gid'] = '<input type="hidden" name="gid" value="'. $currentUser->gid .'" /><strong>'. JText::_( 'Super Administrator' ) .'</strong>';
}
else if ( $userGroupName == $myGroupName && $myGroupName == 'administrator' ) {
*/
if ( $userGroupName == $myGroupName && $myGroupName == 'administrator' )
{
// administrators can't change each other
$lists['gid'] = '<input type="hidden" name="gid" value="'. $user->get('gid') .'" /><strong>'. JText::_( 'Administrator' ) .'</strong>';
}
else
{
$gtree = $acl->get_group_children_tree( null, 'USERS', false );
// remove users 'above' me
//$i = 0;
//while ($i < count( $gtree )) {
// if ( in_array( $gtree[$i]->value, (array)$excludeGroups ) ) {
// array_splice( $gtree, $i, 1 );
// } else {
// $i++;
// }
//}
$lists['gid'] = JHTML::_('select.genericlist', $gtree, 'gid', 'size="10"', 'value', 'text', $user->get('gid') );
}
// build the html select list
$lists['block'] = JHTML::_('select.booleanlist', 'block', 'class="inputbox" size="1"', $user->get('block') );
// build the html select list
$lists['sendEmail'] = JHTML::_('select.booleanlist', 'sendEmail', 'class="inputbox" size="1"', $user->get('sendEmail') );
$this->assignRef('me', $me);
$this->assignRef('lists', $lists);
$this->assignRef('user', $user);
$this->assignRef('contact', $contact);
parent::display($tpl);
}
}
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
@@ -0,0 +1,138 @@
<?php defined('_JEXEC') or die('Restricted access'); ?>
<?php JHTML::_('behavior.tooltip'); ?>
<?php
JToolBarHelper::title( JText::_( 'User Manager' ), 'user.png' );
JToolBarHelper::custom( 'logout', 'cancel.png', 'cancel_f2.png', 'Logout' );
JToolBarHelper::deleteList();
JToolBarHelper::editListX();
JToolBarHelper::addNewX();
JToolBarHelper::help( 'screen.users' );
?>
<form action="index.php?option=com_users" method="post" name="adminForm">
<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.getElementById('filter_type').value='0';this.form.getElementById('filter_logged').value='0';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
</td>
<td nowrap="nowrap">
<?php echo $this->lists['type'];?>
<?php echo $this->lists['logged'];?>
</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="5%" class="title" nowrap="nowrap">
<?php echo JText::_( 'Logged In' ); ?>
</th>
<th width="5%" class="title" nowrap="nowrap">
<?php echo JHTML::_('grid.sort', 'Enabled', 'a.block', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
</th>
<th width="15%" class="title">
<?php echo JHTML::_('grid.sort', 'Group', '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="10%" class="title">
<?php echo JHTML::_('grid.sort', 'Last Visit', 'a.lastvisitDate', @$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];
$img = $row->block ? 'publish_x.png' : 'tick.png';
$task = $row->block ? 'unblock' : 'block';
$alt = $row->block ? JText::_( 'Enabled' ) : JText::_( 'Blocked' );
$link = 'index.php?option=com_users&amp;view=user&amp;task=edit&amp;cid[]='. $row->id. '';
if ($row->lastvisitDate == "0000-00-00 00:00:00") {
$lvisit = JText::_( 'Never' );
} else {
$lvisit = JHTML::_('date', $row->lastvisitDate, '%Y-%m-%d %H:%M:%S');
}
?>
<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>
<a href="<?php echo $link; ?>">
<?php echo $row->name; ?></a>
</td>
<td>
<?php echo $row->username; ?>
</td>
<td align="center">
<?php echo $row->loggedin ? '<img src="images/tick.png" width="16" height="16" border="0" alt="" />': ''; ?>
</td>
<td align="center">
<a href="javascript:void(0);" onclick="return listItemTask('cb<?php echo $i;?>','<?php echo $task;?>')">
<img src="images/<?php echo $img;?>" width="16" height="16" border="0" alt="<?php echo $alt; ?>" /></a>
</td>
<td>
<?php echo JText::_( $row->groupname ); ?>
</td>
<td>
<a href="mailto:<?php echo $row->email; ?>">
<?php echo $row->email; ?></a>
</td>
<td nowrap="nowrap">
<?php echo $lvisit; ?>
</td>
<td>
<?php echo $row->id; ?>
</td>
</tr>
<?php
$k = 1 - $k;
}
?>
</tbody>
</table>
<input type="hidden" name="option" value="com_users" />
<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,165 @@
<?php
/**
* @version $Id: view.html.php 10381 2008-06-01 03:35:53Z pasamio $
* @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 UsersViewUsers extends JView
{
function display($tpl = null)
{
global $mainframe, $option;
$db =& JFactory::getDBO();
$currentUser =& JFactory::getUser();
$acl =& JFactory::getACL();
$filter_order = $mainframe->getUserStateFromRequest( "$option.filter_order", 'filter_order', 'a.name', 'cmd' );
$filter_order_Dir = $mainframe->getUserStateFromRequest( "$option.filter_order_Dir", 'filter_order_Dir', '', 'word' );
$filter_type = $mainframe->getUserStateFromRequest( "$option.filter_type", 'filter_type', 0, 'string' );
$filter_logged = $mainframe->getUserStateFromRequest( "$option.filter_logged", 'filter_logged', 0, 'int' );
$search = $mainframe->getUserStateFromRequest( "$option.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 )
{
if ( $filter_type == 'Public Frontend' )
{
$where[] = ' a.usertype = \'Registered\' OR a.usertype = \'Author\' OR a.usertype = \'Editor\' OR a.usertype = \'Publisher\' ';
}
else if ( $filter_type == 'Public Backend' )
{
$where[] = 'a.usertype = \'Manager\' OR a.usertype = \'Administrator\' OR a.usertype = \'Super Administrator\' ';
}
else
{
$where[] = 'a.usertype = LOWER( '.$db->Quote($filter_type).' ) ';
}
}
if ( $filter_logged == 1 )
{
$where[] = 's.userid = a.id';
}
else if ($filter_logged == 2)
{
$where[] = 's.userid IS NULL';
}
// 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 ) . ')';
}
$filter = '';
if ($filter_logged == 1 || $filter_logged == 2)
{
$filter = ' INNER JOIN #__session AS s ON s.userid = a.id';
}
$orderby = ' ORDER BY '. $filter_order .' '. $filter_order_Dir;
$where = ( count( $where ) ? ' WHERE (' . implode( ') AND (', $where ) . ')' : '' );
$query = 'SELECT COUNT(a.id)'
. ' FROM #__users AS a'
. $filter
. $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'
. $filter
. $where
. ' GROUP BY a.id'
. $orderby
;
$db->setQuery( $query, $pagination->limitstart, $pagination->limit );
$rows = $db->loadObjectList();
$n = count( $rows );
$template = 'SELECT COUNT(s.userid)'
. ' FROM #__session AS s'
. ' WHERE s.userid = %d'
;
for ($i = 0; $i < $n; $i++)
{
$row = &$rows[$i];
$query = sprintf( $template, intval( $row->id ) );
$db->setQuery( $query );
$row->loggedin = $db->loadResult();
}
// get list of Groups for dropdown filter
$query = 'SELECT name AS value, name AS text'
. ' FROM #__core_acl_aro_groups'
. ' WHERE name != "ROOT"'
. ' AND name != "USERS"'
;
$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['type'] = JHTML::_('select.genericlist', $types, 'filter_type', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', "$filter_type" );
// get list of Log Status for dropdown filter
$logged[] = JHTML::_('select.option', 0, '- '. JText::_( 'Select Log Status' ) .' -');
$logged[] = JHTML::_('select.option', 1, JText::_( 'Logged In' ) );
$lists['logged'] = JHTML::_('select.genericlist', $logged, 'filter_logged', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', "$filter_logged" );
// 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>