添加到 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:
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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>admin@joomla.org</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>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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>admin@joomla.org</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>
|
||||
@@ -0,0 +1,568 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: blogger.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' );
|
||||
|
||||
class plgXMLRPCBlogger extends JPlugin
|
||||
{
|
||||
function plgXMLRPCBlogger(&$subject, $config)
|
||||
{
|
||||
parent::__construct($subject, $config);
|
||||
$this->loadLanguage( '', JPATH_ADMINISTRATOR );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array An array of associative arrays defining the available methods
|
||||
*/
|
||||
function onGetWebServices()
|
||||
{
|
||||
global $xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble, $xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray, $xmlrpcStruct, $xmlrpcValue;
|
||||
|
||||
return array
|
||||
(
|
||||
'blogger.getUsersBlogs' => array(
|
||||
'function' => 'plgXMLRPCBloggerServices::getUserBlogs',
|
||||
'docstring' => JText::_('Returns a list of weblogs to which an author has posting privileges.'),
|
||||
'signature' => array(array($xmlrpcArray, $xmlrpcString, $xmlrpcString, $xmlrpcString ))
|
||||
),
|
||||
'blogger.getUserInfo' => array(
|
||||
'function' => 'plgXMLRPCBloggerServices::getUserInfo',
|
||||
'docstring' => JText::_('Returns information about an author in the system.'),
|
||||
'signature' => array(array($xmlrpcStruct, $xmlrpcString, $xmlrpcString, $xmlrpcString))
|
||||
),
|
||||
'blogger.getPost' => array(
|
||||
'function' => 'plgXMLRPCBloggerServices::getPost',
|
||||
'docstring' => JText::_('Returns information about a specific post.'),
|
||||
'signature' => array(array($xmlrpcStruct, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString))
|
||||
),
|
||||
'blogger.getRecentPosts' => array(
|
||||
'function' => 'plgXMLRPCBloggerServices::getRecentPosts',
|
||||
'docstring' => JText::_('Returns a list of the most recent posts in the system.'),
|
||||
'signature' => array(array($xmlrpcArray, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcInt))
|
||||
),
|
||||
'blogger.getTemplate' => array(
|
||||
'function' => 'plgXMLRPCBloggerServices::getTemplate',
|
||||
'docstring' => '',
|
||||
'signature' => array(array($xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString))
|
||||
),
|
||||
'blogger.setTemplate' => array(
|
||||
'function' => 'plgXMLRPCBloggerServices::setTemplate',
|
||||
'docstring' => '',
|
||||
'signature' => array(array($xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString))
|
||||
),
|
||||
'blogger.newPost' => array(
|
||||
'function' => 'plgXMLRPCBloggerServices::newPost',
|
||||
'docstring' => JText::_('Creates a new post, and optionally publishes it.'),
|
||||
'signature' => array(array($xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcBoolean))
|
||||
),
|
||||
'blogger.deletePost' => array(
|
||||
'function' => 'plgXMLRPCBloggerServices::deletePost',
|
||||
'docstring' => JText::_('Deletes a post.'),
|
||||
'signature' => array(array($xmlrpcBoolean, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcBoolean))
|
||||
),
|
||||
'blogger.editPost' => array(
|
||||
'function' => 'plgXMLRPCBloggerServices::editPost',
|
||||
'docstring' => JText::_('Updates the information about an existing post.'),
|
||||
'signature' => array(array($xmlrpcBoolean, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcBoolean))
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class plgXMLRPCBloggerServices
|
||||
{
|
||||
/*
|
||||
* Note : blogger.getUsersBlogs will make more sense once we support multiple blogs
|
||||
*/
|
||||
function getUserBlogs($appkey, $username, $password)
|
||||
{
|
||||
global $mainframe, $xmlrpcerruser, $xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble, $xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray, $xmlrpcStruct, $xmlrpcValue;
|
||||
|
||||
if(!plgXMLRPCBloggerHelper::authenticateUser($username, $password)) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_("Login Failed"));
|
||||
}
|
||||
|
||||
$user =& JFactory::getUser($username);
|
||||
plgXMLRPCBloggerHelper::getUserAid( $user );
|
||||
|
||||
// Handle the access permissions part of the main database query
|
||||
if ($user->authorize('com_content', 'edit', 'content', 'all')) {
|
||||
$xwhere = '';
|
||||
} else {
|
||||
$xwhere = ' AND a.published = 1 AND b.published = 1';
|
||||
}
|
||||
$gid = $user->get('aid', 0);
|
||||
$access_check = ' AND a.access <= '.(int) $gid .
|
||||
' AND b.access <= '.(int) $gid;
|
||||
// Query of categories within section
|
||||
$query = 'SELECT a.id, a.title, a.section, ' .
|
||||
' CONCAT_WS(\'/\', a.title, b.title) AS catName' .
|
||||
' FROM #__categories AS a' .
|
||||
' LEFT JOIN #__sections AS b ON a.section = b.id' .
|
||||
$xwhere.
|
||||
$access_check;
|
||||
$db = &JFactory::getDBO();
|
||||
$db->setQuery( $query );
|
||||
$categories = $db->loadObjectList();
|
||||
$structarray = array();
|
||||
|
||||
foreach( $categories AS $category ) {
|
||||
if (intval($category->section) > 0) {
|
||||
$blog = new xmlrpcval(array(
|
||||
'url' => new xmlrpcval(JURI::base(), $xmlrpcString),
|
||||
'blogid' => new xmlrpcval($category->id, $xmlrpcString),
|
||||
'blogName' => new xmlrpcval($category->catName, $xmlrpcString)
|
||||
), 'struct');
|
||||
array_push($structarray, $blog);
|
||||
}
|
||||
}
|
||||
return new xmlrpcresp(new xmlrpcval( $structarray , $xmlrpcArray));
|
||||
}
|
||||
|
||||
function getUserInfo($appkey, $username, $password)
|
||||
{
|
||||
global $xmlrpcerruser, $xmlrpcStruct;
|
||||
|
||||
if(!plgXMLRPCBloggerHelper::authenticateUser($username, $password)) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_("Login Failed"));
|
||||
}
|
||||
|
||||
$user =& JFactory::getUser($username);
|
||||
plgXMLRPCBloggerHelper::getUserAid( $user );
|
||||
|
||||
$struct = new xmlrpcval(
|
||||
array(
|
||||
'nickname' => new xmlrpcval($user->get('username')),
|
||||
'userid' => new xmlrpcval($user->get('id')),
|
||||
'url' => new xmlrpcval(''),
|
||||
'email' => new xmlrpcval($user->get('email')),
|
||||
'lastname' => new xmlrpcval($user->get('name')),
|
||||
'firstname' => new xmlrpcval($user->get('name'))
|
||||
), $xmlrpcStruct);
|
||||
|
||||
return new xmlrpcresp($struct);
|
||||
}
|
||||
|
||||
function getPost($appkey, $postid, $username, $password)
|
||||
{
|
||||
global $xmlrpcerruser, $xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble, $xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray, $xmlrpcStruct, $xmlrpcValue;
|
||||
|
||||
if(!plgXMLRPCBloggerHelper::authenticateUser($username, $password)) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_("Login Failed"));
|
||||
}
|
||||
|
||||
$user =& JFactory::getUser($username);
|
||||
plgXMLRPCBloggerHelper::getUserAid( $user );
|
||||
|
||||
$db = &JFactory::getDBO();
|
||||
|
||||
$where = 'a.id = ' . (int) $postid;
|
||||
|
||||
$canReadUnpublished = $user->authorize('com_content', 'edit', 'content', 'all');
|
||||
if ($canReadUnpublished) {
|
||||
$publishedWhere = '';
|
||||
} else {
|
||||
$publishedWhere = ' AND u.published = 1 AND b.published = 1';
|
||||
}
|
||||
|
||||
$nullDate = $db->getNullDate();
|
||||
$date =& JFactory::getDate();
|
||||
$now = $date->toMySQL();
|
||||
|
||||
$query = 'SELECT a.title AS title,'
|
||||
. ' a.created AS created,'
|
||||
. ' a.introtext AS introtext,'
|
||||
. ' a.fulltext AS ftext,'
|
||||
. ' a.id AS id,'
|
||||
. ' a.created_by AS created_by'
|
||||
. ' FROM #__content AS a'
|
||||
. ' INNER JOIN #__categories AS b ON b.id=a.catid'
|
||||
. ' INNER JOIN #__sections AS u ON u.id = a.sectionid'
|
||||
. ' WHERE '.$where
|
||||
. $publishedWhere
|
||||
. ' AND a.access <= '.(int) $user->get( 'aid' )
|
||||
. ' AND b.access <= '.(int) $user->get( 'aid' )
|
||||
. ' AND u.access <= '.(int) $user->get( 'aid' )
|
||||
. ' AND ( a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).' )'
|
||||
. ' AND ( a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).' )'
|
||||
;
|
||||
|
||||
$db->setQuery( $query );
|
||||
$item = $db->loadObject();
|
||||
|
||||
if ($item === null) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+2, JText::_("Access Denied"));
|
||||
}
|
||||
|
||||
$content = '<title>'.$item->title.'</title>';
|
||||
$content .= $item->introtext.'<more_text>'.$item->ftext.'</more_text>';
|
||||
|
||||
$struct = new xmlrpcval(
|
||||
array(
|
||||
'userid' => new xmlrpcval($item->created_by),
|
||||
'dateCreated' => new xmlrpcval($item->created),
|
||||
'content' => new xmlrpcval($content),
|
||||
'postid' => new xmlrpcval($item->id)
|
||||
), $xmlrpcStruct);
|
||||
|
||||
return new xmlrpcresp($struct);
|
||||
}
|
||||
|
||||
function newPost($appkey, $blogid, $username, $password, $content, $publish)
|
||||
{
|
||||
global $xmlrpcerruser, $xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble, $xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray, $xmlrpcStruct, $xmlrpcValue;
|
||||
|
||||
if(!plgXMLRPCBloggerHelper::authenticateUser($username, $password)) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_("Login Failed"));
|
||||
}
|
||||
|
||||
$user =& JFactory::getUser($username);
|
||||
plgXMLRPCBloggerHelper::getUserAid( $user );
|
||||
|
||||
if ($user->get('gid') < 19) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_('ALERTNOTAUTH'));
|
||||
}
|
||||
|
||||
// Create a user access object for the user
|
||||
$access = new stdClass();
|
||||
$access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all');
|
||||
$access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own');
|
||||
$access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all');
|
||||
|
||||
if (!($access->canEdit || $access->canEditOwn)) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_('ALERTNOTAUTH'));
|
||||
}
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
|
||||
// load plugin params info
|
||||
$plugin =& JPluginHelper::getPlugin('xmlrpc','blogger');
|
||||
$params = new JParameter( $plugin->params );
|
||||
|
||||
$blogid = (int) $blogid;
|
||||
|
||||
// load the category
|
||||
$cat =& JTable::getInstance('category');
|
||||
$cat->load($blogid);
|
||||
|
||||
// create a new content item
|
||||
$item =& JTable::getInstance('content');
|
||||
|
||||
$item->title = plgXMLRPCBloggerHelper::getPostTitle($content);
|
||||
$item->introtext = plgXMLRPCBloggerHelper::getPostIntroText($content);
|
||||
$item->fulltext = plgXMLRPCBloggerHelper::getPostFullText($content);
|
||||
|
||||
$item->catid = $blogid;
|
||||
$item->sectionid = $cat->section;
|
||||
|
||||
$date =& JFactory::getDate();
|
||||
|
||||
$item->created = $date->toMySQL();
|
||||
$item->created_by = $user->get('id');
|
||||
|
||||
$item->publish_up = $date->toMySQL();
|
||||
$item->publish_down = $db->getNullDate();
|
||||
|
||||
$item->state = ($publish && $access->canPublish) ? 1 : 0;
|
||||
|
||||
if (!$item->check()) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_('Post check failed') );
|
||||
}
|
||||
|
||||
$item->version++;
|
||||
|
||||
if (!$item->store()) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_('Post store failed') );
|
||||
}
|
||||
|
||||
return new xmlrpcresp(new xmlrpcval($item->id, $xmlrpcString));
|
||||
}
|
||||
|
||||
function editPost($appkey, $postid, $username, $password, $content, $publish)
|
||||
{
|
||||
global $xmlrpcerruser, $xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble, $xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray, $xmlrpcStruct, $xmlrpcValue;
|
||||
|
||||
if(!plgXMLRPCBloggerHelper::authenticateUser($username, $password)) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_("Login Failed"));
|
||||
}
|
||||
|
||||
$user =& JFactory::getUser($username);
|
||||
plgXMLRPCBloggerHelper::getUserAid( $user );
|
||||
|
||||
// Create a user access object for the user
|
||||
$access = new stdClass();
|
||||
$access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all');
|
||||
$access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own');
|
||||
$access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all');
|
||||
|
||||
if (!($access->canEdit || $access->canEditOwn)) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_('ALERTNOTAUTH'));
|
||||
}
|
||||
|
||||
// load the row from the db table
|
||||
$item =& JTable::getInstance('content');
|
||||
if(!$item->load( $postid )) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_('Sorry, no such post') );
|
||||
}
|
||||
|
||||
if($item->isCheckedOut($user->get('id'))) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_('Sorry, post is already being edited') );
|
||||
}
|
||||
|
||||
//lock the item
|
||||
$item->checkout($user->id);
|
||||
|
||||
$item->title = plgXMLRPCBloggerHelper::getPostTitle($content);
|
||||
$item->introtext = plgXMLRPCBloggerHelper::getPostIntroText($content);
|
||||
$item->fulltext = plgXMLRPCBloggerHelper::getPostFullText($content);
|
||||
|
||||
if (!$item->check()) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_('Post check failed') );
|
||||
}
|
||||
|
||||
$item->version++;
|
||||
|
||||
if (!$item->store()) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_('Post store failed') );
|
||||
}
|
||||
|
||||
$item->state = ($publish && $access->canPublish) ? 1 : 0;
|
||||
|
||||
//lock the item
|
||||
$item->checkout();
|
||||
|
||||
return new xmlrpcresp(new xmlrpcval('true', $xmlrpcBoolean));
|
||||
}
|
||||
|
||||
function deletePost($appkey, $postid, $username, $password, $publish)
|
||||
{
|
||||
global $xmlrpcerruser, $xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble, $xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray, $xmlrpcStruct, $xmlrpcValue;
|
||||
|
||||
if(!plgXMLRPCBloggerHelper::authenticateUser($username, $password)) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_("Login Failed"));
|
||||
}
|
||||
|
||||
$user =& JFactory::getUser($username);
|
||||
plgXMLRPCBloggerHelper::getUserAid( $user );
|
||||
|
||||
if ($user->get('gid') < 23) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_('ALERTNOTAUTH'));
|
||||
}
|
||||
|
||||
// load the row from the db table
|
||||
$item =& JTable::getInstance('content');
|
||||
if(!$item->load( $postid )) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_('Sorry, no such post') );
|
||||
}
|
||||
|
||||
if($item->isCheckedOut($user->get('id'))) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_('Sorry, post is already being edited') );
|
||||
}
|
||||
|
||||
//lock the item
|
||||
$item->checkout();
|
||||
|
||||
$item->state = -2;
|
||||
$item->ordering = 0;
|
||||
|
||||
if (!$item->store()) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_('Post delete failed') );
|
||||
}
|
||||
|
||||
return new xmlrpcresp(new xmlrpcval('true', $xmlrpcBoolean));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Blogger API - blogger.getRecentPosts
|
||||
*
|
||||
* @param xmlrpcmessage XML-RPC message passed to the method
|
||||
* @return xmlrpcresp XML-RPC response
|
||||
*/
|
||||
function getRecentPosts($appkey, $blogid, $username, $password, $numposts)
|
||||
{
|
||||
global $xmlrpcerruser, $xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble, $xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray, $xmlrpcStruct, $xmlrpcValue;
|
||||
|
||||
if(!plgXMLRPCBloggerHelper::authenticateUser($username, $password)) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_("Login Failed"));
|
||||
}
|
||||
|
||||
$user =& JFactory::getUser($username);
|
||||
plgXMLRPCBloggerHelper::getUserAid( $user );
|
||||
|
||||
// load plugin params info
|
||||
$plugin =& JPluginHelper::getPlugin('xmlrpc','blogger');
|
||||
$params = new JParameter( $plugin->params );
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
|
||||
$nullDate = $db->getNullDate();
|
||||
$date =& JFactory::getDate();
|
||||
$now = $date->toMySQL();
|
||||
|
||||
$blogid = (int) $blogid;
|
||||
|
||||
$canReadUnpublished = $user->authorize('com_content', 'edit', 'content', 'all');
|
||||
if ($canReadUnpublished) {
|
||||
$publishedWhere = '';
|
||||
$publishTimeWhere = '';
|
||||
} else {
|
||||
$publishedWhere = ' AND u.published = 1 AND b.published = 1';
|
||||
$publishTimeWhere = ' AND ( a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).' )'
|
||||
. ' AND ( a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).' )';
|
||||
}
|
||||
|
||||
$query = 'SELECT a.title AS title,'
|
||||
. ' a.created AS created,'
|
||||
. ' a.introtext AS introtext,'
|
||||
. ' a.fulltext AS ftext,'
|
||||
. ' a.id AS id,'
|
||||
. ' a.created_by AS created_by'
|
||||
. ' FROM #__content AS a'
|
||||
. ' INNER JOIN #__categories AS b ON b.id=a.catid'
|
||||
. ' INNER JOIN #__sections AS u ON u.id = a.sectionid'
|
||||
. ' WHERE a.catid = '. $blogid
|
||||
. $publishedWhere
|
||||
. ' AND a.access <= '.(int) $user->get( 'aid' )
|
||||
. ' AND b.access <= '.(int) $user->get( 'aid' )
|
||||
. ' AND u.access <= '.(int) $user->get( 'aid' )
|
||||
. $publishTimeWhere
|
||||
;
|
||||
|
||||
$db->setQuery($query, 0, $numposts);
|
||||
$items = $db->loadObjectList();
|
||||
|
||||
if ($items === null) {
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_('No posts available, or an error has occured.') );
|
||||
}
|
||||
|
||||
$structArray = array();
|
||||
foreach ($items as $item)
|
||||
{
|
||||
$content = '<title>'.$item->title.'</title>';
|
||||
$content .= $item->introtext.'<more_text>'.$item->ftext.'</more_text>';
|
||||
|
||||
$structArray[] = new xmlrpcval(array(
|
||||
'userid' => new xmlrpcval($item->created_by),
|
||||
'dateCreated' => new xmlrpcval($item->created),
|
||||
'content' => new xmlrpcval($content),
|
||||
'postid' => new xmlrpcval($item->id)
|
||||
), 'struct');
|
||||
}
|
||||
|
||||
return new xmlrpcresp(new xmlrpcval( $structArray , $xmlrpcArray));
|
||||
}
|
||||
|
||||
function getTemplate($appkey, $blogid, $username, $password, $templateType)
|
||||
{
|
||||
global $xmlrpcerruser;
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_('Method not implemented') );
|
||||
}
|
||||
|
||||
function setTemplate($appkey, $blogid, $username, $password, $template, $templateType)
|
||||
{
|
||||
global $xmlrpcerruser;
|
||||
return new xmlrpcresp(0, $xmlrpcerruser+1, JText::_('Method not implemented') );
|
||||
}
|
||||
}
|
||||
|
||||
class plgXMLRPCBloggerHelper
|
||||
{
|
||||
function getUserAid( &$user ) {
|
||||
|
||||
$acl = &JFactory::getACL();
|
||||
|
||||
//Get the user group from the ACL
|
||||
$grp = $acl->getAroGroup($user->get('id'));
|
||||
|
||||
// Mark the user as logged in
|
||||
$user->set('guest', 0);
|
||||
$user->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')) {
|
||||
$user->set('aid', 2);
|
||||
}
|
||||
}
|
||||
|
||||
function authenticateUser($username, $password)
|
||||
{
|
||||
// Get the global JAuthentication object
|
||||
jimport( 'joomla.user.authentication');
|
||||
$auth = & JAuthentication::getInstance();
|
||||
$credentials = array( 'username' => $username, 'password' => $password );
|
||||
$options = array();
|
||||
$response = $auth->authenticate($credentials, $options);
|
||||
return $response->status === JAUTHENTICATE_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
function getPostTitle($content)
|
||||
{
|
||||
$title = '';
|
||||
if ( preg_match('/<title>(.+?)<\/title>/is', $content, $matchtitle) )
|
||||
{
|
||||
$title = $matchtitle[0];
|
||||
$title = preg_replace('/<title>/si', '', $title);
|
||||
$title = preg_replace('/<\/title>/si', '', $title);
|
||||
}
|
||||
if (empty( $title )) {
|
||||
$title = substr( $content, 0, 20 );
|
||||
}
|
||||
return $title;
|
||||
}
|
||||
|
||||
function getPostCategory($content)
|
||||
{
|
||||
$category = 0;
|
||||
|
||||
$match = array();
|
||||
if ( preg_match('/<category>(.+?)<\/category>/is', $content, $match) )
|
||||
{
|
||||
$category = trim($match[1], ',');
|
||||
$category = explode(',', $category);
|
||||
}
|
||||
|
||||
return $category;
|
||||
}
|
||||
|
||||
function getPostIntroText($content)
|
||||
{
|
||||
return plgXMLRPCBloggerHelper::removePostData($content); //substr($string, 0, strpos($string, '<more_text>'));
|
||||
}
|
||||
|
||||
function getPostFullText($content)
|
||||
{
|
||||
$match = array();
|
||||
if ( preg_match('/<more_text>(.+?)<\/more_text>/is', $content, $match) )
|
||||
{
|
||||
$fulltext = $match[0];
|
||||
$fulltext = preg_replace('/<more_text>/si', '', $fulltext);
|
||||
$fulltext = preg_replace('/<\/more_text>/si', '', $fulltext);
|
||||
}
|
||||
|
||||
return $fulltext;
|
||||
}
|
||||
|
||||
function removePostData($content)
|
||||
{
|
||||
$content = preg_replace('/<title>(.+?)<\/title>/si', '', $content);
|
||||
$content = preg_replace('/<category>(.+?)<\/category>/si', '', $content);
|
||||
$content = preg_replace('/<more_text>(.+?)<\/more_text>/si', '', $content);
|
||||
$content = trim($content);
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
@@ -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>admin@joomla.org</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>
|
||||
@@ -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>admin@joomla.org</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>joomlers@gmail.com</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 joomlers@gmail.com
|
||||
* @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 ' ';
|
||||
|
||||
$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">∇</span> '. JText::_($label);
|
||||
} else {
|
||||
$align = 'right';
|
||||
$style = ' style="font-size:1.1em;color:#0B55C4;padding-left:1em;"';
|
||||
$label = '<span style="color:#55B10A">Δ</span> '. 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 ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user