添加到 trunk

+YUCHENG HU+

git-svn-id: https://svn.code.sf.net/p/hawebs/svn@158 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
YuCheng Hu
2010-06-12 18:45:03 +00:00
parent 4dd0682c4e
commit c6fed9a692
16 changed files with 3345 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
+1
View File
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
+174
View File
@@ -0,0 +1,174 @@
<?php
/**
* @version $Id: example.php 11720 2009-03-27 21:27:42Z ian $
* @package Joomla
* @subpackage JFramework
* @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.plugin.plugin');
/**
* Example User Plugin
*
* @package Joomla
* @subpackage JFramework
* @since 1.5
*/
class plgUserExample extends JPlugin {
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.5
*/
function plgUserExample(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Example store user method
*
* Method is called before user data is stored in the database
*
* @param array holds the old user data
* @param boolean true if a new user is stored
*/
function onBeforeStoreUser($user, $isnew)
{
global $mainframe;
}
/**
* Example store user method
*
* Method is called after user data is stored in the database
*
* @param array holds the new user data
* @param boolean true if a new user is stored
* @param boolean true if user was succesfully stored in the database
* @param string message
*/
function onAfterStoreUser($user, $isnew, $success, $msg)
{
global $mainframe;
// convert the user parameters passed to the event
// to a format the external application
$args = array();
$args['username'] = $user['username'];
$args['email'] = $user['email'];
$args['fullname'] = $user['name'];
$args['password'] = $user['password'];
if ($isnew)
{
// Call a function in the external app to create the user
// ThirdPartyApp::createUser($user['id'], $args);
}
else
{
// Call a function in the external app to update the user
// ThirdPartyApp::updateUser($user['id'], $args);
}
}
/**
* Example store user method
*
* Method is called before user data is deleted from the database
*
* @param array holds the user data
*/
function onBeforeDeleteUser($user)
{
global $mainframe;
}
/**
* Example store user method
*
* Method is called after user data is deleted from the database
*
* @param array holds the user data
* @param boolean true if user was succesfully stored in the database
* @param string message
*/
function onAfterDeleteUser($user, $succes, $msg)
{
global $mainframe;
// only the $user['id'] exists and carries valid information
// Call a function in the external app to delete the user
// ThirdPartyApp::deleteUser($user['id']);
}
/**
* This method should handle any login logic and report back to the subject
*
* @access public
* @param array holds the user data
* @param array extra options
* @return boolean True on success
* @since 1.5
*/
function onLoginUser($user, $options)
{
// Initialize variables
$success = false;
// Here you would do whatever you need for a login routine with the credentials
//
// Remember, this is not the authentication routine as that is done separately.
// The most common use of this routine would be logging the user into a third party
// application.
//
// In this example the boolean variable $success would be set to true
// if the login routine succeeds
// ThirdPartyApp::loginUser($user['username'], $user['password']);
return $success;
}
/**
* This method should handle any logout logic and report back to the subject
*
* @access public
* @param array holds the user data
* @return boolean True on success
* @since 1.5
*/
function onLogoutUser($user)
{
// Initialize variables
$success = false;
// Here you would do whatever you need for a logout routine with the credentials
//
// In this example the boolean variable $success would be set to true
// if the logout routine succeeds
// ThirdPartyApp::loginUser($user['username'], $user['password']);
return $success;
}
}
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="plugin" group="user">
<name>User - Example</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>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.0</version>
<description>An example user synchronisation plugin</description>
<files>
<filename plugin="example">example.php</filename>
</files>
<params/>
</install>
+1
View File
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
+228
View File
@@ -0,0 +1,228 @@
<?php
/**
* @version $Id: joomla.php 11190 2008-10-20 00:49:55Z ian $
* @package Joomla
* @subpackage JFramework
* @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.plugin.plugin');
/**
* Joomla User plugin
*
* @package Joomla
* @subpackage JFramework
* @since 1.5
*/
class plgUserJoomla extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.5
*/
function plgUserJoomla(& $subject, $config) {
parent::__construct($subject, $config);
}
/**
* Remove all sessions for the user name
*
* Method is called after user data is deleted from the database
*
* @param array holds the user data
* @param boolean true if user was succesfully stored in the database
* @param string message
*/
function onAfterDeleteUser($user, $succes, $msg)
{
if(!$succes) {
return false;
}
$db =& JFactory::getDBO();
$db->setQuery('DELETE FROM #__session WHERE userid = '.$db->Quote($user['id']));
$db->Query();
return true;
}
/**
* This method should handle any login logic and report back to the subject
*
* @access public
* @param array holds the user data
* @param array array holding options (remember, autoregister, group)
* @return boolean True on success
* @since 1.5
*/
function onLoginUser($user, $options = array())
{
jimport('joomla.user.helper');
$instance =& $this->_getUser($user, $options);
// if _getUser returned an error, then pass it back.
if (JError::isError( $instance )) {
return $instance;
}
// If the user is blocked, redirect with an error
if ($instance->get('block') == 1) {
return JError::raiseWarning('SOME_ERROR_CODE', JText::_('E_NOLOGIN_BLOCKED'));
}
// Get an ACL object
$acl =& JFactory::getACL();
// Get the user group from the ACL
if ($instance->get('tmp_user') == 1) {
$grp = new JObject;
// This should be configurable at some point
$grp->set('name', 'Registered');
} else {
$grp = $acl->getAroGroup($instance->get('id'));
}
//Authorise the user based on the group information
if(!isset($options['group'])) {
$options['group'] = 'USERS';
}
if(!$acl->is_group_child_of( $grp->name, $options['group'])) {
return JError::raiseWarning('SOME_ERROR_CODE', JText::_('E_NOLOGIN_ACCESS'));
}
//Mark the user as logged in
$instance->set( 'guest', 0);
$instance->set('aid', 1);
// Fudge Authors, Editors, Publishers and Super Administrators into the special access group
if ($acl->is_group_child_of($grp->name, 'Registered') ||
$acl->is_group_child_of($grp->name, 'Public Backend')) {
$instance->set('aid', 2);
}
//Set the usertype based on the ACL group name
$instance->set('usertype', $grp->name);
// Register the needed session variables
$session =& JFactory::getSession();
$session->set('user', $instance);
// Get the session object
$table = & JTable::getInstance('session');
$table->load( $session->getId() );
$table->guest = $instance->get('guest');
$table->username = $instance->get('username');
$table->userid = intval($instance->get('id'));
$table->usertype = $instance->get('usertype');
$table->gid = intval($instance->get('gid'));
$table->update();
// Hit the user last visit field
$instance->setLastVisit();
return true;
}
/**
* This method should handle any logout logic and report back to the subject
*
* @access public
* @param array holds the user data
* @param array array holding options (client, ...)
* @return object True on success
* @since 1.5
*/
function onLogoutUser($user, $options = array())
{
$my =& JFactory::getUser();
//Make sure we're a valid user first
if($user['id'] == 0 && !$my->get('tmp_user')) return true;
//Check to see if we're deleting the current session
if($my->get('id') == $user['id'])
{
// Hit the user last visit field
$my->setLastVisit();
// Destroy the php session for this user
$session =& JFactory::getSession();
$session->destroy();
} else {
// Force logout all users with that userid
$table = & JTable::getInstance('session');
$table->destroy($user['id'], $options['clientid']);
}
return true;
}
/**
* This method will return a user object
*
* If options['autoregister'] is true, if the user doesn't exist yet he will be created
*
* @access public
* @param array holds the user data
* @param array array holding options (remember, autoregister, group)
* @return object A JUser object
* @since 1.5
*/
function &_getUser($user, $options = array())
{
$instance = new JUser();
if($id = intval(JUserHelper::getUserId($user['username']))) {
$instance->load($id);
return $instance;
}
//TODO : move this out of the plugin
jimport('joomla.application.component.helper');
$config = &JComponentHelper::getParams( 'com_users' );
$usertype = $config->get( 'new_usertype', 'Registered' );
$acl =& JFactory::getACL();
$instance->set( 'id' , 0 );
$instance->set( 'name' , $user['fullname'] );
$instance->set( 'username' , $user['username'] );
$instance->set( 'password_clear' , $user['password_clear'] );
$instance->set( 'email' , $user['email'] ); // Result should contain an email (check)
$instance->set( 'gid' , $acl->get_group_id( '', $usertype));
$instance->set( 'usertype' , $usertype );
//If autoregister is set let's register the user
$autoregister = isset($options['autoregister']) ? $options['autoregister'] : $this->params->get('autoregister', 1);
if($autoregister)
{
if(!$instance->save()) {
return JError::raiseWarning('SOME_ERROR_CODE', $instance->getError());
}
} else {
// No existing user and autoregister off, this is a temporary user.
$instance->set( 'tmp_user', true );
}
return $instance;
}
}
+21
View File
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="plugin" group="user">
<name>User - Joomla!</name>
<author>Joomla! Project</author>
<creationDate>December 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</version>
<description>PLG_USER_JOOMLA</description>
<files>
<filename plugin="joomla">joomla.php</filename>
</files>
<params>
<param name="autoregister" type="radio" default="1" label="Auto Create Users" description="PARAMAUTOCREATEUSERS">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
</params>
</install>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="plugin" group="xmlrpc">
<name>XML-RPC - Blogger API</name>
<author>Joomla! Project</author>
<creationDate>February 2006</creationDate>
<copyright>
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.0</version>
<description>Blogger XML-RPC API</description>
<files>
<filename plugin="blogger">blogger.php</filename>
</files>
<params>
<param name="catid" type="category" default="1"
label="New posts" description="PARAMCATEGORY" />
<param name="sectionid" type="section" default="0"
label="Edit posts" description="PARAMSECTION" />
</params>
</install>
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
+111
View File
@@ -0,0 +1,111 @@
<?php
/**
* @version $Id: joomla.php 10381 2008-06-01 03:35:53Z pasamio $
* @package Joomla
* @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.plugin.plugin');
/**
* Joomla! Base XML-RPC Plugin
*
* @package XML-RPC
* @since 1.5
*/
class plgXMLRPCJoomla extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param object $params The object that holds the plugin parameters
* @since 1.5
*/
function plgXMLRPCJoomla(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Get available web services for this plugin
*
* @access public
* @return array Array of web service descriptors
* @since 1.5
*/
function onGetWebServices()
{
global $xmlrpcString;
// Initialize variables
$services = array();
// Site search service
$services['joomla.searchSite'] = array(
'function' => 'plgXMLRPCJoomlaServices::searchSite',
'docstring' => 'Searches a remote site.',
'signature' => array(array($xmlrpcString, $xmlrpcString, $xmlrpcString))
);
return $services;
}
}
class plgXMLRPCJoomlaServices
{
/**
* Remote Search method
*
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
*
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
* @return array Search Results
* @since 1.5
*/
function searchSite($searchword, $phrase='', $order='')
{
global $mainframe;
// Initialize variables
$db =& JFactory::getDBO();
// Prepare arguments
$searchword = $db->getEscaped( trim( $searchword ) );
$phrase = '';
$ordering = '';
// Load search plugins and fire the onSearch event
JPluginHelper::importPlugin( 'search' );
$results = $mainframe->triggerEvent( 'onSearch', array( $searchword, $phrase, $ordering ) );
// Iterate through results building the return array
require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_search'.DS.'helpers'.DS.'search.php');
foreach ($results as $i=>$rows)
{
foreach ($rows as $j=>$row) {
$results[$i][$j]->href = eregi('^(http|https)://', $row->href) ? $row->href : JURI::root().'/'.$row->href;
$results[$i][$j]->text = SearchHelper::prepareSearchContent( $row->text, 200, $searchword);
}
}
return $results;
}
}
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="plugin" group="xmlrpc">
<name>XML-RPC - Joomla API</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>
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.0</version>
<description>Joomla! XML-RPC API</description>
<files>
<filename plugin="joomla">joomla.php</filename>
<filename>joomla/methods.php</filename>
</files>
<params />
</install>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<install method="upgrade" version="1.5" type="plugin" group="xmlrpc">
<name>XML-RPC - MovableType API</name>
<author>Joomler!.net</author>
<creationDate>Sep 2008</creationDate>
<copyright>(C) 2009 Joomler!.net</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomler.net</authorUrl>
<version>2.3.3</version>
<description>PLGXMLRPC_MT_DESC</description>
<files>
<filename plugin="movabletype">movabletype.php</filename>
<folder>movabletype</folder>
</files>
<languages>
<language tag="en-GB">en-GB.plg_xmlrpc_movabletype.ini</language>
<language tag="ja-JP">ja-JP.plg_xmlrpc_movabletype.ini</language>
<language tag="ja-JU">ja-JU.plg_xmlrpc_movabletype.ini</language>
</languages>
<params addpath="/plugins/xmlrpc/movabletype">
<!--<param name="db_enc" type="list" default="UTF-8" label="DB Encode" description="type of Joomla database encoding">
<option value="UTF-8">UTF-8 Unicode</option>
<option value="EUC-JP">EUC-JP</option>
<option value="ISO-8859-1">ISO-8859-1</option>
<option value="WINDOWS-1250">Central European WIN-1250</option>
<option value="WINDOWS-1251">Cyrillic WIN-1251</option>
<option value="WINDOWS-1252">Western WIN-1252</option>
<option value="WINDOWS-1257">Baltic WIN-1257</option>
</param>-->
<param name="@spacer" type="subtitle" label="Category(required)" default=" " />
<param name="catid" type="category" default="1" label="Default Category" description="Default Category(required)" />
<param name="@spacer" type="subtitle" label="@spacer" default=" " />
<param name="@spacer" type="subtitle" label="Mode" default=" " />
<param name="catonly" type="list" default="0" label="Single category mode" description="When Yes is selected, it comes to be able to edit only the article in one category." >
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="@spacer" type="subtitle" label="@spacer" default=" " />
<param name="@spacer" type="subtitle" label="Storage" default=" " />
<param name="img_storage_path" type="text" default="images/stories/" label="Storage Path" description="Image storage path(e.g: images/stories/ )" />
<param name="overwrite" type="list" default="0" label="Overwrite if the same file name" description="Overwrite if the same file name" >
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="maxsize" type="text" default="" label="Max Size(byte)" description="Max size of upload file.(byte) if blank or 0, unlimited. default :300000" />
<param name="exts" type="text" default="jpg,jpeg,gif,png" label="File Type" description="Please fill it out at a comma end. example:jpg,jpeg,gif,png"/>
<param name="@spacer" type="subtitle" label="@spacer" default=" " />
<param name="@spacer" type="subtitle" label="Options" default="" description="" />
<param name="autodesc" type="list" label="Auto MetaDesc" default="1" description="When you posted it, This is automatic and do generate metadescription?">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="regex" type="text" default="" label="Regex" description="this is only english. Change regex of your language. example:[a-zA-Z]{2,15}|[yourlanga-yourlangz]{2,15}" size="20" />
<param name="maxkeylength" type="text" default="30" label="MaxLength(meta description)" description="Max Length of Meta Description" />
<param name="autokey" type="list" label="Auto MetaKey" default="1" description="When you posted it, This is automatic and do generate metakey?" >
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="maxkeyword" type="text" default="10" label="Word Num(meta key)" description="The number of the keyword" />
<param name="@spacer" type="subtitle" label="@spacer" default=" " />
<param name="@spacer" type="subtitle" default="" label="For Google Docs" description="" />
<param name="readmore" type="list" default="0" label="Google Doc Readmore" description="User the first Horizontal line or the first Page break(printing) as Readmore">
<option value="0">Use First Horizontal line</option>
<option value="1">Use First Page break</option>
</param>
<param name="pagebreak" type="list" default="1" label="Google Doc Pagebreak" description="Enable/Disable Google Doc Pagebreak">
<option value="0">Disable</option>
<option value="1">Enable</option>
</param>
<param name="@spacer" type="subtitle" label="@spacer" default=" " />
<param name="@spacer" type="subtitle" default="" label="Restriction" description="" />
<param name="use_iprestrict" type="list" default="0" label="IP Address Restrict" description="IP Address Restriction. (It is only a fixed IP address.)">
<option value="1">Yes</option>
<option value="0">No</option>
</param>
<param name="ipaddress" type="text" default="" label="Allow IP" description="Please fill it out in Comma Separated Value. (example:123.123.123.123,234.234.234.234)" />
<param name="@spacer" type="subtitle" label="@spacer" default=" " />
<param name="@spacer" type="subtitle" default="" label="For Author or Registered" description="" />
<param name="access" type="textarea" rows="10" cols="30" label="Access" description="1line 1user. userid=categories. example:userid=1,2,3. This setting is enabled for only registered or author." />
<param name="creatoronly" type="list" default="1" label="Allow own articles only" description="When Yes, Only the article of the creator admits editing. This setting is enabled for only registered or author." >
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="publish" type="list" default="0" label="Allow auto publish" description="Allow publish Desc" >
<option value="0">No</option>
<option value="1">Yes</option>
</param>
</params>
</install>
@@ -0,0 +1 @@
<html><body></body></html>
@@ -0,0 +1,68 @@
<?php
/**
* Component JContentPlus
* @version 1.0.0
* @package JContentPlus
* @copyright Copyright (C) 2008 Joomler!.net. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
* @author Joomler!.net [email protected]
* @url http://www.joomler.net
*/
/**
* @package Joomla
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL
*/
defined('_JEXEC') or die( 'Restricted access' );
class JElementSubtitle extends JElement
{
function fetchTooltip($label, $description, &$node, $control_name, $name) {
static $script;
if(is_null($script)){
$document = & JFactory::getDocument();
$script = "window.addEvent('domready', function(){ $$('td.paramlist_key').setProperty('width', '50%').setStyles({'width':'50%', 'padding-right':'1em'}); });";
$document->addScriptDeclaration($script);
}
if(strpos($label, '@') === 0) return '&nbsp;';
$description = trim($description);
$position = $node->attributes('position');
if(empty($position)){
$align = 'left';
$style = ' style="font-size:1.1em;color:#0B55C4;padding-left:1em;"';
$label = '<span style="color:#55B10A">&nabla;</span>&nbsp;'. JText::_($label);
} else {
$align = 'right';
$style = ' style="font-size:1.1em;color:#0B55C4;padding-left:1em;"';
$label = '<span style="color:#55B10A">&Delta;</span>&nbsp;'. JText::_($label);
}
if(!empty($description)){
$output = '<label id="'.$control_name.$name.'-lbl" for="'.$control_name.$name.'"';
$output .= ' class="hasTip" title="'.JText::_($label).'::'.JText::_($description).'">';
$output .= $label. '</label>';
return $output;
} else {
$label = sprintf('<div align="'. $align. '"'. $style. '>%s</div>', $label);
}
return $label;
}
function fetchElement($name, $value, &$node, $control_name)
{
if ($value) {
return $value;
} else {
return '&nbsp;';
}
}
}