添加到 trunk

+YUCHENG HU+

git-svn-id: https://svn.code.sf.net/p/hawebs/svn@338 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
YuCheng Hu
2010-06-16 20:05:52 +00:00
parent 7f28ae6e54
commit 2196b3d762
900 changed files with 29551 additions and 11777 deletions
@@ -1,85 +1,85 @@
<?php
/**
* @version $Id: example.php 10381 2008-06-01 03:35:53Z pasamio $
* @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 Authentication Plugin
*
* @package Joomla
* @subpackage JFramework
* @since 1.5
*/
class plgAuthenticationExample 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 plgAuthenticationExample(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* This method should handle any authentication and report back to the subject
*
* @access public
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param object $response Authentication response object
* @return boolean
* @since 1.5
*/
function onAuthenticate( $credentials, $options, &$response )
{
/*
* Here you would do whatever you need for an authentication routine with the credentials
*
* In this example the mixed variable $return would be set to false
* if the authentication routine fails or an integer userid of the authenticated
* user if the routine passes
*/
$success = true;
if ($success)
{
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = '';
// You may also define other variables:
/*
$yourUser = YourClass::getUser( $credentials );
$response->email = $yourUser->email;
$response->fullname = $yourUser->name;
*/
return true;
}
else
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Could not authenticate';
return false;
}
}
}
<?php
/**
* @version $Id: example.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @subpackage JFramework
* @copyright Copyright (C) 2005 - 2010 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 Authentication Plugin
*
* @package Joomla
* @subpackage JFramework
* @since 1.5
*/
class plgAuthenticationExample 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 plgAuthenticationExample(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* This method should handle any authentication and report back to the subject
*
* @access public
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param object $response Authentication response object
* @return boolean
* @since 1.5
*/
function onAuthenticate( $credentials, $options, &$response )
{
/*
* Here you would do whatever you need for an authentication routine with the credentials
*
* In this example the mixed variable $return would be set to false
* if the authentication routine fails or an integer userid of the authenticated
* user if the routine passes
*/
$success = true;
if ($success)
{
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = '';
// You may also define other variables:
/*
$yourUser = YourClass::getUser( $credentials );
$response->email = $yourUser->email;
$response->fullname = $yourUser->name;
*/
return true;
}
else
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Could not authenticate';
return false;
}
}
}
@@ -3,7 +3,7 @@
<name>Authentication - Example</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
+106 -106
View File
@@ -1,106 +1,106 @@
<?php
/**
* @version $Id: gmail.php 11236 2008-11-02 02:44:35Z 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' );
/**
* GMail Authentication Plugin
*
* @package Joomla
* @subpackage JFramework
* @since 1.5
*/
class plgAuthenticationGMail 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 plgAuthenticationGMail(& $subject, $config) {
parent::__construct($subject, $config);
}
/**
* This method should handle any authentication and report back to the subject
*
* @access public
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param object $response Authentication response object
* @return boolean
* @since 1.5
*/
function onAuthenticate( $credentials, $options, &$response )
{
$message = '';
$success = 0;
if(function_exists('curl_init'))
{
if(strlen($credentials['username']) && strlen($credentials['password']))
{
$curl = curl_init('https://mail.google.com/mail/feed/atom');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
//curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_USERPWD, $credentials['username'].':'.$credentials['password']);
$result = curl_exec($curl);
$code = curl_getinfo ($curl, CURLINFO_HTTP_CODE);
switch($code)
{
case 200:
$message = 'Access Granted';
$success = 1;
break;
case 401:
$message = 'Access Denied';
break;
default:
$message = 'Result unknown, access denied.';
break;
}
}
else {
$message = 'Username or password blank';
}
}
else {
$message = 'curl isn\'t installed';
}
if ($success)
{
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = '';
$response->email = $credentials['username'];
$response->fullname = $credentials['username'];
}
else
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Failed to authenticate: ' . $message;
}
}
}
<?php
/**
* @version $Id: gmail.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @subpackage JFramework
* @copyright Copyright (C) 2005 - 2010 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' );
/**
* GMail Authentication Plugin
*
* @package Joomla
* @subpackage JFramework
* @since 1.5
*/
class plgAuthenticationGMail 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 plgAuthenticationGMail(& $subject, $config) {
parent::__construct($subject, $config);
}
/**
* This method should handle any authentication and report back to the subject
*
* @access public
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param object $response Authentication response object
* @return boolean
* @since 1.5
*/
function onAuthenticate( $credentials, $options, &$response )
{
$message = '';
$success = 0;
if(function_exists('curl_init'))
{
if(strlen($credentials['username']) && strlen($credentials['password']))
{
$curl = curl_init('https://mail.google.com/mail/feed/atom');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
//curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_USERPWD, $credentials['username'].':'.$credentials['password']);
$result = curl_exec($curl);
$code = curl_getinfo ($curl, CURLINFO_HTTP_CODE);
switch($code)
{
case 200:
$message = 'Access Granted';
$success = 1;
break;
case 401:
$message = 'Access Denied';
break;
default:
$message = 'Result unknown, access denied.';
break;
}
}
else {
$message = 'Username or password blank';
}
}
else {
$message = 'curl isn\'t installed';
}
if ($success)
{
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = '';
$response->email = $credentials['username'];
$response->fullname = $credentials['username'];
}
else
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Failed to authenticate: ' . $message;
}
}
}
@@ -3,7 +3,7 @@
<name>Authentication - GMail</name>
<author>Joomla! Project</author>
<creationDate>February 2006</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
+105 -105
View File
@@ -1,105 +1,105 @@
<?php
/**
* @version $Id: joomla.php 10709 2008-08-21 09:58:52Z eddieajau $
* @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 Authentication plugin
*
* @package Joomla
* @subpackage JFramework
* @since 1.5
*/
class plgAuthenticationJoomla 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 plgAuthenticationJoomla(& $subject, $config) {
parent::__construct($subject, $config);
}
/**
* This method should handle any authentication and report back to the subject
*
* @access public
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param object $response Authentication response object
* @return boolean
* @since 1.5
*/
function onAuthenticate( $credentials, $options, &$response )
{
jimport('joomla.user.helper');
// Joomla does not like blank passwords
if (empty($credentials['password']))
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Empty password not allowed';
return false;
}
// Initialize variables
$conditions = '';
// Get a database object
$db =& JFactory::getDBO();
$query = 'SELECT `id`, `password`, `gid`'
. ' FROM `#__users`'
. ' WHERE username=' . $db->Quote( $credentials['username'] )
;
$db->setQuery( $query );
$result = $db->loadObject();
if($result)
{
$parts = explode( ':', $result->password );
$crypt = $parts[0];
$salt = @$parts[1];
$testcrypt = JUserHelper::getCryptedPassword($credentials['password'], $salt);
if ($crypt == $testcrypt) {
$user = JUser::getInstance($result->id); // Bring this in line with the rest of the system
$response->email = $user->email;
$response->fullname = $user->name;
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = '';
} else {
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Invalid password';
}
}
else
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'User does not exist';
}
}
}
<?php
/**
* @version $Id: joomla.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @subpackage JFramework
* @copyright Copyright (C) 2005 - 2010 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 Authentication plugin
*
* @package Joomla
* @subpackage JFramework
* @since 1.5
*/
class plgAuthenticationJoomla 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 plgAuthenticationJoomla(& $subject, $config) {
parent::__construct($subject, $config);
}
/**
* This method should handle any authentication and report back to the subject
*
* @access public
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param object $response Authentication response object
* @return boolean
* @since 1.5
*/
function onAuthenticate( $credentials, $options, &$response )
{
jimport('joomla.user.helper');
// Joomla does not like blank passwords
if (empty($credentials['password']))
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Empty password not allowed';
return false;
}
// Initialize variables
$conditions = '';
// Get a database object
$db =& JFactory::getDBO();
$query = 'SELECT `id`, `password`, `gid`'
. ' FROM `#__users`'
. ' WHERE username=' . $db->Quote( $credentials['username'] )
;
$db->setQuery( $query );
$result = $db->loadObject();
if($result)
{
$parts = explode( ':', $result->password );
$crypt = $parts[0];
$salt = @$parts[1];
$testcrypt = JUserHelper::getCryptedPassword($credentials['password'], $salt);
if ($crypt == $testcrypt) {
$user = JUser::getInstance($result->id); // Bring this in line with the rest of the system
$response->email = $user->email;
$response->fullname = $user->name;
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = '';
} else {
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Invalid password';
}
}
else
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'User does not exist';
}
}
}
@@ -3,7 +3,7 @@
<name>Authentication - Joomla</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
+162 -162
View File
@@ -1,162 +1,162 @@
<?php
/**
* @version $Id: ldap.php 10709 2008-08-21 09:58:52Z eddieajau $
* @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' );
/**
* LDAP Authentication Plugin
*
* @package Joomla
* @subpackage JFramework
* @since 1.5
*/
class plgAuthenticationLdap 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 plgAuthenticationLdap(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* This method should handle any authentication and report back to the subject
*
* @access public
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param object $response Authentication response object
* @return object boolean
* @since 1.5
*/
function onAuthenticate( $credentials, $options, &$response )
{
// Initialize variables
$userdetails = null;
$success = 0;
$userdetails = Array();
// For JLog
$response->type = 'LDAP';
// LDAP does not like Blank passwords (tries to Anon Bind which is bad)
if (empty($credentials['password']))
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'LDAP can not have blank password';
return false;
}
// load plugin params info
$ldap_email = $this->params->get('ldap_email');
$ldap_fullname = $this->params->get('ldap_fullname');
$ldap_uid = $this->params->get('ldap_uid');
$auth_method = $this->params->get('auth_method');
jimport('joomla.client.ldap');
$ldap = new JLDAP($this->params);
if (!$ldap->connect())
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Unable to connect to LDAP server';
return;
}
switch($auth_method)
{
case 'search':
{
// Bind using Connect Username/password
// Force anon bind to mitigate misconfiguration like [#7119]
if(strlen($this->params->get('username'))) $bindtest = $ldap->bind();
else $bindtest = $ldap->anonymous_bind();
if($bindtest)
{
// Search for users DN
$binddata = $ldap->simple_search(str_replace("[search]", $credentials['username'], $this->params->get('search_string')));
if(isset($binddata[0]) && isset($binddata[0]['dn'])) {
// Verify Users Credentials
$success = $ldap->bind($binddata[0]['dn'],$credentials['password'],1);
// Get users details
$userdetails = $binddata;
} else {
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Unable to find user';
}
}
else
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Unable to bind to LDAP';
}
} break;
case 'bind':
{
// We just accept the result here
$success = $ldap->bind($credentials['username'],$credentials['password']);
if($success) {
$userdetails = $ldap->simple_search(str_replace("[search]", $credentials['username'], $this->params->get('search_string')));
} else {
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Failed binding to LDAP server';
}
} break;
}
if(!$success)
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
if(!strlen($response->error_message)) $response->error_message = 'Incorrect username/password';
}
else
{
// Grab some details from LDAP and return them
if (isset($userdetails[0][$ldap_uid][0])) {
$response->username = $userdetails[0][$ldap_uid][0];
}
if (isset($userdetails[0][$ldap_email][0])) {
$response->email = $userdetails[0][$ldap_email][0];
}
if(isset($userdetails[0][$ldap_fullname][0])) {
$response->fullname = $userdetails[0][$ldap_fullname][0];
} else {
$response->fullname = $credentials['username'];
}
// Were good - So say so.
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = '';
}
$ldap->close();
}
}
<?php
/**
* @version $Id: ldap.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @subpackage JFramework
* @copyright Copyright (C) 2005 - 2010 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' );
/**
* LDAP Authentication Plugin
*
* @package Joomla
* @subpackage JFramework
* @since 1.5
*/
class plgAuthenticationLdap 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 plgAuthenticationLdap(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* This method should handle any authentication and report back to the subject
*
* @access public
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param object $response Authentication response object
* @return object boolean
* @since 1.5
*/
function onAuthenticate( $credentials, $options, &$response )
{
// Initialize variables
$userdetails = null;
$success = 0;
$userdetails = Array();
// For JLog
$response->type = 'LDAP';
// LDAP does not like Blank passwords (tries to Anon Bind which is bad)
if (empty($credentials['password']))
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'LDAP can not have blank password';
return false;
}
// load plugin params info
$ldap_email = $this->params->get('ldap_email');
$ldap_fullname = $this->params->get('ldap_fullname');
$ldap_uid = $this->params->get('ldap_uid');
$auth_method = $this->params->get('auth_method');
jimport('joomla.client.ldap');
$ldap = new JLDAP($this->params);
if (!$ldap->connect())
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Unable to connect to LDAP server';
return;
}
switch($auth_method)
{
case 'search':
{
// Bind using Connect Username/password
// Force anon bind to mitigate misconfiguration like [#7119]
if(strlen($this->params->get('username'))) $bindtest = $ldap->bind();
else $bindtest = $ldap->anonymous_bind();
if($bindtest)
{
// Search for users DN
$binddata = $ldap->simple_search(str_replace("[search]", $credentials['username'], $this->params->get('search_string')));
if(isset($binddata[0]) && isset($binddata[0]['dn'])) {
// Verify Users Credentials
$success = $ldap->bind($binddata[0]['dn'],$credentials['password'],1);
// Get users details
$userdetails = $binddata;
} else {
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Unable to find user';
}
}
else
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Unable to bind to LDAP';
}
} break;
case 'bind':
{
// We just accept the result here
$success = $ldap->bind($credentials['username'],$credentials['password']);
if($success) {
$userdetails = $ldap->simple_search(str_replace("[search]", $credentials['username'], $this->params->get('search_string')));
} else {
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Failed binding to LDAP server';
}
} break;
}
if(!$success)
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
if(!strlen($response->error_message)) $response->error_message = 'Incorrect username/password';
}
else
{
// Grab some details from LDAP and return them
if (isset($userdetails[0][$ldap_uid][0])) {
$response->username = $userdetails[0][$ldap_uid][0];
}
if (isset($userdetails[0][$ldap_email][0])) {
$response->email = $userdetails[0][$ldap_email][0];
}
if(isset($userdetails[0][$ldap_fullname][0])) {
$response->fullname = $userdetails[0][$ldap_fullname][0];
} else {
$response->fullname = $credentials['username'];
}
// Were good - So say so.
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = '';
}
$ldap->close();
}
}
@@ -3,7 +3,7 @@
<name>Authentication - LDAP</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
+274 -274
View File
@@ -1,274 +1,274 @@
<?php
/**
* @version $Id: openid.php 11403 2009-01-06 06:19:31Z 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');
/**
* OpenID Authentication Plugin
*
* @package Joomla
* @subpackage openID
* @since 1.5
*/
class plgAuthenticationOpenID 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 plgAuthenticationOpenID(& $subject, $config) {
parent::__construct($subject, $config);
}
/**
* This method should handle any authentication and report back to the subject
*
* @access public
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options (return, entry_url)
* @param object $response Authentication response object
* @return boolean
* @since 1.5
*/
function onAuthenticate($credentials, $options, & $response) {
$mainframe =& JFactory::getApplication();
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
define('Auth_OpenID_RAND_SOURCE', null);
} else {
$f = @fopen('/dev/urandom', 'r');
if ($f !== false) {
define('Auth_OpenID_RAND_SOURCE', '/dev/urandom');
fclose($f);
} else {
$f = @fopen('/dev/random', 'r');
if ($f !== false) {
define('Auth_OpenID_RAND_SOURCE', '/dev/urandom');
fclose($f);
} else {
define('Auth_OpenID_RAND_SOURCE', null);
}
}
}
jimport('openid.consumer');
jimport('joomla.filesystem.folder');
// Access the session data
$session = & JFactory :: getSession();
// Create and/or start using the data store
$store_path = JPATH_ROOT . '/tmp/_joomla_openid_store';
if (!JFolder :: exists($store_path) && !JFolder :: create($store_path)) {
$response->type = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = "Could not create the FileStore directory '$store_path'. " . " Please check the effective permissions.";
return false;
}
// Create store object
$store = new Auth_OpenID_FileStore($store_path);
// Create a consumer object
$consumer = new Auth_OpenID_Consumer($store);
if (!isset ($_SESSION['_openid_consumer_last_token'])) {
// Begin the OpenID authentication process.
if (!$auth_request = $consumer->begin($credentials['username'])) {
$response->type = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Authentication error : could not connect to the openid server';
return false;
}
$sreg_request = Auth_OpenID_SRegRequest::build(
array ('email'),
array ('fullname','language','timezone')
);
if ($sreg_request) {
$auth_request->addExtension($sreg_request);
}
$policy_uris = array();
if ($this->params->get( 'phishing-resistant', 0)) {
$policy_uris[] = 'http://schemas.openid.net/pape/policies/2007/06/phishing-resistant';
}
if ($this->params->get( 'multi-factor', 0)) {
$policy_uris[] = 'http://schemas.openid.net/pape/policies/2007/06/multi-factor';
}
if ($this->params->get( 'multi-factor-physical', 0)) {
$policy_uris[] = 'http://schemas.openid.net/pape/policies/2007/06/multi-factor-physical';
}
$pape_request = new Auth_OpenID_PAPE_Request($policy_uris);
if ($pape_request) {
$auth_request->addExtension($pape_request);
}
//Create the entry url
$entry_url = isset ($options['entry_url']) ? $options['entry_url'] : JURI :: base();
$entry_url = JURI :: getInstance($entry_url);
unset ($options['entry_url']); //We don't need this anymore
//Create the url query information
$options['return'] = isset($options['return']) ? base64_encode($options['return']) : base64_encode(JURI::base());
$options[JUtility::getToken()] = 1;
$process_url = sprintf($entry_url->toString()."?option=com_user&task=login&username=%s", $credentials['username']);
$process_url .= '&'.JURI::buildQuery($options);
$session->set('return_url', $process_url );
$trust_url = $entry_url->toString(array (
'path',
'host',
'port',
'scheme'
));
$session->set('trust_url', $trust_url);
// For OpenID 1, send a redirect. For OpenID 2, use a Javascript
// form to send a POST request to the server.
if ($auth_request->shouldSendRedirect()) {
$redirect_url = $auth_request->redirectURL($trust_url, $process_url);
// If the redirect URL can't be built, display an error
// message.
if (Auth_OpenID :: isFailure($redirect_url)) {
displayError("Could not redirect to server: " . $redirect_url->message);
} else {
// Send redirect.
$mainframe->redirect($redirect_url);
return false;
}
} else {
// Generate form markup and render it.
$form_id = 'openid_message';
$form_html = $auth_request->htmlMarkup($trust_url, $process_url, false, array (
'id' => $form_id
));
// Display an error if the form markup couldn't be generated;
// otherwise, render the HTML.
if (Auth_OpenID :: isFailure($form_html)) {
//displayError("Could not redirect to server: " . $form_html->message);
} else {
JResponse :: setBody($form_html);
echo JResponse :: toString($mainframe->getCfg('gzip'));
$mainframe->close();
return false;
}
}
}
$result = $consumer->complete($session->get('return_url'));
switch ($result->status) {
case Auth_OpenID_SUCCESS :
{
$sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($result);
$sreg = $sreg_resp->contents();
$usermode = $this->params->get('usermode', 2);
/* in the following code, we deal with the transition from the old openid version to the new openid version
In the old version, the username was always taken straight from the login form. In the new version, we get a
username back from the openid provider. This is necessary for a number of reasons. First, providers such as
yahoo.com allow you to enter only the provider name in the username field (i.e. yahoo.com or flickr.com). Taking
this as the username would obviously cause problems because everybody who had an id from yahoo.com would have username
yahoo.com. Second, it is necessary because with the old way, we rely on the user entering the id the same every time.
This is bad because if the user enters the http:// one time and not the second time, they end up as two different users.
There are two possible settings here - the first setting, is to always use the new way, which is to get the username from
the provider after authentication. The second setting is to check if the username exists that we got from the provider. If it
doesn't, then we check if the entered username exists. If it does, then we update the database with the username from the provider
and continue happily along with the new username.
We had talked about a third option, which would be to always used the old way, but that seems insecure in the case of somebody using
a yahoo.com ID.
*/
if ($usermode && $usermode == 1) {
$response->username = $result->getDisplayIdentifier();
} else {
// first, check if the provider provided username exists in the database
$db = &JFactory::getDBO();
$query = 'SELECT username FROM #__users'.
' WHERE username='.$db->Quote($result->getDisplayIdentifier()).
' AND password=\'\'';
$db->setQuery($query);
$dbresult = $db->loadObject();
if ($dbresult) {
// if so, we set our username value to the provided value
$response->username = $result->getDisplayIdentifier();
} else {
// if it doesn't, we check if the username from the from exists in the database
$query = 'SELECT username FROM #__users'.
' WHERE username='.$db->Quote( $credentials['username'] ).
' AND password=\'\'';
$db->setQuery($query);
$dbresult = $db->loadObject();
if ($dbresult) {
// if it does, we update the database
$query = 'UPDATE #__users SET username='.$db->Quote($result->getDisplayIdentifier()).
' WHERE username='.$db->Quote($credentials['username']);
$db->setQuery($query);
$db->query();
if (!$db->query()) {
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = $db->getErrorMsg();
//break out of the switch if we hit an error with our query
break;
}
}
$response->username = $result->getDisplayIdentifier();
// we return the username provided by the openid provider
}
}
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = '';
if (!isset($sreg['email'])) {
$response->email = str_replace( array('http://', 'https://'), '', $response->username );
$response->email = str_replace( '/', '-', $response->email );
$response->email .= '@openid.';
} else {
$response->email = $sreg['email'];
}
$response->fullname = isset ($sreg['fullname']) ? $sreg['fullname'] : $response->username;
$response->language = isset ($sreg['language']) ? $sreg['language'] : '';
$response->timezone = isset ($sreg['timezone']) ? $sreg['timezone'] : '';
}
break;
case Auth_OpenID_CANCEL :
{
$response->status = JAUTHENTICATE_STATUS_CANCEL;
$response->error_message = 'Authentication cancelled';
}
break;
case Auth_OpenID_FAILURE :
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Authentication failed';
}
break;
}
}
// function
}
<?php
/**
* @version $Id: openid.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @subpackage JFramework
* @copyright Copyright (C) 2005 - 2010 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');
/**
* OpenID Authentication Plugin
*
* @package Joomla
* @subpackage openID
* @since 1.5
*/
class plgAuthenticationOpenID 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 plgAuthenticationOpenID(& $subject, $config) {
parent::__construct($subject, $config);
}
/**
* This method should handle any authentication and report back to the subject
*
* @access public
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options (return, entry_url)
* @param object $response Authentication response object
* @return boolean
* @since 1.5
*/
function onAuthenticate($credentials, $options, & $response) {
$mainframe =& JFactory::getApplication();
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
define('Auth_OpenID_RAND_SOURCE', null);
} else {
$f = @fopen('/dev/urandom', 'r');
if ($f !== false) {
define('Auth_OpenID_RAND_SOURCE', '/dev/urandom');
fclose($f);
} else {
$f = @fopen('/dev/random', 'r');
if ($f !== false) {
define('Auth_OpenID_RAND_SOURCE', '/dev/urandom');
fclose($f);
} else {
define('Auth_OpenID_RAND_SOURCE', null);
}
}
}
jimport('openid.consumer');
jimport('joomla.filesystem.folder');
// Access the session data
$session = & JFactory :: getSession();
// Create and/or start using the data store
$store_path = JPATH_ROOT . '/tmp/_joomla_openid_store';
if (!JFolder :: exists($store_path) && !JFolder :: create($store_path)) {
$response->type = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = "Could not create the FileStore directory '$store_path'. " . " Please check the effective permissions.";
return false;
}
// Create store object
$store = new Auth_OpenID_FileStore($store_path);
// Create a consumer object
$consumer = new Auth_OpenID_Consumer($store);
if (!isset ($_SESSION['_openid_consumer_last_token'])) {
// Begin the OpenID authentication process.
if (!$auth_request = $consumer->begin($credentials['username'])) {
$response->type = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Authentication error : could not connect to the openid server';
return false;
}
$sreg_request = Auth_OpenID_SRegRequest::build(
array ('email'),
array ('fullname','language','timezone')
);
if ($sreg_request) {
$auth_request->addExtension($sreg_request);
}
$policy_uris = array();
if ($this->params->get( 'phishing-resistant', 0)) {
$policy_uris[] = 'http://schemas.openid.net/pape/policies/2007/06/phishing-resistant';
}
if ($this->params->get( 'multi-factor', 0)) {
$policy_uris[] = 'http://schemas.openid.net/pape/policies/2007/06/multi-factor';
}
if ($this->params->get( 'multi-factor-physical', 0)) {
$policy_uris[] = 'http://schemas.openid.net/pape/policies/2007/06/multi-factor-physical';
}
$pape_request = new Auth_OpenID_PAPE_Request($policy_uris);
if ($pape_request) {
$auth_request->addExtension($pape_request);
}
//Create the entry url
$entry_url = isset ($options['entry_url']) ? $options['entry_url'] : JURI :: base();
$entry_url = JURI :: getInstance($entry_url);
unset ($options['entry_url']); //We don't need this anymore
//Create the url query information
$options['return'] = isset($options['return']) ? base64_encode($options['return']) : base64_encode(JURI::base());
$options[JUtility::getToken()] = 1;
$process_url = sprintf($entry_url->toString()."?option=com_user&task=login&username=%s", $credentials['username']);
$process_url .= '&'.JURI::buildQuery($options);
$session->set('return_url', $process_url );
$trust_url = $entry_url->toString(array (
'path',
'host',
'port',
'scheme'
));
$session->set('trust_url', $trust_url);
// For OpenID 1, send a redirect. For OpenID 2, use a Javascript
// form to send a POST request to the server.
if ($auth_request->shouldSendRedirect()) {
$redirect_url = $auth_request->redirectURL($trust_url, $process_url);
// If the redirect URL can't be built, display an error
// message.
if (Auth_OpenID :: isFailure($redirect_url)) {
displayError("Could not redirect to server: " . $redirect_url->message);
} else {
// Send redirect.
$mainframe->redirect($redirect_url);
return false;
}
} else {
// Generate form markup and render it.
$form_id = 'openid_message';
$form_html = $auth_request->htmlMarkup($trust_url, $process_url, false, array (
'id' => $form_id
));
// Display an error if the form markup couldn't be generated;
// otherwise, render the HTML.
if (Auth_OpenID :: isFailure($form_html)) {
//displayError("Could not redirect to server: " . $form_html->message);
} else {
JResponse :: setBody($form_html);
echo JResponse :: toString($mainframe->getCfg('gzip'));
$mainframe->close();
return false;
}
}
}
$result = $consumer->complete($session->get('return_url'));
switch ($result->status) {
case Auth_OpenID_SUCCESS :
{
$sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($result);
$sreg = $sreg_resp->contents();
$usermode = $this->params->get('usermode', 2);
/* in the following code, we deal with the transition from the old openid version to the new openid version
In the old version, the username was always taken straight from the login form. In the new version, we get a
username back from the openid provider. This is necessary for a number of reasons. First, providers such as
yahoo.com allow you to enter only the provider name in the username field (i.e. yahoo.com or flickr.com). Taking
this as the username would obviously cause problems because everybody who had an id from yahoo.com would have username
yahoo.com. Second, it is necessary because with the old way, we rely on the user entering the id the same every time.
This is bad because if the user enters the http:// one time and not the second time, they end up as two different users.
There are two possible settings here - the first setting, is to always use the new way, which is to get the username from
the provider after authentication. The second setting is to check if the username exists that we got from the provider. If it
doesn't, then we check if the entered username exists. If it does, then we update the database with the username from the provider
and continue happily along with the new username.
We had talked about a third option, which would be to always used the old way, but that seems insecure in the case of somebody using
a yahoo.com ID.
*/
if ($usermode && $usermode == 1) {
$response->username = $result->getDisplayIdentifier();
} else {
// first, check if the provider provided username exists in the database
$db = &JFactory::getDBO();
$query = 'SELECT username FROM #__users'.
' WHERE username='.$db->Quote($result->getDisplayIdentifier()).
' AND password=\'\'';
$db->setQuery($query);
$dbresult = $db->loadObject();
if ($dbresult) {
// if so, we set our username value to the provided value
$response->username = $result->getDisplayIdentifier();
} else {
// if it doesn't, we check if the username from the from exists in the database
$query = 'SELECT username FROM #__users'.
' WHERE username='.$db->Quote( $credentials['username'] ).
' AND password=\'\'';
$db->setQuery($query);
$dbresult = $db->loadObject();
if ($dbresult) {
// if it does, we update the database
$query = 'UPDATE #__users SET username='.$db->Quote($result->getDisplayIdentifier()).
' WHERE username='.$db->Quote($credentials['username']);
$db->setQuery($query);
$db->query();
if (!$db->query()) {
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = $db->getErrorMsg();
//break out of the switch if we hit an error with our query
break;
}
}
$response->username = $result->getDisplayIdentifier();
// we return the username provided by the openid provider
}
}
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = '';
if (!isset($sreg['email'])) {
$response->email = str_replace( array('http://', 'https://'), '', $response->username );
$response->email = str_replace( '/', '-', $response->email );
$response->email .= '@openid.';
} else {
$response->email = $sreg['email'];
}
$response->fullname = isset ($sreg['fullname']) ? $sreg['fullname'] : $response->username;
$response->language = isset ($sreg['language']) ? $sreg['language'] : '';
$response->timezone = isset ($sreg['timezone']) ? $sreg['timezone'] : '';
}
break;
case Auth_OpenID_CANCEL :
{
$response->status = JAUTHENTICATE_STATUS_CANCEL;
$response->error_message = 'Authentication cancelled';
}
break;
case Auth_OpenID_FAILURE :
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Authentication failed';
}
break;
}
}
// function
}
@@ -3,7 +3,7 @@
<name>Authentication - OpenID</name>
<author>Joomla! Project</author>
<creationDate>February 2006</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
@@ -12,22 +12,22 @@
<files>
<filename plugin="openid">openid.php</filename>
</files>
<params>
<param name="usermode" type="radio" default="2" label="Convert old usernames" description="OPENID_USERMODE_DESC">
<option value="2">Yes</option>
<option value="1">No</option>
</param>
<param name="phishing-resistant" type="radio" default="0" label="Require Policy phishing resistant" description="PHISHING_RESISTANT_DESC">
<option value="1">Yes</option>
<option value="0">No</option>
<params>
<param name="usermode" type="radio" default="2" label="Convert old usernames" description="OPENID_USERMODE_DESC">
<option value="2">Yes</option>
<option value="1">No</option>
</param>
<param name="phishing-resistant" type="radio" default="0" label="Require Policy phishing resistant" description="PHISHING_RESISTANT_DESC">
<option value="1">Yes</option>
<option value="0">No</option>
</param>
<param name="multi-factor" type="radio" default="0" label="Require Policy multi factor" description="MULTI_FACTOR_DESC">
<option value="1">Yes</option>
<option value="0">No</option>
</param>
<option value="1">Yes</option>
<option value="0">No</option>
</param>
<param name="multi-factor-physical" type="radio" default="0" label="Require Policy multi factor physical" description="MULTI_FACTOR_PHYSICAL_DESC">
<option value="1">Yes</option>
<option value="0">No</option>
</param>
</params>
</install>
<option value="1">Yes</option>
<option value="0">No</option>
</param>
</params>
</install>
+226 -166
View File
@@ -1,166 +1,226 @@
<?php
/**
* @version $Id: emailcloak.php 12537 2009-07-22 17:15:21Z ian $
* @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' );
$mainframe->registerEvent('onPrepareContent', 'plgContentEmailCloak');
/**
* Plugin that cloaks all emails in content from spambots via Javascript.
*
* @param object|string An object with a "text" property or the string to be
* cloaked.
* @param array Additional parameters. See {@see plgEmailCloak()}.
* @param int Optional page number. Unused. Defaults to zero.
* @return boolean True on success.
*/
function plgContentEmailCloak(&$row, &$params, $page=0)
{
if (is_object($row)) {
return plgEmailCloak($row->text, $params);
}
return plgEmailCloak($row, $params);
}
/**
* Genarate a search pattern based on link and text.
*
* @param string The target of an e-mail link.
* @param string The text enclosed by the link.
* @return string A regular expression that matches a link containing the
* parameters.
*/
function plgContentEmailCloak_searchPattern ($link, $text) {
// <a href="mailto:anyLink">anyText</a>
$pattern = '~(?:<a [\w "\'=\@\.\-]*href\s*=\s*"mailto:'
. $link . '"[\w "\'=\@\.\-]*)>' . $text . '</a>~i';
return $pattern;
}
/**
* Cloak all emails in text from spambots via Javascript.
*
* @param string The string to be cloaked.
* @param array Additional parameters. Parameter "mode" (integer, default 1)
* replaces addresses with "mailto:" links if nonzero.
* @return boolean True on success.
*/
function plgEmailCloak(&$text, &$params)
{
/*
* Check for presence of {emailcloak=off} which is explicits disables this
* bot for the item.
*/
if (JString::strpos($text, '{emailcloak=off}') !== false) {
$text = JString::str_ireplace('{emailcloak=off}', '', $text);
return true;
}
// Simple performance check to determine whether bot should process further.
if (JString::strpos($text, '@') === false) {
return true;
}
$plugin = & JPluginHelper::getPlugin('content', 'emailcloak');
// Load plugin params info
$pluginParams = new JParameter($plugin->params);
$mode = $pluginParams->def('mode', 1);
// any@email.address.com
$searchEmail = '([\w\.\-]+\@(?:[a-z0-9\.\-]+\.)+(?:[a-z0-9\-]{2,4}))';
// any@email.address.com?subject=anyText
$searchEmailLink = $searchEmail . '([?&][\x20-\x7f][^"<>]+)';
// anyText
$searchText = '([\x20-\x7f][^<>]+)';
/*
* Search for derivatives of link code <a href="mailto:email@amail.com"
* >email@amail.com</a>
*/
$pattern = plgContentEmailCloak_searchPattern($searchEmail, $searchEmail);
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) {
$mail = $regs[1][0];
$mailText = $regs[2][0];
// Check to see if mail text is different from mail addy
$replacement = JHTML::_('email.cloak', $mail, $mode, $mailText);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
}
/*
* Search for derivatives of link code <a href="mailto:email@amail.com">
* anytext</a>
*/
$pattern = plgContentEmailCloak_searchPattern($searchEmail, $searchText);
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) {
$mail = $regs[1][0];
$mailText = $regs[2][0];
$replacement = JHTML::_('email.cloak', $mail, $mode, $mailText, 0);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
}
/*
* Search for derivatives of link code <a href="mailto:email@amail.com?
* subject=Text">email@amail.com</a>
*/
$pattern = plgContentEmailCloak_searchPattern($searchEmailLink, $searchEmail);
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) {
$mail = $regs[1][0] . $regs[2][0];
$mailText = $regs[3][0];
// Needed for handling of Body parameter
$mail = str_replace( '&amp;', '&', $mail );
// Check to see if mail text is different from mail addy
$replacement = JHTML::_('email.cloak', $mail, $mode, $mailText);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
}
/*
* Search for derivatives of link code <a href="mailto:email@amail.com?
* subject=Text">anytext</a>
*/
$pattern = plgContentEmailCloak_searchPattern($searchEmailLink, $searchText);
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) {
$mail = $regs[1][0] . $regs[2][0];
$mailText = $regs[3][0];
// Needed for handling of Body parameter
$mail = str_replace('&amp;', '&', $mail);
$replacement = JHTML::_('email.cloak', $mail, $mode, $mailText, 0);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
}
// Search for plain text email@amail.com
$pattern = '~' . $searchEmail . '([^a-z0-9]|$)~i';
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) {
$mail = $regs[1][0];
$replacement = JHTML::_('email.cloak', $mail, $mode);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[1][1], strlen($mail));
}
return true;
}
<?php
/**
* @version $Id: emailcloak.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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' );
$mainframe->registerEvent('onPrepareContent', 'plgContentEmailCloak');
/**
* Plugin that cloaks all emails in content from spambots via Javascript.
*
* @param object|string An object with a "text" property or the string to be
* cloaked.
* @param array Additional parameters. See {@see plgEmailCloak()}.
* @param int Optional page number. Unused. Defaults to zero.
* @return boolean True on success.
*/
function plgContentEmailCloak(&$row, &$params, $page=0)
{
if (is_object($row)) {
return plgEmailCloak($row->text, $params);
}
return plgEmailCloak($row, $params);
}
/**
* Genarate a search pattern based on link and text.
*
* @param string The target of an e-mail link.
* @param string The text enclosed by the link.
* @return string A regular expression that matches a link containing the
* parameters.
*/
function plgContentEmailCloak_searchPattern ($link, $text) {
// <a href="mailto:anyLink">anyText</a>
$pattern = '~(?:<a [\w "\'=\@\.\-]*href\s*=\s*"(mailto:|https?://(?:[a-z0-9][a-z0-9\-]*[a-z0-9]\.)*(?:[a-z0-9]+)(?::\d+)?[a-z0-9;/\?:\@&=+\$,\-_\.!\~*\'\(\)%]+?%3C)'
. $link . '(%3E)?"([\w "\'=\@\.\-]*))>' . $text . '</a>~i';
return $pattern;
}
/**
* Cloak all emails in text from spambots via Javascript.
*
* @param string The string to be cloaked.
* @param array Additional parameters. Parameter "mode" (integer, default 1)
* replaces addresses with "mailto:" links if nonzero.
* @return boolean True on success.
*/
function plgEmailCloak(&$text, &$params)
{
/*
* Check for presence of {emailcloak=off} which is explicits disables this
* bot for the item.
*/
if (JString::strpos($text, '{emailcloak=off}') !== false) {
$text = JString::str_ireplace('{emailcloak=off}', '', $text);
return true;
}
// Simple performance check to determine whether bot should process further.
if (JString::strpos($text, '@') === false) {
return true;
}
$plugin = & JPluginHelper::getPlugin('content', 'emailcloak');
// Load plugin params info
$pluginParams = new JParameter($plugin->params);
$mode = $pluginParams->def('mode', 1);
// split the string into parts to exclude strcipt tags from being handled
$text = explode( '<script', $text );
foreach ( $text as $i => $str ) {
if ( $i == 0 ) {
plgEmailCloakString( $text[$i], $mode );
} else {
$str_split = explode( '</script>', $str );
foreach ( $str_split as $j => $str_split_part ) {
if ( ( $j % 2 ) == 1 ) {
plgEmailCloakString( $str_split[$i], $mode );
}
}
$text[$i] = implode( '</script>', $str_split );
}
}
$text = implode( '<script', $text );
return true;
}
/**
* Cloak all emails in text from spambots via Javascript.
*
* @param string The string to be cloaked.
* @param string The mode.
* replaces addresses with "mailto:" links if nonzero.
* @return boolean True on success.
*/
function plgEmailCloakString(&$text, $mode = 1)
{
// Simple performance check to determine whether bot should process further.
if (JString::strpos($text, '@') === false) {
return true;
}
// any@email.address.com
$searchEmail = '([\w\.\-]+\@(?:[a-z0-9\.\-]+\.)+(?:[a-z0-9\-]{2,4}))';
// any@email.address.com?subject=anyText
$searchEmailLink = $searchEmail . '([?&][\x20-\x7f][^"<>]+)';
// anyText
$searchText = '((?:[\x20-\x7f]|[\xA1-\xFF]|[\xC2-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF4][\x80-\xBF]{3})[^<>]+)';
//$searchText = '(+)';
//Any Image link
$searchImage = "(<img[^>]+>)";
/*
* Search for derivatives of link code <a href="mailto:email@amail.com"
* >email@amail.com</a>
*/
$pattern = plgContentEmailCloak_searchPattern($searchEmail, $searchEmail);
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) {
$mail = $regs[2][0];
$mailText = $regs[3][0];
// Check to see if mail text is different from mail addy
$replacement = JHTML::_('email.cloak', $mail, $mode, $mailText);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
}
/*
* Search for derivatives of link code <a href="mailto:email@amail.com">
* anytext</a>
*/
$pattern = plgContentEmailCloak_searchPattern($searchEmail, $searchText);
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) {
$prefix = $regs[1][0];
$mail = $regs[2][0];
$suffix = $regs[3][0];
$attribs = $regs[4][0];
$mailText = $regs[5][0];
$replacement = JHTML::_('email.cloak', $mail, $mode, $mailText, 0, $prefix, $suffix, $attribs);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
}
/*
* Search for derivatives of link code <a href="mailto:email@amail.com">
* <img anything></a>
*/
$pattern = plgContentEmailCloak_searchPattern($searchEmail, $searchImage);
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) {
$prefix = $regs[1][0];
$mail = $regs[2][0];
$suffix = $regs[3][0];
$attribs = $regs[4][0];
$mailText = $regs[5][0];
$replacement = JHTML::_('email.cloak', $mail, $mode, $mailText, 0, $prefix, $suffix, $attribs);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
}
/*
* Search for derivatives of link code <a href="mailto:email@amail.com?
* subject=Text">email@amail.com</a>
*/
$pattern = plgContentEmailCloak_searchPattern($searchEmailLink, $searchEmail);
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) {
$mail = $regs[2][0] . $regs[3][0];
$mailText = $regs[6][0];
// Needed for handling of Body parameter
$mail = str_replace( '&amp;', '&', $mail );
// Check to see if mail text is different from mail addy
$replacement = JHTML::_('email.cloak', $mail, $mode, $mailText);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
}
/*
* Search for derivatives of link code <a href="mailto:email@amail.com?
* subject=Text">anytext</a>
*/
$pattern = plgContentEmailCloak_searchPattern($searchEmailLink, $searchText);
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) {
$mail = $regs[2][0] . $regs[3][0];
$mailText = $regs[6][0];
// Needed for handling of Body parameter
$mail = str_replace('&amp;', '&', $mail);
$replacement = JHTML::_('email.cloak', $mail, $mode, $mailText, 0);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
}
// Search for plain text email@amail.com
$pattern = '~' . $searchEmail . '([^a-z0-9]|$)~i';
while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) {
$mail = $regs[1][0];
$replacement = JHTML::_('email.cloak', $mail, $mode);
// Replace the found address with the js cloaked email
$text = substr_replace($text, $replacement, $regs[1][1], strlen($mail));
}
return true;
}
@@ -3,7 +3,7 @@
<name>Content - Email Cloaking</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
+148 -148
View File
@@ -1,148 +1,148 @@
<?php
/**
* @version $Id: example.php 10714 2008-08-21 10:10:14Z eddieajau $
* @package Joomla
* @subpackage Content
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// Check to ensure this file is included in Joomla!
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* Example Content Plugin
*
* @package Joomla
* @subpackage Content
* @since 1.5
*/
class plgContentExample 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 plgContentExample( &$subject, $params )
{
parent::__construct( $subject, $params );
}
/**
* Example prepare content method
*
* Method is called by the view
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
*/
function onPrepareContent( &$article, &$params, $limitstart )
{
global $mainframe;
}
/**
* Example after display title method
*
* Method is called by the view and the results are imploded and displayed in a placeholder
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
* @return string
*/
function onAfterDisplayTitle( &$article, &$params, $limitstart )
{
global $mainframe;
return '';
}
/**
* Example before display content method
*
* Method is called by the view and the results are imploded and displayed in a placeholder
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
* @return string
*/
function onBeforeDisplayContent( &$article, &$params, $limitstart )
{
global $mainframe;
return '';
}
/**
* Example after display content method
*
* Method is called by the view and the results are imploded and displayed in a placeholder
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
* @return string
*/
function onAfterDisplayContent( &$article, &$params, $limitstart )
{
global $mainframe;
return '';
}
/**
* Example before save content method
*
* Method is called right before content is saved into the database.
* Article object is passed by reference, so any changes will be saved!
* NOTE: Returning false will abort the save with an error.
* You can set the error by calling $article->setError($message)
*
* @param object A JTableContent object
* @param bool If the content is just about to be created
* @return bool If false, abort the save
*/
function onBeforeContentSave( &$article, $isNew )
{
global $mainframe;
return true;
}
/**
* Example after save content method
* Article is passed by reference, but after the save, so no changes will be saved.
* Method is called right after the content is saved
*
*
* @param object A JTableContent object
* @param bool If the content is just about to be created
* @return void
*/
function onAfterContentSave( &$article, $isNew )
{
global $mainframe;
return true;
}
}
<?php
/**
* @version $Id: example.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @subpackage Content
* @copyright Copyright (C) 2005 - 2010 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 Content Plugin
*
* @package Joomla
* @subpackage Content
* @since 1.5
*/
class plgContentExample 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 plgContentExample( &$subject, $params )
{
parent::__construct( $subject, $params );
}
/**
* Example prepare content method
*
* Method is called by the view
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
*/
function onPrepareContent( &$article, &$params, $limitstart )
{
global $mainframe;
}
/**
* Example after display title method
*
* Method is called by the view and the results are imploded and displayed in a placeholder
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
* @return string
*/
function onAfterDisplayTitle( &$article, &$params, $limitstart )
{
global $mainframe;
return '';
}
/**
* Example before display content method
*
* Method is called by the view and the results are imploded and displayed in a placeholder
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
* @return string
*/
function onBeforeDisplayContent( &$article, &$params, $limitstart )
{
global $mainframe;
return '';
}
/**
* Example after display content method
*
* Method is called by the view and the results are imploded and displayed in a placeholder
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
* @return string
*/
function onAfterDisplayContent( &$article, &$params, $limitstart )
{
global $mainframe;
return '';
}
/**
* Example before save content method
*
* Method is called right before content is saved into the database.
* Article object is passed by reference, so any changes will be saved!
* NOTE: Returning false will abort the save with an error.
* You can set the error by calling $article->setError($message)
*
* @param object A JTableContent object
* @param bool If the content is just about to be created
* @return bool If false, abort the save
*/
function onBeforeContentSave( &$article, $isNew )
{
global $mainframe;
return true;
}
/**
* Example after save content method
* Article is passed by reference, but after the save, so no changes will be saved.
* Method is called right after the content is saved
*
*
* @param object A JTableContent object
* @param bool If the content is just about to be created
* @return void
*/
function onAfterContentSave( &$article, $isNew )
{
global $mainframe;
return true;
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
<name>Content - Example</name>
<author>Joomla! Project</author>
<creationDate>July 2007</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
+86 -86
View File
@@ -1,87 +1,87 @@
<?php
/**
* @version $Id: loadmodule.php 11646 2009-03-01 19:34:56Z ian $
* @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' );
$mainframe->registerEvent( 'onPrepareContent', 'plgContentLoadModule' );
/**
* Plugin that loads module positions within content
*/
function plgContentLoadModule( &$row, &$params, $page=0 )
{
$db =& JFactory::getDBO();
// simple performance check to determine whether bot should process further
if ( JString::strpos( $row->text, 'loadposition' ) === false ) {
return true;
}
// Get plugin info
$plugin =& JPluginHelper::getPlugin('content', 'loadmodule');
// expression to search for
$regex = '/{loadposition\s*.*?}/i';
$pluginParams = new JParameter( $plugin->params );
// check whether plugin has been unpublished
if ( !$pluginParams->get( 'enabled', 1 ) ) {
$row->text = preg_replace( $regex, '', $row->text );
return true;
}
// find all instances of plugin and put in $matches
preg_match_all( $regex, $row->text, $matches );
// Number of plugins
$count = count( $matches[0] );
// plugin only processes if there are any instances of the plugin in the text
if ( $count ) {
// Get plugin parameters
$style = $pluginParams->def( 'style', -2 );
plgContentProcessPositions( $row, $matches, $count, $regex, $style );
}
}
function plgContentProcessPositions ( &$row, &$matches, $count, $regex, $style )
{
for ( $i=0; $i < $count; $i++ )
{
$load = str_replace( 'loadposition', '', $matches[0][$i] );
$load = str_replace( '{', '', $load );
$load = str_replace( '}', '', $load );
$load = trim( $load );
$modules = plgContentLoadPosition( $load, $style );
$row->text = str_replace($matches[0][$i], $modules, $row->text );
}
// removes tags without matching module positions
$row->text = preg_replace( $regex, '', $row->text );
}
function plgContentLoadPosition( $position, $style=-2 )
{
$document = &JFactory::getDocument();
$renderer = $document->loadRenderer('module');
$params = array('style'=>$style);
$contents = '';
foreach (JModuleHelper::getModules($position) as $mod) {
$contents .= $renderer->render($mod, $params);
}
return $contents;
<?php
/**
* @version $Id: loadmodule.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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' );
$mainframe->registerEvent( 'onPrepareContent', 'plgContentLoadModule' );
/**
* Plugin that loads module positions within content
*/
function plgContentLoadModule( &$row, &$params, $page=0 )
{
$db =& JFactory::getDBO();
// simple performance check to determine whether bot should process further
if ( JString::strpos( $row->text, 'loadposition' ) === false ) {
return true;
}
// Get plugin info
$plugin =& JPluginHelper::getPlugin('content', 'loadmodule');
// expression to search for
$regex = '/{loadposition\s*.*?}/i';
$pluginParams = new JParameter( $plugin->params );
// check whether plugin has been unpublished
if ( !$pluginParams->get( 'enabled', 1 ) ) {
$row->text = preg_replace( $regex, '', $row->text );
return true;
}
// find all instances of plugin and put in $matches
preg_match_all( $regex, $row->text, $matches );
// Number of plugins
$count = count( $matches[0] );
// plugin only processes if there are any instances of the plugin in the text
if ( $count ) {
// Get plugin parameters
$style = $pluginParams->def( 'style', -2 );
plgContentProcessPositions( $row, $matches, $count, $regex, $style );
}
}
function plgContentProcessPositions ( &$row, &$matches, $count, $regex, $style )
{
for ( $i=0; $i < $count; $i++ )
{
$load = str_replace( 'loadposition', '', $matches[0][$i] );
$load = str_replace( '{', '', $load );
$load = str_replace( '}', '', $load );
$load = trim( $load );
$modules = plgContentLoadPosition( $load, $style );
$row->text = str_replace($matches[0][$i], $modules, $row->text );
}
// removes tags without matching module positions
$row->text = preg_replace( $regex, '', $row->text );
}
function plgContentLoadPosition( $position, $style=-2 )
{
$document = &JFactory::getDocument();
$renderer = $document->loadRenderer('module');
$params = array('style'=>$style);
$contents = '';
foreach (JModuleHelper::getModules($position) as $mod) {
$contents .= $renderer->render($mod, $params);
}
return $contents;
}
@@ -3,7 +3,7 @@
<name>Content - Load Modules</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
+295 -295
View File
@@ -1,295 +1,295 @@
<?php
/**
* @version $Id: pagebreak.php 12228 2009-06-21 02:01:44Z ian $
* @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' );
$mainframe->registerEvent( 'onPrepareContent', 'plgContentPagebreak' );
/**
* Page break plugin
*
* <b>Usage:</b>
* <code><hr class="system-pagebreak" /></code>
* <code><hr class="system-pagebreak" title="The page title" /></code>
* or
* <code><hr class="system-pagebreak" alt="The first page" /></code>
* or
* <code><hr class="system-pagebreak" title="The page title" alt="The first page" /></code>
* or
* <code><hr class="system-pagebreak" alt="The first page" title="The page title" /></code>
*
*/
function plgContentPagebreak( &$row, &$params, $page=0 )
{
// expression to search for
$regex = '#<hr([^>]*?)class=(\"|\')system-pagebreak(\"|\')([^>]*?)\/*>#iU';
// Get Plugin info
$plugin =& JPluginHelper::getPlugin('content', 'pagebreak');
$pluginParams = new JParameter( $plugin->params );
$print = JRequest::getBool('print');
$showall = JRequest::getBool('showall');
JPlugin::loadLanguage( 'plg_content_pagebreak' );
if (!$pluginParams->get('enabled', 1)) {
$print = true;
}
if ($print) {
$row->text = preg_replace( $regex, '<br />', $row->text );
return true;
}
//simple performance check to determine whether bot should process further
if ( strpos( $row->text, 'class="system-pagebreak' ) === false && strpos( $row->text, 'class=\'system-pagebreak' ) === false ) {
return true;
}
$db =& JFactory::getDBO();
$view = JRequest::getCmd('view');
if(!$page) {
$page = 0;
}
// check whether plugin has been unpublished
if (!JPluginHelper::isEnabled('content', 'pagebreak') || $params->get( 'intro_only' )|| $params->get( 'popup' ) || $view != 'article') {
$row->text = preg_replace( $regex, '', $row->text );
return;
}
// find all instances of plugin and put in $matches
$matches = array();
preg_match_all( $regex, $row->text, $matches, PREG_SET_ORDER );
if (($showall && $pluginParams->get('showall', 1) ))
{
$hasToc = $pluginParams->get( 'multipage_toc', 1 );
if ( $hasToc ) {
// display TOC
$page = 1;
plgContentCreateTOC( $row, $matches, $page );
} else {
$row->toc = '';
}
$row->text = preg_replace( $regex, '<br/>', $row->text );
return true;
}
// split the text around the plugin
$text = preg_split( $regex, $row->text );
// count the number of pages
$n = count( $text );
$row->pagebreaktitle = $row->title;
// we have found at least one plugin, therefore at least 2 pages
if ($n > 1)
{
// Get plugin parameters
$pluginParams = new JParameter( $plugin->params );
$title = $pluginParams->get( 'title', 1 );
$hasToc = $pluginParams->get( 'multipage_toc', 1 );
// adds heading or title to <site> Title
if ( $title )
{
if ( $page ) {
$page_text = $page + 1;
if ( $page && @$matches[$page-1][2] )
{
$attrs = JUtility::parseAttributes($matches[$page-1][0]);
if ( @$attrs['title'] ) {
$row->title = $row->title.' - '.$attrs['title'];
} else {
$thispage = $page + 1;
$row->title = $row->title.' - '.JText::_( 'Page' ).' '.$thispage;
}
}
}
}
// reset the text, we already hold it in the $text array
$row->text = '';
// display TOC
if ( $hasToc ) {
plgContentCreateTOC( $row, $matches, $page );
} else {
$row->toc = '';
}
// traditional mos page navigation
jimport('joomla.html.pagination');
$pageNav = new JPagination( $n, $page, 1 );
// page counter
$row->text .= '<div class="pagenavcounter">';
$row->text .= $pageNav->getPagesCounter();
$row->text .= '</div>';
// page text
$text[$page] = str_replace("<hr id=\"\"system-readmore\"\" />", "", $text[$page]);
$row->text .= $text[$page];
$row->text .= '<br />';
$row->text .= '<div class="pagenavbar">';
// adds navigation between pages to bottom of text
if ( $hasToc ) {
plgContentCreateNavigation( $row, $page, $n );
}
// page links shown at bottom of page if TOC disabled
if (!$hasToc) {
$row->text .= $pageNav->getPagesLinks();
}
$row->text .= '</div><br />';
}
return true;
}
function plgContentCreateTOC( &$row, &$matches, &$page )
{
if (isset($row->pagebreaktitle)) {$heading = $row->pagebreaktitle;} else {$heading = $row->title;}
$limitstart = JRequest::getInt('limitstart', 0);
$showall = JRequest::getInt('showall', 0);
// TOC Header
$row->toc = '
<table cellpadding="0" cellspacing="0" class="contenttoc">
<tr>
<th>'
. JText::_( 'Article Index' ) .
'</th>
</tr>
';
// TOC First Page link
$class = ($limitstart === 0 && $showall === 0) ? 'toclink active' : 'toclink';
$row->toc .= '
<tr>
<td>
<a href="'. JRoute::_( '&showall=&limitstart=') .'" class="'. $class .'">'
. $heading .
'</a>
</td>
</tr>
';
$i = 2;
foreach ( $matches as $bot )
{
$link = JRoute::_( '&showall=&limitstart='. ($i-1) );
if ( @$bot[0] )
{
$attrs2 = JUtility::parseAttributes($bot[0]);
if ( @$attrs2['alt'] )
{
$title = stripslashes( $attrs2['alt'] );
}
elseif ( @$attrs2['title'] )
{
$title = stripslashes( $attrs2['title'] );
}
else
{
$title = JText::sprintf( 'Page #', $i );
}
}
else
{
$title = JText::sprintf( 'Page #', $i );
}
$class = ($limitstart == $i-1) ? 'toclink active' : 'toclink';
$row->toc .= '
<tr>
<td>
<a href="'. $link .'" class="'. $class .'">'
. $title .
'</a>
</td>
</tr>
';
$i++;
}
// Get Plugin info
$plugin =& JPluginHelper::getPlugin('content', 'pagebreak');
$params = new JParameter( $plugin->params );
if ($params->get('showall') )
{
$link = JRoute::_( '&showall=1&limitstart=');
$class = ($showall == 1) ? 'toclink active' : 'toclink';
$row->toc .= '
<tr>
<td>
<a href="'. $link .'" class="'. $class .'">'
. JText::_( 'All Pages' ) .
'</a>
</td>
</tr>
';
}
$row->toc .= '</table>';
}
function plgContentCreateNavigation( &$row, $page, $n )
{
$pnSpace = "";
if (JText::_( '&lt' ) || JText::_( '&gt' )) $pnSpace = " ";
if ( $page < $n-1 )
{
$page_next = $page + 1;
$link_next = JRoute::_( '&limitstart='. ( $page_next ) );
// Next >>
$next = '<a href="'. $link_next .'">' . JText::_( 'Next' ) . $pnSpace . JText::_( '&gt' ) . JText::_( '&gt' ) .'</a>';
}
else
{
$next = JText::_( 'Next' );
}
if ( $page > 0 )
{
$page_prev = $page - 1 == 0 ? "" : $page - 1;
$link_prev = JRoute::_( '&limitstart='. ( $page_prev) );
// << Prev
$prev = '<a href="'. $link_prev .'">'. JText::_( '&lt' ) . JText::_( '&lt' ) . $pnSpace . JText::_( 'Prev' ) .'</a>';
}
else
{
$prev = JText::_( 'Prev' );
}
$row->text .= '<div>' . $prev . ' - ' . $next .'</div>';
}
<?php
/**
* @version $Id: pagebreak.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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' );
$mainframe->registerEvent( 'onPrepareContent', 'plgContentPagebreak' );
/**
* Page break plugin
*
* <b>Usage:</b>
* <code><hr class="system-pagebreak" /></code>
* <code><hr class="system-pagebreak" title="The page title" /></code>
* or
* <code><hr class="system-pagebreak" alt="The first page" /></code>
* or
* <code><hr class="system-pagebreak" title="The page title" alt="The first page" /></code>
* or
* <code><hr class="system-pagebreak" alt="The first page" title="The page title" /></code>
*
*/
function plgContentPagebreak( &$row, &$params, $page=0 )
{
// expression to search for
$regex = '#<hr([^>]*?)class=(\"|\')system-pagebreak(\"|\')([^>]*?)\/*>#iU';
// Get Plugin info
$plugin =& JPluginHelper::getPlugin('content', 'pagebreak');
$pluginParams = new JParameter( $plugin->params );
$print = JRequest::getBool('print');
$showall = JRequest::getBool('showall');
JPlugin::loadLanguage( 'plg_content_pagebreak' );
if (!$pluginParams->get('enabled', 1)) {
$print = true;
}
if ($print) {
$row->text = preg_replace( $regex, '<br />', $row->text );
return true;
}
//simple performance check to determine whether bot should process further
if ( strpos( $row->text, 'class="system-pagebreak' ) === false && strpos( $row->text, 'class=\'system-pagebreak' ) === false ) {
return true;
}
$db =& JFactory::getDBO();
$view = JRequest::getCmd('view');
if(!$page) {
$page = 0;
}
// check whether plugin has been unpublished
if (!JPluginHelper::isEnabled('content', 'pagebreak') || $params->get( 'intro_only' )|| $params->get( 'popup' ) || $view != 'article') {
$row->text = preg_replace( $regex, '', $row->text );
return;
}
// find all instances of plugin and put in $matches
$matches = array();
preg_match_all( $regex, $row->text, $matches, PREG_SET_ORDER );
if (($showall && $pluginParams->get('showall', 1) ))
{
$hasToc = $pluginParams->get( 'multipage_toc', 1 );
if ( $hasToc ) {
// display TOC
$page = 1;
plgContentCreateTOC( $row, $matches, $page );
} else {
$row->toc = '';
}
$row->text = preg_replace( $regex, '<br/>', $row->text );
return true;
}
// split the text around the plugin
$text = preg_split( $regex, $row->text );
// count the number of pages
$n = count( $text );
$row->pagebreaktitle = $row->title;
// we have found at least one plugin, therefore at least 2 pages
if ($n > 1)
{
// Get plugin parameters
$pluginParams = new JParameter( $plugin->params );
$title = $pluginParams->get( 'title', 1 );
$hasToc = $pluginParams->get( 'multipage_toc', 1 );
// adds heading or title to <site> Title
if ( $title )
{
if ( $page ) {
$page_text = $page + 1;
if ( $page && @$matches[$page-1][2] )
{
$attrs = JUtility::parseAttributes($matches[$page-1][0]);
if ( @$attrs['title'] ) {
$row->title = $row->title.' - '.$attrs['title'];
} else {
$thispage = $page + 1;
$row->title = $row->title.' - '.JText::_( 'Page' ).' '.$thispage;
}
}
}
}
// reset the text, we already hold it in the $text array
$row->text = '';
// display TOC
if ( $hasToc ) {
plgContentCreateTOC( $row, $matches, $page );
} else {
$row->toc = '';
}
// traditional mos page navigation
jimport('joomla.html.pagination');
$pageNav = new JPagination( $n, $page, 1 );
// page counter
$row->text .= '<div class="pagenavcounter">';
$row->text .= $pageNav->getPagesCounter();
$row->text .= '</div>';
// page text
$text[$page] = str_replace("<hr id=\"\"system-readmore\"\" />", "", $text[$page]);
$row->text .= $text[$page];
$row->text .= '<br />';
$row->text .= '<div class="pagenavbar">';
// adds navigation between pages to bottom of text
if ( $hasToc ) {
plgContentCreateNavigation( $row, $page, $n );
}
// page links shown at bottom of page if TOC disabled
if (!$hasToc) {
$row->text .= $pageNav->getPagesLinks();
}
$row->text .= '</div><br />';
}
return true;
}
function plgContentCreateTOC( &$row, &$matches, &$page )
{
if (isset($row->pagebreaktitle)) {$heading = $row->pagebreaktitle;} else {$heading = $row->title;}
$limitstart = JRequest::getInt('limitstart', 0);
$showall = JRequest::getInt('showall', 0);
// TOC Header
$row->toc = '
<table cellpadding="0" cellspacing="0" class="contenttoc">
<tr>
<th>'
. JText::_( 'Article Index' ) .
'</th>
</tr>
';
// TOC First Page link
$class = ($limitstart === 0 && $showall === 0) ? 'toclink active' : 'toclink';
$row->toc .= '
<tr>
<td>
<a href="'. JRoute::_( '&showall=&limitstart=') .'" class="'. $class .'">'
. $heading .
'</a>
</td>
</tr>
';
$i = 2;
foreach ( $matches as $bot )
{
$link = JRoute::_( '&showall=&limitstart='. ($i-1) );
if ( @$bot[0] )
{
$attrs2 = JUtility::parseAttributes($bot[0]);
if ( @$attrs2['alt'] )
{
$title = stripslashes( $attrs2['alt'] );
}
elseif ( @$attrs2['title'] )
{
$title = stripslashes( $attrs2['title'] );
}
else
{
$title = JText::sprintf( 'Page #', $i );
}
}
else
{
$title = JText::sprintf( 'Page #', $i );
}
$class = ($limitstart == $i-1) ? 'toclink active' : 'toclink';
$row->toc .= '
<tr>
<td>
<a href="'. $link .'" class="'. $class .'">'
. $title .
'</a>
</td>
</tr>
';
$i++;
}
// Get Plugin info
$plugin =& JPluginHelper::getPlugin('content', 'pagebreak');
$params = new JParameter( $plugin->params );
if ($params->get('showall') )
{
$link = JRoute::_( '&showall=1&limitstart=');
$class = ($showall == 1) ? 'toclink active' : 'toclink';
$row->toc .= '
<tr>
<td>
<a href="'. $link .'" class="'. $class .'">'
. JText::_( 'All Pages' ) .
'</a>
</td>
</tr>
';
}
$row->toc .= '</table>';
}
function plgContentCreateNavigation( &$row, $page, $n )
{
$pnSpace = "";
if (JText::_( '&lt' ) || JText::_( '&gt' )) $pnSpace = " ";
if ( $page < $n-1 )
{
$page_next = $page + 1;
$link_next = JRoute::_( '&limitstart='. ( $page_next ) );
// Next >>
$next = '<a href="'. $link_next .'">' . JText::_( 'Next' ) . $pnSpace . JText::_( '&gt' ) . JText::_( '&gt' ) .'</a>';
}
else
{
$next = JText::_( 'Next' );
}
if ( $page > 0 )
{
$page_prev = $page - 1 == 0 ? "" : $page - 1;
$link_prev = JRoute::_( '&limitstart='. ( $page_prev) );
// << Prev
$prev = '<a href="'. $link_prev .'">'. JText::_( '&lt' ) . JText::_( '&lt' ) . $pnSpace . JText::_( 'Prev' ) .'</a>';
}
else
{
$prev = JText::_( 'Prev' );
}
$row->text .= '<div>' . $prev . ' - ' . $next .'</div>';
}
@@ -3,7 +3,7 @@
<name>Content - Pagebreak</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
@@ -1,220 +1,220 @@
<?php
/**
* @version $Id: pagenavigation.php 11783 2009-04-24 17:28:10Z kdevine $
* @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' );
$mainframe->registerEvent( 'onBeforeDisplayContent', 'plgContentNavigation' );
function plgContentNavigation( &$row, &$params, $page=0 )
{
$view = JRequest::getCmd('view');
// Get Plugin info
$plugin =& JPluginHelper::getPlugin('content', 'pagenavigation');
if ($params->get('show_item_navigation') && ($view == 'article'))
{
$html = '';
$db = & JFactory::getDBO();
$user = & JFactory::getUser();
$nullDate = $db->getNullDate();
$date =& JFactory::getDate();
$config = & JFactory::getConfig();
$now = $date->toMySQL();
$uid = $row->id;
$option = 'com_content';
$canPublish = $user->authorize('com_content', 'publish', 'content', 'all');
// the following is needed as different menu items types utilise a different param to control ordering
// for Blogs the `orderby_sec` param is the order controlling param
// for Table and List views it is the `orderby` param
$params_list = $params->toArray();
if (array_key_exists('orderby_sec', $params_list)) {
$order_method = $params->get('orderby_sec', '');
} else {
$order_method = $params->get('orderby', '');
}
// additional check for invalid sort ordering
if ( $order_method == 'front' ) {
$order_method = '';
}
// Determine sort order
switch ($order_method)
{
case 'date' :
$orderby = 'a.created';
break;
case 'rdate' :
$orderby = 'a.created DESC';
break;
case 'alpha' :
$orderby = 'a.title';
break;
case 'ralpha' :
$orderby = 'a.title DESC';
break;
case 'hits' :
$orderby = 'a.hits';
break;
case 'rhits' :
$orderby = 'a.hits DESC';
break;
case 'order' :
$orderby = 'a.ordering';
break;
case 'author' :
$orderby = 'a.created_by_alias, u.name';
break;
case 'rauthor' :
$orderby = 'a.created_by_alias DESC, u.name DESC';
break;
case 'front' :
$orderby = 'f.ordering';
break;
default :
$orderby = 'a.ordering';
break;
}
$xwhere = ' AND ( a.state = 1 OR a.state = -1 )' .
' AND ( publish_up = '.$db->Quote($nullDate).' OR publish_up <= '.$db->Quote($now).' )' .
' AND ( publish_down = '.$db->Quote($nullDate).' OR publish_down >= '.$db->Quote($now).' )';
// array of articles in same category correctly ordered
$query = 'SELECT a.id,'
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'
. ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug'
. ' FROM #__content AS a'
. ' LEFT JOIN #__categories AS cc ON cc.id = a.catid'
. ' WHERE a.catid = ' . (int) $row->catid
. ' AND a.state = '. (int) $row->state
. ($canPublish ? '' : ' AND a.access <= ' .(int) $user->get('aid', 0))
. $xwhere
. ' ORDER BY '. $orderby;
$db->setQuery($query);
$list = $db->loadObjectList('id');
// this check needed if incorrect Itemid is given resulting in an incorrect result
if ( !is_array($list) ) {
$list = array();
}
reset($list);
// location of current content item in array list
$location = array_search($uid, array_keys($list));
$rows = array_values($list);
$row->prev = null;
$row->next = null;
if ($location -1 >= 0) {
// the previous content item cannot be in the array position -1
$row->prev = $rows[$location -1];
}
if (($location +1) < count($rows)) {
// the next content item cannot be in an array position greater than the number of array postions
$row->next = $rows[$location +1];
}
$pnSpace = "";
if (JText::_('&lt') || JText::_('&gt')) {
$pnSpace = " ";
}
if ($row->prev) {
$row->prev = JRoute::_(ContentHelperRoute::getArticleRoute($row->prev->slug, $row->prev->catslug));
} else {
$row->prev = '';
}
if ($row->next) {
$row->next = JRoute::_(ContentHelperRoute::getArticleRoute($row->next->slug, $row->next->catslug));
} else {
$row->next = '';
}
// output
if ($row->prev || $row->next)
{
$html = '
<table align="center" class="pagenav">
<tr>'
;
if ($row->prev)
{
$html .= '
<th class="pagenav_prev">
<a href="'. $row->prev .'">'
. JText::_( '&lt' ) . $pnSpace . JText::_( 'Prev' ) . '</a>
</th>'
;
}
if ($row->prev && $row->next)
{
$html .= '
<td width="50">
&nbsp;
</td>'
;
}
if ($row->next)
{
$html .= '
<th class="pagenav_next">
<a href="'. $row->next .'">'
. JText::_( 'Next' ) . $pnSpace . JText::_( '&gt' ) .'</a>
</th>'
;
}
$html .= '
</tr>
</table>'
;
// Get the plugin parameters
$pluginParams = new JParameter( $plugin->params );
$position = $pluginParams->get('position', 1);
if ($position) {
// display after content
$row->text .= $html;
} else {
// display before content
$row->text = $html . $row->text;
}
}
}
return ;
}
<?php
/**
* @version $Id: pagenavigation.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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' );
$mainframe->registerEvent( 'onBeforeDisplayContent', 'plgContentNavigation' );
function plgContentNavigation( &$row, &$params, $page=0 )
{
$view = JRequest::getCmd('view');
// Get Plugin info
$plugin =& JPluginHelper::getPlugin('content', 'pagenavigation');
if ($params->get('show_item_navigation') && ($view == 'article'))
{
$html = '';
$db = & JFactory::getDBO();
$user = & JFactory::getUser();
$nullDate = $db->getNullDate();
$date =& JFactory::getDate();
$config = & JFactory::getConfig();
$now = $date->toMySQL();
$uid = $row->id;
$option = 'com_content';
$canPublish = $user->authorize('com_content', 'publish', 'content', 'all');
// the following is needed as different menu items types utilise a different param to control ordering
// for Blogs the `orderby_sec` param is the order controlling param
// for Table and List views it is the `orderby` param
$params_list = $params->toArray();
if (array_key_exists('orderby_sec', $params_list)) {
$order_method = $params->get('orderby_sec', '');
} else {
$order_method = $params->get('orderby', '');
}
// additional check for invalid sort ordering
if ( $order_method == 'front' ) {
$order_method = '';
}
// Determine sort order
switch ($order_method)
{
case 'date' :
$orderby = 'a.created';
break;
case 'rdate' :
$orderby = 'a.created DESC';
break;
case 'alpha' :
$orderby = 'a.title';
break;
case 'ralpha' :
$orderby = 'a.title DESC';
break;
case 'hits' :
$orderby = 'a.hits';
break;
case 'rhits' :
$orderby = 'a.hits DESC';
break;
case 'order' :
$orderby = 'a.ordering';
break;
case 'author' :
$orderby = 'a.created_by_alias, u.name';
break;
case 'rauthor' :
$orderby = 'a.created_by_alias DESC, u.name DESC';
break;
case 'front' :
$orderby = 'f.ordering';
break;
default :
$orderby = 'a.ordering';
break;
}
$xwhere = ' AND ( a.state = 1 OR a.state = -1 )' .
' AND ( publish_up = '.$db->Quote($nullDate).' OR publish_up <= '.$db->Quote($now).' )' .
' AND ( publish_down = '.$db->Quote($nullDate).' OR publish_down >= '.$db->Quote($now).' )';
// array of articles in same category correctly ordered
$query = 'SELECT a.id,'
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'
. ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug'
. ' FROM #__content AS a'
. ' LEFT JOIN #__categories AS cc ON cc.id = a.catid'
. ' WHERE a.catid = ' . (int) $row->catid
. ' AND a.state = '. (int) $row->state
. ($canPublish ? '' : ' AND a.access <= ' .(int) $user->get('aid', 0))
. $xwhere
. ' ORDER BY '. $orderby;
$db->setQuery($query);
$list = $db->loadObjectList('id');
// this check needed if incorrect Itemid is given resulting in an incorrect result
if ( !is_array($list) ) {
$list = array();
}
reset($list);
// location of current content item in array list
$location = array_search($uid, array_keys($list));
$rows = array_values($list);
$row->prev = null;
$row->next = null;
if ($location -1 >= 0) {
// the previous content item cannot be in the array position -1
$row->prev = $rows[$location -1];
}
if (($location +1) < count($rows)) {
// the next content item cannot be in an array position greater than the number of array postions
$row->next = $rows[$location +1];
}
$pnSpace = "";
if (JText::_('&lt') || JText::_('&gt')) {
$pnSpace = " ";
}
if ($row->prev) {
$row->prev = JRoute::_(ContentHelperRoute::getArticleRoute($row->prev->slug, $row->prev->catslug));
} else {
$row->prev = '';
}
if ($row->next) {
$row->next = JRoute::_(ContentHelperRoute::getArticleRoute($row->next->slug, $row->next->catslug));
} else {
$row->next = '';
}
// output
if ($row->prev || $row->next)
{
$html = '
<table align="center" class="pagenav">
<tr>'
;
if ($row->prev)
{
$html .= '
<th class="pagenav_prev">
<a href="'. $row->prev .'">'
. JText::_( '&lt' ) . $pnSpace . JText::_( 'Prev' ) . '</a>
</th>'
;
}
if ($row->prev && $row->next)
{
$html .= '
<td width="50">
&nbsp;
</td>'
;
}
if ($row->next)
{
$html .= '
<th class="pagenav_next">
<a href="'. $row->next .'">'
. JText::_( 'Next' ) . $pnSpace . JText::_( '&gt' ) .'</a>
</th>'
;
}
$html .= '
</tr>
</table>'
;
// Get the plugin parameters
$pluginParams = new JParameter( $plugin->params );
$position = $pluginParams->get('position', 1);
if ($position) {
// display after content
$row->text .= $html;
} else {
// display before content
$row->text = $html . $row->text;
}
}
}
return ;
}
@@ -3,7 +3,7 @@
<name>Content - Page Navigation</name>
<author>Joomla! Project</author>
<creationDate>January 2006</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
+66 -66
View File
@@ -1,67 +1,67 @@
<?php
/**
* @version $Id: vote.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' );
$mainframe->registerEvent( 'onBeforeDisplayContent', 'plgContentVote' );
function plgContentVote( &$row, &$params, $page=0 )
{
$uri = & JFactory::getURI();
$id = $row->id;
$html = '';
if (isset($row->rating_count) && $params->get( 'show_vote' ) && !$params->get( 'popup' ))
{
JPlugin::loadLanguage( 'plg_content_vote' );
$html .= '<form method="post" action="' . $uri->toString( ) . '">';
$img = '';
// look for images in template if available
$starImageOn = JHTML::_('image.site', 'rating_star.png', '/images/M_images/' );
$starImageOff = JHTML::_('image.site', 'rating_star_blank.png', '/images/M_images/' );
for ($i=0; $i < $row->rating; $i++) {
$img .= $starImageOn;
}
for ($i=$row->rating; $i < 5; $i++) {
$img .= $starImageOff;
}
$html .= '<span class="content_rating">';
$html .= JText::_( 'User Rating' ) .':'. $img .'&nbsp;/&nbsp;';
$html .= intval( $row->rating_count );
$html .= "</span>\n<br />\n";
if (!$params->get( 'intro_only' ))
{
$html .= '<span class="content_vote">';
$html .= JText::_( 'Poor' );
$html .= '<input type="radio" alt="vote 1 star" name="user_rating" value="1" />';
$html .= '<input type="radio" alt="vote 2 star" name="user_rating" value="2" />';
$html .= '<input type="radio" alt="vote 3 star" name="user_rating" value="3" />';
$html .= '<input type="radio" alt="vote 4 star" name="user_rating" value="4" />';
$html .= '<input type="radio" alt="vote 5 star" name="user_rating" value="5" checked="checked" />';
$html .= JText::_( 'Best' );
$html .= '&nbsp;<input class="button" type="submit" name="submit_vote" value="'. JText::_( 'Rate' ) .'" />';
$html .= '<input type="hidden" name="task" value="vote" />';
$html .= '<input type="hidden" name="option" value="com_content" />';
$html .= '<input type="hidden" name="cid" value="'. $id .'" />';
$html .= '<input type="hidden" name="url" value="'. $uri->toString( ) .'" />';
$html .= '</span>';
}
$html .= '</form>';
}
return $html;
<?php
/**
* @version $Id: vote.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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' );
$mainframe->registerEvent( 'onBeforeDisplayContent', 'plgContentVote' );
function plgContentVote( &$row, &$params, $page=0 )
{
$uri = & JFactory::getURI();
$id = $row->id;
$html = '';
if (isset($row->rating_count) && $params->get( 'show_vote' ) && !$params->get( 'popup' ))
{
JPlugin::loadLanguage( 'plg_content_vote' );
$html .= '<form method="post" action="' . $uri->toString( ) . '">';
$img = '';
// look for images in template if available
$starImageOn = JHTML::_('image.site', 'rating_star.png', '/images/M_images/' );
$starImageOff = JHTML::_('image.site', 'rating_star_blank.png', '/images/M_images/' );
for ($i=0; $i < $row->rating; $i++) {
$img .= $starImageOn;
}
for ($i=$row->rating; $i < 5; $i++) {
$img .= $starImageOff;
}
$html .= '<span class="content_rating">';
$html .= JText::_( 'User Rating' ) .':'. $img .'&nbsp;/&nbsp;';
$html .= intval( $row->rating_count );
$html .= "</span>\n<br />\n";
if (!$params->get( 'intro_only' ))
{
$html .= '<span class="content_vote">';
$html .= JText::_( 'Poor' );
$html .= '<input type="radio" alt="vote 1 star" name="user_rating" value="1" />';
$html .= '<input type="radio" alt="vote 2 star" name="user_rating" value="2" />';
$html .= '<input type="radio" alt="vote 3 star" name="user_rating" value="3" />';
$html .= '<input type="radio" alt="vote 4 star" name="user_rating" value="4" />';
$html .= '<input type="radio" alt="vote 5 star" name="user_rating" value="5" checked="checked" />';
$html .= JText::_( 'Best' );
$html .= '&nbsp;<input class="button" type="submit" name="submit_vote" value="'. JText::_( 'Rate' ) .'" />';
$html .= '<input type="hidden" name="task" value="vote" />';
$html .= '<input type="hidden" name="option" value="com_content" />';
$html .= '<input type="hidden" name="cid" value="'. $id .'" />';
$html .= '<input type="hidden" name="url" value="'. $uri->toString( ) .'" />';
$html .= '</span>';
}
$html .= '</form>';
}
return $html;
}
+1 -1
View File
@@ -3,7 +3,7 @@
<name>Content - Vote</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
+97 -97
View File
@@ -1,97 +1,97 @@
<?php
/**
* @version $Id: image.php 12542 2009-07-22 17:40:48Z ian $
* @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' );
/**
* Editor Image buton
*
* @package Editors-xtd
* @since 1.5
*/
class plgButtonImage 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 plgButtonImage(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Display the button
*
* @return array A two element array of ( imageName, textToInsert )
*/
function onDisplay($name)
{
global $mainframe;
$params =& JComponentHelper::getParams('com_media');
//Find out who has permission to upload and change the acl to let them.
$acl = & JFactory::getACL();
switch ($params->get('allowed_media_usergroup'))
{
case '1':
$acl->addACL( 'com_media', 'upload', 'users', 'publisher' );
break;
case '2':
$acl->addACL( 'com_media', 'upload', 'users', 'publisher' );
$acl->addACL( 'com_media', 'upload', 'users', 'editor' );
break;
case '3':
$acl->addACL( 'com_media', 'upload', 'users', 'publisher' );
$acl->addACL( 'com_media', 'upload', 'users', 'editor' );
$acl->addACL( 'com_media', 'upload', 'users', 'author' );
break;
case '4':
$acl->addACL( 'com_media', 'upload', 'users', 'publisher' );
$acl->addACL( 'com_media', 'upload', 'users', 'editor' );
$acl->addACL( 'com_media', 'upload', 'users', 'author' );
$acl->addACL( 'com_media', 'upload', 'users', 'registered' );
break;
}
//Make sure the user is authorized to view this page
$user = & JFactory::getUser();
if (!$user->authorize( 'com_media', 'popup' )) {
return;
}
$doc =& JFactory::getDocument();
$template = $mainframe->getTemplate();
$link = 'index.php?option=com_media&amp;view=images&amp;tmpl=component&amp;e_name='.$name;
JHTML::_('behavior.modal');
$button = new JObject();
$button->set('modal', true);
$button->set('link', $link);
$button->set('text', JText::_('Image'));
$button->set('name', 'image');
$button->set('options', "{handler: 'iframe', size: {x: 570, y: 400}}");
return $button;
}
}
<?php
/**
* @version $Id: image.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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' );
/**
* Editor Image buton
*
* @package Editors-xtd
* @since 1.5
*/
class plgButtonImage 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 plgButtonImage(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Display the button
*
* @return array A two element array of ( imageName, textToInsert )
*/
function onDisplay($name)
{
global $mainframe;
$params =& JComponentHelper::getParams('com_media');
//Find out who has permission to upload and change the acl to let them.
$acl = & JFactory::getACL();
switch ($params->get('allowed_media_usergroup'))
{
case '1':
$acl->addACL( 'com_media', 'upload', 'users', 'publisher' );
break;
case '2':
$acl->addACL( 'com_media', 'upload', 'users', 'publisher' );
$acl->addACL( 'com_media', 'upload', 'users', 'editor' );
break;
case '3':
$acl->addACL( 'com_media', 'upload', 'users', 'publisher' );
$acl->addACL( 'com_media', 'upload', 'users', 'editor' );
$acl->addACL( 'com_media', 'upload', 'users', 'author' );
break;
case '4':
$acl->addACL( 'com_media', 'upload', 'users', 'publisher' );
$acl->addACL( 'com_media', 'upload', 'users', 'editor' );
$acl->addACL( 'com_media', 'upload', 'users', 'author' );
$acl->addACL( 'com_media', 'upload', 'users', 'registered' );
break;
}
//Make sure the user is authorized to view this page
$user = & JFactory::getUser();
if (!$user->authorize( 'com_media', 'popup' )) {
return;
}
$doc =& JFactory::getDocument();
$template = $mainframe->getTemplate();
$link = 'index.php?option=com_media&amp;view=images&amp;tmpl=component&amp;e_name='.$name;
JHTML::_('behavior.modal');
$button = new JObject();
$button->set('modal', true);
$button->set('link', $link);
$button->set('text', JText::_('Image'));
$button->set('name', 'image');
$button->set('options', "{handler: 'iframe', size: {x: 570, y: 400}}");
return $button;
}
}
@@ -3,7 +3,7 @@
<name>Button - Image</name>
<author>Joomla! Project</author>
<creationDate>August 2004</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
@@ -1,68 +1,68 @@
<?php
/**
* @version $Id: pagebreak.php 10709 2008-08-21 09:58:52Z eddieajau $
* @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' );
/**
* Editor Pagebreak buton
*
* @package Editors-xtd
* @since 1.5
*/
class plgButtonPagebreak 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 plgButtonPagebreak(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Display the button
*
* @return array A two element array of ( imageName, textToInsert )
*/
function onDisplay($name)
{
global $mainframe;
$doc = & JFactory::getDocument();
$template = $mainframe->getTemplate();
$link = 'index.php?option=com_content&amp;task=ins_pagebreak&amp;tmpl=component&amp;e_name='.$name;
JHTML::_('behavior.modal');
$button = new JObject();
$button->set('modal', true);
$button->set('link', $link);
$button->set('text', JText::_('Pagebreak'));
$button->set('name', 'pagebreak');
$button->set('options', "{handler: 'iframe', size: {x: 400, y: 85}}");
return $button;
}
<?php
/**
* @version $Id: pagebreak.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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' );
/**
* Editor Pagebreak buton
*
* @package Editors-xtd
* @since 1.5
*/
class plgButtonPagebreak 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 plgButtonPagebreak(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Display the button
*
* @return array A two element array of ( imageName, textToInsert )
*/
function onDisplay($name)
{
global $mainframe;
$doc = & JFactory::getDocument();
$template = $mainframe->getTemplate();
$link = 'index.php?option=com_content&amp;task=ins_pagebreak&amp;tmpl=component&amp;e_name='.$name;
JHTML::_('behavior.modal');
$button = new JObject();
$button->set('modal', true);
$button->set('link', $link);
$button->set('text', JText::_('Pagebreak'));
$button->set('name', 'pagebreak');
$button->set('options', "{handler: 'iframe', size: {x: 400, y: 85}}");
return $button;
}
}
@@ -3,7 +3,7 @@
<name>Button - Pagebreak</name>
<author>Joomla! Project</author>
<creationDate>August 2004</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
@@ -1,83 +1,83 @@
<?php
/**
* @version $Id: readmore.php 10709 2008-08-21 09:58:52Z eddieajau $
* @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' );
/**
* Editor Readmore buton
*
* @package Editors-xtd
* @since 1.5
*/
class plgButtonReadmore 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 plgButtonReadmore(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* readmore button
* @return array A two element array of ( imageName, textToInsert )
*/
function onDisplay($name)
{
global $mainframe;
$doc =& JFactory::getDocument();
$template = $mainframe->getTemplate();
// button is not active in specific content components
$getContent = $this->_subject->getContent($name);
$present = JText::_('ALREADY EXISTS', true) ;
$js = "
function insertReadmore(editor) {
var content = $getContent
if (content.match(/<hr\s+id=(\"|')system-readmore(\"|')\s*\/*>/i)) {
alert('$present');
return false;
} else {
jInsertEditorText('<hr id=\"system-readmore\" />', editor);
}
}
";
$doc->addScriptDeclaration($js);
$button = new JObject();
$button->set('modal', false);
$button->set('onclick', 'insertReadmore(\''.$name.'\');return false;');
$button->set('text', JText::_('Readmore'));
$button->set('name', 'readmore');
// TODO: The button writer needs to take into account the javascript directive
//$button->set('link', 'javascript:void(0)');
$button->set('link', '#');
return $button;
}
<?php
/**
* @version $Id: readmore.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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' );
/**
* Editor Readmore buton
*
* @package Editors-xtd
* @since 1.5
*/
class plgButtonReadmore 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 plgButtonReadmore(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* readmore button
* @return array A two element array of ( imageName, textToInsert )
*/
function onDisplay($name)
{
global $mainframe;
$doc =& JFactory::getDocument();
$template = $mainframe->getTemplate();
// button is not active in specific content components
$getContent = $this->_subject->getContent($name);
$present = JText::_('ALREADY EXISTS', true) ;
$js = "
function insertReadmore(editor) {
var content = $getContent
if (content.match(/<hr\s+id=(\"|')system-readmore(\"|')\s*\/*>/i)) {
alert('$present');
return false;
} else {
jInsertEditorText('<hr id=\"system-readmore\" />', editor);
}
}
";
$doc->addScriptDeclaration($js);
$button = new JObject();
$button->set('modal', false);
$button->set('onclick', 'insertReadmore(\''.$name.'\');return false;');
$button->set('text', JText::_('Readmore'));
$button->set('name', 'readmore');
// TODO: The button writer needs to take into account the javascript directive
//$button->set('link', 'javascript:void(0)');
$button->set('link', '#');
return $button;
}
}
@@ -3,7 +3,7 @@
<name>Button - Readmore</name>
<author>Joomla! Project</author>
<creationDate>March 2006</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
+182 -182
View File
@@ -1,183 +1,183 @@
<?php
/**
* @version $Id: none.php 10709 2008-08-21 09:58:52Z eddieajau $
* @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' );
/**
* No WYSIWYG Editor Plugin
*
* @package Editors
* @since 1.5
*/
class plgEditorNone 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 plgEditorNone(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Method to handle the onInitEditor event.
* - Initializes the Editor
*
* @access public
* @return string JavaScript Initialization string
* @since 1.5
*/
function onInit()
{
$txt = "<script type=\"text/javascript\">
function insertAtCursor(myField, myValue) {
if (document.selection) {
// IE support
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
} else if (myField.selectionStart || myField.selectionStart == '0') {
// MOZILLA/NETSCAPE support
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(endPos, myField.value.length);
} else {
myField.value += myValue;
}
}
</script>";
return $txt;
}
/**
* No WYSIWYG Editor - copy editor content to form field
*
* @param string The name of the editor
*/
function onSave( $editor ) {
return;
}
/**
* No WYSIWYG Editor - get the editor content
*
* @param string The name of the editor
*/
function onGetContent( $editor ) {
return "document.getElementById( '$editor' ).value;\n";
}
/**
* No WYSIWYG Editor - set the editor content
*
* @param string The name of the editor
*/
function onSetContent( $editor, $html ) {
return "document.getElementById( '$editor' ).value = $html;\n";
}
/**
* No WYSIWYG Editor - display the editor
*
* @param string The name of the editor area
* @param string The content of the field
* @param string The name of the form field
* @param string The width of the editor area
* @param string The height of the editor area
* @param int The number of columns for the editor area
* @param int The number of rows for the editor area
*/
function onDisplay( $name, $content, $width, $height, $col, $row, $buttons = true )
{
// Only add "px" to width and height if they are not given as a percentage
if (is_numeric( $width )) {
$width .= 'px';
}
if (is_numeric( $height )) {
$height .= 'px';
}
$buttons = $this->_displayButtons($name, $buttons);
$editor = "<textarea name=\"$name\" id=\"$name\" cols=\"$col\" rows=\"$row\" style=\"width: $width; height: $height;\">$content</textarea>" . $buttons;
return $editor;
}
function onGetInsertMethod($name)
{
$doc = & JFactory::getDocument();
$js= "\tfunction jInsertEditorText( text, editor ) {
insertAtCursor( document.getElementById(editor), text );
}";
$doc->addScriptDeclaration($js);
return true;
}
function _displayButtons($name, $buttons)
{
// Load modal popup behavior
JHTML::_('behavior.modal', 'a.modal-button');
$args['name'] = $name;
$args['event'] = 'onGetInsertMethod';
$return = '';
$results[] = $this->update($args);
foreach ($results as $result) {
if (is_string($result) && trim($result)) {
$return .= $result;
}
}
if(!empty($buttons))
{
$results = $this->_subject->getButtons($name, $buttons);
/*
* This will allow plugins to attach buttons or change the behavior on the fly using AJAX
*/
$return .= "\n<div id=\"editor-xtd-buttons\">\n";
foreach ($results as $button)
{
/*
* Results should be an object
*/
if ( $button->get('name') )
{
$modal = ($button->get('modal')) ? 'class="modal-button"' : null;
$href = ($button->get('link')) ? 'href="'.$button->get('link').'"' : null;
$onclick = ($button->get('onclick')) ? 'onclick="'.$button->get('onclick').'"' : null;
$return .= "<div class=\"button2-left\"><div class=\"".$button->get('name')."\"><a ".$modal." title=\"".$button->get('text')."\" ".$href." ".$onclick." rel=\"".$button->get('options')."\">".$button->get('text')."</a></div></div>\n";
}
}
$return .= "</div>\n";
}
return $return;
}
<?php
/**
* @version $Id: none.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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' );
/**
* No WYSIWYG Editor Plugin
*
* @package Editors
* @since 1.5
*/
class plgEditorNone 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 plgEditorNone(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Method to handle the onInitEditor event.
* - Initializes the Editor
*
* @access public
* @return string JavaScript Initialization string
* @since 1.5
*/
function onInit()
{
$txt = "<script type=\"text/javascript\">
function insertAtCursor(myField, myValue) {
if (document.selection) {
// IE support
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
} else if (myField.selectionStart || myField.selectionStart == '0') {
// MOZILLA/NETSCAPE support
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(endPos, myField.value.length);
} else {
myField.value += myValue;
}
}
</script>";
return $txt;
}
/**
* No WYSIWYG Editor - copy editor content to form field
*
* @param string The name of the editor
*/
function onSave( $editor ) {
return;
}
/**
* No WYSIWYG Editor - get the editor content
*
* @param string The name of the editor
*/
function onGetContent( $editor ) {
return "document.getElementById( '$editor' ).value;\n";
}
/**
* No WYSIWYG Editor - set the editor content
*
* @param string The name of the editor
*/
function onSetContent( $editor, $html ) {
return "document.getElementById( '$editor' ).value = $html;\n";
}
/**
* No WYSIWYG Editor - display the editor
*
* @param string The name of the editor area
* @param string The content of the field
* @param string The name of the form field
* @param string The width of the editor area
* @param string The height of the editor area
* @param int The number of columns for the editor area
* @param int The number of rows for the editor area
*/
function onDisplay( $name, $content, $width, $height, $col, $row, $buttons = true )
{
// Only add "px" to width and height if they are not given as a percentage
if (is_numeric( $width )) {
$width .= 'px';
}
if (is_numeric( $height )) {
$height .= 'px';
}
$buttons = $this->_displayButtons($name, $buttons);
$editor = "<textarea name=\"$name\" id=\"$name\" cols=\"$col\" rows=\"$row\" style=\"width: $width; height: $height;\">$content</textarea>" . $buttons;
return $editor;
}
function onGetInsertMethod($name)
{
$doc = & JFactory::getDocument();
$js= "\tfunction jInsertEditorText( text, editor ) {
insertAtCursor( document.getElementById(editor), text );
}";
$doc->addScriptDeclaration($js);
return true;
}
function _displayButtons($name, $buttons)
{
// Load modal popup behavior
JHTML::_('behavior.modal', 'a.modal-button');
$args['name'] = $name;
$args['event'] = 'onGetInsertMethod';
$return = '';
$results[] = $this->update($args);
foreach ($results as $result) {
if (is_string($result) && trim($result)) {
$return .= $result;
}
}
if(!empty($buttons))
{
$results = $this->_subject->getButtons($name, $buttons);
/*
* This will allow plugins to attach buttons or change the behavior on the fly using AJAX
*/
$return .= "\n<div id=\"editor-xtd-buttons\">\n";
foreach ($results as $button)
{
/*
* Results should be an object
*/
if ( $button->get('name') )
{
$modal = ($button->get('modal')) ? 'class="modal-button"' : null;
$href = ($button->get('link')) ? 'href="'.$button->get('link').'"' : null;
$onclick = ($button->get('onclick')) ? 'onclick="'.$button->get('onclick').'"' : null;
$return .= "<div class=\"button2-left\"><div class=\"".$button->get('name')."\"><a ".$modal." title=\"".$button->get('text')."\" ".$href." ".$onclick." rel=\"".$button->get('options')."\">".$button->get('text')."</a></div></div>\n";
}
}
$return .= "</div>\n";
}
return $return;
}
}
+2 -2
View File
@@ -6,8 +6,8 @@
<author></author>
<authorEmail>N/A</authorEmail>
<authorUrl></authorUrl>
<copyright>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</copyright>
<license>LGPL</license>
<copyright>Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<description>This loads a basic text entry field</description>
<files>
<filename plugin="none">none.php</filename>
File diff suppressed because it is too large Load Diff
+202 -198
View File
@@ -1,198 +1,202 @@
<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="plugin" group="editors" method="upgrade">
<name>Editor - TinyMCE 3</name>
<version>3.2.4.1</version>
<creationDate>2005-2009</creationDate>
<author>Moxiecode Systems AB</author>
<authorEmail>N/A</authorEmail>
<authorUrl>tinymce.moxiecode.com/</authorUrl>
<copyright>Moxiecode Systems AB</copyright>
<license>LGPL</license>
<description>DESCTINYMCE</description>
<files>
<filename plugin="tinymce3">tinymce3.php</filename>
<folder>tinymce3</folder>
</files>
<languages>
<language tag="en-GB">en-GB.plg_editors_tinymce3.ini</language>
</languages>
<params>
<param name="mode" type="list" default="advanced" label="Functionality" description="Select functionality">
<option value="simple">Simple</option>
<option value="advanced">Advanced</option>
<option value="extended">Extended</option>
</param>
<param name="skin" type="list" default="0" label="Skin" description="Select skin">
<option value="0">Default</option>
<option value="1">Office2007 Blue</option>
<option value="2">Office2007 Silver</option>
<option value="3">Office2007 Black</option>
</param>
<param name="compressed" type="radio" default="0" label="Compressed Version" description="PARAMCOMPRESSEDVERSION">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="cleanup_startup" type="radio" default="0" label="Code Cleanup on startup" description="Cleans code on editor load">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="cleanup_save" type="radio" default="2" label="Code Cleanup on Save" description="Code Cleanup upon saving article">
<option value="0">Never</option>
<option value="1">Front Only</option>
<option value="2">Always</option>
</param>
<param name="entity_encoding" type="list" default="raw" label="Entity Encoding" description="Controls how entities get processed by editor">
<option value="named">named</option>
<option value="numeric">numeric</option>
<option value="raw">raw</option>
</param>
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="lang_mode" type="radio" default="0" label="Automatic Language Selection" description="DESCLANGMODE">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="lang_code" type="text" default="en" size="2" label="Language Code" description="DESCLANGCODE"/>
<param name="text_direction" type="list" default="ltr" label="Text Direction" description="Ability to change text direction">
<option value="ltr">Left to Right</option>
<option value="rtl">Right to Left</option>
</param>
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="content_css" type="radio" default="1" label="Template CSS classes" description="PARAMTEMPLATECSS">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="content_css_custom" type="text" size="30" default="" label="Custom CSS Classes" description="PARAMCUSTOMCSS"/>
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="relative_urls" type="list" default="1" label="Urls" description="URL behaviour">
<option value="0">Absolute</option>
<option value="1">Relative</option>
</param>
<param name="newlines" type="list" default="0" label="Newlines" description="Newlines will be made into the selected option">
<option value="1">BR Elements</option>
<option value="0">P Elements</option>
</param>
<param name="invalid_elements" type="textarea" rows="2" cols="30" default="script,applet,iframe" label="Prohibited Elements" description="Elements that will be cleaned from the text"/>
<param name="extended_elements" type="textarea" rows="2" cols="30" default="" label="Extended Valid Elements" description="PARAMEXTVALIDELEMENTS"/>
</params>
<params group="advanced">
<param name="toolbar" type="list" default="top" label="Toolbar" description="Position of the toolbar">
<option value="top">Top</option>
<option value="bottom">Bottom</option>
</param>
<param name="toolbar_align" type="list" default="left" label="Toolbar align" description="Alignment of the toolbar">
<option value="left">Left</option>
<option value="center">Center</option>
<option value="right">Right</option>
</param>
<param name="html_height" type="text" default="550" label="HTML Height" description="PARAMHTMLHEIGHT"/>
<param name="html_width" type="text" default="750" label="HTML Width" description="PARAMHTMLWIDTH"/>
<param name="element_path" type="radio" default="1" label="Element Path" description="PARAMELEMENTPATH">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="@spacer" type="spacer" default="Params Extended Mode" label="" description="" />
<param name="fonts" type="radio" default="1" label="Fonts" description="PARAMFONTS">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="paste" type="radio" default="1" label="Paste" description="PARAMPASTE">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="searchreplace" type="radio" default="1" label="Search-Replace" description="PARAMSEARCHREPLACE">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="insertdate" type="radio" default="1" label="Insert Date" description="PARAMINSERTDATE">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="format_date" type="text" default="%Y-%m-%d" label="Date format" description="Format of inserted Date. Only works in Advanced mode"/>
<param name="inserttime" type="radio" default="1" label="Insert Time" description="PARAMINSERTTIME">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="format_time" type="text" default="%H:%M:%S" label="Time format" description="Format of inserted Time. Only works in Advanced mode"/>
<param name="colors" type="radio" default="1" label="Colors" description="PARAMCOLORS">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="table" type="radio" default="1" label="Table" description="PARAMTABLE">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="smilies" type="radio" default="1" label="Smilies" description="PARAMSMILIES">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="media" type="radio" default="1" label="Media" description="PARAMMEDIA">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="hr" type="radio" default="1" label="Horizontal Rule" description="Show/Hide the Horizontal Rule button">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="directionality" type="radio" default="1" label="Directionality" description="PARAMDIRECTIONALITY">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="fullscreen" type="radio" default="1" label="Fullscreen" description="PARAMFULLSCREEN">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="style" type="radio" default="1" label="Style" description="PARAMSTYLE">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="layer" type="radio" default="1" label="Layer" description="PARAMLAYER">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="xhtmlxtras" type="radio" default="1" label="XHTMLxtras" description="PARAMXHTMLXTRAS">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="visualchars" type="radio" default="1" label="Visualchars" description="Possibility to see invisible characters">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="nonbreaking" type="radio" default="1" label="Nonbreaking" description="Insert nonbreaking space entities">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="template" type="radio" default="1" label="Template" description="PARAMTEMPLATE">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="advimage" type="radio" default="1" label="Advanced image" description="Turn on/off a more advanced image dialog">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="advlink" type="radio" default="1" label="Advanced link" description="Turn on/off a more advanced link dialog">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="autosave" type="radio" default="1" label="Save Warning" description="Save warning - gives warning if you cancel without saving changes">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="contextmenu" type="radio" default="1" label="Context menu" description="Turn on/off Context menu">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="inlinepopups" type="radio" default="1" label="Inline popups" description="All dialogs to open as floating DIV layers instead of popup windows. This option can be very useful in order to get around popup blockers.">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="safari" type="radio" default="0" label="Safari compatibility" description="Turn on/off Safari compatibility plugin">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="custom_plugin" type="text" default="" label="Custom plugin" description="Add custom plugin(s)"/>
<param name="custom_button" type="text" default="" label="Custom button" description="Add custom button(s)"/>
</params>
</install>
<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="plugin" group="editors" method="upgrade">
<name>Editor - TinyMCE 3</name>
<version>3.2.6</version>
<creationDate>2005-2009</creationDate>
<author>Moxiecode Systems AB</author>
<authorEmail>N/A</authorEmail>
<authorUrl>tinymce.moxiecode.com/</authorUrl>
<copyright>Moxiecode Systems AB</copyright>
<license>LGPL</license>
<description>DESCTINYMCE</description>
<files>
<filename plugin="tinymce3">tinymce.php</filename>
<folder>tinymce</folder>
</files>
<languages>
<language tag="en-GB">en-GB.plg_editors_tinymce.ini</language>
</languages>
<params>
<param name="mode" type="list" default="advanced" label="Functionality" description="Select functionality">
<option value="simple">Simple</option>
<option value="advanced">Advanced</option>
<option value="extended">Extended</option>
</param>
<param name="skin" type="list" default="0" label="Skin" description="Select skin">
<option value="0">Default</option>
<option value="1">Office2007 Blue</option>
<option value="2">Office2007 Silver</option>
<option value="3">Office2007 Black</option>
</param>
<param name="compressed" type="radio" default="0" label="Compressed Version" description="PARAMCOMPRESSEDVERSION">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="cleanup_startup" type="radio" default="0" label="Code Cleanup on startup" description="Cleans code on editor load">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="cleanup_save" type="radio" default="2" label="Code Cleanup on Save" description="PARAMCODECLEANUPONSAVE">
<option value="0">Never</option>
<option value="1">Front Only</option>
<option value="2">Always</option>
</param>
<param name="entity_encoding" type="list" default="raw" label="Entity Encoding" description="PARAMENTITYENCODING">
<option value="named">named</option>
<option value="numeric">numeric</option>
<option value="raw">raw</option>
</param>
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="lang_mode" type="radio" default="0" label="Automatic Language Selection" description="DESCLANGMODE">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="lang_code" type="text" default="en" size="2" label="Language Code" description="DESCLANGCODE"/>
<param name="text_direction" type="list" default="ltr" label="Text Direction" description="Ability to change text direction">
<option value="ltr">Left to Right</option>
<option value="rtl">Right to Left</option>
</param>
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="content_css" type="radio" default="1" label="Template CSS classes" description="PARAMTEMPLATECSS">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="content_css_custom" type="text" size="30" default="" label="Custom CSS Classes" description="PARAMCUSTOMCSS"/>
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="relative_urls" type="list" default="1" label="Urls" description="URL behaviour">
<option value="0">Absolute</option>
<option value="1">Relative</option>
</param>
<param name="newlines" type="list" default="0" label="Newlines" description="Newlines will be made into the selected option">
<option value="1">BR Elements</option>
<option value="0">P Elements</option>
</param>
<param name="invalid_elements" type="textarea" rows="2" cols="30" default="script,applet,iframe" label="Prohibited Elements" description="Elements that will be cleaned from the text"/>
<param name="extended_elements" type="textarea" rows="2" cols="30" default="" label="Extended Valid Elements" description="PARAMEXTVALIDELEMENTS"/>
</params>
<params group="advanced">
<param name="toolbar" type="list" default="top" label="Toolbar" description="Position of the toolbar">
<option value="top">Top</option>
<option value="bottom">Bottom</option>
</param>
<param name="toolbar_align" type="list" default="left" label="Toolbar align" description="Alignment of the toolbar">
<option value="left">Left</option>
<option value="center">Center</option>
<option value="right">Right</option>
</param>
<param name="html_height" type="text" default="550" label="HTML Height" description="PARAMHTMLHEIGHT"/>
<param name="html_width" type="text" default="750" label="HTML Width" description="PARAMHTMLWIDTH"/>
<param name="element_path" type="radio" default="1" label="Element Path" description="PARAMELEMENTPATH">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="@spacer" type="spacer" default="Params Extended Mode" label="" description="" />
<param name="fonts" type="radio" default="1" label="Fonts" description="PARAMFONTS">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="paste" type="radio" default="1" label="Paste" description="PARAMPASTE">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="searchreplace" type="radio" default="1" label="Search-Replace" description="PARAMSEARCHREPLACE">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="insertdate" type="radio" default="1" label="Insert Date" description="PARAMINSERTDATE">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="format_date" type="text" default="%Y-%m-%d" label="Date format" description="Format of inserted Date. Only works in Advanced mode"/>
<param name="inserttime" type="radio" default="1" label="Insert Time" description="PARAMINSERTTIME">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="format_time" type="text" default="%H:%M:%S" label="Time format" description="Format of inserted Time. Only works in Advanced mode"/>
<param name="colors" type="radio" default="1" label="Colors" description="PARAMCOLORS">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="table" type="radio" default="1" label="Table" description="PARAMTABLE">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="smilies" type="radio" default="1" label="Smilies" description="PARAMSMILIES">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="media" type="radio" default="1" label="Media" description="PARAMMEDIA">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="hr" type="radio" default="1" label="Horizontal Rule" description="Show/Hide the Horizontal Rule button">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="directionality" type="radio" default="1" label="Directionality" description="PARAMDIRECTIONALITY">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="fullscreen" type="radio" default="1" label="Fullscreen" description="PARAMFULLSCREEN">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="style" type="radio" default="1" label="Style" description="PARAMSTYLE">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="layer" type="radio" default="1" label="Layer" description="PARAMLAYER">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="xhtmlxtras" type="radio" default="1" label="XHTMLxtras" description="PARAMXHTMLXTRAS">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="visualchars" type="radio" default="1" label="Visualchars" description="Possibility to see invisible characters">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="nonbreaking" type="radio" default="1" label="Nonbreaking" description="Insert nonbreaking space entities">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="blockquote" type="radio" default="1" label="Blockquote" description="PARAMBLOCKQUOTE">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="template" type="radio" default="1" label="Template" description="PARAMTEMPLATE">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="advimage" type="radio" default="1" label="Advanced image" description="Turn on/off a more advanced image dialog">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="advlink" type="radio" default="1" label="Advanced link" description="Turn on/off a more advanced link dialog">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="autosave" type="radio" default="1" label="Save Warning" description="Save warning - gives warning if you cancel without saving changes">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="contextmenu" type="radio" default="1" label="Context menu" description="Turn on/off Context menu">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="inlinepopups" type="radio" default="1" label="Inline popups" description="All dialogs to open as floating DIV layers instead of popup windows. This option can be very useful in order to get around popup blockers.">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="safari" type="radio" default="0" label="Safari compatibility" description="Turn on/off Safari compatibility plugin">
<option value="0">Off</option>
<option value="1">On</option>
</param>
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="custom_plugin" type="text" default="" label="Custom plugin" description="Add custom plugin(s)"/>
<param name="custom_button" type="text" default="" label="Custom button" description="Add custom button(s)"/>
</params>
</install>
@@ -1,8 +1 @@
// UK lang variables
/* Remember to namespace the language parameters lang_<your plugin>_<some name> */
tinyMCE.addToLang('',{
template_title : 'This is just a template popup',
template_desc : 'This is just a template button'
});
// UK lang variables/* Remember to namespace the language parameters lang_<your plugin>_<some name> *//r//Older tiny2 lang file. Can be deleted
@@ -1,8 +1 @@
// UK lang variables
tinyMCE.addToLang('',{
insert_advhr_desc : 'Horizontal rule',
insert_advhr_width : 'Width',
insert_advhr_size : 'Height',
insert_advhr_noshade : 'No shadow'
});
// UK lang variables
@@ -1,27 +1 @@
// UK lang variables
tinyMCE.addToLang('advimage',{
tab_general : 'General',
tab_appearance : 'Appearance',
tab_advanced : 'Advanced',
general : 'General',
title : 'Title',
preview : 'Preview',
constrain_proportions : 'Constrain proportions',
langdir : 'Language direction',
langcode : 'Language code',
long_desc : 'Long description link',
style : 'Style',
classes : 'Classes',
ltr : 'Left to right',
rtl : 'Right to left',
id : 'Id',
image_map : 'Image map',
swap_image : 'Swap image',
alt_image : 'Alternative image',
mouseover : 'for mouse over',
mouseout : 'for mouse out',
misc : 'Miscellaneous',
example_img : 'Appearance&nbsp;preview&nbsp;image',
missing_alt : 'Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.'
});
// UK lang variables
@@ -1,46 +1 @@
// UK lang variables
tinyMCE.addToLang('advlink',{
general_tab : 'General',
popup_tab : 'Popup',
events_tab : 'Events',
advanced_tab : 'Advanced',
general_props : 'General properties',
popup_props : 'Popup properties',
event_props : 'Events',
advanced_props : 'Advanced properties',
popup_opts : 'Options',
anchor_names : 'Anchors',
target_same : 'Open in this window / frame',
target_parent : 'Open in parent window / frame',
target_top : 'Open in top frame (replaces all frames)',
target_blank : 'Open in new window',
popup : 'Javascript popup',
popup_url : 'Popup URL',
popup_name : 'Window name',
popup_return : 'Insert \'return false\'',
popup_scrollbars : 'Show scrollbars',
popup_statusbar : 'Show status bar',
popup_toolbar : 'Show toolbars',
popup_menubar : 'Show menu bar',
popup_location : 'Show location bar',
popup_resizable : 'Make window resizable',
popup_dependent : 'Dependent (Mozilla/Firefox only)',
popup_size : 'Size',
popup_position : 'Position (X/Y)',
id : 'Id',
style: 'Style',
classes : 'Classes',
target_name : 'Target name',
langdir : 'Language direction',
target_langcode : 'Target language',
langcode : 'Language code',
encoding : 'Target character encoding',
mime : 'Target MIME type',
rel : 'Relationship page to target',
rev : 'Relationship target to page',
tabindex : 'Tabindex',
accesskey : 'Accesskey',
ltr : 'Left to right',
rtl : 'Right to left'
});
// UK lang variables
@@ -1,5 +1 @@
// EN lang variables
tinyMCE.addToLang('',{
autosave_unload_msg : 'The changes you made will be lost if you navigate away from this page.'
});
// EN lang variables
@@ -1,23 +1 @@
// UK lang variables
tinyMCE.addToLang('devkit',{
title : 'TinyMCE Development Kit',
info_tab : 'Info',
settings_tab : 'Settings',
log_tab : 'Log',
content_tab : 'Content',
command_states_tab : 'Commands',
undo_redo_tab : 'Undo/Redo',
misc_tab : 'Misc',
filter : 'Filter:',
clear_log : 'Clear log',
refresh : 'Refresh',
info_help : 'Press Refresh to view info.',
settings_help : 'Press Refresh to display the settings array for each TinyMCE_Control instance.',
content_help : 'Press Refresh to display the raw and cleaned HTML content for each TinyMCE_Control instance.',
command_states_help : 'Press Refresh to display the current command states from inst.queryCommandState. This list will also mark unsupported commands.',
undo_redo_help : 'Press Refresh to display the global and instance undo/redo levels.',
misc_help : 'Here are various tools for debugging and development purposes.',
debug_events : 'Debug events',
undo_diff : 'Diff undo levels'
});
// UK lang variables
@@ -1,6 +1 @@
// UK lang variables
tinyMCE.addToLang('',{
directionality_ltr_desc : 'Direction left to right',
directionality_rtl_desc : 'Direction right to left'
});
// UK lang variables
@@ -1,22 +1 @@
// UK lang variables
tinyMCE.addToLang('emotions',{
title : 'Insert emotion',
desc : 'Emotions',
cool : 'Cool',
cry : 'Cry',
embarassed : 'Embarassed',
foot_in_mouth : 'Foot in mouth',
frown : 'Frown',
innocent : 'Innocent',
kiss : 'Kiss',
laughing : 'Laughing',
money_mouth : 'Money mouth',
sealed : 'Sealed',
smile : 'Smile',
surprised : 'Surprised',
tongue_out : 'Tongue out',
undecided : 'Undecided',
wink : 'Wink',
yell : 'Yell'
});
// UK lang variables
@@ -1,11 +1 @@
// UK lang variables
tinyMCE.addToLang('flash',{
title : 'Insert / edit Flash Movie',
desc : 'Insert / edit Flash Movie',
file : 'Flash-File (.swf)',
size : 'Size',
list : 'Flash files',
props : 'Flash properties',
general : 'General'
});
// UK lang variables
@@ -123,7 +123,7 @@ function init() {
// Parse xml and doctype
xmlVer = getReItem(/<\?\s*?xml.*?version\s*?=\s*?"(.*?)".*?\?>/gi, h, 1);
xmlEnc = getReItem(/<\?\s*?xml.*?encoding\s*?=\s*?"(.*?)".*?\?>/gi, h, 1);
docType = getReItem(/<\!DOCTYPE.*?>/gi, h, 0);
docType = getReItem(/<\!DOCTYPE.*?>/gi, h.replace(/\n/g, ''), 0).replace(/ +/g, ' ');
f.langcode.value = getReItem(/lang="(.*?)"/gi, h, 1);
// Parse title
@@ -1,92 +1 @@
// UK lang variables
tinyMCE.addToLang('fullpage',{
title : 'Document properties',
desc : 'Document properties',
meta_tab : 'General',
appearance_tab : 'Appearance',
advanced_tab : 'Advanced',
meta_props : 'Meta information',
langprops : 'Language and encoding',
meta_title : 'Title',
meta_keywords : 'Keywords',
meta_description : 'Description',
meta_robots : 'Robots',
doctypes : 'Doctype',
langcode : 'Language code',
langdir : 'Language direction',
ltr : 'Left to right',
rtl : 'Right to left',
xml_pi : 'XML declaration',
encoding : 'Character encoding',
appearance_bgprops : 'Background properties',
appearance_marginprops : 'Body margins',
appearance_linkprops : 'Link colors',
appearance_textprops : 'Text properties',
bgcolor : 'Background color',
bgimage : 'Background image',
left_margin : 'Left margin',
right_margin : 'Right margin',
top_margin : 'Top margin',
bottom_margin : 'Bottom margin',
text_color : 'Text color',
font_size : 'Font size',
font_face : 'Font face',
link_color : 'Link color',
hover_color : 'Hover color',
visited_color : 'Visited color',
active_color : 'Active color',
textcolor : 'Color',
fontsize : 'Font size',
fontface : 'Font family',
meta_index_follow : 'Index and follow the links',
meta_index_nofollow : 'Index and don\'t follow the links',
meta_noindex_follow : 'Do not index but follow the links',
meta_noindex_nofollow : 'Do not index and don\'t follow the links',
appearance_style : 'Stylesheet and style properties',
stylesheet : 'Stylesheet',
style : 'Style',
author : 'Author',
copyright : 'Copyright',
add : 'Add new element',
remove : 'Remove selected element',
moveup : 'Move selected element up',
movedown : 'Move selected element down',
head_elements : 'Head elements',
info : 'Information',
info_text : '',
add_title : 'Title element',
add_meta : 'Meta element',
add_script : 'Script element',
add_style : 'Style element',
add_link : 'Link element',
add_base : 'Base element',
add_comment : 'Comment node',
title_element : 'Title element',
script_element : 'Script element',
style_element : 'Style element',
base_element : 'Base element',
link_element : 'Link element',
meta_element : 'Meta element',
comment_element : 'Comment',
src : 'Src',
language : 'Language',
href : 'Href',
target : 'Target',
rel : 'Rel',
type : 'Type',
charset : 'Charset',
defer : 'Defer',
media : 'Media',
properties : 'Properties',
name : 'Name',
value : 'Value',
content : 'Content',
rel : 'Rel',
rev : 'Rev',
hreflang : 'Href lang',
general_props : 'General',
advanced_props : 'Advanced',
delta_width : 0,
delta_height : 0
});
// UK lang variables
@@ -1,5 +1 @@
// UK lang variables
tinyMCE.addToLang('',{
fullscreen_desc : 'Toggle fullscreen mode'
});
// UK lang variables
@@ -1,7 +1 @@
// UK lang variables
tinyMCE.addToLang('',{
iespell_desc : 'Run spell checking',
iespell_download : "ieSpell not detected. Click OK to go to download page."
});
// UK lang variables
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
/**
* $Id: editor_plugin_src.js 999 2009-02-10 17:42:58Z spocke $
* $Id: editor_plugin_src.js 1150 2009-06-01 11:50:46Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
@@ -50,7 +50,7 @@
// Only store selection if the type is a normal window
if (!f.type)
t.bookmark = ed.selection.getBookmark('simple');
t.bookmark = ed.selection.getBookmark(1);
id = DOM.uniqueId();
vp = DOM.getViewPort();
@@ -1,12 +1 @@
// UK lang variables
tinyMCE.addToLang('',{
insertdate_def_fmt : '%Y-%m-%d',
inserttime_def_fmt : '%H:%M:%S',
insertdate_desc : 'Insert date',
inserttime_desc : 'Insert time',
inserttime_months_long : new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"),
inserttime_months_short : new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"),
inserttime_day_long : new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"),
inserttime_day_short : new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
});
// UK lang variables
@@ -1,9 +1 @@
// UK lang variables
tinyMCE.addToLang('layer',{
insertlayer_desc : 'Insert new layer',
forward_desc : 'Move forward',
backward_desc : 'Move backward',
absolute_desc : 'Toggle absolute positioning',
content : 'New layer...'
});
// UK lang variables
@@ -1,94 +1 @@
// UK lang variables
tinyMCE.addToLang('media',{
title : 'Insert / edit embedded media',
desc : 'Insert / edit embedded media',
general : 'General',
advanced : 'Advanced',
file : 'File/URL',
list : 'List',
size : 'Dimensions',
preview : 'Preview',
constrain_proportions : 'Constrain proportions',
type : 'Type',
id : 'Id',
name : 'Name',
class_name : 'Class',
vspace : 'V-Space',
hspace : 'H-Space',
play : 'Auto play',
loop : 'Loop',
menu : 'Show menu',
quality : 'Quality',
scale : 'Scale',
align : 'Align',
salign : 'SAlign',
wmode : 'WMode',
bgcolor : 'Background',
base : 'Base',
flashvars : 'Flashvars',
liveconnect : 'SWLiveConnect',
autohref : 'AutoHREF',
cache : 'Cache',
hidden : 'Hidden',
controller : 'Controller',
kioskmode : 'Kiosk mode',
playeveryframe : 'Play every frame',
targetcache : 'Target cache',
correction : 'No correction',
enablejavascript : 'Enable JavaScript',
starttime : 'Start time',
endtime : 'End time',
href : 'Href',
qtsrcchokespeed : 'Choke speed',
target : 'Target',
volume : 'Volume',
autostart : 'Auto start',
enabled : 'Enabled',
fullscreen : 'Fullscreen',
invokeurls : 'Invoke URLs',
mute : 'Mute',
stretchtofit : 'Stretch to fit',
windowlessvideo : 'Windowless video',
balance : 'Balance',
baseurl : 'Base URL',
captioningid : 'Captioning id',
currentmarker : 'Current marker',
currentposition : 'Current position',
defaultframe : 'Default frame',
playcount : 'Play count',
rate : 'Rate',
uimode : 'UI Mode',
flash_options : 'Flash options',
qt_options : 'Quicktime options',
wmp_options : 'Windows media player options',
rmp_options : 'Real media player options',
shockwave_options : 'Shockwave options',
autogotourl : 'Auto goto URL',
center : 'Center',
imagestatus : 'Image status',
maintainaspect : 'Maintain aspect',
nojava : 'No java',
prefetch : 'Prefetch',
shuffle : 'Shuffle',
console : 'Console',
numloop : 'Num loops',
controls : 'Controls',
scriptcallbacks : 'Script callbacks',
swstretchstyle : 'Stretch style',
swstretchhalign : 'Stretch H-Align',
swstretchvalign : 'Stretch V-Align',
sound : 'Sound',
progress : 'Progress',
qtsrc : 'QT Src',
qt_stream_warn : 'Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..',
align_top : 'Top',
align_right : 'Right',
align_bottom : 'Bottom',
align_left : 'Left',
align_center : 'Center',
align_top_left : 'Top left',
align_top_right : 'Top right',
align_bottom_left : 'Bottom left',
align_bottom_right : 'Bottom right'
});
// UK lang variables
@@ -1,5 +1 @@
// UK lang variables
tinyMCE.addToLang('nonbreaking',{
desc : 'Insert non-breaking space character'
});
// UK lang variables
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
/**
* $Id: editor_plugin_src.js 1134 2009-05-21 12:48:25Z spocke $
* $Id: editor_plugin_src.js 1199 2009-08-18 11:55:59Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
@@ -34,8 +34,8 @@
});
// This function executes the process handlers and inserts the contents
function process(h) {
var dom = ed.dom, o = {content : h};
function process(o) {
var dom = ed.dom;
// Execute pre process handlers
t.onPreProcess.dispatch(t, o);
@@ -57,8 +57,8 @@
};
// Add command for external usage
ed.addCommand('mceInsertClipboardContent', function(u, v) {
process(v);
ed.addCommand('mceInsertClipboardContent', function(u, o) {
process(o);
});
// This function grabs the contents from the clipboard by adding a
@@ -98,9 +98,15 @@
// Remove container
dom.remove(n);
// Process contents
process(n.innerHTML);
// Check if the contents was changed, if it wasn't then clipboard extraction failed probably due
// to IE security settings so we pass the junk though better than nothing right
if (n.innerHTML === '&nbsp;')
return;
// Process contents
process({content : n.innerHTML});
// Block the real paste event
return tinymce.dom.Event.cancel(e);
} else {
or = ed.selection.getRng();
@@ -114,26 +120,19 @@
// Wait a while and grab the pasted contents
window.setTimeout(function() {
var n = dom.get('_mcePaste'), h;
var h = '';
// Webkit clones the _mcePaste div for some odd reason so this will ensure that we get the real new div not the old empty one
n.id = '_mceRemoved';
dom.remove(n);
n = dom.get('_mcePaste') || n;
// Grab the HTML contents
// We need to look for a apple style wrapper on webkit it also adds a div wrapper if you copy/paste the body of the editor
// It's amazing how strange the contentEditable mode works in WebKit
h = (dom.select('> span.Apple-style-span div', n)[0] || dom.select('> span.Apple-style-span', n)[0] || n).innerHTML;
// Remove hidden div and restore selection
dom.remove(n);
// WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string
each(dom.select('div[id=_mcePaste]').reverse(), function(n) {
h += (dom.select('> span.Apple-style-span div', n)[0] || dom.select('> span.Apple-style-span', n)[0] || n).innerHTML;
dom.remove(n);
});
// Restore the old selection
if (or)
sel.setRng(or);
process(h);
process({content : h});
}, 0);
}
};
@@ -195,17 +194,17 @@
});
};
// Process away some basic content
process([
/^\s*(&nbsp;)+/g, // nbsp entities at the start of contents
/(&nbsp;|<br[^>]*>)+\s*$/g // nbsp entities at the end of contents
]);
// Detect Word content and process it more aggressive
if (/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(h)) {
if (/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(h) || o.wordContent) {
o.wordContent = true; // Mark the pasted contents as word specific content
//console.log('Word contents detected.');
// Process away some basic content
process([
/^\s*(&nbsp;)+/g, // nbsp entities at the start of contents
/(&nbsp;|<br[^>]*>)+\s*$/g // nbsp entities at the end of contents
]);
if (ed.getParam('paste_convert_middot_lists', true)) {
process([
[/<!--\[if !supportLists\]-->/gi, '$&__MCE_ITEM__'], // Convert supportLists to a list item marker
@@ -436,9 +435,10 @@
// Insert a marker for the caret position
this._insert('<span id="_marker">&nbsp;</span>', 1);
marker = dom.get('_marker');
parentBlock = dom.getParent(marker, 'p,h1,h2,h3,h4,h5,h6,ul,ol');
parentBlock = dom.getParent(marker, 'p,h1,h2,h3,h4,h5,h6,ul,ol,th,td');
if (parentBlock) {
// If it's a parent block but not a table cell
if (parentBlock && !/TD|TH/.test(parentBlock.nodeName)) {
// Split parent block
marker = dom.split(parentBlock, marker);
@@ -19,7 +19,7 @@ var PasteTextDialog = {
}
}
tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, h);
tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h});
tinyMCEPopup.close();
},
@@ -13,7 +13,7 @@ var PasteWordDialog = {
css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")];
css = css.concat(tinymce.explode(ed.settings.content_css) || []);
tinymce.each(css, function(u) {
cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute(u) + '" rel="stylesheet" type="text/css" />';
cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute('' + u) + '" rel="stylesheet" type="text/css" />';
});
// Write content into iframe
@@ -32,7 +32,7 @@ var PasteWordDialog = {
insert : function() {
var h = document.getElementById('iframe').contentWindow.document.body.innerHTML;
tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, h);
tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true});
tinyMCEPopup.close();
},
@@ -1,10 +1 @@
// UK lang variables
tinyMCE.addToLang('',{
paste_text_desc : 'Paste as Plain Text',
paste_text_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
paste_text_linebreaks : 'Keep linebreaks',
paste_word_desc : 'Paste from Word',
paste_word_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
selectall_desc : 'Select All'
});
// UK lang variables
@@ -1,5 +1 @@
// UK lang variables
tinyMCE.addToLang('',{
preview_desc : 'Preview'
});
// UK lang variables
@@ -1,5 +1 @@
// UK lang variables
tinyMCE.addToLang('',{
print_desc : 'Print'
});
// UK lang variables
@@ -1,6 +1 @@
// UK lang variables
tinyMCE.addToLang('',{
save_desc : 'Save',
cancel_desc : 'Cancel all changes'
});
// UK lang variables
@@ -1,21 +1 @@
// UK lang variables
tinyMCE.addToLang('',{
searchreplace_search_desc : 'Find',
searchreplace_searchnext_desc : 'Find again',
searchreplace_replace_desc : 'Find/Replace',
searchreplace_notfound : 'The search has been completed. The search string could not be found.',
searchreplace_search_title : 'Find',
searchreplace_replace_title : 'Find/Replace',
searchreplace_allreplaced : 'All occurrences of the search string were replaced.',
searchreplace_findwhat : 'Find what',
searchreplace_replacewith : 'Replace with',
searchreplace_direction : 'Direction',
searchreplace_up : 'Up',
searchreplace_down : 'Down',
searchreplace_case : 'Match case',
searchreplace_findnext : 'Find&nbsp;next',
searchreplace_replace : 'Replace',
searchreplace_replaceall : 'Replace&nbsp;all',
searchreplace_cancel : 'Cancel'
});
// UK lang variables
@@ -1,66 +1 @@
// UK lang variables
tinyMCE.addToLang('style',{
title : 'Edit CSS Style',
styleinfo_desc : 'Edit CSS Style',
apply : 'Apply',
text_tab : 'Text',
background_tab : 'Background',
block_tab : 'Block',
box_tab : 'Box',
border_tab : 'Border',
list_tab : 'List',
positioning_tab : 'Positioning',
text_props : 'Text',
text_font : 'Font',
text_size : 'Size',
text_weight : 'Weight',
text_style : 'Style',
text_variant : 'Variant',
text_lineheight : 'Line height',
text_case : 'Case',
text_color : 'Color',
text_decoration : 'Decoration',
text_overline : 'overline',
text_underline : 'underline',
text_striketrough : 'strikethrough',
text_blink : 'blink',
text_none : 'none',
background_color : 'Background color',
background_image : 'Background image',
background_repeat : 'Repeat',
background_attachment : 'Attachment',
background_hpos : 'Horizontal position',
background_vpos : 'Vertical position',
block_wordspacing : 'Word spacing',
block_letterspacing : 'Letter spacing',
block_vertical_alignment : 'Vertical alignment',
block_text_align : 'Text align',
block_text_indent : 'Text indent',
block_whitespace : 'Whitespace',
block_display : 'Display',
box_width : 'Width',
box_height : 'Height',
box_float : 'Float',
box_clear : 'Clear',
padding : 'Padding',
same : 'Same for all',
top : 'Top',
right : 'Right',
bottom : 'Bottom',
left : 'Left',
margin : 'Margin',
style : 'Style',
width : 'Width',
height : 'Height',
color : 'Color',
list_type : 'Type',
bullet_image : 'Bullet image',
position : 'Position',
positioning_type : 'Type',
visibility : 'Visibility',
zindex : 'Z-index',
overflow : 'Overflow',
placement : 'Placement',
clip : 'Clip'
});
// UK lang variables
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
/**
* $Id: editor_plugin_src.js 953 2008-11-04 10:16:50Z spocke $
* $Id: editor_plugin_src.js 1206 2009-08-19 12:30:52Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
@@ -55,6 +55,30 @@
}
ed.onInit.add(function() {
// Fixes an issue on Gecko where it's impossible to place the caret behind a table
// This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
if (!tinymce.isIE && ed.getParam('forced_root_block')) {
function fixTableCaretPos() {
var last = ed.getBody().lastChild;
if (last && last.nodeName == 'TABLE')
ed.dom.add(ed.getBody(), 'p', null, '<br mce_bogus="1" />');
};
ed.onKeyUp.add(fixTableCaretPos);
ed.onSetContent.add(fixTableCaretPos);
ed.onVisualAid.add(fixTableCaretPos);
ed.onPreProcess.add(function(ed, o) {
var last = o.node.lastChild;
if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR')
ed.dom.remove(last);
});
fixTableCaretPos();
}
if (ed && ed.plugins.contextmenu) {
ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
var sm, se = ed.selection, el = se.getNode() || ed.getBody();
@@ -24,14 +24,14 @@ function insertTable() {
border = formObj.elements['border'].value != "" ? formObj.elements['border'].value : 0;
cellpadding = formObj.elements['cellpadding'].value != "" ? formObj.elements['cellpadding'].value : "";
cellspacing = formObj.elements['cellspacing'].value != "" ? formObj.elements['cellspacing'].value : "";
align = formObj.elements['align'].options[formObj.elements['align'].selectedIndex].value;
frame = formObj.elements['frame'].options[formObj.elements['frame'].selectedIndex].value;
rules = formObj.elements['rules'].options[formObj.elements['rules'].selectedIndex].value;
align = getSelectValue(formObj, "align");
frame = getSelectValue(formObj, "tframe");
rules = getSelectValue(formObj, "rules");
width = formObj.elements['width'].value;
height = formObj.elements['height'].value;
bordercolor = formObj.elements['bordercolor'].value;
bgcolor = formObj.elements['bgcolor'].value;
className = formObj.elements['class'].options[formObj.elements['class'].selectedIndex].value;
className = getSelectValue(formObj, "class");
id = formObj.elements['id'].value;
summary = formObj.elements['summary'].value;
style = formObj.elements['style'].value;
@@ -322,7 +322,7 @@ function init() {
// Update form
selectByValue(formObj, 'align', align);
selectByValue(formObj, 'frame', frame);
selectByValue(formObj, 'tframe', frame);
selectByValue(formObj, 'rules', rules);
selectByValue(formObj, 'class', className, true, true);
formObj.cols.value = cols;
@@ -1,79 +1 @@
// UK lang variables
tinyMCE.addToLang('table',{
general_tab : 'General',
advanced_tab : 'Advanced',
general_props : 'General properties',
advanced_props : 'Advanced properties',
desc : 'Inserts a new table',
row_before_desc : 'Insert row before',
row_after_desc : 'Insert row after',
delete_row_desc : 'Delete row',
col_before_desc : 'Insert column before',
col_after_desc : 'Insert column after',
delete_col_desc : 'Remove column',
rowtype : 'Row in table part',
title : 'Insert/Modify table',
width : 'Width',
height : 'Height',
cols : 'Columns',
rows : 'Rows',
cellspacing : 'Cellspacing',
cellpadding : 'Cellpadding',
border : 'Border',
align : 'Alignment',
align_default : 'Default',
align_left : 'Left',
align_right : 'Right',
align_middle : 'Center',
row_title : 'Table row properties',
cell_title : 'Table cell properties',
cell_type : 'Cell type',
row_desc : 'Table row properties',
cell_desc : 'Table cell properties',
valign : 'Vertical alignment',
align_top : 'Top',
align_bottom : 'Bottom',
props_desc : 'Table properties',
bordercolor : 'Border color',
bgcolor : 'Background color',
merge_cells_title : 'Merge table cells',
split_cells_desc : 'Split merged table cells',
merge_cells_desc : 'Merge table cells',
cut_row_desc : 'Cut table row',
copy_row_desc : 'Copy table row',
paste_row_before_desc : 'Paste table row before',
paste_row_after_desc : 'Paste table row after',
id : 'Id',
style: 'Style',
langdir : 'Language direction',
langcode : 'Language code',
mime : 'Target MIME type',
ltr : 'Left to right',
rtl : 'Right to left',
bgimage : 'Background image',
summary : 'Summary',
td : "Data",
th : "Header",
cell_cell : 'Update current cell',
cell_row : 'Update all cells in row',
cell_all : 'Update all cells in table',
row_row : 'Update current row',
row_odd : 'Update odd rows in table',
row_even : 'Update even rows in table',
row_all : 'Update all rows in table',
thead : 'Table Head',
tbody : 'Table Body',
tfoot : 'Table Foot',
del : 'Delete table',
scope : 'Scope',
row : 'Row',
col : 'Col',
rowgroup : 'Row Group',
colgroup : 'Col Group',
col_limit : 'You\'ve exceeded the maximum number of columns of {$cols}.',
row_limit : 'You\'ve exceeded the maximum number of rows of {$rows}.',
cell_limit : 'You\'ve exceeded the maximum number of cells of {$cells}.',
missing_scope: 'Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.',
caption : 'Table caption'
});
// UK lang variables
@@ -108,9 +108,9 @@
</tr>
<tr>
<td class="column1"><label for="frame">{#table_dlg.frame}</label></td>
<td class="column1"><label for="tframe">{#table_dlg.frame}</label></td>
<td>
<select id="frame" name="frame" class="advfield">
<select id="tframe" name="tframe" class="advfield">
<option value="">{#not_set}</option>
<option value="void">{#table_dlg.rules_void}</option>
<option value="above">{#table_dlg.rules_above}</option>
@@ -1,16 +1,2 @@
// UK lang variables
tinyMCE.addToLang('template',{
title : 'Templates',
label : 'Template',
desc_label : 'Description',
desc : 'Insert predefined template content',
select : 'Select a template',
preview : 'Preview',
warning : 'Warning: Updating a template with a different one may cause data loss.',
def_date_format : '%Y-%m-%d %H:%M:%S',
months_long : new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"),
months_short : new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"),
day_long : new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"),
day_short : new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
});
// UK lang variables
//Older tiny2 lang file. Can be deleted
@@ -1,5 +1 @@
// EN lang variables
tinyMCE.addToLang('visualchars',{
desc : 'Visual control characters on/off.'
});
// EN lang variables
@@ -1,42 +1 @@
// UK lang variables
tinyMCE.addToLang('xhtmlxtras',{
cite_desc : 'Citation',
abbr_desc : 'Abbreviation',
acronym_desc : 'Acronym',
del_desc : 'Deletion',
ins_desc : 'Insertion',
attribute_label_title : 'Title',
attribute_label_id : 'ID',
attribute_label_class : 'Class',
attribute_label_style : 'Style',
attribute_label_cite : 'Cite',
attribute_label_datetime : 'Date/Time',
attribute_label_langdir : 'Text Direction',
attribute_option_ltr : 'Left to right',
attribute_option_rtl : 'Right to left',
attribute_label_langcode : 'Language',
attribute_label_tabindex : 'TabIndex',
attribute_label_accesskey : 'AccessKey',
attribute_label_cite : 'Cite',
attribute_events_tab : 'Events',
attribute_attrib_tab : 'Attributes',
general_tab : 'General',
attrib_tab : 'Attributes',
events_tab : 'Events',
fieldset_general_tab : 'General Settings',
fieldset_attrib_tab : 'Element Attributes',
fieldset_events_tab : 'Element Events',
title_ins_element : 'Insertion Element',
title_del_element : 'Deletion Element',
title_acronym_element : 'Acronym Element',
title_abbr_element : 'Abbreviation Element',
title_cite_element : 'Citation Element',
remove : 'Remove',
not_set : '--not set--',
insert_date : 'Insert current date/time',
option_ltr : 'Left to right',
option_rtl : 'Right to left',
attribs_desc : 'Insert/Edit Attributes',
attribs_title : 'Insert/Edit Attributes'
});
// UK lang variables
@@ -21,7 +21,7 @@
<fieldset>
<legend>{#advanced_dlg.colorpicker_picker_title}</legend>
<div id="picker">
<img id="colors" src="img/colorpicker.jpg" onclick="computeColor(event)" onmousedown="isMouseDown = true;return false;" onmouseup="isMouseDown = false;" onmousemove="if (isMouseDown && isMouseOver) computeColor(event); return false;" onmouseover="isMouseOver=true;" onmouseout="isMouseOver=false;" alt=" " />
<img id="colors" src="img/colorpicker.jpg" onclick="computeColor(event)" onmousedown="isMouseDown = true;return false;" onmouseup="isMouseDown = false;" onmousemove="if (isMouseDown && isMouseOver) computeColor(event); return false;" onmouseover="isMouseOver=true;" onmouseout="isMouseOver=false;" alt="" />
<div id="light">
<!-- Will be filled with divs -->
@@ -63,8 +63,8 @@ var LinkDialog = {
ed.dom.setAttribs(e, {
href : f.href.value,
title : f.linktitle.value,
target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null,
'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null
target : f.target_list ? getSelectValue(f, "target_list") : null,
'class' : f.class_list ? getSelectValue(f, "class_list") : null
});
}
});
@@ -72,8 +72,8 @@ var LinkDialog = {
ed.dom.setAttribs(e, {
href : f.href.value,
title : f.linktitle.value,
target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null,
'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null
target : f.target_list ? getSelectValue(f, "target_list") : null,
'class' : f.class_list ? getSelectValue(f, "class_list") : null
});
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,5 @@
/**
* $Id: form_utils.js 996 2009-02-06 17:32:20Z spocke $
* $Id: form_utils.js 1184 2009-08-11 11:47:27Z spocke $
*
* Various form utilitiy functions.
*
@@ -92,7 +92,7 @@ function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
function getSelectValue(form_obj, field_name) {
var elm = form_obj.elements[field_name];
if (elm == null || elm.options == null)
if (elm == null || elm.options == null || elm.selectedIndex === -1)
return "";
return elm.options[elm.selectedIndex].value;
+285 -285
View File
@@ -1,286 +1,286 @@
<?php
/**
* @version $Id: xstandard.php 10709 2008-08-21 09:58:52Z eddieajau $
* @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.
*/
// Do not allow direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* XStandard Lite for Joomla! WYSIWYG Editor Plugin
*
* @package Editors
* @since 1.5
*/
class plgEditorXstandard 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 plgEditorXstandard(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Method to handle the onInitEditor event.
* - Initializes the XStandard Lite WYSIWYG Editor
*
* @access public
* @return string JavaScript Initialization string
* @since 1.5
*/
function onInit()
{
$html = '';
ob_start();
?>
<script type="text/javascript" src="<?php echo JURI::root() ?>/plugins/editors/xstandard/xstandard.js"></script>
<?php
$html = ob_get_contents();
ob_end_clean();
return $html;
}
/**
* XStandard Lite WYSIWYG Editor - get the editor content
*
* @param string The name of the editor
*/
function onGetContent( $editor ) {
return "$('xstandard').value;";
}
/**
* XStandard Lite WYSIWYG Editor - set the editor content
*
* @param string The name of the editor
*/
function onSetContent( $editor, $html ) {
return "$('xstandard').value =". $html .";";
}
/**
* XStandard Lite WYSIWYG Editor - copy editor content to form field
*
* @param string The name of the editor
*/
function onSave( $editor ) {
$js = "var editor = $('xstandard');\n";
$js .= "editor.EscapeUnicode = true;";
$js .= "$('".$editor."').value = editor.value;";
return $js;
}
/**
* XStandard Lite WYSIWYG Editor - display the editor
*
* @param string The name of the editor area
* @param string The content of the field
* @param string The name of the form field
* @param string The width of the editor area
* @param string The height of the editor area
* @param int The number of columns for the editor area
* @param int The number of rows for the editor area
* @param mixed Can be boolean or array.
*/
function onDisplay( $name, $content, $width, $height, $col, $row, $buttons = true )
{
// Load modal popup behavior
JHTML::_('behavior.modal', 'a.modal-button');
// Only add "px" to width and height if they are not given as a percentage
if (is_numeric( $width )) {
$width .= 'px';
}
if (is_numeric( $height )) {
$height .= 'px';
}
jimport('joomla.environment.browser');
$instance =& JBrowser::getInstance();
$language =& JFactory::getLanguage();
$db =& JFactory::getDBO();
$url = JURI::root();
$lang = substr( $language->getTag(), 0, strpos( $language->getTag(), '-' ) );
if ($language->isRTL()) {
$direction = 'rtl';
} else {
$direction = 'ltr';
}
/*
* Lets get the default template for the site application
*/
$query = 'SELECT template'
. ' FROM #__templates_menu'
. ' WHERE client_id = 0'
. ' AND menuid = 0'
;
$db->setQuery( $query );
$template = $db->loadResult();
$file_path = JPATH_SITE .'/templates/'. $template .'/css/';
if ( !file_exists( $file_path .DS. 'editor.css' ) ) {
$template = 'system';
}
$css = JURI::root() .'/templates/'. $template . '/css/editor.css';
$html = '';
ob_start();
?>
<div style="border: 1px solid #D5D5D5">
<object type="application/x-xstandard" id="xstandard" class="<?php echo $name ?>" width="<?php echo $width ?>" height="<?php echo $height ?>">
<param name="Value" value="<?php echo $content ?>" />
<param name="Lang" value="<?php echo $lang ?>" />
<param name="Dir" value="<?php echo $direction ?>" />
<param name="EditorCSS" value="<?php echo $css ?>" />
<param name="EnablePasteMarkup" value="yes" />
<param name="EnableTimestamp" value="no" />
<param name="EscapeUnicode" value="no" />
<param name="ToolbarWysiwyg" value="line, hyperlink, attachment, directory, undo, , wysiwyg, source, screen-reader, ,expand; strong, em, underline, strikethrough, , align-left, align-center, align-right, , blockquote, undo-blockquote, ,numbering, bullets, , undo, redo, ,layout-table, data-table, draw-layout-table, draw-data-table" />
<param name="ToolbarSource" value="indent, whitespace, word-wrap, dim-tags, validate,, wysiwyg, source, screen-reader, , expand" />
<param name="ToolbarPreview" value="wysiwyg, source, screen-reader, ,expand" />
<param name="ToolbarScreenReader" value="wysiwyg, source, screen-reader, , expand" />
<param name="BackgroundColor" value="#F9F9F9" />
<param name="Mode" value="<?php echo $this->params->get('mode', 'wysiwyg'); ?>" />
<param name="IndentOutput" value="yes" />
<param name="Options" value="<?php echo $this->params->get('wrap', '0'); ?>" />
<param name="BorderColor" value="#FFF" />
<param name="Base" value="<?php echo $url ?>" />
<param name="ExpandWidth" value="800" />
<param name="ExpandHeight" value="600" />
<param name="LatestVersion" value="2.0.0.0" />
<param name="CMSCode" value="065126D6-357D-46FC-AF74-A1F5B2D5036E" />
<param name="CMSImageLibraryURL" value="<?php echo $url ?>plugins/editors/xstandard/imagelibrary.php" />
<param name="CMSAttachmentLibraryURL" value="<?php echo $url ?>plugins/editors/xstandard/attachmentlibrary.php" />
<param name="CMSDirectoryURL" value="<?php echo $url ?>plugins/editors/xstandard/directory.php" />
<param name="PreviewXSLT" value="<?php echo $url ?>plugins/editors/xstandard/preview.xsl" />
<param name="CSS" value="<?php echo $this->_getTemplateCss(); ?>" />
<textarea name="alternate1" id="alternate1" cols="60" rows="15"><?php echo $content ?></textarea>
</object>
<input type="hidden" id="<?php echo $name ?>" name="<?php echo $name ?>" value="" />
</div>
<?php
$html = ob_get_contents();
ob_end_clean();
$html .= $this->_displayButtons($name, $buttons);
return $html;
}
function onGetInsertMethod($name)
{
$doc = & JFactory::getDocument();
$js= "function jInsertEditorText( text ) {
var editor = document.getElementById('xstandard');
editor.InsertXML(text);
}";
$doc->addScriptDeclaration($js);
return true;
}
function _getTemplateCss()
{
$db =& JFactory::getDBO();
/*
* Lets get the default template for the site application
*/
$query = 'SELECT template'
. ' FROM #__templates_menu'
. ' WHERE client_id = 0'
. ' AND menuid = 0'
;
$db->setQuery( $query );
$template = $db->loadResult();
$content_css = JURI::root() .'/templates/'. $template .'/css/';
$file_path = JPATH_SITE .'/templates/'. $template .'/css/';
if ( file_exists( $file_path .DS. 'editor.css' ) ) {
$content_css = $content_css . 'editor.css' .'", ';
} else {
$content_css = $content_css . 'template_css.css", ';
}
return $content_css;
}
function _displayButtons($name, $buttons)
{
// Load modal popup behavior
JHTML::_('behavior.modal', 'a.modal-button');
$args['name'] = $name;
$args['event'] = 'onGetInsertMethod';
$return = '';
$results[] = $this->update($args);
foreach ($results as $result) {
if (is_string($result) && trim($result)) {
$return .= $result;
}
}
if(!empty($buttons))
{
$results = $this->_subject->getButtons($name, $buttons);
/*
* This will allow plugins to attach buttons or change the behavior on the fly using AJAX
*/
$return .= "\n<div id=\"editor-xtd-buttons\">\n";
foreach ($results as $button)
{
/*
* Results should be an object
*/
if ( $button->get('name') )
{
$modal = ($button->get('modal')) ? 'class="modal-button"' : null;
$href = ($button->get('link')) ? 'href="'.$button->get('link').'"' : null;
$onclick = ($button->get('onclick')) ? 'onclick="'.$button->get('onclick').'"' : null;
$return .= "<div class=\"button2-left\"><div class=\"".$button->get('name')."\"><a ".$modal." title=\"".$button->get('text')."\" ".$href." ".$onclick." rel=\"".$button->get('options')."\">".$button->get('text')."</a></div></div>\n";
}
}
$return .= "</div>\n";
}
return $return;
}
<?php
/**
* @version $Id: xstandard.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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.
*/
// Do not allow direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* XStandard Lite for Joomla! WYSIWYG Editor Plugin
*
* @package Editors
* @since 1.5
*/
class plgEditorXstandard 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 plgEditorXstandard(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Method to handle the onInitEditor event.
* - Initializes the XStandard Lite WYSIWYG Editor
*
* @access public
* @return string JavaScript Initialization string
* @since 1.5
*/
function onInit()
{
$html = '';
ob_start();
?>
<script type="text/javascript" src="<?php echo JURI::root() ?>/plugins/editors/xstandard/xstandard.js"></script>
<?php
$html = ob_get_contents();
ob_end_clean();
return $html;
}
/**
* XStandard Lite WYSIWYG Editor - get the editor content
*
* @param string The name of the editor
*/
function onGetContent( $editor ) {
return "$('xstandard').value;";
}
/**
* XStandard Lite WYSIWYG Editor - set the editor content
*
* @param string The name of the editor
*/
function onSetContent( $editor, $html ) {
return "$('xstandard').value =". $html .";";
}
/**
* XStandard Lite WYSIWYG Editor - copy editor content to form field
*
* @param string The name of the editor
*/
function onSave( $editor ) {
$js = "var editor = $('xstandard');\n";
$js .= "editor.EscapeUnicode = true;";
$js .= "$('".$editor."').value = editor.value;";
return $js;
}
/**
* XStandard Lite WYSIWYG Editor - display the editor
*
* @param string The name of the editor area
* @param string The content of the field
* @param string The name of the form field
* @param string The width of the editor area
* @param string The height of the editor area
* @param int The number of columns for the editor area
* @param int The number of rows for the editor area
* @param mixed Can be boolean or array.
*/
function onDisplay( $name, $content, $width, $height, $col, $row, $buttons = true )
{
// Load modal popup behavior
JHTML::_('behavior.modal', 'a.modal-button');
// Only add "px" to width and height if they are not given as a percentage
if (is_numeric( $width )) {
$width .= 'px';
}
if (is_numeric( $height )) {
$height .= 'px';
}
jimport('joomla.environment.browser');
$instance =& JBrowser::getInstance();
$language =& JFactory::getLanguage();
$db =& JFactory::getDBO();
$url = JURI::root();
$lang = substr( $language->getTag(), 0, strpos( $language->getTag(), '-' ) );
if ($language->isRTL()) {
$direction = 'rtl';
} else {
$direction = 'ltr';
}
/*
* Lets get the default template for the site application
*/
$query = 'SELECT template'
. ' FROM #__templates_menu'
. ' WHERE client_id = 0'
. ' AND menuid = 0'
;
$db->setQuery( $query );
$template = $db->loadResult();
$file_path = JPATH_SITE .'/templates/'. $template .'/css/';
if ( !file_exists( $file_path .DS. 'editor.css' ) ) {
$template = 'system';
}
$css = JURI::root() .'/templates/'. $template . '/css/editor.css';
$html = '';
ob_start();
?>
<div style="border: 1px solid #D5D5D5">
<object type="application/x-xstandard" id="xstandard" class="<?php echo $name ?>" width="<?php echo $width ?>" height="<?php echo $height ?>">
<param name="Value" value="<?php echo $content ?>" />
<param name="Lang" value="<?php echo $lang ?>" />
<param name="Dir" value="<?php echo $direction ?>" />
<param name="EditorCSS" value="<?php echo $css ?>" />
<param name="EnablePasteMarkup" value="yes" />
<param name="EnableTimestamp" value="no" />
<param name="EscapeUnicode" value="no" />
<param name="ToolbarWysiwyg" value="line, hyperlink, attachment, directory, undo, , wysiwyg, source, screen-reader, ,expand; strong, em, underline, strikethrough, , align-left, align-center, align-right, , blockquote, undo-blockquote, ,numbering, bullets, , undo, redo, ,layout-table, data-table, draw-layout-table, draw-data-table" />
<param name="ToolbarSource" value="indent, whitespace, word-wrap, dim-tags, validate,, wysiwyg, source, screen-reader, , expand" />
<param name="ToolbarPreview" value="wysiwyg, source, screen-reader, ,expand" />
<param name="ToolbarScreenReader" value="wysiwyg, source, screen-reader, , expand" />
<param name="BackgroundColor" value="#F9F9F9" />
<param name="Mode" value="<?php echo $this->params->get('mode', 'wysiwyg'); ?>" />
<param name="IndentOutput" value="yes" />
<param name="Options" value="<?php echo $this->params->get('wrap', '0'); ?>" />
<param name="BorderColor" value="#FFF" />
<param name="Base" value="<?php echo $url ?>" />
<param name="ExpandWidth" value="800" />
<param name="ExpandHeight" value="600" />
<param name="LatestVersion" value="2.0.0.0" />
<param name="CMSCode" value="065126D6-357D-46FC-AF74-A1F5B2D5036E" />
<param name="CMSImageLibraryURL" value="<?php echo $url ?>plugins/editors/xstandard/imagelibrary.php" />
<param name="CMSAttachmentLibraryURL" value="<?php echo $url ?>plugins/editors/xstandard/attachmentlibrary.php" />
<param name="CMSDirectoryURL" value="<?php echo $url ?>plugins/editors/xstandard/directory.php" />
<param name="PreviewXSLT" value="<?php echo $url ?>plugins/editors/xstandard/preview.xsl" />
<param name="CSS" value="<?php echo $this->_getTemplateCss(); ?>" />
<textarea name="alternate1" id="alternate1" cols="60" rows="15"><?php echo $content ?></textarea>
</object>
<input type="hidden" id="<?php echo $name ?>" name="<?php echo $name ?>" value="" />
</div>
<?php
$html = ob_get_contents();
ob_end_clean();
$html .= $this->_displayButtons($name, $buttons);
return $html;
}
function onGetInsertMethod($name)
{
$doc = & JFactory::getDocument();
$js= "function jInsertEditorText( text ) {
var editor = document.getElementById('xstandard');
editor.InsertXML(text);
}";
$doc->addScriptDeclaration($js);
return true;
}
function _getTemplateCss()
{
$db =& JFactory::getDBO();
/*
* Lets get the default template for the site application
*/
$query = 'SELECT template'
. ' FROM #__templates_menu'
. ' WHERE client_id = 0'
. ' AND menuid = 0'
;
$db->setQuery( $query );
$template = $db->loadResult();
$content_css = JURI::root() .'/templates/'. $template .'/css/';
$file_path = JPATH_SITE .'/templates/'. $template .'/css/';
if ( file_exists( $file_path .DS. 'editor.css' ) ) {
$content_css = $content_css . 'editor.css' .'", ';
} else {
$content_css = $content_css . 'template_css.css", ';
}
return $content_css;
}
function _displayButtons($name, $buttons)
{
// Load modal popup behavior
JHTML::_('behavior.modal', 'a.modal-button');
$args['name'] = $name;
$args['event'] = 'onGetInsertMethod';
$return = '';
$results[] = $this->update($args);
foreach ($results as $result) {
if (is_string($result) && trim($result)) {
$return .= $result;
}
}
if(!empty($buttons))
{
$results = $this->_subject->getButtons($name, $buttons);
/*
* This will allow plugins to attach buttons or change the behavior on the fly using AJAX
*/
$return .= "\n<div id=\"editor-xtd-buttons\">\n";
foreach ($results as $button)
{
/*
* Results should be an object
*/
if ( $button->get('name') )
{
$modal = ($button->get('modal')) ? 'class="modal-button"' : null;
$href = ($button->get('link')) ? 'href="'.$button->get('link').'"' : null;
$onclick = ($button->get('onclick')) ? 'onclick="'.$button->get('onclick').'"' : null;
$return .= "<div class=\"button2-left\"><div class=\"".$button->get('name')."\"><a ".$modal." title=\"".$button->get('text')."\" ".$href." ".$onclick." rel=\"".$button->get('options')."\">".$button->get('text')."</a></div></div>\n";
}
}
$return .= "</div>\n";
}
return $return;
}
}
@@ -6,7 +6,7 @@
<author>Joomla! Project</author>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<description>DESCXSTANDARD</description>
<files>
@@ -1,49 +1,49 @@
/**
* @version $Id: xstandard.js 10714 2008-08-21 10:10:14Z eddieajau $
* @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.
*/
/**
* JXStandard javascript behavior
*
* @package Joomla
* @since 1.5
* @version 1.0
*/
var JXStandard = new Class({
instances : null,
initialize: function()
{
this.instances = $ES('object[type=application/x-xstandard]');
var self = this;
document.adminForm.onsubmit = function() {
self.save();
}
},
save: function()
{
this.instances.each(function(instance)
{
instance.EscapeUnicode = false;
var contents = instance.value;
$(instance.className).value = contents;
});
}
})
document.xstandard = null
window.addEvent('domready', function(){
var xstandard = new JXStandard();
document.xstandard = xstandard;
/**
* @version $Id: xstandard.js 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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.
*/
/**
* JXStandard javascript behavior
*
* @package Joomla
* @since 1.5
* @version 1.0
*/
var JXStandard = new Class({
instances : null,
initialize: function()
{
this.instances = $ES('object[type=application/x-xstandard]');
var self = this;
document.adminForm.onsubmit = function() {
self.save();
}
},
save: function()
{
this.instances.each(function(instance)
{
instance.EscapeUnicode = false;
var contents = instance.value;
$(instance.className).value = contents;
});
}
})
document.xstandard = null
window.addEvent('domready', function(){
var xstandard = new JXStandard();
document.xstandard = xstandard;
});
+116 -116
View File
@@ -1,116 +1,116 @@
<?php
/**
* @version $Id: categories.php 10870 2008-08-30 07:26:29Z willebil $
* @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' );
$mainframe->registerEvent( 'onSearch', 'plgSearchCategories' );
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchCategoryAreas' );
JPlugin::loadLanguage( 'plg_search_categories' );
/**
* @return array An array of search areas
*/
function &plgSearchCategoryAreas()
{
static $areas = array(
'categories' => 'Categories'
);
return $areas;
}
/**
* Categories 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
* @param mixed An array if restricted to areas, null if search all
*/
function plgSearchCategories( $text, $phrase='', $ordering='', $areas=null )
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$searchText = $text;
require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
if (is_array( $areas )) {
if (!array_intersect( $areas, array_keys( plgSearchCategoryAreas() ) )) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'categories');
$pluginParams = new JParameter( $plugin->params );
$limit = $pluginParams->def( 'search_limit', 50 );
$text = trim( $text );
if ( $text == '' ) {
return array();
}
switch ( $ordering ) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
}
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
$query = 'SELECT a.title, a.description AS text, "" AS created, a.name,'
. ' "2" AS browsernav,'
. ' s.id AS secid, a.id AS catid,'
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug'
. ' FROM #__categories AS a'
. ' INNER JOIN #__sections AS s ON s.id = a.section'
. ' WHERE ( a.name LIKE '.$text
. ' OR a.title LIKE '.$text
. ' OR a.description LIKE '.$text.' )'
. ' AND a.published = 1'
. ' AND s.published = 1'
. ' AND a.access <= '.(int) $user->get('aid')
. ' AND s.access <= '.(int) $user->get('aid')
. ' GROUP BY a.id'
. ' ORDER BY '. $order
;
$db->setQuery( $query, 0, $limit );
$rows = $db->loadObjectList();
$count = count( $rows );
for ( $i = 0; $i < $count; $i++ ) {
$rows[$i]->href = ContentHelperRoute::getCategoryRoute($rows[$i]->slug, $rows[$i]->secid);
$rows[$i]->section = JText::_( 'Category' );
}
$return = array();
foreach($rows AS $key => $category) {
if(searchHelper::checkNoHTML($category, $searchText, array('name', 'title', 'text'))) {
$return[] = $category;
}
}
return $return;
}
<?php
/**
* @version $Id: categories.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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' );
$mainframe->registerEvent( 'onSearch', 'plgSearchCategories' );
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchCategoryAreas' );
JPlugin::loadLanguage( 'plg_search_categories' );
/**
* @return array An array of search areas
*/
function &plgSearchCategoryAreas()
{
static $areas = array(
'categories' => 'Categories'
);
return $areas;
}
/**
* Categories 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
* @param mixed An array if restricted to areas, null if search all
*/
function plgSearchCategories( $text, $phrase='', $ordering='', $areas=null )
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$searchText = $text;
require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
if (is_array( $areas )) {
if (!array_intersect( $areas, array_keys( plgSearchCategoryAreas() ) )) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'categories');
$pluginParams = new JParameter( $plugin->params );
$limit = $pluginParams->def( 'search_limit', 50 );
$text = trim( $text );
if ( $text == '' ) {
return array();
}
switch ( $ordering ) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
}
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
$query = 'SELECT a.title, a.description AS text, "" AS created, a.name,'
. ' "2" AS browsernav,'
. ' s.id AS secid, a.id AS catid,'
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug'
. ' FROM #__categories AS a'
. ' INNER JOIN #__sections AS s ON s.id = a.section'
. ' WHERE ( a.name LIKE '.$text
. ' OR a.title LIKE '.$text
. ' OR a.description LIKE '.$text.' )'
. ' AND a.published = 1'
. ' AND s.published = 1'
. ' AND a.access <= '.(int) $user->get('aid')
. ' AND s.access <= '.(int) $user->get('aid')
. ' GROUP BY a.id'
. ' ORDER BY '. $order
;
$db->setQuery( $query, 0, $limit );
$rows = $db->loadObjectList();
$count = count( $rows );
for ( $i = 0; $i < $count; $i++ ) {
$rows[$i]->href = ContentHelperRoute::getCategoryRoute($rows[$i]->slug, $rows[$i]->secid);
$rows[$i]->section = JText::_( 'Category' );
}
$return = array();
foreach($rows AS $key => $category) {
if(searchHelper::checkNoHTML($category, $searchText, array('name', 'title', 'text'))) {
$return[] = $category;
}
}
return $return;
}
@@ -3,7 +3,7 @@
<name>Search - Categories</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
+116 -116
View File
@@ -1,116 +1,116 @@
<?php
/**
* @version $Id: contacts.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' );
$mainframe->registerEvent( 'onSearch', 'plgSearchContacts' );
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchContactAreas' );
JPlugin::loadLanguage( 'plg_search_contacts' );
/**
* @return array An array of search areas
*/
function &plgSearchContactAreas()
{
static $areas = array(
'contacts' => 'Contacts'
);
return $areas;
}
/**
* Contacts 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
*/
function plgSearchContacts( $text, $phrase='', $ordering='', $areas=null )
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
if (is_array( $areas )) {
if (!array_intersect( $areas, array_keys( plgSearchContactAreas() ) )) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'contacts');
$pluginParams = new JParameter( $plugin->params );
$limit = $pluginParams->def( 'search_limit', 50 );
$text = trim( $text );
if ($text == '') {
return array();
}
$section = JText::_( 'Contact' );
switch ( $ordering ) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
$order = 'b.title ASC, a.name ASC';
break;
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
}
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
$query = 'SELECT a.name AS title, "" AS created,'
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
. ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(\':\', b.id, b.alias) ELSE b.id END AS catslug, '
. ' CONCAT_WS( ", ", a.name, a.con_position, a.misc ) AS text,'
. ' CONCAT_WS( " / ", '.$db->Quote($section).', b.title ) AS section,'
. ' "2" AS browsernav'
. ' FROM #__contact_details AS a'
. ' INNER JOIN #__categories AS b ON b.id = a.catid'
. ' WHERE ( a.name LIKE '.$text
. ' OR a.misc LIKE '.$text
. ' OR a.con_position LIKE '.$text
. ' OR a.address LIKE '.$text
. ' OR a.suburb LIKE '.$text
. ' OR a.state LIKE '.$text
. ' OR a.country LIKE '.$text
. ' OR a.postcode LIKE '.$text
. ' OR a.telephone LIKE '.$text
. ' OR a.fax LIKE '.$text.' )'
. ' AND a.published = 1'
. ' AND b.published = 1'
. ' AND a.access <= '.(int) $user->get( 'aid' )
. ' AND b.access <= '.(int) $user->get( 'aid' )
. ' GROUP BY a.id'
. ' ORDER BY '. $order
;
$db->setQuery( $query, 0, $limit );
$rows = $db->loadObjectList();
foreach($rows as $key => $row) {
$rows[$key]->href = 'index.php?option=com_contact&view=contact&id='.$row->slug.'&catid='.$row->catslug;
}
return $rows;
}
<?php
/**
* @version $Id: contacts.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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' );
$mainframe->registerEvent( 'onSearch', 'plgSearchContacts' );
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchContactAreas' );
JPlugin::loadLanguage( 'plg_search_contacts' );
/**
* @return array An array of search areas
*/
function &plgSearchContactAreas()
{
static $areas = array(
'contacts' => 'Contacts'
);
return $areas;
}
/**
* Contacts 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
*/
function plgSearchContacts( $text, $phrase='', $ordering='', $areas=null )
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
if (is_array( $areas )) {
if (!array_intersect( $areas, array_keys( plgSearchContactAreas() ) )) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'contacts');
$pluginParams = new JParameter( $plugin->params );
$limit = $pluginParams->def( 'search_limit', 50 );
$text = trim( $text );
if ($text == '') {
return array();
}
$section = JText::_( 'Contact' );
switch ( $ordering ) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
$order = 'b.title ASC, a.name ASC';
break;
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
}
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
$query = 'SELECT a.name AS title, "" AS created,'
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
. ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(\':\', b.id, b.alias) ELSE b.id END AS catslug, '
. ' CONCAT_WS( ", ", a.name, a.con_position, a.misc ) AS text,'
. ' CONCAT_WS( " / ", '.$db->Quote($section).', b.title ) AS section,'
. ' "2" AS browsernav'
. ' FROM #__contact_details AS a'
. ' INNER JOIN #__categories AS b ON b.id = a.catid'
. ' WHERE ( a.name LIKE '.$text
. ' OR a.misc LIKE '.$text
. ' OR a.con_position LIKE '.$text
. ' OR a.address LIKE '.$text
. ' OR a.suburb LIKE '.$text
. ' OR a.state LIKE '.$text
. ' OR a.country LIKE '.$text
. ' OR a.postcode LIKE '.$text
. ' OR a.telephone LIKE '.$text
. ' OR a.fax LIKE '.$text.' )'
. ' AND a.published = 1'
. ' AND b.published = 1'
. ' AND a.access <= '.(int) $user->get( 'aid' )
. ' AND b.access <= '.(int) $user->get( 'aid' )
. ' GROUP BY a.id'
. ' ORDER BY '. $order
;
$db->setQuery( $query, 0, $limit );
$rows = $db->loadObjectList();
foreach($rows as $key => $row) {
$rows[$key]->href = 'index.php?option=com_contact&view=contact&id='.$row->slug.'&catid='.$row->catslug;
}
return $rows;
}
+1 -1
View File
@@ -3,7 +3,7 @@
<name>Search - Contacts</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
+264 -264
View File
@@ -1,264 +1,264 @@
<?php
/**
* @version $Id: content.php 11371 2008-12-30 01:31:50Z ian $
* @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' );
$mainframe->registerEvent( 'onSearch', 'plgSearchContent' );
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchContentAreas' );
JPlugin::loadLanguage( 'plg_search_content' );
/**
* @return array An array of search areas
*/
function &plgSearchContentAreas()
{
static $areas = array(
'content' => 'Articles'
);
return $areas;
}
/**
* Content 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
* @param mixed An array if the search it to be restricted to areas, null if search all
*/
function plgSearchContent( $text, $phrase='', $ordering='', $areas=null )
{
global $mainframe;
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_search'.DS.'helpers'.DS.'search.php');
$searchText = $text;
if (is_array( $areas )) {
if (!array_intersect( $areas, array_keys( plgSearchContentAreas() ) )) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'content');
$pluginParams = new JParameter( $plugin->params );
$sContent = $pluginParams->get( 'search_content', 1 );
$sUncategorised = $pluginParams->get( 'search_uncategorised', 1 );
$sArchived = $pluginParams->get( 'search_archived', 1 );
$limit = $pluginParams->def( 'search_limit', 50 );
$nullDate = $db->getNullDate();
$date =& JFactory::getDate();
$now = $date->toMySQL();
$text = trim( $text );
if ($text == '') {
return array();
}
$wheres = array();
switch ($phrase) {
case 'exact':
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
$wheres2 = array();
$wheres2[] = 'a.title LIKE '.$text;
$wheres2[] = 'a.introtext LIKE '.$text;
$wheres2[] = 'a.fulltext LIKE '.$text;
$wheres2[] = 'a.metakey LIKE '.$text;
$wheres2[] = 'a.metadesc LIKE '.$text;
$where = '(' . implode( ') OR (', $wheres2 ) . ')';
break;
case 'all':
case 'any':
default:
$words = explode( ' ', $text );
$wheres = array();
foreach ($words as $word) {
$word = $db->Quote( '%'.$db->getEscaped( $word, true ).'%', false );
$wheres2 = array();
$wheres2[] = 'a.title LIKE '.$word;
$wheres2[] = 'a.introtext LIKE '.$word;
$wheres2[] = 'a.fulltext LIKE '.$word;
$wheres2[] = 'a.metakey LIKE '.$word;
$wheres2[] = 'a.metadesc LIKE '.$word;
$wheres[] = implode( ' OR ', $wheres2 );
}
$where = '(' . implode( ($phrase == 'all' ? ') AND (' : ') OR ('), $wheres ) . ')';
break;
}
$morder = '';
switch ($ordering) {
case 'oldest':
$order = 'a.created ASC';
break;
case 'popular':
$order = 'a.hits DESC';
break;
case 'alpha':
$order = 'a.title ASC';
break;
case 'category':
$order = 'b.title ASC, a.title ASC';
$morder = 'a.title ASC';
break;
case 'newest':
default:
$order = 'a.created DESC';
break;
}
$rows = array();
// search articles
if ( $sContent && $limit > 0 )
{
$query = 'SELECT a.title AS title, a.metadesc, a.metakey,'
. ' a.created AS created,'
. ' CONCAT(a.introtext, a.fulltext) AS text,'
. ' CONCAT_WS( "/", u.title, b.title ) AS section,'
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'
. ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(":", b.id, b.alias) ELSE b.id END as catslug,'
. ' u.id AS sectionid,'
. ' "2" AS browsernav'
. ' 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.' )'
. ' AND a.state = 1'
. ' AND u.published = 1'
. ' AND b.published = 1'
. ' 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).' )'
. ' GROUP BY a.id'
. ' ORDER BY '. $order
;
$db->setQuery( $query, 0, $limit );
$list = $db->loadObjectList();
$limit -= count($list);
if(isset($list))
{
foreach($list as $key => $item)
{
$list[$key]->href = ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid);
}
}
$rows[] = $list;
}
// search uncategorised content
if ( $sUncategorised && $limit > 0 )
{
$query = 'SELECT id, a.title AS title, a.created AS created, a.metadesc, a.metakey, '
. ' CONCAT(a.introtext, a.fulltext) AS text,'
. ' "2" as browsernav, "'. $db->Quote(JText::_('Uncategorised Content')) .'" AS section'
. ' FROM #__content AS a'
. ' WHERE ('.$where.')'
. ' AND a.state = 1'
. ' AND a.access <= '.(int) $user->get( 'aid' )
. ' AND a.sectionid = 0'
. ' AND a.catid = 0'
. ' 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).' )'
. ' ORDER BY '. ($morder ? $morder : $order)
;
$db->setQuery( $query, 0, $limit );
$list2 = $db->loadObjectList();
$limit -= count($list2);
if(isset($list2))
{
foreach($list2 as $key => $item)
{
$list2[$key]->href = ContentHelperRoute::getArticleRoute($item->id);
}
}
$rows[] = $list2;
}
// search archived content
if ( $sArchived && $limit > 0 )
{
$searchArchived = JText::_( 'Archived' );
$query = 'SELECT a.title AS title, a.metadesc, a.metakey,'
. ' a.created AS created,'
. ' CONCAT(a.introtext, a.fulltext) AS text,'
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'
. ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(":", b.id, b.alias) ELSE b.id END as catslug,'
. ' u.id AS sectionid,'
. ' CONCAT_WS( "/", u.title, b.title ) AS section,'
. ' "2" AS browsernav'
. ' FROM #__content AS a'
. ' INNER JOIN #__categories AS b ON b.id=a.catid AND b.access <= ' .$user->get( 'gid' )
. ' INNER JOIN #__sections AS u ON u.id = a.sectionid'
. ' WHERE ( '.$where.' )'
. ' AND a.state = -1'
. ' AND u.published = 1'
. ' AND b.published = 1'
. ' 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).' )'
. ' ORDER BY '. $order
;
$db->setQuery( $query, 0, $limit );
$list3 = $db->loadObjectList();
if(isset($list3))
{
foreach($list3 as $key => $item)
{
$list3[$key]->href = ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid);
}
}
$rows[] = $list3;
}
$results = array();
if(count($rows))
{
foreach($rows as $row)
{
$new_row = array();
foreach($row AS $key => $article) {
if(searchHelper::checkNoHTML($article, $searchText, array('text', 'title', 'metadesc', 'metakey'))) {
$new_row[] = $article;
}
}
$results = array_merge($results, (array) $new_row);
}
}
return $results;
}
<?php
/**
* @version $Id: content.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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' );
$mainframe->registerEvent( 'onSearch', 'plgSearchContent' );
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchContentAreas' );
JPlugin::loadLanguage( 'plg_search_content' );
/**
* @return array An array of search areas
*/
function &plgSearchContentAreas()
{
static $areas = array(
'content' => 'Articles'
);
return $areas;
}
/**
* Content 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
* @param mixed An array if the search it to be restricted to areas, null if search all
*/
function plgSearchContent( $text, $phrase='', $ordering='', $areas=null )
{
global $mainframe;
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_search'.DS.'helpers'.DS.'search.php');
$searchText = $text;
if (is_array( $areas )) {
if (!array_intersect( $areas, array_keys( plgSearchContentAreas() ) )) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'content');
$pluginParams = new JParameter( $plugin->params );
$sContent = $pluginParams->get( 'search_content', 1 );
$sUncategorised = $pluginParams->get( 'search_uncategorised', 1 );
$sArchived = $pluginParams->get( 'search_archived', 1 );
$limit = $pluginParams->def( 'search_limit', 50 );
$nullDate = $db->getNullDate();
$date =& JFactory::getDate();
$now = $date->toMySQL();
$text = trim( $text );
if ($text == '') {
return array();
}
$wheres = array();
switch ($phrase) {
case 'exact':
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
$wheres2 = array();
$wheres2[] = 'a.title LIKE '.$text;
$wheres2[] = 'a.introtext LIKE '.$text;
$wheres2[] = 'a.fulltext LIKE '.$text;
$wheres2[] = 'a.metakey LIKE '.$text;
$wheres2[] = 'a.metadesc LIKE '.$text;
$where = '(' . implode( ') OR (', $wheres2 ) . ')';
break;
case 'all':
case 'any':
default:
$words = explode( ' ', $text );
$wheres = array();
foreach ($words as $word) {
$word = $db->Quote( '%'.$db->getEscaped( $word, true ).'%', false );
$wheres2 = array();
$wheres2[] = 'a.title LIKE '.$word;
$wheres2[] = 'a.introtext LIKE '.$word;
$wheres2[] = 'a.fulltext LIKE '.$word;
$wheres2[] = 'a.metakey LIKE '.$word;
$wheres2[] = 'a.metadesc LIKE '.$word;
$wheres[] = implode( ' OR ', $wheres2 );
}
$where = '(' . implode( ($phrase == 'all' ? ') AND (' : ') OR ('), $wheres ) . ')';
break;
}
$morder = '';
switch ($ordering) {
case 'oldest':
$order = 'a.created ASC';
break;
case 'popular':
$order = 'a.hits DESC';
break;
case 'alpha':
$order = 'a.title ASC';
break;
case 'category':
$order = 'b.title ASC, a.title ASC';
$morder = 'a.title ASC';
break;
case 'newest':
default:
$order = 'a.created DESC';
break;
}
$rows = array();
// search articles
if ( $sContent && $limit > 0 )
{
$query = 'SELECT a.title AS title, a.metadesc, a.metakey,'
. ' a.created AS created,'
. ' CONCAT(a.introtext, a.fulltext) AS text,'
. ' CONCAT_WS( "/", u.title, b.title ) AS section,'
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'
. ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(":", b.id, b.alias) ELSE b.id END as catslug,'
. ' u.id AS sectionid,'
. ' "2" AS browsernav'
. ' 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.' )'
. ' AND a.state = 1'
. ' AND u.published = 1'
. ' AND b.published = 1'
. ' 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).' )'
. ' GROUP BY a.id'
. ' ORDER BY '. $order
;
$db->setQuery( $query, 0, $limit );
$list = $db->loadObjectList();
$limit -= count($list);
if(isset($list))
{
foreach($list as $key => $item)
{
$list[$key]->href = ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid);
}
}
$rows[] = $list;
}
// search uncategorised content
if ( $sUncategorised && $limit > 0 )
{
$query = 'SELECT id, a.title AS title, a.created AS created, a.metadesc, a.metakey, '
. ' CONCAT(a.introtext, a.fulltext) AS text,'
. ' "2" as browsernav, "'. $db->getEscaped(JText::_('Uncategorised Content')) .'" AS section'
. ' FROM #__content AS a'
. ' WHERE ('.$where.')'
. ' AND a.state = 1'
. ' AND a.access <= '.(int) $user->get( 'aid' )
. ' AND a.sectionid = 0'
. ' AND a.catid = 0'
. ' 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).' )'
. ' ORDER BY '. ($morder ? $morder : $order)
;
$db->setQuery( $query, 0, $limit );
$list2 = $db->loadObjectList();
$limit -= count($list2);
if(isset($list2))
{
foreach($list2 as $key => $item)
{
$list2[$key]->href = ContentHelperRoute::getArticleRoute($item->id);
}
}
$rows[] = $list2;
}
// search archived content
if ( $sArchived && $limit > 0 )
{
$searchArchived = JText::_( 'Archived' );
$query = 'SELECT a.title AS title, a.metadesc, a.metakey,'
. ' a.created AS created,'
. ' CONCAT(a.introtext, a.fulltext) AS text,'
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'
. ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(":", b.id, b.alias) ELSE b.id END as catslug,'
. ' u.id AS sectionid,'
. ' CONCAT_WS( "/", u.title, b.title ) AS section,'
. ' "2" AS browsernav'
. ' FROM #__content AS a'
. ' INNER JOIN #__categories AS b ON b.id=a.catid AND b.access <= ' .$user->get( 'gid' )
. ' INNER JOIN #__sections AS u ON u.id = a.sectionid'
. ' WHERE ( '.$where.' )'
. ' AND a.state = -1'
. ' AND u.published = 1'
. ' AND b.published = 1'
. ' 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).' )'
. ' ORDER BY '. $order
;
$db->setQuery( $query, 0, $limit );
$list3 = $db->loadObjectList();
if(isset($list3))
{
foreach($list3 as $key => $item)
{
$list3[$key]->href = ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid);
}
}
$rows[] = $list3;
}
$results = array();
if(count($rows))
{
foreach($rows as $row)
{
$new_row = array();
foreach($row AS $key => $article) {
if(searchHelper::checkNoHTML($article, $searchText, array('text', 'title', 'metadesc', 'metakey'))) {
$new_row[] = $article;
}
}
$results = array_merge($results, (array) $new_row);
}
}
return $results;
}
+1 -1
View File
@@ -3,7 +3,7 @@
<name>Search - Content</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
+131 -131
View File
@@ -1,131 +1,131 @@
<?php
/**
* @version $Id: newsfeeds.php 10579 2008-07-22 14:54:24Z ircmaxell $
* @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' );
$mainframe->registerEvent( 'onSearch', 'plgSearchNewsfeedslinks' );
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchNewsfeedAreas' );
JPlugin::loadLanguage( 'plg_search_newsfeeds' );
/**
* @return array An array of search areas
*/
function &plgSearchNewsfeedAreas()
{
static $areas = array(
'newsfeeds' => 'Newsfeeds'
);
return $areas;
}
/**
* Contacts 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
* @param mixed An array if the search it to be restricted to areas, null if search all
*/
function plgSearchNewsfeedslinks( $text, $phrase='', $ordering='', $areas=null )
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
if (is_array( $areas )) {
if (!array_intersect( $areas, array_keys( plgSearchNewsfeedAreas() ) )) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'newsfeeds');
$pluginParams = new JParameter( $plugin->params );
$limit = $pluginParams->def( 'search_limit', 50 );
$text = trim( $text );
if ($text == '') {
return array();
}
$wheres = array();
switch ($phrase) {
case 'exact':
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
$wheres2 = array();
$wheres2[] = 'a.name LIKE '.$text;
$wheres2[] = 'a.link LIKE '.$text;
$where = '(' . implode( ') OR (', $wheres2 ) . ')';
break;
case 'all':
case 'any':
default:
$words = explode( ' ', $text );
$wheres = array();
foreach ($words as $word)
{
$word = $db->Quote( '%'.$db->getEscaped( $word, true ).'%', false );
$wheres2 = array();
$wheres2[] = 'a.name LIKE '.$word;
$wheres2[] = 'a.link LIKE '.$word;
$wheres[] = implode( ' OR ', $wheres2 );
}
$where = '(' . implode( ($phrase == 'all' ? ') AND (' : ') OR ('), $wheres ) . ')';
break;
}
switch ( $ordering ) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
$order = 'b.title ASC, a.name ASC';
break;
case 'oldest':
case 'popular':
case 'newest':
default:
$order = 'a.name ASC';
}
$searchNewsfeeds = JText::_( 'Newsfeeds' );
$query = 'SELECT a.name AS title, "" AS created, a.link AS text,'
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
. ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(\':\', b.id, b.alias) ELSE b.id END as catslug, '
. ' CONCAT_WS( " / ", '. $db->Quote($searchNewsfeeds) .', b.title )AS section,'
. ' "1" AS browsernav'
. ' FROM #__newsfeeds AS a'
. ' INNER JOIN #__categories AS b ON b.id = a.catid'
. ' WHERE ( '. $where .' )'
. ' AND a.published = 1'
. ' AND b.published = 1'
. ' AND b.access <= '. (int) $user->get( 'aid' )
. ' ORDER BY '. $order
;
$db->setQuery( $query, 0, $limit );
$rows = $db->loadObjectList();
foreach($rows as $key => $row) {
$rows[$key]->href = 'index.php?option=com_newsfeeds&view=newsfeed&catid='.$row->catslug.'&id='.$row->slug;
}
return $rows;
}
<?php
/**
* @version $Id: newsfeeds.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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' );
$mainframe->registerEvent( 'onSearch', 'plgSearchNewsfeedslinks' );
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchNewsfeedAreas' );
JPlugin::loadLanguage( 'plg_search_newsfeeds' );
/**
* @return array An array of search areas
*/
function &plgSearchNewsfeedAreas()
{
static $areas = array(
'newsfeeds' => 'Newsfeeds'
);
return $areas;
}
/**
* Contacts 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
* @param mixed An array if the search it to be restricted to areas, null if search all
*/
function plgSearchNewsfeedslinks( $text, $phrase='', $ordering='', $areas=null )
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
if (is_array( $areas )) {
if (!array_intersect( $areas, array_keys( plgSearchNewsfeedAreas() ) )) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'newsfeeds');
$pluginParams = new JParameter( $plugin->params );
$limit = $pluginParams->def( 'search_limit', 50 );
$text = trim( $text );
if ($text == '') {
return array();
}
$wheres = array();
switch ($phrase) {
case 'exact':
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
$wheres2 = array();
$wheres2[] = 'a.name LIKE '.$text;
$wheres2[] = 'a.link LIKE '.$text;
$where = '(' . implode( ') OR (', $wheres2 ) . ')';
break;
case 'all':
case 'any':
default:
$words = explode( ' ', $text );
$wheres = array();
foreach ($words as $word)
{
$word = $db->Quote( '%'.$db->getEscaped( $word, true ).'%', false );
$wheres2 = array();
$wheres2[] = 'a.name LIKE '.$word;
$wheres2[] = 'a.link LIKE '.$word;
$wheres[] = implode( ' OR ', $wheres2 );
}
$where = '(' . implode( ($phrase == 'all' ? ') AND (' : ') OR ('), $wheres ) . ')';
break;
}
switch ( $ordering ) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
$order = 'b.title ASC, a.name ASC';
break;
case 'oldest':
case 'popular':
case 'newest':
default:
$order = 'a.name ASC';
}
$searchNewsfeeds = JText::_( 'Newsfeeds' );
$query = 'SELECT a.name AS title, "" AS created, a.link AS text,'
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
. ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(\':\', b.id, b.alias) ELSE b.id END as catslug, '
. ' CONCAT_WS( " / ", '. $db->Quote($searchNewsfeeds) .', b.title )AS section,'
. ' "1" AS browsernav'
. ' FROM #__newsfeeds AS a'
. ' INNER JOIN #__categories AS b ON b.id = a.catid'
. ' WHERE ( '. $where .' )'
. ' AND a.published = 1'
. ' AND b.published = 1'
. ' AND b.access <= '. (int) $user->get( 'aid' )
. ' ORDER BY '. $order
;
$db->setQuery( $query, 0, $limit );
$rows = $db->loadObjectList();
foreach($rows as $key => $row) {
$rows[$key]->href = 'index.php?option=com_newsfeeds&view=newsfeed&catid='.$row->catslug.'&id='.$row->slug;
}
return $rows;
}
@@ -3,7 +3,7 @@
<name>Search - Newsfeeds</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
+112 -112
View File
@@ -1,112 +1,112 @@
<?php
/**
* @version $Id: sections.php 10579 2008-07-22 14:54:24Z ircmaxell $
* @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' );
$mainframe->registerEvent( 'onSearch', 'plgSearchSections' );
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchSectionAreas' );
JPlugin::loadLanguage( 'plg_search_sections' );
/**
* @return array An array of search areas
*/
function &plgSearchSectionAreas() {
static $areas = array(
'sections' => 'Sections'
);
return $areas;
}
/**
* Sections 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
* @param mixed An array if restricted to areas, null if search all
*/
function plgSearchSections( $text, $phrase='', $ordering='', $areas=null )
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$searchText = $text;
require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
if (is_array( $areas )) {
if (!array_intersect( $areas, array_keys( plgSearchSectionAreas() ) )) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'sections');
$pluginParams = new JParameter( $plugin->params );
$limit = $pluginParams->def( 'search_limit', 50 );
$text = trim( $text );
if ($text == '') {
return array();
}
switch ( $ordering ) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
}
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
$query = 'SELECT a.title AS title, a.description AS text, a.name, '
. ' "" AS created,'
. ' "2" AS browsernav,'
. ' a.id AS secid'
. ' FROM #__sections AS a'
. ' WHERE ( a.name LIKE '.$text
. ' OR a.title LIKE '.$text
. ' OR a.description LIKE '.$text.' )'
. ' AND a.published = 1'
. ' AND a.access <= '.(int) $user->get( 'aid' )
. ' GROUP BY a.id'
. ' ORDER BY '. $order
;
$db->setQuery( $query, 0, $limit );
$rows = $db->loadObjectList();
$count = count( $rows );
for ( $i = 0; $i < $count; $i++ )
{
$rows[$i]->href = ContentHelperRoute::getSectionRoute($rows[$i]->secid);
$rows[$i]->section = JText::_( 'Section' );
}
$return = array();
foreach($rows AS $key => $section) {
if(searchHelper::checkNoHTML($section, $searchText, array('name', 'title', 'text'))) {
$return[] = $section;
}
}
return $return;
}
<?php
/**
* @version $Id: sections.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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' );
$mainframe->registerEvent( 'onSearch', 'plgSearchSections' );
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchSectionAreas' );
JPlugin::loadLanguage( 'plg_search_sections' );
/**
* @return array An array of search areas
*/
function &plgSearchSectionAreas() {
static $areas = array(
'sections' => 'Sections'
);
return $areas;
}
/**
* Sections 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
* @param mixed An array if restricted to areas, null if search all
*/
function plgSearchSections( $text, $phrase='', $ordering='', $areas=null )
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$searchText = $text;
require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
if (is_array( $areas )) {
if (!array_intersect( $areas, array_keys( plgSearchSectionAreas() ) )) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'sections');
$pluginParams = new JParameter( $plugin->params );
$limit = $pluginParams->def( 'search_limit', 50 );
$text = trim( $text );
if ($text == '') {
return array();
}
switch ( $ordering ) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
}
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
$query = 'SELECT a.title AS title, a.description AS text, a.name, '
. ' "" AS created,'
. ' "2" AS browsernav,'
. ' a.id AS secid'
. ' FROM #__sections AS a'
. ' WHERE ( a.name LIKE '.$text
. ' OR a.title LIKE '.$text
. ' OR a.description LIKE '.$text.' )'
. ' AND a.published = 1'
. ' AND a.access <= '.(int) $user->get( 'aid' )
. ' GROUP BY a.id'
. ' ORDER BY '. $order
;
$db->setQuery( $query, 0, $limit );
$rows = $db->loadObjectList();
$count = count( $rows );
for ( $i = 0; $i < $count; $i++ )
{
$rows[$i]->href = ContentHelperRoute::getSectionRoute($rows[$i]->secid);
$rows[$i]->section = JText::_( 'Section' );
}
$return = array();
foreach($rows AS $key => $section) {
if(searchHelper::checkNoHTML($section, $searchText, array('name', 'title', 'text'))) {
$return[] = $section;
}
}
return $return;
}
+1 -1
View File
@@ -3,7 +3,7 @@
<name>Search - Sections</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
+150 -150
View File
@@ -1,150 +1,150 @@
<?php
/**
* @version $Id: weblinks.php 10579 2008-07-22 14:54:24Z ircmaxell $
* @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' );
$mainframe->registerEvent( 'onSearch', 'plgSearchWeblinks' );
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchWeblinksAreas' );
JPlugin::loadLanguage( 'plg_search_weblinks' );
/**
* @return array An array of search areas
*/
function &plgSearchWeblinksAreas() {
static $areas = array(
'weblinks' => 'Weblinks'
);
return $areas;
}
/**
* Weblink 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
* @param mixed An array if the search it to be restricted to areas, null if search all
*/
function plgSearchWeblinks( $text, $phrase='', $ordering='', $areas=null )
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$searchText = $text;
require_once(JPATH_SITE.DS.'components'.DS.'com_weblinks'.DS.'helpers'.DS.'route.php');
if (is_array( $areas )) {
if (!array_intersect( $areas, array_keys( plgSearchWeblinksAreas() ) )) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'weblinks');
$pluginParams = new JParameter( $plugin->params );
$limit = $pluginParams->def( 'search_limit', 50 );
$text = trim( $text );
if ($text == '') {
return array();
}
$section = JText::_( 'Web Links' );
$wheres = array();
switch ($phrase)
{
case 'exact':
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
$wheres2 = array();
$wheres2[] = 'a.url LIKE '.$text;
$wheres2[] = 'a.description LIKE '.$text;
$wheres2[] = 'a.title LIKE '.$text;
$where = '(' . implode( ') OR (', $wheres2 ) . ')';
break;
case 'all':
case 'any':
default:
$words = explode( ' ', $text );
$wheres = array();
foreach ($words as $word)
{
$word = $db->Quote( '%'.$db->getEscaped( $word, true ).'%', false );
$wheres2 = array();
$wheres2[] = 'a.url LIKE '.$word;
$wheres2[] = 'a.description LIKE '.$word;
$wheres2[] = 'a.title LIKE '.$word;
$wheres[] = implode( ' OR ', $wheres2 );
}
$where = '(' . implode( ($phrase == 'all' ? ') AND (' : ') OR ('), $wheres ) . ')';
break;
}
switch ( $ordering )
{
case 'oldest':
$order = 'a.date ASC';
break;
case 'popular':
$order = 'a.hits DESC';
break;
case 'alpha':
$order = 'a.title ASC';
break;
case 'category':
$order = 'b.title ASC, a.title ASC';
break;
case 'newest':
default:
$order = 'a.date DESC';
}
$query = 'SELECT a.title AS title, a.description AS text, a.date AS created, a.url, '
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
. ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(\':\', b.id, b.alias) ELSE b.id END as catslug, '
. ' CONCAT_WS( " / ", '.$db->Quote($section).', b.title ) AS section,'
. ' "1" AS browsernav'
. ' FROM #__weblinks AS a'
. ' INNER JOIN #__categories AS b ON b.id = a.catid'
. ' WHERE ('. $where .')'
. ' AND a.published = 1'
. ' AND b.published = 1'
. ' AND b.access <= '.(int) $user->get( 'aid' )
. ' ORDER BY '. $order
;
$db->setQuery( $query, 0, $limit );
$rows = $db->loadObjectList();
foreach($rows as $key => $row) {
$rows[$key]->href = WeblinksHelperRoute::getWeblinkRoute($row->slug, $row->catslug);
}
$return = array();
foreach($rows AS $key => $weblink) {
if(searchHelper::checkNoHTML($weblink, $searchText, array('url', 'text', 'title'))) {
$return[] = $weblink;
}
}
return $return;
}
<?php
/**
* @version $Id: weblinks.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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' );
$mainframe->registerEvent( 'onSearch', 'plgSearchWeblinks' );
$mainframe->registerEvent( 'onSearchAreas', 'plgSearchWeblinksAreas' );
JPlugin::loadLanguage( 'plg_search_weblinks' );
/**
* @return array An array of search areas
*/
function &plgSearchWeblinksAreas() {
static $areas = array(
'weblinks' => 'Weblinks'
);
return $areas;
}
/**
* Weblink 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
* @param mixed An array if the search it to be restricted to areas, null if search all
*/
function plgSearchWeblinks( $text, $phrase='', $ordering='', $areas=null )
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$searchText = $text;
require_once(JPATH_SITE.DS.'components'.DS.'com_weblinks'.DS.'helpers'.DS.'route.php');
if (is_array( $areas )) {
if (!array_intersect( $areas, array_keys( plgSearchWeblinksAreas() ) )) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'weblinks');
$pluginParams = new JParameter( $plugin->params );
$limit = $pluginParams->def( 'search_limit', 50 );
$text = trim( $text );
if ($text == '') {
return array();
}
$section = JText::_( 'Web Links' );
$wheres = array();
switch ($phrase)
{
case 'exact':
$text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false );
$wheres2 = array();
$wheres2[] = 'a.url LIKE '.$text;
$wheres2[] = 'a.description LIKE '.$text;
$wheres2[] = 'a.title LIKE '.$text;
$where = '(' . implode( ') OR (', $wheres2 ) . ')';
break;
case 'all':
case 'any':
default:
$words = explode( ' ', $text );
$wheres = array();
foreach ($words as $word)
{
$word = $db->Quote( '%'.$db->getEscaped( $word, true ).'%', false );
$wheres2 = array();
$wheres2[] = 'a.url LIKE '.$word;
$wheres2[] = 'a.description LIKE '.$word;
$wheres2[] = 'a.title LIKE '.$word;
$wheres[] = implode( ' OR ', $wheres2 );
}
$where = '(' . implode( ($phrase == 'all' ? ') AND (' : ') OR ('), $wheres ) . ')';
break;
}
switch ( $ordering )
{
case 'oldest':
$order = 'a.date ASC';
break;
case 'popular':
$order = 'a.hits DESC';
break;
case 'alpha':
$order = 'a.title ASC';
break;
case 'category':
$order = 'b.title ASC, a.title ASC';
break;
case 'newest':
default:
$order = 'a.date DESC';
}
$query = 'SELECT a.title AS title, a.description AS text, a.date AS created, a.url, '
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
. ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(\':\', b.id, b.alias) ELSE b.id END as catslug, '
. ' CONCAT_WS( " / ", '.$db->Quote($section).', b.title ) AS section,'
. ' "1" AS browsernav'
. ' FROM #__weblinks AS a'
. ' INNER JOIN #__categories AS b ON b.id = a.catid'
. ' WHERE ('. $where .')'
. ' AND a.published = 1'
. ' AND b.published = 1'
. ' AND b.access <= '.(int) $user->get( 'aid' )
. ' ORDER BY '. $order
;
$db->setQuery( $query, 0, $limit );
$rows = $db->loadObjectList();
foreach($rows as $key => $row) {
$rows[$key]->href = WeblinksHelperRoute::getWeblinkRoute($row->slug, $row->catslug);
}
$return = array();
foreach($rows AS $key => $weblink) {
if(searchHelper::checkNoHTML($weblink, $searchText, array('url', 'text', 'title'))) {
$return[] = $weblink;
}
}
return $return;
}
+1 -1
View File
@@ -3,7 +3,7 @@
<name>Search - Weblinks</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
File diff suppressed because it is too large Load Diff
+28 -28
View File
@@ -1,29 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="plugin" group="system">
<name>System - Backlinks</name>
<author>Joomla! Project</author>
<creationDate>September 2007</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.5</version>
<description>Provides backlink support</description>
<files>
<filename plugin="backlink">backlink.php</filename>
</files>
<params>
<param name="url" type="radio" default="1" label="Search Query Strings" description="If yes, it searches for old query strings that might match and redirects">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="sef" type="radio" default="1" label="Search SEF" description="If yes, it uses old style SEF and directs it to the new link">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="legacysef" type="radio" default="1" label="Attempt Legacy SEF" description="If yes, it uses old style SEF and attempts to generate a valid link">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
</params>
<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="plugin" group="system">
<name>System - Backlinks</name>
<author>Joomla! Project</author>
<creationDate>September 2007</creationDate>
<copyright>Copyright (C) 2005 - 2010 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>Provides backlink support</description>
<files>
<filename plugin="backlink">backlink.php</filename>
</files>
<params>
<param name="url" type="radio" default="1" label="Search Query Strings" description="If yes, it searches for old query strings that might match and redirects">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="sef" type="radio" default="1" label="Search SEF" description="If yes, it uses old style SEF and directs it to the new link">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="legacysef" type="radio" default="1" label="Attempt Legacy SEF" description="If yes, it uses old style SEF and attempts to generate a valid link">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
</params>
</install>
+117 -117
View File
@@ -1,117 +1,117 @@
<?php
/**
* @version $Id: cache.php 11616 2009-02-07 14:09:52Z kdevine $
* @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! Page Cache Plugin
*
* @package Joomla
* @subpackage System
*/
class plgSystemCache extends JPlugin
{
var $_cache = null;
/**
* 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.
*
* @access protected
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.0
*/
function plgSystemCache(& $subject, $config)
{
parent::__construct($subject, $config);
//Set the language in the class
$config =& JFactory::getConfig();
$options = array(
'cachebase' => JPATH_BASE.DS.'cache',
'defaultgroup' => 'page',
'lifetime' => $this->params->get('cachetime', 15) * 60,
'browsercache' => $this->params->get('browsercache', false),
'caching' => false,
'language' => $config->getValue('config.language', 'en-GB')
);
jimport('joomla.cache.cache');
$this->_cache =& JCache::getInstance( 'page', $options );
}
/**
* Converting the site URL to fit to the HTTP request
*
*/
function onAfterInitialise()
{
global $mainframe, $_PROFILER;
$user = &JFactory::getUser();
if($mainframe->isAdmin() || JDEBUG) {
return;
}
if (!$user->get('aid') && $_SERVER['REQUEST_METHOD'] == 'GET') {
$this->_cache->setCaching(true);
}
$data = $this->_cache->get();
if($data !== false)
{
// the following code searches for a token in the cached page and replaces it with the
// proper token.
$token = JUtility::getToken();
$search = '#<input type="hidden" name="[0-9a-f]{32}" value="1" />#';
$replacement = '<input type="hidden" name="'.$token.'" value="1" />';
$data = preg_replace( $search, $replacement, $data );
JResponse::setBody($data);
echo JResponse::toString($mainframe->getCfg('gzip'));
if(JDEBUG)
{
$_PROFILER->mark('afterCache');
echo implode( '', $_PROFILER->getBuffer());
}
$mainframe->close();
}
}
function onAfterRender()
{
global $mainframe;
if($mainframe->isAdmin() || JDEBUG) {
return;
}
$user =& JFactory::getUser();
if(!$user->get('aid')) {
//We need to check again here, because auto-login plugins have not been fired before the first aid check
$this->_cache->store();
}
}
}
<?php
/**
* @version $Id: cache.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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! Page Cache Plugin
*
* @package Joomla
* @subpackage System
*/
class plgSystemCache extends JPlugin
{
var $_cache = null;
/**
* 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.
*
* @access protected
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.0
*/
function plgSystemCache(& $subject, $config)
{
parent::__construct($subject, $config);
//Set the language in the class
$config =& JFactory::getConfig();
$options = array(
'cachebase' => JPATH_BASE.DS.'cache',
'defaultgroup' => 'page',
'lifetime' => $this->params->get('cachetime', 15) * 60,
'browsercache' => $this->params->get('browsercache', false),
'caching' => false,
'language' => $config->getValue('config.language', 'en-GB')
);
jimport('joomla.cache.cache');
$this->_cache =& JCache::getInstance( 'page', $options );
}
/**
* Converting the site URL to fit to the HTTP request
*
*/
function onAfterInitialise()
{
global $mainframe, $_PROFILER;
$user = &JFactory::getUser();
if($mainframe->isAdmin() || JDEBUG) {
return;
}
if (!$user->get('aid') && $_SERVER['REQUEST_METHOD'] == 'GET') {
$this->_cache->setCaching(true);
}
$data = $this->_cache->get();
if($data !== false)
{
// the following code searches for a token in the cached page and replaces it with the
// proper token.
$token = JUtility::getToken();
$search = '#<input type="hidden" name="[0-9a-f]{32}" value="1" />#';
$replacement = '<input type="hidden" name="'.$token.'" value="1" />';
$data = preg_replace( $search, $replacement, $data );
JResponse::setBody($data);
echo JResponse::toString($mainframe->getCfg('gzip'));
if(JDEBUG)
{
$_PROFILER->mark('afterCache');
echo implode( '', $_PROFILER->getBuffer());
}
$mainframe->close();
}
}
function onAfterRender()
{
global $mainframe;
if($mainframe->isAdmin() || JDEBUG) {
return;
}
$user =& JFactory::getUser();
if(!$user->get('aid')) {
//We need to check again here, because auto-login plugins have not been fired before the first aid check
$this->_cache->store();
}
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
<name>System - Cache</name>
<author>Joomla! Project</author>
<creationDate>February 2007</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
+206 -206
View File
@@ -1,207 +1,207 @@
<?php
/**
* @version $Id: debug.php 10709 2008-08-21 09:58:52Z eddieajau $
* @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! Debug plugin
*
* @package Joomla
* @subpackage System
*/
class plgSystemDebug 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.
*
* @access protected
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.0
*/
function plgSystemDebug(& $subject, $config)
{
parent::__construct($subject, $config);
//load the translation
$this->loadLanguage( );
}
/**
* Converting the site URL to fit to the HTTP request
*
*/
function onAfterRender()
{
global $_PROFILER, $mainframe, $database;
// Do not render if debugging is not enabled
if(!JDEBUG) { return; }
$document =& JFactory::getDocument();
$doctype = $document->getType();
// Only render for HTML output
if ( $doctype !== 'html' ) { return; }
$profiler =& $_PROFILER;
ob_start();
echo '<div id="system-debug" class="profiler">';
if ($this->params->get('profile', 1)) {
echo '<h4>'.JText::_( 'Profile Information' ).'</h4>';
foreach ( $profiler->getBuffer() as $mark ) {
echo '<div>'.$mark.'</div>';
}
}
if ($this->params->get('memory', 1)) {
echo '<h4>'.JText::_( 'Memory Usage' ).'</h4>';
echo $profiler->getMemory();
}
if ($this->params->get('queries', 1))
{
jimport('geshi.geshi');
$geshi = new GeSHi( '', 'sql' );
$geshi->set_header_type(GESHI_HEADER_DIV);
//$geshi->enable_line_numbers( GESHI_FANCY_LINE_NONE );
$newlineKeywords = '/<span style="color: #993333; font-weight: bold;">'
.'(FROM|LEFT|INNER|OUTER|WHERE|SET|VALUES|ORDER|GROUP|HAVING|LIMIT|ON|AND)'
.'<\\/span>/i'
;
$db =& JFactory::getDBO();
echo '<h4>'.JText::sprintf( 'Queries logged', $db->getTicker() ).'</h4>';
if ($log = $db->getLog())
{
echo '<ol>';
foreach ($log as $k=>$sql)
{
$geshi->set_source($sql);
$text = $geshi->parse_code();
$text = preg_replace($newlineKeywords, '<br />&nbsp;&nbsp;\\0', $text);
echo '<li>'.$text.'</li>';
}
echo '</ol>';
}
if(isset($database))
{
echo '<h4>'.JText::sprintf( 'Legacy Queries logged', $database->getTicker() ).'</h4>';
echo '<ol>';
foreach ($database->getLog() as $k=>$sql)
{
$geshi->set_source($sql);
$text = $geshi->parse_code();
$text = preg_replace($newlineKeywords, '<br />&nbsp;&nbsp;\\0', $text);
echo '<li>'.$text.'</li>';
}
echo '</ol>';
}
}
$lang = &JFactory::getLanguage();
if ($this->params->get('language_files', 1))
{
echo '<h4>'.JText::_( 'Language Files Loaded' ).'</h4>';
echo '<ul>';
$extensions = $lang->getPaths();
foreach ( $extensions as $extension => $files)
{
foreach ( $files as $file => $status )
{
echo "<li>$file $status</li>";
}
}
echo '</ul>';
}
$langStrings = $this->params->get('language_strings', -1);
if ($langStrings < 0 OR $langStrings == 1) {
echo '<h4>'.JText::_( 'Untranslated Strings Diagnostic' ).'</h4>';
echo '<pre>';
$orphans = $lang->getOrphans();
if (count( $orphans ))
{
ksort( $orphans, SORT_STRING );
foreach ($orphans as $key => $occurance) {
foreach ( $occurance as $i => $info) {
$class = @$info['class'];
$func = @$info['function'];
$file = @$info['file'];
$line = @$info['line'];
echo strtoupper( $key )."\t$class::$func()\t[$file:$line]\n";
}
}
}
else {
echo JText::_( 'None' );
}
echo '</pre>';
}
if ($langStrings < 0 OR $langStrings == 2) {
echo '<h4>'.JText::_( 'Untranslated Strings Designer' ).'</h4>';
echo '<pre>';
$orphans = $lang->getOrphans();
if (count( $orphans ))
{
ksort( $orphans, SORT_STRING );
$guesses = array();
foreach ($orphans as $key => $occurance) {
if (is_array( $occurance ) AND isset( $occurance[0] )) {
$info = &$occurance[0];
$file = @$info['file'];
if (!isset( $guesses[$file] )) {
$guesses[$file] = array();
}
$guess = str_replace( '_', ' ', $info['string'] );
if ($strip = $this->params->get('language_prefix')) {
$guess = trim( preg_replace( chr(1).'^'.$strip.chr(1), '', $guess ) );
}
$guesses[$file][] = trim( strtoupper( $key ) ).'='.$guess;
}
}
foreach ($guesses as $file => $keys) {
echo "\n\n# ".($file ? $file : JText::_( 'Unknown file' ))."\n\n";
echo implode( "\n", $keys );
}
}
else {
echo JText::_( 'None' );
}
echo '</pre>';
}
echo '</div>';
$debug = ob_get_clean();
$body = JResponse::getBody();
$body = str_replace('</body>', $debug.'</body>', $body);
JResponse::setBody($body);
}
<?php
/**
* @version $Id: debug.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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! Debug plugin
*
* @package Joomla
* @subpackage System
*/
class plgSystemDebug 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.
*
* @access protected
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.0
*/
function plgSystemDebug(& $subject, $config)
{
parent::__construct($subject, $config);
//load the translation
$this->loadLanguage( );
}
/**
* Converting the site URL to fit to the HTTP request
*
*/
function onAfterRender()
{
global $_PROFILER, $mainframe, $database;
// Do not render if debugging is not enabled
if(!JDEBUG) { return; }
$document =& JFactory::getDocument();
$doctype = $document->getType();
// Only render for HTML output
if ( $doctype !== 'html' ) { return; }
$profiler =& $_PROFILER;
ob_start();
echo '<div id="system-debug" class="profiler">';
if ($this->params->get('profile', 1)) {
echo '<h4>'.JText::_( 'Profile Information' ).'</h4>';
foreach ( $profiler->getBuffer() as $mark ) {
echo '<div>'.$mark.'</div>';
}
}
if ($this->params->get('memory', 1)) {
echo '<h4>'.JText::_( 'Memory Usage' ).'</h4>';
echo $profiler->getMemory();
}
if ($this->params->get('queries', 1))
{
jimport('geshi.geshi');
$geshi = new GeSHi( '', 'sql' );
$geshi->set_header_type(GESHI_HEADER_DIV);
//$geshi->enable_line_numbers( GESHI_FANCY_LINE_NONE );
$newlineKeywords = '/<span style="color: #993333; font-weight: bold;">'
.'(FROM|LEFT|INNER|OUTER|WHERE|SET|VALUES|ORDER|GROUP|HAVING|LIMIT|ON|AND)'
.'<\\/span>/i'
;
$db =& JFactory::getDBO();
echo '<h4>'.JText::sprintf( 'Queries logged', $db->getTicker() ).'</h4>';
if ($log = $db->getLog())
{
echo '<ol>';
foreach ($log as $k=>$sql)
{
$geshi->set_source($sql);
$text = $geshi->parse_code();
$text = preg_replace($newlineKeywords, '<br />&nbsp;&nbsp;\\0', $text);
echo '<li>'.$text.'</li>';
}
echo '</ol>';
}
if(isset($database))
{
echo '<h4>'.JText::sprintf( 'Legacy Queries logged', $database->getTicker() ).'</h4>';
echo '<ol>';
foreach ($database->getLog() as $k=>$sql)
{
$geshi->set_source($sql);
$text = $geshi->parse_code();
$text = preg_replace($newlineKeywords, '<br />&nbsp;&nbsp;\\0', $text);
echo '<li>'.$text.'</li>';
}
echo '</ol>';
}
}
$lang = &JFactory::getLanguage();
if ($this->params->get('language_files', 1))
{
echo '<h4>'.JText::_( 'Language Files Loaded' ).'</h4>';
echo '<ul>';
$extensions = $lang->getPaths();
foreach ( $extensions as $extension => $files)
{
foreach ( $files as $file => $status )
{
echo "<li>$file $status</li>";
}
}
echo '</ul>';
}
$langStrings = $this->params->get('language_strings', -1);
if ($langStrings < 0 OR $langStrings == 1) {
echo '<h4>'.JText::_( 'Untranslated Strings Diagnostic' ).'</h4>';
echo '<pre>';
$orphans = $lang->getOrphans();
if (count( $orphans ))
{
ksort( $orphans, SORT_STRING );
foreach ($orphans as $key => $occurance) {
foreach ( $occurance as $i => $info) {
$class = @$info['class'];
$func = @$info['function'];
$file = @$info['file'];
$line = @$info['line'];
echo strtoupper( $key )."\t$class::$func()\t[$file:$line]\n";
}
}
}
else {
echo JText::_( 'None' );
}
echo '</pre>';
}
if ($langStrings < 0 OR $langStrings == 2) {
echo '<h4>'.JText::_( 'Untranslated Strings Designer' ).'</h4>';
echo '<pre>';
$orphans = $lang->getOrphans();
if (count( $orphans ))
{
ksort( $orphans, SORT_STRING );
$guesses = array();
foreach ($orphans as $key => $occurance) {
if (is_array( $occurance ) AND isset( $occurance[0] )) {
$info = &$occurance[0];
$file = @$info['file'];
if (!isset( $guesses[$file] )) {
$guesses[$file] = array();
}
$guess = str_replace( '_', ' ', $info['string'] );
if ($strip = $this->params->get('language_prefix')) {
$guess = trim( preg_replace( chr(1).'^'.$strip.chr(1), '', $guess ) );
}
$guesses[$file][] = trim( strtoupper( $key ) ).'='.$guess;
}
}
foreach ($guesses as $file => $keys) {
echo "\n\n# ".($file ? $file : JText::_( 'Unknown file' ))."\n\n";
echo implode( "\n", $keys );
}
}
else {
echo JText::_( 'None' );
}
echo '</pre>';
}
echo '</div>';
$debug = ob_get_clean();
$body = JResponse::getBody();
$body = str_replace('</body>', $debug.'</body>', $body);
JResponse::setBody($body);
}
}
+39 -39
View File
@@ -1,40 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="plugin" group="system">
<name>System - Debug</name>
<author>Joomla! Project</author>
<creationDate>December 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.5</version>
<description>Provides debug information</description>
<files>
<filename plugin="debug">debug.php</filename>
</files>
<params>
<param name="profile" type="radio" default="1" label="Display Profiling Information" description="If yes, display profiling information">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="queries" type="radio" default="1" label="Display SQL query log" description="If yes, display SQL query log">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="memory" type="radio" default="1" label="Display memory usage" description="If yes, display memory usage">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="language_files" type="radio" default="1" label="Display loaded language files" description="If yes, display a list of the language files loaded">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="language_strings" type="list" default="2" label="Display undefined language strings" description="Displays orphaned strings in different ways">
<option value="0">No</option>
<option value="-1">All modes</option>
<option value="1">Diagnostic mode</option>
<option value="2">Designer mode</option>
</param>
<param name="language_prefix" type="text" default="" label="Strip String Prefix" description="Strip String Prefix Desc" />
</params>
<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="plugin" group="system">
<name>System - Debug</name>
<author>Joomla! Project</author>
<creationDate>December 2006</creationDate>
<copyright>Copyright (C) 2005 - 2010 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>Provides debug information</description>
<files>
<filename plugin="debug">debug.php</filename>
</files>
<params>
<param name="profile" type="radio" default="1" label="Display Profiling Information" description="If yes, display profiling information">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="queries" type="radio" default="1" label="Display SQL query log" description="If yes, display SQL query log">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="memory" type="radio" default="1" label="Display memory usage" description="If yes, display memory usage">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="language_files" type="radio" default="1" label="Display loaded language files" description="If yes, display a list of the language files loaded">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="language_strings" type="list" default="2" label="Display undefined language strings" description="Displays orphaned strings in different ways">
<option value="0">No</option>
<option value="-1">All modes</option>
<option value="1">Diagnostic mode</option>
<option value="2">Designer mode</option>
</param>
<param name="language_prefix" type="text" default="" label="Strip String Prefix" description="Strip String Prefix Desc" />
</params>
</install>
+403 -403
View File
@@ -1,403 +1,403 @@
<?php
/**
* @version $Id: legacy.php 11299 2008-11-22 01:40:44Z ian $
* @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! Debug plugin
*
* @package Joomla
* @subpackage System
*/
class plgSystemLegacy 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.0
*/
function plgSystemLegacy(& $subject, $config)
{
parent::__construct($subject, $config);
global $mainframe;
// Define the 1.0 legacy mode constant
define('_JLEGACY', '1.0');
// Set global configuration var for legacy mode
$config = &JFactory::getConfig();
$config->setValue('config.legacy', 1);
// Import library dependencies
require_once(dirname(__FILE__).DS.'legacy'.DS.'classes.php');
require_once(dirname(__FILE__).DS.'legacy'.DS.'functions.php');
// Register legacy classes for autoloading
JLoader::register('mosAdminMenus' , dirname(__FILE__).DS.'legacy'.DS.'adminmenus.php');
JLoader::register('mosCache' , dirname(__FILE__).DS.'legacy'.DS.'cache.php');
JLoader::register('mosCategory' , dirname(__FILE__).DS.'legacy'.DS.'category.php');
JLoader::register('mosCommonHTML' , dirname(__FILE__).DS.'legacy'.DS.'commonhtml.php');
JLoader::register('mosComponent' , dirname(__FILE__).DS.'legacy'.DS.'component.php');
JLoader::register('mosContent' , dirname(__FILE__).DS.'legacy'.DS.'content.php');
JLoader::register('mosDBTable' , dirname(__FILE__).DS.'legacy'.DS.'dbtable.php');
JLoader::register('mosHTML' , dirname(__FILE__).DS.'legacy'.DS.'html.php');
JLoader::register('mosInstaller' , dirname(__FILE__).DS.'legacy'.DS.'installer.php');
JLoader::register('mosMainFrame' , dirname(__FILE__).DS.'legacy'.DS.'mainframe.php');
JLoader::register('mosMambot' , dirname(__FILE__).DS.'legacy'.DS.'mambot.php');
JLoader::register('mosMambotHandler', dirname(__FILE__).DS.'legacy'.DS.'mambothandler.php');
JLoader::register('mosMenu' , dirname(__FILE__).DS.'legacy'.DS.'menu.php');
JLoader::register('mosMenuBar' , dirname(__FILE__).DS.'legacy'.DS.'menubar.php');
JLoader::register('mosModule' , dirname(__FILE__).DS.'legacy'.DS.'module.php');
//JLoader::register('mosPageNav' , dirname(__FILE__).DS.'legacy'.DS.'pagination.php');
JLoader::register('mosParameters' , dirname(__FILE__).DS.'legacy'.DS.'parameters.php');
JLoader::register('patFactory' , dirname(__FILE__).DS.'legacy'.DS.'patfactory.php');
JLoader::register('mosProfiler' , dirname(__FILE__).DS.'legacy'.DS.'profiler.php');
JLoader::register('mosSection' , dirname(__FILE__).DS.'legacy'.DS.'section.php');
JLoader::register('mosSession' , dirname(__FILE__).DS.'legacy'.DS.'session.php');
JLoader::register('mosToolbar' , dirname(__FILE__).DS.'legacy'.DS.'toolbar.php');
JLoader::register('mosUser' , dirname(__FILE__).DS.'legacy'.DS.'user.php');
// Register class for the database, depends on which db type has been selected for use
$dbtype = $config->getValue('config.dbtype', 'mysql');
JLoader::register('database' , dirname(__FILE__).DS.'legacy'.DS.$dbtype.'.php');
/**
* Legacy define, _ISO define not used anymore. All output is forced as utf-8.
* @deprecated As of version 1.5
*/
define('_ISO','charset=utf-8');
/**
* Legacy constant, use _JEXEC instead
* @deprecated As of version 1.5
*/
define( '_VALID_MOS', 1 );
/**
* Legacy constant, use _JEXEC instead
* @deprecated As of version 1.5
*/
define( '_MOS_MAMBO_INCLUDED', 1 );
/**
* Legacy constant, use DATE_FORMAT_LC instead
* @deprecated As of version 1.5
*/
DEFINE('_DATE_FORMAT_LC', JText::_('DATE_FORMAT_LC1') ); //Uses PHP's strftime Command Format
/**
* Legacy constant, use DATE_FORMAT_LC2 instead
* @deprecated As of version 1.5
*/
DEFINE('_DATE_FORMAT_LC2', JText::_('DATE_FORMAT_LC2'));
/**
* Legacy constant, use JFilterInput instead
* @deprecated As of version 1.5
*/
DEFINE( "_MOS_NOTRIM", 0x0001 );
/**
* Legacy constant, use JFilterInput instead
* @deprecated As of version 1.5
*/
DEFINE( "_MOS_ALLOWHTML", 0x0002 );
/**
* Legacy constant, use JFilterInput instead
* @deprecated As of version 1.5
*/
DEFINE( "_MOS_ALLOWRAW", 0x0004 );
/**
* Legacy global, use JVersion->getLongVersion() instead
* @name $_VERSION
* @deprecated As of version 1.5
*/
$GLOBALS['_VERSION'] = new JVersion();
$version = $GLOBALS['_VERSION']->getLongVersion();
/**
* Legacy global, use JFactory::getDBO() instead
* @name $database
* @deprecated As of version 1.5
*/
$conf =& JFactory::getConfig();
$GLOBALS['database'] = new database($conf->getValue('config.host'), $conf->getValue('config.user'), $conf->getValue('config.password'), $conf->getValue('config.db'), $conf->getValue('config.dbprefix'));
$GLOBALS['database']->debug($conf->getValue('config.debug'));
/**
* Legacy global, use JFactory::getUser() [JUser object] instead
* @name $my
* @deprecated As of version 1.5
*/
$user =& JFactory::getUser();
$GLOBALS['my'] = (object)$user->getProperties();
$GLOBALS['my']->gid = $user->get('aid', 0);
/**
* Insert configuration values into global scope (for backwards compatibility)
* @deprecated As of version 1.5
*/
$temp = new JConfig;
foreach (get_object_vars($temp) as $k => $v) {
$name = 'mosConfig_'.$k;
$GLOBALS[$name] = $v;
}
$GLOBALS['mosConfig_live_site'] = substr_replace(JURI::root(), '', -1, 1);
$GLOBALS['mosConfig_absolute_path'] = JPATH_SITE;
$GLOBALS['mosConfig_cachepath'] = JPATH_BASE.DS.'cache';
$GLOBALS['mosConfig_offset_user'] = 0;
$lang =& JFactory::getLanguage();
$GLOBALS['mosConfig_lang'] = $lang->getBackwardLang();
$config->setValue('config.live_site', $GLOBALS['mosConfig_live_site']);
$config->setValue('config.absolute_path', $GLOBALS['mosConfig_absolute_path']);
$config->setValue('config.lang', $GLOBALS['mosConfig_lang']);
/**
* Legacy global, use JFactory::getUser() instead
* @name $acl
* @deprecated As of version 1.5
*/
$acl =& JFactory::getACL();
// Legacy ACL's for backward compat
$acl->addACL( 'administration', 'edit', 'users', 'super administrator', 'components', 'all' );
$acl->addACL( 'administration', 'edit', 'users', 'administrator', 'components', 'all' );
$acl->addACL( 'administration', 'edit', 'users', 'super administrator', 'user properties', 'block_user' );
$acl->addACL( 'administration', 'manage', 'users', 'super administrator', 'components', 'com_users' );
$acl->addACL( 'administration', 'manage', 'users', 'administrator', 'components', 'com_users' );
$acl->addACL( 'administration', 'config', 'users', 'super administrator' );
//$acl->addACL( 'administration', 'config', 'users', 'administrator' );
$acl->addACL( 'action', 'add', 'users', 'author', 'content', 'all' );
$acl->addACL( 'action', 'add', 'users', 'editor', 'content', 'all' );
$acl->addACL( 'action', 'add', 'users', 'publisher', 'content', 'all' );
$acl->addACL( 'action', 'edit', 'users', 'author', 'content', 'own' );
$acl->addACL( 'action', 'edit', 'users', 'editor', 'content', 'all' );
$acl->addACL( 'action', 'edit', 'users', 'publisher', 'content', 'all' );
$acl->addACL( 'action', 'publish', 'users', 'publisher', 'content', 'all' );
$acl->addACL( 'action', 'add', 'users', 'manager', 'content', 'all' );
$acl->addACL( 'action', 'edit', 'users', 'manager', 'content', 'all' );
$acl->addACL( 'action', 'publish', 'users', 'manager', 'content', 'all' );
$acl->addACL( 'action', 'add', 'users', 'administrator', 'content', 'all' );
$acl->addACL( 'action', 'edit', 'users', 'administrator', 'content', 'all' );
$acl->addACL( 'action', 'publish', 'users', 'administrator', 'content', 'all' );
$acl->addACL( 'action', 'add', 'users', 'super administrator', 'content', 'all' );
$acl->addACL( 'action', 'edit', 'users', 'super administrator', 'content', 'all' );
$acl->addACL( 'action', 'publish', 'users', 'super administrator', 'content', 'all' );
$acl->addACL( 'com_syndicate', 'manage', 'users', 'super administrator' );
$acl->addACL( 'com_syndicate', 'manage', 'users', 'administrator' );
$acl->addACL( 'com_syndicate', 'manage', 'users', 'manager' );
$GLOBALS['acl'] =& $acl;
/**
* Legacy global
* @name $task
* @deprecated As of version 1.5
*/
$GLOBALS['task'] = JRequest::getString('task');
/**
* Load the site language file (the old way - to be deprecated)
* @deprecated As of version 1.5
*/
global $mosConfig_lang;
$mosConfig_lang = JFilterInput::clean($mosConfig_lang, 'cmd');
$file = JPATH_SITE.DS.'language'.DS.$mosConfig_lang.'.php';
if (file_exists( $file )) {
require_once( $file);
} else {
$file = JPATH_SITE.DS.'language'.DS.'english.php';
if (file_exists( $file )) {
require_once( $file );
}
}
/**
* Legacy global
* use JApplicaiton->registerEvent and JApplication->triggerEvent for event handling
* use JPlugingHelper::importPlugin to load bot code
* @deprecated As of version 1.5
*/
$GLOBALS['_MAMBOTS'] = new mosMambotHandler();
$mosmsg = JRequest::getVar( 'mosmsg' );
$mainframe->enqueueMessage( $mosmsg );
}
/**
* Fixes the $my global if the user was restored by the remember me plugin
*/
function onAfterInitialise()
{
$user =& JFactory::getUser();
if ($user->id) {
if ($GLOBALS['my']->id === 0) {
$GLOBALS['my'] = (object)$user->getProperties();
$GLOBALS['my']->gid = $user->get('aid', 0);
}
}
return true;
}
function onAfterRoute()
{
global $mainframe;
if ($mainframe->isAdmin()) {
return;
}
switch(JRequest::getCmd('option'))
{
case 'com_content' :
$this->routeContent();
break;
case 'com_newsfeeds' :
$this->routeNewsfeeds();
break;
case 'com_weblinks' :
$this->routeWeblinks();
break;
case 'com_frontpage' :
JRequest::setVar('option', 'com_content');
JRequest::setVar('view', 'frontpage');
break;
case 'com_login' :
JRequest::setVar('option', 'com_user');
JRequest::setVar('view', 'login');
break;
case 'com_registration' :
JRequest::setVar('option', 'com_user');
JRequest::setVar('view', 'register');
break;
}
/**
* Legacy global, use JApplication::getTemplate() instead
* @name $cur_template
* @deprecated As of version 1.5
*/
$GLOBALS['cur_template'] = $mainframe->getTemplate();
}
function routeContent()
{
$viewName = JRequest::getCmd( 'view', 'article' );
$layout = JRequest::getCmd( 'layout', 'default' );
// interceptors to support legacy urls
switch( JRequest::getCmd('task'))
{
//index.php?option=com_content&task=x&id=x&Itemid=x
case 'blogsection':
$viewName = 'section';
$layout = 'blog';
break;
case 'section':
$viewName = 'section';
break;
case 'category':
$viewName = 'category';
break;
case 'blogcategory':
$viewName = 'category';
$layout = 'blog';
break;
case 'archivesection':
case 'archivecategory':
$viewName = 'archive';
break;
case 'frontpage' :
$viewName = 'frontpage';
break;
case 'view':
$viewName = 'article';
break;
}
JRequest::setVar('layout', $layout);
JRequest::setVar('view', $viewName);
}
function routeNewsfeeds()
{
$viewName = JRequest::getCmd( 'view', 'categories' );
// interceptors to support legacy urls
switch( JRequest::getCmd('task'))
{
//index.php?option=com_newsfeeds&task=x&catid=xid=x&Itemid=x
case 'view':
$viewName = 'newsfeed';
break;
default:
{
if(JRequest::getInt('catid') && !JRequest::getCmd('view')) {
$viewName = 'category';
}
}
}
JRequest::setVar('view', $viewName);
}
function routeWeblinks()
{
$viewName = JRequest::getCmd( 'view', 'categories' );
// interceptors to support legacy urls
switch( JRequest::getCmd('task'))
{
//index.php?option=com_weblinks&task=x&catid=xid=x
case 'view':
$viewName = 'weblink';
break;
default:
{
if(($catid = JRequest::getInt('catid')) && !JRequest::getCmd('view')) {
$viewName = 'category';
JRequest::setVar('id', $catid);
}
}
}
JRequest::setVar('view', $viewName);
}
}
<?php
/**
* @version $Id: legacy.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 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! Debug plugin
*
* @package Joomla
* @subpackage System
*/
class plgSystemLegacy 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.0
*/
function plgSystemLegacy(& $subject, $config)
{
parent::__construct($subject, $config);
global $mainframe;
// Define the 1.0 legacy mode constant
define('_JLEGACY', '1.0');
// Set global configuration var for legacy mode
$config = &JFactory::getConfig();
$config->setValue('config.legacy', 1);
// Import library dependencies
require_once(dirname(__FILE__).DS.'legacy'.DS.'classes.php');
require_once(dirname(__FILE__).DS.'legacy'.DS.'functions.php');
// Register legacy classes for autoloading
JLoader::register('mosAdminMenus' , dirname(__FILE__).DS.'legacy'.DS.'adminmenus.php');
JLoader::register('mosCache' , dirname(__FILE__).DS.'legacy'.DS.'cache.php');
JLoader::register('mosCategory' , dirname(__FILE__).DS.'legacy'.DS.'category.php');
JLoader::register('mosCommonHTML' , dirname(__FILE__).DS.'legacy'.DS.'commonhtml.php');
JLoader::register('mosComponent' , dirname(__FILE__).DS.'legacy'.DS.'component.php');
JLoader::register('mosContent' , dirname(__FILE__).DS.'legacy'.DS.'content.php');
JLoader::register('mosDBTable' , dirname(__FILE__).DS.'legacy'.DS.'dbtable.php');
JLoader::register('mosHTML' , dirname(__FILE__).DS.'legacy'.DS.'html.php');
JLoader::register('mosInstaller' , dirname(__FILE__).DS.'legacy'.DS.'installer.php');
JLoader::register('mosMainFrame' , dirname(__FILE__).DS.'legacy'.DS.'mainframe.php');
JLoader::register('mosMambot' , dirname(__FILE__).DS.'legacy'.DS.'mambot.php');
JLoader::register('mosMambotHandler', dirname(__FILE__).DS.'legacy'.DS.'mambothandler.php');
JLoader::register('mosMenu' , dirname(__FILE__).DS.'legacy'.DS.'menu.php');
JLoader::register('mosMenuBar' , dirname(__FILE__).DS.'legacy'.DS.'menubar.php');
JLoader::register('mosModule' , dirname(__FILE__).DS.'legacy'.DS.'module.php');
//JLoader::register('mosPageNav' , dirname(__FILE__).DS.'legacy'.DS.'pagination.php');
JLoader::register('mosParameters' , dirname(__FILE__).DS.'legacy'.DS.'parameters.php');
JLoader::register('patFactory' , dirname(__FILE__).DS.'legacy'.DS.'patfactory.php');
JLoader::register('mosProfiler' , dirname(__FILE__).DS.'legacy'.DS.'profiler.php');
JLoader::register('mosSection' , dirname(__FILE__).DS.'legacy'.DS.'section.php');
JLoader::register('mosSession' , dirname(__FILE__).DS.'legacy'.DS.'session.php');
JLoader::register('mosToolbar' , dirname(__FILE__).DS.'legacy'.DS.'toolbar.php');
JLoader::register('mosUser' , dirname(__FILE__).DS.'legacy'.DS.'user.php');
// Register class for the database, depends on which db type has been selected for use
$dbtype = $config->getValue('config.dbtype', 'mysql');
JLoader::register('database' , dirname(__FILE__).DS.'legacy'.DS.$dbtype.'.php');
/**
* Legacy define, _ISO define not used anymore. All output is forced as utf-8.
* @deprecated As of version 1.5
*/
define('_ISO','charset=utf-8');
/**
* Legacy constant, use _JEXEC instead
* @deprecated As of version 1.5
*/
define( '_VALID_MOS', 1 );
/**
* Legacy constant, use _JEXEC instead
* @deprecated As of version 1.5
*/
define( '_MOS_MAMBO_INCLUDED', 1 );
/**
* Legacy constant, use DATE_FORMAT_LC instead
* @deprecated As of version 1.5
*/
DEFINE('_DATE_FORMAT_LC', JText::_('DATE_FORMAT_LC1') ); //Uses PHP's strftime Command Format
/**
* Legacy constant, use DATE_FORMAT_LC2 instead
* @deprecated As of version 1.5
*/
DEFINE('_DATE_FORMAT_LC2', JText::_('DATE_FORMAT_LC2'));
/**
* Legacy constant, use JFilterInput instead
* @deprecated As of version 1.5
*/
DEFINE( "_MOS_NOTRIM", 0x0001 );
/**
* Legacy constant, use JFilterInput instead
* @deprecated As of version 1.5
*/
DEFINE( "_MOS_ALLOWHTML", 0x0002 );
/**
* Legacy constant, use JFilterInput instead
* @deprecated As of version 1.5
*/
DEFINE( "_MOS_ALLOWRAW", 0x0004 );
/**
* Legacy global, use JVersion->getLongVersion() instead
* @name $_VERSION
* @deprecated As of version 1.5
*/
$GLOBALS['_VERSION'] = new JVersion();
$version = $GLOBALS['_VERSION']->getLongVersion();
/**
* Legacy global, use JFactory::getDBO() instead
* @name $database
* @deprecated As of version 1.5
*/
$conf =& JFactory::getConfig();
$GLOBALS['database'] = new database($conf->getValue('config.host'), $conf->getValue('config.user'), $conf->getValue('config.password'), $conf->getValue('config.db'), $conf->getValue('config.dbprefix'));
$GLOBALS['database']->debug($conf->getValue('config.debug'));
/**
* Legacy global, use JFactory::getUser() [JUser object] instead
* @name $my
* @deprecated As of version 1.5
*/
$user =& JFactory::getUser();
$GLOBALS['my'] = (object)$user->getProperties();
$GLOBALS['my']->gid = $user->get('aid', 0);
/**
* Insert configuration values into global scope (for backwards compatibility)
* @deprecated As of version 1.5
*/
$temp = new JConfig;
foreach (get_object_vars($temp) as $k => $v) {
$name = 'mosConfig_'.$k;
$GLOBALS[$name] = $v;
}
$GLOBALS['mosConfig_live_site'] = substr_replace(JURI::root(), '', -1, 1);
$GLOBALS['mosConfig_absolute_path'] = JPATH_SITE;
$GLOBALS['mosConfig_cachepath'] = JPATH_BASE.DS.'cache';
$GLOBALS['mosConfig_offset_user'] = 0;
$lang =& JFactory::getLanguage();
$GLOBALS['mosConfig_lang'] = $lang->getBackwardLang();
$config->setValue('config.live_site', $GLOBALS['mosConfig_live_site']);
$config->setValue('config.absolute_path', $GLOBALS['mosConfig_absolute_path']);
$config->setValue('config.lang', $GLOBALS['mosConfig_lang']);
/**
* Legacy global, use JFactory::getUser() instead
* @name $acl
* @deprecated As of version 1.5
*/
$acl =& JFactory::getACL();
// Legacy ACL's for backward compat
$acl->addACL( 'administration', 'edit', 'users', 'super administrator', 'components', 'all' );
$acl->addACL( 'administration', 'edit', 'users', 'administrator', 'components', 'all' );
$acl->addACL( 'administration', 'edit', 'users', 'super administrator', 'user properties', 'block_user' );
$acl->addACL( 'administration', 'manage', 'users', 'super administrator', 'components', 'com_users' );
$acl->addACL( 'administration', 'manage', 'users', 'administrator', 'components', 'com_users' );
$acl->addACL( 'administration', 'config', 'users', 'super administrator' );
//$acl->addACL( 'administration', 'config', 'users', 'administrator' );
$acl->addACL( 'action', 'add', 'users', 'author', 'content', 'all' );
$acl->addACL( 'action', 'add', 'users', 'editor', 'content', 'all' );
$acl->addACL( 'action', 'add', 'users', 'publisher', 'content', 'all' );
$acl->addACL( 'action', 'edit', 'users', 'author', 'content', 'own' );
$acl->addACL( 'action', 'edit', 'users', 'editor', 'content', 'all' );
$acl->addACL( 'action', 'edit', 'users', 'publisher', 'content', 'all' );
$acl->addACL( 'action', 'publish', 'users', 'publisher', 'content', 'all' );
$acl->addACL( 'action', 'add', 'users', 'manager', 'content', 'all' );
$acl->addACL( 'action', 'edit', 'users', 'manager', 'content', 'all' );
$acl->addACL( 'action', 'publish', 'users', 'manager', 'content', 'all' );
$acl->addACL( 'action', 'add', 'users', 'administrator', 'content', 'all' );
$acl->addACL( 'action', 'edit', 'users', 'administrator', 'content', 'all' );
$acl->addACL( 'action', 'publish', 'users', 'administrator', 'content', 'all' );
$acl->addACL( 'action', 'add', 'users', 'super administrator', 'content', 'all' );
$acl->addACL( 'action', 'edit', 'users', 'super administrator', 'content', 'all' );
$acl->addACL( 'action', 'publish', 'users', 'super administrator', 'content', 'all' );
$acl->addACL( 'com_syndicate', 'manage', 'users', 'super administrator' );
$acl->addACL( 'com_syndicate', 'manage', 'users', 'administrator' );
$acl->addACL( 'com_syndicate', 'manage', 'users', 'manager' );
$GLOBALS['acl'] =& $acl;
/**
* Legacy global
* @name $task
* @deprecated As of version 1.5
*/
$GLOBALS['task'] = JRequest::getString('task');
/**
* Load the site language file (the old way - to be deprecated)
* @deprecated As of version 1.5
*/
global $mosConfig_lang;
$mosConfig_lang = JFilterInput::clean($mosConfig_lang, 'cmd');
$file = JPATH_SITE.DS.'language'.DS.$mosConfig_lang.'.php';
if (file_exists( $file )) {
require_once( $file);
} else {
$file = JPATH_SITE.DS.'language'.DS.'english.php';
if (file_exists( $file )) {
require_once( $file );
}
}
/**
* Legacy global
* use JApplicaiton->registerEvent and JApplication->triggerEvent for event handling
* use JPlugingHelper::importPlugin to load bot code
* @deprecated As of version 1.5
*/
$GLOBALS['_MAMBOTS'] = new mosMambotHandler();
$mosmsg = JRequest::getVar( 'mosmsg' );
$mainframe->enqueueMessage( $mosmsg );
}
/**
* Fixes the $my global if the user was restored by the remember me plugin
*/
function onAfterInitialise()
{
$user =& JFactory::getUser();
if ($user->id) {
if ($GLOBALS['my']->id === 0) {
$GLOBALS['my'] = (object)$user->getProperties();
$GLOBALS['my']->gid = $user->get('aid', 0);
}
}
return true;
}
function onAfterRoute()
{
global $mainframe;
if ($mainframe->isAdmin()) {
return;
}
switch(JRequest::getCmd('option'))
{
case 'com_content' :
$this->routeContent();
break;
case 'com_newsfeeds' :
$this->routeNewsfeeds();
break;
case 'com_weblinks' :
$this->routeWeblinks();
break;
case 'com_frontpage' :
JRequest::setVar('option', 'com_content');
JRequest::setVar('view', 'frontpage');
break;
case 'com_login' :
JRequest::setVar('option', 'com_user');
JRequest::setVar('view', 'login');
break;
case 'com_registration' :
JRequest::setVar('option', 'com_user');
JRequest::setVar('view', 'register');
break;
}
/**
* Legacy global, use JApplication::getTemplate() instead
* @name $cur_template
* @deprecated As of version 1.5
*/
$GLOBALS['cur_template'] = $mainframe->getTemplate();
}
function routeContent()
{
$viewName = JRequest::getCmd( 'view', 'article' );
$layout = JRequest::getCmd( 'layout', 'default' );
// interceptors to support legacy urls
switch( JRequest::getCmd('task'))
{
//index.php?option=com_content&task=x&id=x&Itemid=x
case 'blogsection':
$viewName = 'section';
$layout = 'blog';
break;
case 'section':
$viewName = 'section';
break;
case 'category':
$viewName = 'category';
break;
case 'blogcategory':
$viewName = 'category';
$layout = 'blog';
break;
case 'archivesection':
case 'archivecategory':
$viewName = 'archive';
break;
case 'frontpage' :
$viewName = 'frontpage';
break;
case 'view':
$viewName = 'article';
break;
}
JRequest::setVar('layout', $layout);
JRequest::setVar('view', $viewName);
}
function routeNewsfeeds()
{
$viewName = JRequest::getCmd( 'view', 'categories' );
// interceptors to support legacy urls
switch( JRequest::getCmd('task'))
{
//index.php?option=com_newsfeeds&task=x&catid=xid=x&Itemid=x
case 'view':
$viewName = 'newsfeed';
break;
default:
{
if(JRequest::getInt('catid') && !JRequest::getCmd('view')) {
$viewName = 'category';
}
}
}
JRequest::setVar('view', $viewName);
}
function routeWeblinks()
{
$viewName = JRequest::getCmd( 'view', 'categories' );
// interceptors to support legacy urls
switch( JRequest::getCmd('task'))
{
//index.php?option=com_weblinks&task=x&catid=xid=x
case 'view':
$viewName = 'weblink';
break;
default:
{
if(($catid = JRequest::getInt('catid')) && !JRequest::getCmd('view')) {
$viewName = 'category';
JRequest::setVar('id', $catid);
}
}
}
JRequest::setVar('view', $viewName);
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
<name>System - Legacy</name>
<author>Joomla! Project</author>
<creationDate>January 2007</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 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>
@@ -1,416 +1,416 @@
<?php
/**
* @version $Id: adminmenus.php 10381 2008-06-01 03:35:53Z pasamio $
* @package Joomla.Legacy
* @subpackage 1.5
* @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 within the rest of the framework
defined('JPATH_BASE') or die();
/**
* Utility class for drawing admin menu HTML elements
*
* @static
* @package Joomla.Legacy
* @subpackage 1.5
* @since 1.0
* @deprecated As of version 1.5
*/
class mosAdminMenus
{
/**
* Legacy function, use {@link JHTML::_('menu.ordering')} instead
*
* @deprecated As of version 1.5
*/
function Ordering( &$row, $id )
{
return JHTML::_('menu.ordering', $row, $id);
}
/**
* Legacy function, use {@link JHTML::_('list.accesslevel', )} instead
*
* @deprecated As of version 1.5
*/
function Access( &$row )
{
return JHTML::_('list.accesslevel', $row);
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function Published( &$row )
{
$published = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published );
return $published;
}
/**
* Legacy function, use {@link JAdminMenus::MenuLinks()} instead
*
* @deprecated As of version 1.5
*/
function MenuLinks( &$lookup, $all=NULL, $none=NULL, $unassigned=1 )
{
$options = JHTML::_('menu.linkoptions', $lookup, $all, $none|$unassigned);
if (empty( $lookup )) {
$lookup = array( JHTML::_('select.option', -1 ) );
}
$pages = JHTML::_('select.genericlist', $options, 'selections[]', 'class="inputbox" size="15" multiple="multiple"', 'value', 'text', $lookup, 'selections' );
return $pages;
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function Category( &$menu, $id, $javascript='' )
{
$db =& JFactory::getDBO();
$query = 'SELECT c.id AS `value`, c.section AS `id`, CONCAT_WS( " / ", s.title, c.title) AS `text`'
. ' FROM #__sections AS s'
. ' INNER JOIN #__categories AS c ON c.section = s.id'
. ' WHERE s.scope = "content"'
. ' ORDER BY s.name, c.name'
;
$db->setQuery( $query );
$rows = $db->loadObjectList();
$category = '';
$category .= JHTML::_('select.genericlist', $rows, 'componentid', 'class="inputbox" size="10"'. $javascript, 'value', 'text', $menu->componentid );
$category .= '<input type="hidden" name="link" value="" />';
return $category;
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function Section( &$menu, $id, $all=0 )
{
$db =& JFactory::getDBO();
$query = 'SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`'
. ' FROM #__sections AS s'
. ' WHERE s.scope = "content"'
. ' ORDER BY s.name'
;
$db->setQuery( $query );
if ( $all ) {
$rows[] = JHTML::_('select.option', 0, '- '. JText::_( 'All Sections' ) .' -' );
$rows = array_merge( $rows, $db->loadObjectList() );
} else {
$rows = $db->loadObjectList();
}
$section = JHTML::_('select.genericlist', $rows, 'componentid', 'class="inputbox" size="10"', 'value', 'text', $menu->componentid );
$section .= '<input type="hidden" name="link" value="" />';
return $section;
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function Component( &$menu, $id )
{
$db =& JFactory::getDBO();
$query = 'SELECT c.id AS value, c.name AS text, c.link'
. ' FROM #__components AS c'
. ' WHERE c.link <> ""'
. ' ORDER BY c.name'
;
$db->setQuery( $query );
$rows = $db->loadObjectList( );
$component = JHTML::_('select.genericlist', $rows, 'componentid', 'class="inputbox" size="10"', 'value', 'text', $menu->componentid, '', 1 );
return $component;
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function ComponentName( &$menu, $id )
{
$db =& JFactory::getDBO();
$query = 'SELECT c.id AS value, c.name AS text, c.link'
. ' FROM #__components AS c'
. ' WHERE c.link <> ""'
. ' ORDER BY c.name'
;
$db->setQuery( $query );
$rows = $db->loadObjectList( );
$component = 'Component';
foreach ( $rows as $row ) {
if ( $row->value == $menu->componentid ) {
$component = JText::_( $row->text );
}
}
return $component;
}
/**
* Legacy function, use {@link JHTML::_('list.images', )} instead
*
* @deprecated As of version 1.5
*/
function Images( $name, &$active, $javascript=NULL, $directory=NULL )
{
return JHTML::_('list.images', $name, $active, $javascript, $directory);
}
/**
* Legacy function, use {@link JHTML::_('list.specificordering', )} instead
*
* @deprecated As of version 1.5
*/
function SpecificOrdering( &$row, $id, $query, $neworder=0 )
{
return JHTML::_('list.specificordering', $row, $id, $query, $neworder);
}
/**
* Legacy function, use {@link JHTML::_('list.users', )} instead
*
* @deprecated As of version 1.5
*/
function UserSelect( $name, $active, $nouser=0, $javascript=NULL, $order='name', $reg=1 )
{
return JHTML::_('list.users', $name, $active, $nouser, $javascript, $order, $reg);
}
/**
* Legacy function, use {@link JHTML::_('list.positions', )} instead
*
* @deprecated As of version 1.5
*/
function Positions( $name, $active=NULL, $javascript=NULL, $none=1, $center=1, $left=1, $right=1, $id=false )
{
return JHTML::_('list.positions', $name, $active, $javascript, $none, $center, $left, $right, $id);
}
/**
* Legacy function, use {@link JHTML::_('list.category', )} instead
*
* @deprecated As of version 1.5
*/
function ComponentCategory( $name, $section, $active=NULL, $javascript=NULL, $order='ordering', $size=1, $sel_cat=1 )
{
return JHTML::_('list.category', $name, $section, $active, $javascript, $order, $size, $sel_cat);
}
/**
* Legacy function, use {@link JHTML::_('list.section', )} instead
*
* @deprecated As of version 1.5
*/
function SelectSection( $name, $active=NULL, $javascript=NULL, $order='ordering' )
{
return JHTML::_('list.section', $name, $active, $javascript, $order);
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function Links2Menu( $type, $and )
{
$db =& JFactory::getDBO();
$query = 'SELECT * '
. ' FROM #__menu '
. ' WHERE type = '.$db->Quote($type)
. ' AND published = 1'
. $and
;
$db->setQuery( $query );
$menus = $db->loadObjectList();
return $menus;
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function MenuSelect( $name='menuselect', $javascript=NULL )
{
$db =& JFactory::getDBO();
$query = 'SELECT params'
. ' FROM #__modules'
. ' WHERE module = "mod_mainmenu"'
;
$db->setQuery( $query );
$menus = $db->loadObjectList();
$total = count( $menus );
$menuselect = array();
for( $i = 0; $i < $total; $i++ )
{
$registry = new JRegistry();
$registry->loadINI($menus[$i]->params);
$params = $registry->toObject( );
$menuselect[$i]->value = $params->menutype;
$menuselect[$i]->text = $params->menutype;
}
// sort array of objects
JArrayHelper::sortObjects( $menuselect, 'text', 1 );
$menus = JHTML::_('select.genericlist', $menuselect, $name, 'class="inputbox" size="10" '. $javascript, 'value', 'text' );
return $menus;
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function ReadImages( $imagePath, $folderPath, &$folders, &$images )
{
jimport( 'joomla.filesystem.folder' );
$imgFiles = JFolder::files( $imagePath );
foreach ($imgFiles as $file)
{
$ff_ = $folderPath.DS.$file;
$ff = $folderPath.DS.$file;
$i_f = $imagePath .'/'. $file;
if ( is_dir( $i_f ) && $file <> 'CVS' && $file <> '.svn') {
$folders[] = JHTML::_('select.option', $ff_ );
mosAdminMenus::ReadImages( $i_f, $ff_, $folders, $images );
} else if ( eregi( "bmp|gif|jpg|png", $file ) && is_file( $i_f ) ) {
// leading / we don't need
$imageFile = substr( $ff, 1 );
$images[$folderPath][] = JHTML::_('select.option', $imageFile, $file );
}
}
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function GetImageFolders( &$folders, $path )
{
$javascript = "onchange=\"changeDynaList( 'imagefiles', folderimages, document.adminForm.folders.options[document.adminForm.folders.selectedIndex].value, 0, 0); previewImage( 'imagefiles', 'view_imagefiles', '$path/' );\"";
$getfolders = JHTML::_('select.genericlist', $folders, 'folders', 'class="inputbox" size="1" '. $javascript, 'value', 'text', '/' );
return $getfolders;
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function GetImages( &$images, $path )
{
if ( !isset($images['/'] ) ) {
$images['/'][] = JHTML::_('select.option', '' );
}
//$javascript = "onchange=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\" onfocus=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\"";
$javascript = "onchange=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\"";
$getimages = JHTML::_('select.genericlist', $images['/'], 'imagefiles', 'class="inputbox" size="10" multiple="multiple" '. $javascript , 'value', 'text', null );
return $getimages;
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function GetSavedImages( &$row, $path )
{
$images2 = array();
foreach( $row->images as $file ) {
$temp = explode( '|', $file );
if( strrchr($temp[0], '/') ) {
$filename = substr( strrchr($temp[0], '/' ), 1 );
} else {
$filename = $temp[0];
}
$images2[] = JHTML::_('select.option', $file, $filename );
}
//$javascript = "onchange=\"previewImage( 'imagelist', 'view_imagelist', '$path/' ); showImageProps( '$path/' ); \" onfocus=\"previewImage( 'imagelist', 'view_imagelist', '$path/' )\"";
$javascript = "onchange=\"previewImage( 'imagelist', 'view_imagelist', '$path/' ); showImageProps( '$path/' ); \"";
$imagelist = JHTML::_('select.genericlist', $images2, 'imagelist', 'class="inputbox" size="10" '. $javascript, 'value', 'text' );
return $imagelist;
}
/**
* Legacy function, use {@link JHTML::_('image.site')} instead
*
* @deprecated As of version 1.5
*/
function ImageCheck( $file, $directory='/images/M_images/', $param=NULL, $param_directory='/images/M_images/', $alt=NULL, $name='image', $type=1, $align='top' )
{
$attribs = array('align' => $align);
return JHTML::_('image.site', $file, $directory, $param, $param_directory, $alt, $attribs, $type);
}
/**
* Legacy function, use {@link JHTML::_('image.administrator')} instead
*
* @deprecated As of version 1.5
*/
function ImageCheckAdmin( $file, $directory='/images/', $param=NULL, $param_directory='/images/', $alt=NULL, $name=NULL, $type=1, $align='middle' )
{
$attribs = array('align' => $align);
return JHTML::_('image.administrator', $file, $directory, $param, $param_directory, $alt, $attribs, $type);
}
/**
* Legacy function, use {@link MenusHelper::getMenuTypes()} instead
*
* @deprecated As of version 1.5
*/
function menutypes()
{
JError::raiseNotice( 0, 'mosAdminMenus::menutypes method deprecated' );
}
/**
* Legacy function, use {@link MenusHelper::menuItem()} instead
*
* @deprecated As of version 1.5
*/
function menuItem( $item )
{
JError::raiseNotice( 0, 'mosAdminMenus::menuItem method deprecated' );
}
}
<?php
/**
* @version $Id: adminmenus.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla.Legacy
* @subpackage 1.5
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();
/**
* Utility class for drawing admin menu HTML elements
*
* @static
* @package Joomla.Legacy
* @subpackage 1.5
* @since 1.0
* @deprecated As of version 1.5
*/
class mosAdminMenus
{
/**
* Legacy function, use {@link JHTML::_('menu.ordering')} instead
*
* @deprecated As of version 1.5
*/
function Ordering( &$row, $id )
{
return JHTML::_('menu.ordering', $row, $id);
}
/**
* Legacy function, use {@link JHTML::_('list.accesslevel', )} instead
*
* @deprecated As of version 1.5
*/
function Access( &$row )
{
return JHTML::_('list.accesslevel', $row);
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function Published( &$row )
{
$published = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published );
return $published;
}
/**
* Legacy function, use {@link JAdminMenus::MenuLinks()} instead
*
* @deprecated As of version 1.5
*/
function MenuLinks( &$lookup, $all=NULL, $none=NULL, $unassigned=1 )
{
$options = JHTML::_('menu.linkoptions', $lookup, $all, $none|$unassigned);
if (empty( $lookup )) {
$lookup = array( JHTML::_('select.option', -1 ) );
}
$pages = JHTML::_('select.genericlist', $options, 'selections[]', 'class="inputbox" size="15" multiple="multiple"', 'value', 'text', $lookup, 'selections' );
return $pages;
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function Category( &$menu, $id, $javascript='' )
{
$db =& JFactory::getDBO();
$query = 'SELECT c.id AS `value`, c.section AS `id`, CONCAT_WS( " / ", s.title, c.title) AS `text`'
. ' FROM #__sections AS s'
. ' INNER JOIN #__categories AS c ON c.section = s.id'
. ' WHERE s.scope = "content"'
. ' ORDER BY s.name, c.name'
;
$db->setQuery( $query );
$rows = $db->loadObjectList();
$category = '';
$category .= JHTML::_('select.genericlist', $rows, 'componentid', 'class="inputbox" size="10"'. $javascript, 'value', 'text', $menu->componentid );
$category .= '<input type="hidden" name="link" value="" />';
return $category;
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function Section( &$menu, $id, $all=0 )
{
$db =& JFactory::getDBO();
$query = 'SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`'
. ' FROM #__sections AS s'
. ' WHERE s.scope = "content"'
. ' ORDER BY s.name'
;
$db->setQuery( $query );
if ( $all ) {
$rows[] = JHTML::_('select.option', 0, '- '. JText::_( 'All Sections' ) .' -' );
$rows = array_merge( $rows, $db->loadObjectList() );
} else {
$rows = $db->loadObjectList();
}
$section = JHTML::_('select.genericlist', $rows, 'componentid', 'class="inputbox" size="10"', 'value', 'text', $menu->componentid );
$section .= '<input type="hidden" name="link" value="" />';
return $section;
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function Component( &$menu, $id )
{
$db =& JFactory::getDBO();
$query = 'SELECT c.id AS value, c.name AS text, c.link'
. ' FROM #__components AS c'
. ' WHERE c.link <> ""'
. ' ORDER BY c.name'
;
$db->setQuery( $query );
$rows = $db->loadObjectList( );
$component = JHTML::_('select.genericlist', $rows, 'componentid', 'class="inputbox" size="10"', 'value', 'text', $menu->componentid, '', 1 );
return $component;
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function ComponentName( &$menu, $id )
{
$db =& JFactory::getDBO();
$query = 'SELECT c.id AS value, c.name AS text, c.link'
. ' FROM #__components AS c'
. ' WHERE c.link <> ""'
. ' ORDER BY c.name'
;
$db->setQuery( $query );
$rows = $db->loadObjectList( );
$component = 'Component';
foreach ( $rows as $row ) {
if ( $row->value == $menu->componentid ) {
$component = JText::_( $row->text );
}
}
return $component;
}
/**
* Legacy function, use {@link JHTML::_('list.images', )} instead
*
* @deprecated As of version 1.5
*/
function Images( $name, &$active, $javascript=NULL, $directory=NULL )
{
return JHTML::_('list.images', $name, $active, $javascript, $directory);
}
/**
* Legacy function, use {@link JHTML::_('list.specificordering', )} instead
*
* @deprecated As of version 1.5
*/
function SpecificOrdering( &$row, $id, $query, $neworder=0 )
{
return JHTML::_('list.specificordering', $row, $id, $query, $neworder);
}
/**
* Legacy function, use {@link JHTML::_('list.users', )} instead
*
* @deprecated As of version 1.5
*/
function UserSelect( $name, $active, $nouser=0, $javascript=NULL, $order='name', $reg=1 )
{
return JHTML::_('list.users', $name, $active, $nouser, $javascript, $order, $reg);
}
/**
* Legacy function, use {@link JHTML::_('list.positions', )} instead
*
* @deprecated As of version 1.5
*/
function Positions( $name, $active=NULL, $javascript=NULL, $none=1, $center=1, $left=1, $right=1, $id=false )
{
return JHTML::_('list.positions', $name, $active, $javascript, $none, $center, $left, $right, $id);
}
/**
* Legacy function, use {@link JHTML::_('list.category', )} instead
*
* @deprecated As of version 1.5
*/
function ComponentCategory( $name, $section, $active=NULL, $javascript=NULL, $order='ordering', $size=1, $sel_cat=1 )
{
return JHTML::_('list.category', $name, $section, $active, $javascript, $order, $size, $sel_cat);
}
/**
* Legacy function, use {@link JHTML::_('list.section', )} instead
*
* @deprecated As of version 1.5
*/
function SelectSection( $name, $active=NULL, $javascript=NULL, $order='ordering' )
{
return JHTML::_('list.section', $name, $active, $javascript, $order);
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function Links2Menu( $type, $and )
{
$db =& JFactory::getDBO();
$query = 'SELECT * '
. ' FROM #__menu '
. ' WHERE type = '.$db->Quote($type)
. ' AND published = 1'
. $and
;
$db->setQuery( $query );
$menus = $db->loadObjectList();
return $menus;
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function MenuSelect( $name='menuselect', $javascript=NULL )
{
$db =& JFactory::getDBO();
$query = 'SELECT params'
. ' FROM #__modules'
. ' WHERE module = "mod_mainmenu"'
;
$db->setQuery( $query );
$menus = $db->loadObjectList();
$total = count( $menus );
$menuselect = array();
for( $i = 0; $i < $total; $i++ )
{
$registry = new JRegistry();
$registry->loadINI($menus[$i]->params);
$params = $registry->toObject( );
$menuselect[$i]->value = $params->menutype;
$menuselect[$i]->text = $params->menutype;
}
// sort array of objects
JArrayHelper::sortObjects( $menuselect, 'text', 1 );
$menus = JHTML::_('select.genericlist', $menuselect, $name, 'class="inputbox" size="10" '. $javascript, 'value', 'text' );
return $menus;
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function ReadImages( $imagePath, $folderPath, &$folders, &$images )
{
jimport( 'joomla.filesystem.folder' );
$imgFiles = JFolder::files( $imagePath );
foreach ($imgFiles as $file)
{
$ff_ = $folderPath.DS.$file;
$ff = $folderPath.DS.$file;
$i_f = $imagePath .'/'. $file;
if ( is_dir( $i_f ) && $file <> 'CVS' && $file <> '.svn') {
$folders[] = JHTML::_('select.option', $ff_ );
mosAdminMenus::ReadImages( $i_f, $ff_, $folders, $images );
} else if ( preg_match( "#bmp|gif|jpg|png#i", $file ) && is_file( $i_f ) ) {
// leading / we don't need
$imageFile = substr( $ff, 1 );
$images[$folderPath][] = JHTML::_('select.option', $imageFile, $file );
}
}
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function GetImageFolders( &$folders, $path )
{
$javascript = "onchange=\"changeDynaList( 'imagefiles', folderimages, document.adminForm.folders.options[document.adminForm.folders.selectedIndex].value, 0, 0); previewImage( 'imagefiles', 'view_imagefiles', '$path/' );\"";
$getfolders = JHTML::_('select.genericlist', $folders, 'folders', 'class="inputbox" size="1" '. $javascript, 'value', 'text', '/' );
return $getfolders;
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function GetImages( &$images, $path )
{
if ( !isset($images['/'] ) ) {
$images['/'][] = JHTML::_('select.option', '' );
}
//$javascript = "onchange=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\" onfocus=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\"";
$javascript = "onchange=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\"";
$getimages = JHTML::_('select.genericlist', $images['/'], 'imagefiles', 'class="inputbox" size="10" multiple="multiple" '. $javascript , 'value', 'text', null );
return $getimages;
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function GetSavedImages( &$row, $path )
{
$images2 = array();
foreach( $row->images as $file ) {
$temp = explode( '|', $file );
if( strrchr($temp[0], '/') ) {
$filename = substr( strrchr($temp[0], '/' ), 1 );
} else {
$filename = $temp[0];
}
$images2[] = JHTML::_('select.option', $file, $filename );
}
//$javascript = "onchange=\"previewImage( 'imagelist', 'view_imagelist', '$path/' ); showImageProps( '$path/' ); \" onfocus=\"previewImage( 'imagelist', 'view_imagelist', '$path/' )\"";
$javascript = "onchange=\"previewImage( 'imagelist', 'view_imagelist', '$path/' ); showImageProps( '$path/' ); \"";
$imagelist = JHTML::_('select.genericlist', $images2, 'imagelist', 'class="inputbox" size="10" '. $javascript, 'value', 'text' );
return $imagelist;
}
/**
* Legacy function, use {@link JHTML::_('image.site')} instead
*
* @deprecated As of version 1.5
*/
function ImageCheck( $file, $directory='/images/M_images/', $param=NULL, $param_directory='/images/M_images/', $alt=NULL, $name='image', $type=1, $align='top' )
{
$attribs = array('align' => $align);
return JHTML::_('image.site', $file, $directory, $param, $param_directory, $alt, $attribs, $type);
}
/**
* Legacy function, use {@link JHTML::_('image.administrator')} instead
*
* @deprecated As of version 1.5
*/
function ImageCheckAdmin( $file, $directory='/images/', $param=NULL, $param_directory='/images/', $alt=NULL, $name=NULL, $type=1, $align='middle' )
{
$attribs = array('align' => $align);
return JHTML::_('image.administrator', $file, $directory, $param, $param_directory, $alt, $attribs, $type);
}
/**
* Legacy function, use {@link MenusHelper::getMenuTypes()} instead
*
* @deprecated As of version 1.5
*/
function menutypes()
{
JError::raiseNotice( 0, 'mosAdminMenus::menutypes method deprecated' );
}
/**
* Legacy function, use {@link MenusHelper::menuItem()} instead
*
* @deprecated As of version 1.5
*/
function menuItem( $item )
{
JError::raiseNotice( 0, 'mosAdminMenus::menuItem method deprecated' );
}
}
@@ -1,42 +1,42 @@
<?php
/**
* @version $Id: cache.php 10381 2008-06-01 03:35:53Z pasamio $
* @package Joomla.Legacy
* @subpackage 1.5
* @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 within the rest of the framework
defined('JPATH_BASE') or die();
/**
* Legacy class, use &{@link JFactory::getCache()} instead
*
* @deprecated As of version 1.5
* @package Joomla.Legacy
* @subpackage 1.5
*/
class mosCache
{
/**
* @return object A function cache object
*/
function &getCache( $group='' )
{
return JFactory::getCache($group);
}
/**
* Cleans the cache
*/
function cleanCache( $group=false )
{
$cache =& JFactory::getCache($group);
$cache->clean($group);
}
<?php
/**
* @version $Id: cache.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla.Legacy
* @subpackage 1.5
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();
/**
* Legacy class, use &{@link JFactory::getCache()} instead
*
* @deprecated As of version 1.5
* @package Joomla.Legacy
* @subpackage 1.5
*/
class mosCache
{
/**
* @return object A function cache object
*/
function &getCache( $group='' )
{
return JFactory::getCache($group);
}
/**
* Cleans the cache
*/
function cleanCache( $group=false )
{
$cache =& JFactory::getCache($group);
$cache->clean($group);
}
}

Some files were not shown because too many files have changed in this diff Show More