feat(deployed): add JCK Editor 6.4.4 (no-source, vetted live)
JCK Editor (WebxSolution, com_jckman 6.4.4 + editors/jckeditor 6.6.2); dead vendor, no upstream -> deployed files; manual CVE-2018-17254 mitigation on menunodes.php preserved. Signed-off-by: LÁZÁR Imre <imre@illusion.hu> Assisted-by: claude-code@claude-opus-4-8
This commit is contained in:
parent
b2bc981aab
commit
9a2654b4fc
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<access component="com_jckman">
|
||||||
|
<section name="component">
|
||||||
|
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
|
||||||
|
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
|
||||||
|
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
|
||||||
|
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
|
||||||
|
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
|
||||||
|
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
|
||||||
|
|
||||||
|
<action name="jckman.install" title="JACTION_INSTALL_LBL" description="JACTION_INSTALL_DESC" />
|
||||||
|
<action name="jckman.uninstall" title="JACTION_UNINSTALL_LBL" description="JACTION_UNINSTALL_DESC" />
|
||||||
|
<action name="jckman.sync" title="JACTION_SYNC_LBL" description="JACTION_SYNC_DESC" />
|
||||||
|
</section>
|
||||||
|
</access>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,205 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined('JPATH_BASE') or die('RESTRICTED');
|
||||||
|
|
||||||
|
// Check to ensure this file is within the rest of the framework
|
||||||
|
defined('JPATH_BASE') or die();
|
||||||
|
defined( '_JEXEC' ) or die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Language installer
|
||||||
|
*
|
||||||
|
* @package JCK
|
||||||
|
* @subpackage Installer
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
class JCKInstallerLanguage extends JObject {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param object $parent Parent object [JInstaller instance]
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function __construct(& $parent)
|
||||||
|
{
|
||||||
|
$this->parent = $parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Install method
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return boolean True on success
|
||||||
|
*/
|
||||||
|
public function install()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// Get the extension manifest object
|
||||||
|
$this->manifest = $this->parent->getManifest();
|
||||||
|
|
||||||
|
$values = array('name', 'version', 'description', 'tag');
|
||||||
|
|
||||||
|
foreach($values as $value)
|
||||||
|
{
|
||||||
|
$this->parent->set($value, $this->manifest->$value);
|
||||||
|
}
|
||||||
|
|
||||||
|
$elements = array('administration', 'editor');
|
||||||
|
|
||||||
|
foreach($elements as $element)
|
||||||
|
{
|
||||||
|
$this->set($element, $this->manifest->$element);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check language tag - if we didn't, we may be trying to install from an older language package
|
||||||
|
if (!$this->parent->get('tag'))
|
||||||
|
{
|
||||||
|
$this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT', JText::_('JLIB_INSTALLER_ERROR_NO_LANGUAGE_TAG')));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$folder =(string) $this->parent->get('tag');
|
||||||
|
// Set the installation target paths
|
||||||
|
$this->parent->setPath('extension_administrator', JPATH_COMPONENT . '/language/overrides');
|
||||||
|
|
||||||
|
// Copy admin files
|
||||||
|
if ($this->parent->parseFiles($this->get('administration'), 1) === false)
|
||||||
|
{
|
||||||
|
$this->parent->abort();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy editor files
|
||||||
|
$this->parent->setPath('extension_administrator', JPATH_COMPONENT . '/editor/lang');
|
||||||
|
|
||||||
|
if ($this->parent->parseFiles($this->get('editor'),1) === false)
|
||||||
|
{
|
||||||
|
$this->parent->abort();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Add an entry to the language table
|
||||||
|
$row = JTable::getInstance('language', 'JCKTable');
|
||||||
|
$row->tag = $folder;
|
||||||
|
$file = $this->parent->getPath('manifest');
|
||||||
|
$filename = str_replace($this->parent->getPath('source').DS,'',$file);
|
||||||
|
|
||||||
|
$row->filename = $filename;
|
||||||
|
|
||||||
|
if (!$row->store())
|
||||||
|
{
|
||||||
|
// Install failed, roll back changes
|
||||||
|
$this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT', $row->getError()));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set path back for manifest
|
||||||
|
$this->parent->setPath('extension_administrator', JPATH_COMPONENT . '/language/overrides');
|
||||||
|
// Lastly, we will copy the manifest file to its appropriate place.
|
||||||
|
if (!$this->parent->copyManifest(1))
|
||||||
|
{
|
||||||
|
// Install failed, rollback changes
|
||||||
|
$this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT_PLG_INSTALL_COPY_SETUP', JText::_('JLIB_INSTALLER_INSTALL')));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uninstall method
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param string $tag The tag of the language to uninstall
|
||||||
|
* @return mixed Return value for uninstall method in component uninstall file
|
||||||
|
*/
|
||||||
|
function uninstall($eid)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Load up the extension details
|
||||||
|
$language = JTable::getInstance('language', 'JCKTable');
|
||||||
|
$language->load($eid);
|
||||||
|
|
||||||
|
|
||||||
|
$tag = $language->tag;
|
||||||
|
|
||||||
|
// Set defaults
|
||||||
|
$this->parent->set('tag', $tag);
|
||||||
|
$this->parent->set('version', '');
|
||||||
|
|
||||||
|
$path = JPATH_COMPONENT . '/language/overrides';
|
||||||
|
|
||||||
|
if (!JFolder::exists($path)) {
|
||||||
|
JError::raiseWarning(100, JText::_('JLIB_INSTALLER_UNINSTALL') . ' : ' . JText::_('JLIB_INSTALLER_ERROR_LANG_UNINSTALL_ELEMENT_EMPTY'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$manifestFile = $path.'/'. $language->filename;
|
||||||
|
|
||||||
|
|
||||||
|
if (JFile::exists($manifestFile))
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->manifest = JFactory::getXML($manifestFile);
|
||||||
|
|
||||||
|
if (!$this->manifest) {
|
||||||
|
JError::raiseWarning(100, JText::_('JLIB_INSTALLER_INSTALL') . ' : ' . JText::_('JCK_INSTALLER_MANIFEST_INVALID'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$values = array('name', 'version', 'description');
|
||||||
|
|
||||||
|
foreach($values as $value)
|
||||||
|
{
|
||||||
|
$this->parent->set($value, $this->manifest->$value);
|
||||||
|
}
|
||||||
|
|
||||||
|
$elements = array('administration', 'editor');
|
||||||
|
|
||||||
|
foreach($elements as $element)
|
||||||
|
{
|
||||||
|
$this->set($element, $this->manifest->$element);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the installation target paths
|
||||||
|
$this->parent->setPath('extension_administrator', $path );
|
||||||
|
|
||||||
|
if (!$this->parent->removeFiles($this->get('administration'), 1)) {
|
||||||
|
JError::raiseWarning(100, JText::_('JLIB_INSTALLER_INSTALL') . ' : ' . JText::_('JCK_INSTALL_DELETE_FILES_ERROR'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->parent->setPath('extension_administrator', JPATH_COMPONENT. '/editor/lang');
|
||||||
|
|
||||||
|
if (!$this->parent->removeFiles($this->get('editor'),1)) {
|
||||||
|
JError::raiseWarning(100, JText::_('JLIB_INSTALLER_INSTALL') . ' : ' . JText::_('JCK_INSTALL_DELETE_FILES_ERROR'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
JFile::delete($manifestFile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
JError::raiseWarning(100, JText::_('JLIB_INSTALLER_INSTALL') . ' : ' . JText::_('JCK_INSTALLER_MANIFEST_ERROR'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the language table entry
|
||||||
|
$language->delete();
|
||||||
|
return true; // return false to stop at this point.
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,755 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Modified for use as the Jplugin installer
|
||||||
|
* AW
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Check to ensure this file is within the rest of the framework
|
||||||
|
defined('JPATH_BASE') or die();
|
||||||
|
defined( '_JEXEC' ) or die();
|
||||||
|
|
||||||
|
define( 'JCK_PATH', JPATH_PLUGINS.DS.'editors'.DS.'jckeditor' );
|
||||||
|
define( 'JCK_PLUGINS', JCK_PATH.DS.'plugins' );
|
||||||
|
|
||||||
|
require_once( JPATH_COMPONENT .DS. 'tables' .DS. 'plugin.php' );
|
||||||
|
require_once(CKEDITOR_LIBRARY.DS . 'toolbar.php');
|
||||||
|
|
||||||
|
jckimport('helper');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin installer
|
||||||
|
*
|
||||||
|
* @package Joomla.Framework
|
||||||
|
* @subpackage Installer
|
||||||
|
* @since 1.5
|
||||||
|
* Renamed JInstallerPlugin to JCKInstallerPlugin
|
||||||
|
*/
|
||||||
|
class JCKInstallerPlugin extends JObject
|
||||||
|
{
|
||||||
|
function __construct(&$parent)
|
||||||
|
{
|
||||||
|
$this->parent = $parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom install method
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return boolean True on success
|
||||||
|
* @since 1.5
|
||||||
|
* Minor alteration - see below
|
||||||
|
*/
|
||||||
|
function install()
|
||||||
|
{
|
||||||
|
// Get a database connector object
|
||||||
|
$db =& $this->parent->getDBO();
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
|
||||||
|
// Get the extension manifest object
|
||||||
|
$manifest =& $this->parent->getManifest();
|
||||||
|
$this->manifest = $manifest;//$manifest->document;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------------------------------
|
||||||
|
* Manifest Document Setup Section
|
||||||
|
* ---------------------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Set the component name
|
||||||
|
$name = '';
|
||||||
|
|
||||||
|
if($this->manifest->name)
|
||||||
|
{
|
||||||
|
$name = $this->manifest->name;
|
||||||
|
$this->parent->set('name', $name->data());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$this->parent->set('name','');
|
||||||
|
|
||||||
|
// Get the component description
|
||||||
|
$description = & $this->manifest->description;
|
||||||
|
if (is_a($description, 'JXMLElement')) {
|
||||||
|
$this->parent->set('message', $description->data());
|
||||||
|
} else {
|
||||||
|
$this->parent->set('message', '' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$element =& $this->manifest->files;
|
||||||
|
|
||||||
|
// Plugin name is specified
|
||||||
|
$pname = (string) $this->manifest->attributes()->plugin;
|
||||||
|
|
||||||
|
//Get type
|
||||||
|
$type = $this->manifest->attributes()->group;
|
||||||
|
|
||||||
|
if (!empty ($pname)) {
|
||||||
|
// ^ Use JCK_PLUGINS defined path
|
||||||
|
$this->parent->setPath('extension_root', JCK_PLUGINS .DS. $pname);
|
||||||
|
} else {
|
||||||
|
$this->parent->abort('Extension Install: '.JText::_('COM_JCKMAN_ADAPTER_NO_PLUGIN_SPECIFIED'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((string)$manifest->scriptfile)
|
||||||
|
{
|
||||||
|
$manifestScript = (string)$manifest->scriptfile;
|
||||||
|
$manifestScriptFile = $this->parent->getPath('source').DS.$manifestScript;
|
||||||
|
if (is_file($manifestScriptFile))
|
||||||
|
{
|
||||||
|
// load the file
|
||||||
|
include_once $manifestScriptFile;
|
||||||
|
}
|
||||||
|
// Set the class name
|
||||||
|
$classname = 'plgJCK'.$pname.'InstallerScript';
|
||||||
|
|
||||||
|
if (class_exists($classname))
|
||||||
|
{
|
||||||
|
// create a new instance
|
||||||
|
$this->parent->manifestClass = new $classname($this);
|
||||||
|
// and set this so we can copy it later
|
||||||
|
$this->set('manifest_script', $manifestScript);
|
||||||
|
// Note: if we don't find the class, don't bother to copy the file
|
||||||
|
}
|
||||||
|
|
||||||
|
// run preflight if possible
|
||||||
|
ob_start();
|
||||||
|
ob_implicit_flush(false);
|
||||||
|
if ($this->parent->manifestClass && method_exists($this->parent->manifestClass,'preflight'))
|
||||||
|
{
|
||||||
|
if($this->parent->manifestClass->preflight('install', $this) === false)
|
||||||
|
{
|
||||||
|
// Install failed, rollback changes
|
||||||
|
$this->parent->abort(JText::_('COM_JCKMAN_ADAPTER_CUSTOM_ABORT'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ob_end_clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------------------------------
|
||||||
|
* Filesystem Processing Section
|
||||||
|
* ---------------------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
// If the extension directory does not exist, lets create it
|
||||||
|
$created = false;
|
||||||
|
if (!file_exists($this->parent->getPath('extension_root'))) {
|
||||||
|
if (!$created = JFolder::create($this->parent->getPath('extension_root'))) {
|
||||||
|
$this->parent->abort('Plugin Install: '.JText::_('Failed to create directory').': "'.$this->parent->getPath('extension_root').'"');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we created the extension directory and will want to remove it if we
|
||||||
|
* have to roll back the installation, lets add it to the installation
|
||||||
|
* step stack
|
||||||
|
*/
|
||||||
|
if ($created) {
|
||||||
|
$this->parent->pushStep(array ('type' => 'folder', 'path' => $this->parent->getPath('extension_root')));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy all necessary files
|
||||||
|
if ($this->parent->parseFiles($element, -1) === false) {
|
||||||
|
// Install failed, roll back changes
|
||||||
|
$this->parent->abort();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->_parseLanguages( $this->manifest->languages) === false) {
|
||||||
|
// Install failed, roll back changes
|
||||||
|
$this->parent->abort();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there is an install file, lets copy it.
|
||||||
|
$installScriptElement =& $this->manifest->installfile;
|
||||||
|
if (is_a($installScriptElement, 'JXMLElement')) {
|
||||||
|
// Make sure it hasn't already been copied (this would be an error in the xml install file)
|
||||||
|
if (!file_exists($this->parent->getPath('extension_root').DS.$installScriptElement->data()))
|
||||||
|
{
|
||||||
|
$path['src'] = $this->parent->getPath('source').DS.$installScriptElement->data();
|
||||||
|
$path['dest'] = $this->parent->getPath('extension_root').DS.$installScriptElement->data();
|
||||||
|
if (!$this->parent->copyFiles(array ($path))) {
|
||||||
|
// Install failed, rollback changes
|
||||||
|
$this->parent->abort(JText::_('COM_JCKMAN_ADAPTER_COMPONENT').' '.JText::_('COM_JCKMAN_ADAPTER_INSTALL').': '.JText::_('COM_JCKMAN_ADAPTER_COULD_NOT_COPY_INSTALL_FILE'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('install.script', $installScriptElement->data());
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there is an uninstall file, lets copy it.
|
||||||
|
$uninstallScriptElement =& $this->manifest->uninstallfile;
|
||||||
|
if (is_a($uninstallScriptElement, 'JXMLElement')) {
|
||||||
|
// Make sure it hasn't already been copied (this would be an error in the xml install file)
|
||||||
|
if (!file_exists($this->parent->getPath('extension_root').DS.$uninstallScriptElement->data()))
|
||||||
|
{
|
||||||
|
$path['src'] = $this->parent->getPath('source').DS.$uninstallScriptElpement->data();
|
||||||
|
$path['dest'] = $this->parent->getPath('extension_root').DS.$uninstallScriptElement->data();
|
||||||
|
if (!$this->parent->copyFiles(array ($path))) {
|
||||||
|
// Install failed, rollback changes
|
||||||
|
$this->parent->abort(JText::_('COM_JCKMAN_ADAPTER_COMPONENT').' '.JText::_('COM_JCKMAN_ADAPTER_INSTALL').': '.JText::_('COM_JCKMAN_ADAPTER_COULD_NOT_COPY_INSTALL_FILE'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------------------------------
|
||||||
|
* Database Processing Section
|
||||||
|
* ---------------------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
$type = (isset($type) ? (string)$type : 'plugin'); //Add group processimg
|
||||||
|
|
||||||
|
// Check to see if a plugin by the same name is already installed
|
||||||
|
// ^ Altered db query for #__JCK_PLUGINS
|
||||||
|
$query = 'SELECT `id`' .
|
||||||
|
' FROM `#__jckplugins`' .
|
||||||
|
' WHERE name = '.$db->Quote($pname);
|
||||||
|
$db->setQuery($query);
|
||||||
|
if (!$db->Query()) {
|
||||||
|
// Install failed, roll back changes
|
||||||
|
$this->parent->abort('Plugin Install: '.$db->stderr(true));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$id = $db->loadResult();
|
||||||
|
|
||||||
|
// Was there a module already installed with the same name?
|
||||||
|
if($id)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!$this->parent->isOverwrite())
|
||||||
|
{
|
||||||
|
// Install failed, roll back changes
|
||||||
|
|
||||||
|
$this->parent->abort(JText::sprintf('COM_JCKMAN_ADAPTER_PLUGIN_ALREADY_EXISTS',$pname));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$row =& JTable::getInstance('plugin', 'JCKTable');
|
||||||
|
$row->type = $type;
|
||||||
|
$row->load($id);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$icon = $this->manifest->icon;
|
||||||
|
|
||||||
|
// ^ Changes to plugin parameters. Use JCK Plugins Table class.
|
||||||
|
$row =& JTable::getInstance('plugin', 'JCKTable');
|
||||||
|
$row->title = $this->parent->get('name');
|
||||||
|
$row->name = $pname;
|
||||||
|
$row->type = $type;
|
||||||
|
$row->row = 4;
|
||||||
|
$row->published = 1;
|
||||||
|
$row->editable = 1;
|
||||||
|
$row->icon = ($icon ? $icon->data() : '');
|
||||||
|
$row->iscore = 0;
|
||||||
|
$row->params = $this->parent->getParams();
|
||||||
|
|
||||||
|
if($this->manifest->attributes()->parent)
|
||||||
|
{
|
||||||
|
$parentName = (string) $this->manifest->attributes()->parent;
|
||||||
|
$row->setParent($parentName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$row->store()) {
|
||||||
|
// Install failed, roll back changes
|
||||||
|
$this->parent->abort(JText::sprintf('COM_JCKMAN_ADAPTER_PLUGIN_INSTALL',$db->stderr(true)));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Since we have created a plugin item, we add it to the installation step stack
|
||||||
|
// so that if we have to rollback the changes we can undo it.
|
||||||
|
$this->parent->pushStep(array ('type' => 'plugin', 'id' => $row->id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------------------------
|
||||||
|
* update editor plugin config file AW
|
||||||
|
* -------------------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
$config = & JCKHelper::getEditorPluginConfig();
|
||||||
|
|
||||||
|
$config->set($pname,1);
|
||||||
|
|
||||||
|
|
||||||
|
$cfgFile = CKEDITOR_LIBRARY.DS . 'plugins' . DS . 'toolbarplugins.php';
|
||||||
|
|
||||||
|
// Get the config registry in PHP class format and write it to configuation.php
|
||||||
|
if (!JFile::write($cfgFile, $config->toString('PHP',array('class' => 'JCKToolbarPlugins extends JCKPlugins'))))
|
||||||
|
{
|
||||||
|
JCKHelper::error(JText::sprintf('COM_JCKMAN_ADAPTER_FAILED_PUBLISH_PLUGIN',$pname));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*-------------------------------------------------------------------------------------------
|
||||||
|
* Add plugin to toolbars
|
||||||
|
*-------------------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
$CKfolder = CKEDITOR_LIBRARY.DS . 'toolbar';
|
||||||
|
|
||||||
|
$toolbars = JCKHelper::getEditorToolbars();
|
||||||
|
$jform = $app->input->get( 'jform', array(), 'array' );
|
||||||
|
|
||||||
|
switch( $jform['toolbars'] )
|
||||||
|
{
|
||||||
|
default :
|
||||||
|
case 'all' :
|
||||||
|
$toolbarnames = $toolbars;
|
||||||
|
break;
|
||||||
|
case 'none' :
|
||||||
|
$toolbarnames = array();
|
||||||
|
break;
|
||||||
|
case 'select' :
|
||||||
|
$toolbarnames = $jform['selections'];
|
||||||
|
break;
|
||||||
|
}//end switch
|
||||||
|
|
||||||
|
if(!empty( $toolbarnames) && $row->icon)
|
||||||
|
{
|
||||||
|
|
||||||
|
$values = array();
|
||||||
|
foreach($toolbarnames as $toolbarname)
|
||||||
|
{
|
||||||
|
|
||||||
|
$tmpfilename = $CKfolder.DS.$toolbarname.'.php';
|
||||||
|
|
||||||
|
require($tmpfilename);
|
||||||
|
|
||||||
|
$classname = 'JCK'. ucfirst($toolbarname);
|
||||||
|
|
||||||
|
$toolbar = new $classname();
|
||||||
|
|
||||||
|
$pluginTitle = str_replace(' ','',$row->title);
|
||||||
|
|
||||||
|
|
||||||
|
if(isset($toolbar->pluginTitle)) continue;
|
||||||
|
|
||||||
|
//fix toolbar values or they will get wiped out
|
||||||
|
foreach (get_object_vars( $toolbar ) as $k => $v)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(is_null($v))
|
||||||
|
{
|
||||||
|
$toolbar->$k = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($k[0] == '_')
|
||||||
|
$toolbar->$k = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
$toolbar->$pluginTitle = '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$toolbarConfig = new JRegistry('toolbar');
|
||||||
|
$toolbarConfig->loadObject($toolbar);
|
||||||
|
|
||||||
|
// Get the config registry in PHP class format and write it to configuation.php
|
||||||
|
if (!JFile::write($tmpfilename, $toolbarConfig->toString('PHP', array('class' => $classname . ' extends JCKToolbar'))))
|
||||||
|
{
|
||||||
|
JCKHelper::error(JText::sprintf('COM_JCKMAN_ADAPTER_FAILED_TO_ADD_PLUGIN_TOOLBAR',$pname,$classname));
|
||||||
|
}
|
||||||
|
|
||||||
|
//layout stuff
|
||||||
|
$sql = $db->getQuery( true );
|
||||||
|
$sql->select( 'id' )
|
||||||
|
->from( '#__jcktoolbars' )
|
||||||
|
->where( 'name = "'. $toolbarname .'"' );
|
||||||
|
$toolbarid = $db->setQuery( $sql )->loadResult();
|
||||||
|
|
||||||
|
$rowDetail = JCKHelper::getNextLayoutRow($toolbarid);
|
||||||
|
|
||||||
|
$values[] = '('.(int)$toolbarid.','. $row->id.','.$rowDetail->rowid.','.$rowDetail->rowordering.',1)';
|
||||||
|
}
|
||||||
|
|
||||||
|
//insert into layout table
|
||||||
|
if(!empty($values))
|
||||||
|
{
|
||||||
|
//Now delete dependencies
|
||||||
|
$query = 'DELETE FROM #__jcktoolbarplugins'
|
||||||
|
. ' WHERE pluginid ='. $row->id;
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$db->query()) {
|
||||||
|
JCKHelper::error( $db->getErrorMsg() );
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = 'INSERT INTO `#__jcktoolbarplugins` (toolbarid,pluginid,row,ordering,state) VALUES ' . implode(',',$values);
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if(!$db->query())
|
||||||
|
{
|
||||||
|
JCKHelper::error( $db->getErrorMsg() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------------------------------
|
||||||
|
* Finalization and Cleanup Section
|
||||||
|
* ---------------------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Lastly, we will copy the manifest file to its appropriate place.
|
||||||
|
if (!$this->parent->copyManifest(-1)) {
|
||||||
|
// Install failed, rollback changes
|
||||||
|
$this->parent->abort('Plugin Install: '.JText::_('Could not copy setup file'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//make a copy of the plugin
|
||||||
|
$src = $this->parent->getPath('extension_root');
|
||||||
|
$dest = JPATH_ADMINISTRATOR.DS.'components'.DS.'com_jckman'.DS.'editor'.DS.'plugins'.DS.$pname;
|
||||||
|
|
||||||
|
if (!JFolder::copy( $src, $dest,null,true)) {
|
||||||
|
// Install failed, roll back changes
|
||||||
|
$this->parent->abort();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// And now we run the postflight
|
||||||
|
ob_start();
|
||||||
|
ob_implicit_flush(false);
|
||||||
|
|
||||||
|
if ($this->parent->manifestClass && method_exists($this->parent->manifestClass,'postflight'))
|
||||||
|
{
|
||||||
|
$this->parent->manifestClass->postflight('install', $this);
|
||||||
|
}
|
||||||
|
ob_end_clean();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _parseLanguages($element)
|
||||||
|
{
|
||||||
|
// Get the array of file nodes to process; we checked whether this had children above.
|
||||||
|
|
||||||
|
if (!$element || !count($element->children()))
|
||||||
|
{
|
||||||
|
// Either the tag does not exist or has no children (hence no files to process) therefore we return zero files processed.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$copyfiles = array();
|
||||||
|
|
||||||
|
$destination = JPATH_COMPONENT.'/language';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Here we set the folder we are going to copy the files from.
|
||||||
|
*
|
||||||
|
* Does the element have a folder attribute?
|
||||||
|
*
|
||||||
|
* If so this indicates that the files are in a subdirectory of the source
|
||||||
|
* folder and we should append the folder attribute to the source path when
|
||||||
|
* copying files.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$folder = (string) $element->attributes()->folder;
|
||||||
|
|
||||||
|
if ($folder && file_exists($this->parent->getPath('source') . '/' . $folder))
|
||||||
|
{
|
||||||
|
$source = $this->parent->getPath('source') . '/' . $folder;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$source = $this->parent->getPath('source');
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = array();
|
||||||
|
|
||||||
|
|
||||||
|
// Process each file in the $files array (children of $tagName).
|
||||||
|
foreach ($element->children() as $file)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Language files go in a subfolder based on the language code, ie.
|
||||||
|
* <language tag="en-US">en-US.mycomponent.ini</language>
|
||||||
|
* would go in the en-US subdirectory of the language folder.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// We will only install language files where a core language pack
|
||||||
|
// already exists.
|
||||||
|
|
||||||
|
if ((string) $file->attributes()->tag != '')
|
||||||
|
{
|
||||||
|
$path['src'] = $source . '/' . $file;
|
||||||
|
$path['dest'] = $destination . '/' . $file->attributes()->tag . '/' . basename((string) $file);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$path['src'] = $source . '/' . $file;
|
||||||
|
$path['dest'] = $destination . '/' . $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Before we can add a file to the copyfiles array we need to ensure
|
||||||
|
* that the folder we are copying our file to exits and if it doesn't,
|
||||||
|
* we need to create it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (basename($path['dest']) != $path['dest'])
|
||||||
|
{
|
||||||
|
$newdir = dirname($path['dest']);
|
||||||
|
|
||||||
|
if (!JFolder::create($newdir))
|
||||||
|
{
|
||||||
|
JLog::add(JText::sprintf('JLIB_INSTALLER_ERROR_CREATE_DIRECTORY', $newdir), JLog::WARNING, 'jerror');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the file to the copyfiles array
|
||||||
|
$copyfiles[] = $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->parent->copyFiles($copyfiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom uninstall method
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param int $cid The id of the plugin to uninstall
|
||||||
|
* @param int $clientId The id of the client (unused)
|
||||||
|
* @return boolean True on success
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
function uninstall($id)
|
||||||
|
{
|
||||||
|
// Initialize variables
|
||||||
|
$row = null;
|
||||||
|
$retval = true;
|
||||||
|
$db =& $this->parent->getDBO();
|
||||||
|
|
||||||
|
// First order of business will be to load the module object table from the database.
|
||||||
|
// This should give us the necessary information to proceed.
|
||||||
|
|
||||||
|
// ^ Changes to plugin parameters. Use JCK Plugins Table class.
|
||||||
|
$row =& JTable::getInstance('plugin', 'JCKTable');
|
||||||
|
$row->load((int) $id);
|
||||||
|
|
||||||
|
// Is the plugin we are trying to uninstall a core one?
|
||||||
|
// Because that is not a good idea...
|
||||||
|
if ($row->iscore) {
|
||||||
|
JCKHelper::error( 'Plugin Uninstall: '.JText::sprintf('WARNCOREPLUGIN', $row->title)."<br />".JText::_('WARNCOREPLUGIN2'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the plugin folder so we can properly build the plugin path
|
||||||
|
if (trim($row->name) == '') {
|
||||||
|
JCKHelper::error( JText::_('COM_JCKMAN_ADAPTER_PLUGIN_FIELD_EMPTY'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Now delete dependencies
|
||||||
|
$sql = $db->getQuery( true );
|
||||||
|
$sql->delete( '#__jcktoolbarplugins' )
|
||||||
|
->where( 'pluginid ='. $row->id );
|
||||||
|
|
||||||
|
if (!$db->setQuery( $sql )->query())
|
||||||
|
{
|
||||||
|
JCKHelper::error( $db->getErrorMsg() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the plugin root path
|
||||||
|
$this->parent->setPath('extension_root', JCK_PLUGINS . DS . $row->name);
|
||||||
|
|
||||||
|
$manifestFile = $this->parent->getPath('extension_root') . DS . $row->name . '.xml';
|
||||||
|
|
||||||
|
if (file_exists($manifestFile))
|
||||||
|
{
|
||||||
|
// If we cannot load the xml file return null
|
||||||
|
if (!($xml = JFactory::getXML($manifestFile))) {
|
||||||
|
JCKHelper::error(JText::_('COM_JCKMAN_ADAPTER_UNINSTALL_COULD_NOT_LOAD_MANIFEST'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pname = (string) $xml->attributes()->plugin;
|
||||||
|
|
||||||
|
if ((string)$xml->scriptfile)
|
||||||
|
{
|
||||||
|
$manifestScript = (string)$xml->scriptfile;
|
||||||
|
$manifestScriptFile = $this->parent->getPath('extension_root').DS.$manifestScript;
|
||||||
|
if (is_file($manifestScriptFile))
|
||||||
|
{
|
||||||
|
// load the file
|
||||||
|
include_once $manifestScriptFile;
|
||||||
|
}
|
||||||
|
// Set the class name
|
||||||
|
$classname = 'plgJCK'.$pname.'InstallerScript';
|
||||||
|
|
||||||
|
if (class_exists($classname))
|
||||||
|
{
|
||||||
|
// create a new instance
|
||||||
|
$this->parent->manifestClass = new $classname($this);
|
||||||
|
// and set this so we can copy it later
|
||||||
|
$this->set('manifest_script', $manifestScript);
|
||||||
|
// Note: if we don't find the class, don't bother to copy the file
|
||||||
|
}
|
||||||
|
|
||||||
|
// run preflight if possible
|
||||||
|
ob_start();
|
||||||
|
ob_implicit_flush(false);
|
||||||
|
if ($this->parent->manifestClass && method_exists($this->parent->manifestClass,'preflight'))
|
||||||
|
{
|
||||||
|
if($this->parent->manifestClass->preflight('uninstall', $this) === false)
|
||||||
|
{
|
||||||
|
// Install failed, rollback changes
|
||||||
|
$this->parent->abort(JText::_('COM_JCKMAN_ADAPTER_CUSTOM_ABORT'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ob_end_clean();
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
ob_implicit_flush(false);
|
||||||
|
if ($this->parent->manifestClass && method_exists($this->parent->manifestClass,'uninstall'))
|
||||||
|
{
|
||||||
|
$this->parent->manifestClass->uninstall($this);
|
||||||
|
}
|
||||||
|
$msg = ob_get_contents(); // append messages
|
||||||
|
ob_end_clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Remove plugin from toolbars file AW
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$CKfolder = CKEDITOR_LIBRARY.DS . 'toolbar';
|
||||||
|
|
||||||
|
$toolbarnames =& JCKHelper::getEditorToolbars();
|
||||||
|
|
||||||
|
foreach($toolbarnames as $toolbarname)
|
||||||
|
{
|
||||||
|
$tmpfilename = $CKfolder.DS.$toolbarname.'.php';
|
||||||
|
|
||||||
|
require_once($tmpfilename);
|
||||||
|
|
||||||
|
$classname = 'JCK'. ucfirst($toolbarname);
|
||||||
|
$toolbar = new $classname();
|
||||||
|
|
||||||
|
$pluginTitle = str_replace(' ','',$row->title);
|
||||||
|
$pluginTitle = ucfirst($pluginTitle);
|
||||||
|
if(!isset($toolbar->$pluginTitle)) continue;
|
||||||
|
//fix toolbar values or they will get wiped out
|
||||||
|
|
||||||
|
foreach (get_object_vars( $toolbar ) as $k => $v)
|
||||||
|
{
|
||||||
|
if(is_null($v))
|
||||||
|
{
|
||||||
|
$toolbar->$k = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($k[0] == '_')
|
||||||
|
$toolbar->$k = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
$toolbar->$pluginTitle = NULL;
|
||||||
|
|
||||||
|
$toolbarConfig = new JRegistry('toolbar');
|
||||||
|
|
||||||
|
$toolbarConfig->loadObject($toolbar);
|
||||||
|
|
||||||
|
// Get the config registry in PHP class format and write it to configuation.php
|
||||||
|
if (!JFile::write($tmpfilename, $toolbarConfig->toString('PHP', array('class' => $classname . ' extends JCKToolbar'))))
|
||||||
|
{
|
||||||
|
JCKHelper::error( JText::sprintf('COM_JCKMAN_ADAPTER_FAILED_TO_REMOVE_PLUGIN_TOOLBAR',$row->name,$classname));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Remove plugin from config file AW
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$config = & JCKHelper::getEditorPluginConfig();
|
||||||
|
|
||||||
|
$config->set($row->name,NULL); // remove value from output
|
||||||
|
|
||||||
|
$cfgFile = CKEDITOR_LIBRARY.DS . 'plugins' . DS . 'toolbarplugins.php';
|
||||||
|
|
||||||
|
// Get the config registry in PHP class format and write it to configuation.php
|
||||||
|
if (!JFile::write($cfgFile, $config->toString('PHP', array('class' => 'JCKToolbarPlugins extends JCKPlugins'))))
|
||||||
|
{
|
||||||
|
JCKHelper::error(JText::sprintf('COM_JCKMAN_ADAPTER_FAILED_TO_REMOVE_PLUGIN_FROM_CONFIG',$pname));
|
||||||
|
}
|
||||||
|
|
||||||
|
$root =& $xml;
|
||||||
|
|
||||||
|
if ($root->getName() != 'extension' && $root->getName() != 'install') {
|
||||||
|
JCKHelper::error( JText::_('COM_JCKMAN_ADAPTER_UNINSTALL_INVALID_MANIFEST'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the plugin files
|
||||||
|
$this->parent->removeFiles($root->files, -1);
|
||||||
|
JFile::delete($manifestFile);
|
||||||
|
|
||||||
|
// Remove all media and languages as well
|
||||||
|
$this->parent->removeFiles($root->languages, 0);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
JCKHelper::error( Jtext::_('COM_JCKMAN_ADAPTER_UNINSTALL_INVALID_MANIFEST_OR_NOT_FOUND'));
|
||||||
|
|
||||||
|
$row->delete($row->id);
|
||||||
|
unset ($row);
|
||||||
|
$retval = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( $row )
|
||||||
|
{
|
||||||
|
// Now we will no longer need the plugin object, so lets delete it
|
||||||
|
$row->delete($row->id);
|
||||||
|
unset ($row);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the folder is empty, let's delete it
|
||||||
|
$files = JFolder::files($this->parent->getPath('extension_root'));
|
||||||
|
if (!count($files)) {
|
||||||
|
JFolder::delete($this->parent->getPath('extension_root'));
|
||||||
|
}
|
||||||
|
|
||||||
|
//Now delete copy of plugin stored in the component
|
||||||
|
$copyPath = JPATH_ADMINISTRATOR.DS.'components'.DS.'com_jckman'.DS.'editor'.DS.'plugins'.DS.$pname;
|
||||||
|
JFolder::delete($copyPath);
|
||||||
|
|
||||||
|
return $retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom rollback method
|
||||||
|
* - Roll back the plugin item
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param array $arg Installation step to rollback
|
||||||
|
* @return boolean True on success
|
||||||
|
* @since 1.5
|
||||||
|
* Minor changes to the db query
|
||||||
|
*/
|
||||||
|
function _rollback_plugin($arg)
|
||||||
|
{
|
||||||
|
// Get database connector object
|
||||||
|
$db =& $this->parent->getDBO();
|
||||||
|
$sql = $db->getQuery( true );
|
||||||
|
|
||||||
|
// Remove the entry from the #__JCK_PLUGINS table
|
||||||
|
$sql->delete( '`#__jckplugins`' )
|
||||||
|
->where( 'id='.(int)$arg['id'] );
|
||||||
|
|
||||||
|
return ($db->setQuery($sql)->query() !== false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// no direct access
|
||||||
|
defined( '_JEXEC' ) or die();
|
||||||
|
|
||||||
|
jckimport('event.observable.editor');
|
||||||
|
|
||||||
|
class JCKController extends JControllerLegacy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Custom Constructor
|
||||||
|
*/
|
||||||
|
private $editor_obervable;
|
||||||
|
protected $event_args;
|
||||||
|
|
||||||
|
public function __construct( $default = array())
|
||||||
|
{
|
||||||
|
parent::__construct( $default );
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$this->_event_args = null;
|
||||||
|
$name = $app->input->get( 'controller', '');
|
||||||
|
|
||||||
|
if(!$name)
|
||||||
|
$name = $app->input->get( 'view', $this->getName() );
|
||||||
|
|
||||||
|
$eventListenerFile = JPATH_COMPONENT .DS . 'event' . DS . $name . '.php';
|
||||||
|
|
||||||
|
jimport('joomla.filesystem.file');
|
||||||
|
|
||||||
|
if(JFile::exists($eventListenerFile))
|
||||||
|
{
|
||||||
|
require_once($eventListenerFile);
|
||||||
|
$this->editor_obervable = new JCKEditorObservable($name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
JCKHelper::error('No Event listener found for '. $name .' controller');
|
||||||
|
}
|
||||||
|
|
||||||
|
//load style sheet
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
$document->addStyleSheet( JCK_COMPONENT . '/css/header.css', 'text/css' );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute( $task )
|
||||||
|
{
|
||||||
|
parent::execute( $task );
|
||||||
|
|
||||||
|
//if error just return
|
||||||
|
//if(JError::getError())
|
||||||
|
// return;
|
||||||
|
//fire event to update editor
|
||||||
|
$this->updateEditor($this->getTask(),$this->event_args);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function updateEditor($event,$args = array())
|
||||||
|
{
|
||||||
|
if(isset($this->editor_obervable))
|
||||||
|
{
|
||||||
|
$this->editor_obervable->update( 'on' . JString::ucfirst($event),$args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,154 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// no direct access
|
||||||
|
defined( '_JEXEC' ) or die();
|
||||||
|
|
||||||
|
// -PC- J3.0 fix
|
||||||
|
jimport( 'joomla.filesystem.folder' );
|
||||||
|
|
||||||
|
class JCKLoader
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Loads a class from specified directories.
|
||||||
|
*
|
||||||
|
* @param string $name The class name to look for ( dot notation ).
|
||||||
|
* @param string $base Search this directory for the class.
|
||||||
|
* @param string $key String used as a prefix to denote the full path of the file ( dot notation ).
|
||||||
|
* @return void
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
public static function import($filePath)
|
||||||
|
{
|
||||||
|
static $paths;
|
||||||
|
|
||||||
|
if (!isset($paths))
|
||||||
|
{
|
||||||
|
$paths = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$keyPath = $filePath;
|
||||||
|
$base = JPATH_COMPONENT;
|
||||||
|
$parts = explode( '.', $filePath );
|
||||||
|
$classname = array_pop( $parts );
|
||||||
|
|
||||||
|
if(!isset($paths[$keyPath]))
|
||||||
|
{
|
||||||
|
if(in_array('event',$parts))
|
||||||
|
{
|
||||||
|
|
||||||
|
if(in_array('observable',$parts))
|
||||||
|
{
|
||||||
|
$classname = 'JCK'. ucfirst($classname) .'Observable';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$classname = 'JCK'. ucfirst($classname) . 'ControllerListener';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif(in_array('controllers',$parts))
|
||||||
|
{
|
||||||
|
$classname = ucfirst($classname) .'Controller';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$classname = 'JCK'. ucfirst($classname);
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = str_replace( '.', DS, $filePath );
|
||||||
|
$classes = JCKLoader::register($classname, $base.DS.$path.'.php');
|
||||||
|
$rs = isset($classes[strtolower($classname)]);
|
||||||
|
$paths[$keyPath] = $rs;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $paths[$keyPath];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a class to autoload
|
||||||
|
*
|
||||||
|
* @param string $classname The class name
|
||||||
|
* @param string $file Full path to the file that holds the class
|
||||||
|
* @return array|boolean Array of classes
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
public static function ®ister($class = null, $file = null)
|
||||||
|
{
|
||||||
|
static $classes;
|
||||||
|
|
||||||
|
if(!isset($classes)) {
|
||||||
|
$classes = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($class && is_file($file))
|
||||||
|
{
|
||||||
|
// Force to lower case.
|
||||||
|
$class = strtolower($class);
|
||||||
|
$classes[$class] = $file;
|
||||||
|
|
||||||
|
// In php4 we load the class immediately.
|
||||||
|
if((version_compare( phpversion(), '5.0' ) < 0)) {
|
||||||
|
JCKLoader::load($class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $classes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the file for a class
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param string $class The class that will be loaded
|
||||||
|
* @return boolean True on success
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
public static function load( $class )
|
||||||
|
{
|
||||||
|
$class = strtolower($class); //force to lower case
|
||||||
|
|
||||||
|
if (class_exists($class)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$classes = JCKLoader::register();
|
||||||
|
if(array_key_exists( strtolower($class), $classes)) {
|
||||||
|
include($classes[$class]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Intelligent file importer
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param string $path A dot syntax path
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
function jckimport( $path )
|
||||||
|
{
|
||||||
|
return JCKLoader::import($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
function JCKRegisterAllEventlisetners()
|
||||||
|
{
|
||||||
|
$files = JFolder::files(JPATH_COMPONENT.DS.'event');
|
||||||
|
|
||||||
|
foreach($files as $file)
|
||||||
|
{
|
||||||
|
jckimport('event.'. str_replace('.php','',$file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(function_exists('spl_autoload_register'))
|
||||||
|
{
|
||||||
|
spl_autoload_register(array('JCKLoader','load'));
|
||||||
|
}
|
||||||
@ -0,0 +1,84 @@
|
|||||||
|
<extension type="component" version="3.0" method="upgrade">
|
||||||
|
<name>com_jckman</name>
|
||||||
|
<version>6.4.4</version>
|
||||||
|
<creationDate>Jan 2015</creationDate>
|
||||||
|
<description><![CDATA[
|
||||||
|
<p>JoomlaCK Editor Manager v6.4</p>
|
||||||
|
]]></description>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<author>Andrew Williams</author>
|
||||||
|
<authoremail>andrew@joomlackeditor.com</authoremail>
|
||||||
|
<authorurl>http://www.joomlackeditor.com</authorurl>
|
||||||
|
<copyright>2013 - 2015 WebxSolutions Ltd</copyright>
|
||||||
|
<scriptfile>install.php</scriptfile>
|
||||||
|
<install>
|
||||||
|
<sql>
|
||||||
|
<file driver="mysql" charset="utf8">sql/install.sql</file>
|
||||||
|
</sql>
|
||||||
|
</install>
|
||||||
|
<uninstall>
|
||||||
|
<sql>
|
||||||
|
<file driver="mysql" charset="utf8">sql/uninstall.sql</file>
|
||||||
|
</sql>
|
||||||
|
</uninstall>
|
||||||
|
<administration>
|
||||||
|
<languages>
|
||||||
|
<language tag="en-GB">language/en-GB/en-GB.com_jckman.ini</language>
|
||||||
|
<language tag="en-GB">language/en-GB/en-GB.com_jckman.sys.ini</language>
|
||||||
|
<language tag="de-DE">language/de-DE/de-DE.com_jckman.ini</language>
|
||||||
|
<language tag="de-DE">language/de-DE/de-DE.com_jckman.sys.ini</language>
|
||||||
|
<language tag="es-ES">language/es-ES/es-ES.com_jckman.ini</language>
|
||||||
|
<language tag="es-ES">language/es-ES/es-ES.com_jckman.sys.ini</language>
|
||||||
|
<language tag="fi-FI">language/fi-FI/fi-FI.com_jckman.ini</language>
|
||||||
|
<language tag="fi-FI">language/fi-FI/fi-FI.com_jckman.sys.ini</language>
|
||||||
|
<language tag="it-IT">language/it-IT/it-IT.com_jckman.ini</language>
|
||||||
|
<language tag="it-IT">language/it-IT/it-IT.com_jckman.sys.ini</language>
|
||||||
|
<language tag="nl-NL">language/nl-NL/nl-NL.com_jckman.ini</language>
|
||||||
|
<language tag="nl-NL">language/nl-NL/nl-NL.com_jckman.sys.ini</language>
|
||||||
|
<language tag="fr-FR">language/fr-FR/fr-FR.com_jckman.ini</language>
|
||||||
|
<language tag="fr-FR">language/fr-FR/fr-FR.com_jckman.sys.ini</language>
|
||||||
|
<language tag="ru-RU">language/ru-RU/ru-RU.com_jckman.ini</language>
|
||||||
|
<language tag="ru-RU">language/ru-RU/ru-RU.com_jckman.sys.ini</language>
|
||||||
|
</languages>
|
||||||
|
<menu img="components/com_jckman/icons/jcklogo.png">COM_JCKMAN_MENU_NAME</menu>
|
||||||
|
<submenu>
|
||||||
|
<menu img="components/com_jckman/icons/icon-16-cpanel.png" link="option=com_jckman&view=cpanel">COM_JCKMAN_SUBMENU_CPANEL_NAME</menu>
|
||||||
|
<menu img="components/com_jckman/icons/icon-16-pluginmanager.png" link="option=com_jckman&view=list">COM_JCKMAN_SUBMENU_PLUGIN_NAME</menu>
|
||||||
|
<menu img="components/com_jckman/icons/icon-16-installer.png" link="option=com_jckman&view=install">COM_JCKMAN_SUBMENU_INSTALL_NAME</menu>
|
||||||
|
<menu img="components/com_jckman/icons/icon-16-uninstaller.png" link="option=com_jckman&view=extension">COM_JCKMAN_SUBMENU_UNINSTALL_NAME</menu>
|
||||||
|
<menu img="components/com_jckman/icons/icon-16-systemcheck.png" link="option=com_jckman&view=cpanel&taskbtn=system">COM_JCKMAN_SUBMENU_SYSTEMCHECK_NAME</menu>
|
||||||
|
<menu img="components/com_jckman/icons/icon-16-sync.png" link="option=com_jckman&view=cpanel&taskbtn=sync">COM_JCKMAN_SUBMENU_SYNC_NAME</menu>
|
||||||
|
<menu img="components/com_jckman/icons/icon-16-editor.png" link="option=com_jckman&view=cpanel&taskbtn=editor">COM_JCKMAN_SUBMENU_JCKEDITOR_NAME</menu>
|
||||||
|
</submenu>
|
||||||
|
<files folder="admin">
|
||||||
|
<filename>config.xml</filename>
|
||||||
|
<filename>controller.php</filename>
|
||||||
|
<filename>jckman.php</filename>
|
||||||
|
<filename>helper.php</filename>
|
||||||
|
<filename>access.xml</filename>
|
||||||
|
<filename>index.html</filename>
|
||||||
|
<folder>adapters</folder>
|
||||||
|
<folder>base</folder>
|
||||||
|
<folder>config</folder>
|
||||||
|
<folder>controllers</folder>
|
||||||
|
<folder>css</folder>
|
||||||
|
<folder>editor</folder>
|
||||||
|
<folder>event</folder>
|
||||||
|
<folder>help</folder>
|
||||||
|
<folder>helpers</folder>
|
||||||
|
<folder>html</folder>
|
||||||
|
<folder>icons</folder>
|
||||||
|
<folder>js</folder>
|
||||||
|
<folder>language</folder>
|
||||||
|
<folder>tables</folder>
|
||||||
|
<folder>models</folder>
|
||||||
|
<folder>views</folder>
|
||||||
|
<folder>modules</folder>
|
||||||
|
<folder>restorers</folder>
|
||||||
|
<folder>sql</folder>
|
||||||
|
</files>
|
||||||
|
</administration>
|
||||||
|
<updateservers>
|
||||||
|
<server type="extension" priority="1" name="JoomlaCK Editor Update Site">http://www.joomlackeditor.com/upgrade/com_jckman.xml</server>
|
||||||
|
</updateservers>
|
||||||
|
</extension>
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<config>
|
||||||
|
<fieldset
|
||||||
|
name="permissions"
|
||||||
|
label="JCONFIG_PERMISSIONS_LABEL"
|
||||||
|
description="JCONFIG_PERMISSIONS_DESC"
|
||||||
|
>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="rules"
|
||||||
|
type="rules"
|
||||||
|
label="JCONFIG_PERMISSIONS_LABEL"
|
||||||
|
filter="rules"
|
||||||
|
validate="rules"
|
||||||
|
component="com_jckman"
|
||||||
|
section="component"/>
|
||||||
|
</fieldset>
|
||||||
|
</config>
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
class JCKConfigHandler
|
||||||
|
{
|
||||||
|
static function getInstance($name = NULL)
|
||||||
|
{
|
||||||
|
static $instances = array();
|
||||||
|
|
||||||
|
if(is_null($name))
|
||||||
|
{
|
||||||
|
if(!isset($instances[$name]))
|
||||||
|
$instances['_self'] = new JCKConfigHandler();
|
||||||
|
return $instances['_self'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($instances[$name]))
|
||||||
|
{
|
||||||
|
$path = JPATH_ADMINISTRATOR.'/components/com_jckman/config/handlers/'.$name.'.php';
|
||||||
|
if(!file_exists($path))
|
||||||
|
{
|
||||||
|
if(!isset($instances[$name]))
|
||||||
|
$instances['_self'] = new JCKConfigHandler();
|
||||||
|
return $instances['_self'];
|
||||||
|
}
|
||||||
|
require $path;
|
||||||
|
$classname = 'JCKConfigHandler'.$name;
|
||||||
|
$instances[$name] = new $classname;
|
||||||
|
}
|
||||||
|
return $instances[$name];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOptions($key,$value,$default,$node,$params,$pluginName)
|
||||||
|
{
|
||||||
|
$options = '';
|
||||||
|
|
||||||
|
if(is_array($value))
|
||||||
|
{
|
||||||
|
$is_a_object = $node->attributes('is_object');
|
||||||
|
$is_a_array = $node->attributes('is_array');
|
||||||
|
$separator = $node->attributes('separator');
|
||||||
|
|
||||||
|
if(!$separator)
|
||||||
|
$separator = ','; //default to a comma separated list
|
||||||
|
|
||||||
|
$value = implode($separator,$value);
|
||||||
|
|
||||||
|
if($is_a_object)
|
||||||
|
$value = '{'.$value.'}';
|
||||||
|
|
||||||
|
if($is_a_array)
|
||||||
|
$value = '['.$value.']';
|
||||||
|
|
||||||
|
$options .= "\"$key='".$value."'\",";
|
||||||
|
}
|
||||||
|
elseif(is_numeric($value))
|
||||||
|
$options .= "\"$key=$value\",";
|
||||||
|
else
|
||||||
|
$options .= "\"$key='".$value."'\",";
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
class JCKConfigHandlerAddColorList
|
||||||
|
{
|
||||||
|
function getOptions($key,$value,$default,$node,$params,$pluginName)
|
||||||
|
{
|
||||||
|
$options = '';
|
||||||
|
|
||||||
|
$is_a_object = $node->attributes('is_object');
|
||||||
|
$is_a_array = $node->attributes('is_array');
|
||||||
|
$separator = $node->attributes('separator');
|
||||||
|
|
||||||
|
if(!$separator)
|
||||||
|
$separator = ','; //default to a comma separated list
|
||||||
|
|
||||||
|
if(empty($value))
|
||||||
|
{
|
||||||
|
$value = array();
|
||||||
|
foreach($node->children()as $option)
|
||||||
|
{
|
||||||
|
if($option->name() == 'option')
|
||||||
|
$value[] = $option->attributes('value');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$value = implode($separator,$value);
|
||||||
|
|
||||||
|
if($is_a_object)
|
||||||
|
$value = '{'.$value.'}';
|
||||||
|
|
||||||
|
if($is_a_array)
|
||||||
|
$value = '['.$value.']';
|
||||||
|
|
||||||
|
$options .= "\"$key='".$value."'\",";
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
class JCKConfigHandlerAddSelectList
|
||||||
|
{
|
||||||
|
function getOptions($key,$value,$default,$node,$params,$pluginName)
|
||||||
|
{
|
||||||
|
$options = '';
|
||||||
|
|
||||||
|
$is_a_object = $node->attributes('is_object');
|
||||||
|
$is_a_array = $node->attributes('is_array');
|
||||||
|
$separator = $node->attributes('separator');
|
||||||
|
|
||||||
|
if(!$separator)
|
||||||
|
$separator = ','; //default to a comma separated list
|
||||||
|
|
||||||
|
if(empty($value))
|
||||||
|
{
|
||||||
|
$value = array();
|
||||||
|
foreach($node->children()as $option)
|
||||||
|
{
|
||||||
|
if($option->name() == 'option')
|
||||||
|
$value[] = $option->attributes('value');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$value = implode($separator,$value);
|
||||||
|
|
||||||
|
if($is_a_object)
|
||||||
|
$value = '{'.$value.'}';
|
||||||
|
|
||||||
|
if($is_a_array)
|
||||||
|
$value = '['.$value.']';
|
||||||
|
|
||||||
|
$options .= "\"$key='".$value."'\",";
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
class JCKConfigHandlerDocumentTypeList
|
||||||
|
{
|
||||||
|
function getOptions($key,$value,$default,$node,$params)
|
||||||
|
{
|
||||||
|
$options = '';
|
||||||
|
$value = preg_replace('/"/','\"',$value);
|
||||||
|
$options .= "\"$key='".$value."'\"\"";
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
class JCKConfigHandlerDualAddColorList
|
||||||
|
{
|
||||||
|
function getOptions($key,$value,$default,$node,$params,$pluginName)
|
||||||
|
{
|
||||||
|
$options = '';
|
||||||
|
|
||||||
|
$is_a_object = $node->attributes('is_object');
|
||||||
|
$is_a_array = $node->attributes('is_array');
|
||||||
|
$separator = $node->attributes('separator');
|
||||||
|
|
||||||
|
if(!$separator)
|
||||||
|
$separator = ','; //default to a comma separated list
|
||||||
|
|
||||||
|
if(empty($value))
|
||||||
|
{
|
||||||
|
$value = array();
|
||||||
|
foreach($node->children()as $option)
|
||||||
|
{
|
||||||
|
if($option->name() != 'option')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$tmp = $option->data();
|
||||||
|
$tmp .= '/'. $option->attributes('value');
|
||||||
|
$value[] = $tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$texts = $params->get($key.'_text');
|
||||||
|
|
||||||
|
foreach($value as $k=>$v)
|
||||||
|
{
|
||||||
|
$tmp = $texts[$k];
|
||||||
|
$tmp .= '/'.$v;
|
||||||
|
$value[$k] = $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$value = implode($separator,$value);
|
||||||
|
|
||||||
|
if($is_a_object)
|
||||||
|
$value = '{'.$value.'}';
|
||||||
|
|
||||||
|
if($is_a_array)
|
||||||
|
$value = '['.$value.']';
|
||||||
|
|
||||||
|
$options .= "\"$key='".$value."'\",";
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
class JCKConfigHandlerDualAddSelectList
|
||||||
|
{
|
||||||
|
function getOptions($key,$value,$default,$node,$params,$pluginName)
|
||||||
|
{
|
||||||
|
$options = '';
|
||||||
|
|
||||||
|
$is_a_object = $node->attributes('is_object');
|
||||||
|
$is_a_array = $node->attributes('is_array');
|
||||||
|
$separator = $node->attributes('separator');
|
||||||
|
|
||||||
|
if(!$separator)
|
||||||
|
$separator = ','; //default to a comma separated list
|
||||||
|
|
||||||
|
if(empty($value))
|
||||||
|
{
|
||||||
|
$value = array();
|
||||||
|
foreach($node->children()as $option)
|
||||||
|
{
|
||||||
|
if($option->name() != 'option')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$tmp = $option->data();
|
||||||
|
$tmp .= '/'. $option->attributes('value');
|
||||||
|
$value[] = $tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$texts = $params->get($key.'_text');
|
||||||
|
|
||||||
|
foreach($value as $k=>$v)
|
||||||
|
{
|
||||||
|
$tmp = $texts[$k];
|
||||||
|
$tmp .= '/'.$v;
|
||||||
|
$value[$k] = $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$value = implode($separator,$value);
|
||||||
|
|
||||||
|
if($is_a_object)
|
||||||
|
$value = '{'.$value.'}';
|
||||||
|
|
||||||
|
if($is_a_array)
|
||||||
|
$value = '['.$value.']';
|
||||||
|
|
||||||
|
$options .= "\"$key='".$value."'\",";
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,92 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
class JCKConfigHandlerFilebrowsers
|
||||||
|
{
|
||||||
|
|
||||||
|
function getOptions($key,$value,$default,$node,$params,$pluginName)
|
||||||
|
{
|
||||||
|
$options = '';
|
||||||
|
$manifest = '';
|
||||||
|
|
||||||
|
|
||||||
|
if($value == 'default')
|
||||||
|
return false;
|
||||||
|
|
||||||
|
jimport('joomla.filesystem.folder');
|
||||||
|
|
||||||
|
if(!JFolder::exists(JPATH_PLUGINS.'/editors/jckeditor/plugins/jckexplorer'))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if($value == 'jfilebrowser')
|
||||||
|
$manifest = JFactory::getXML(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_jckman'.DS.'editor'.DS.'plugins'.DS.'jfilebrowser.xml');
|
||||||
|
else
|
||||||
|
$manifest = JFactory::getXML(JPATH_PLUGINS.DS.'editors'.DS.'jckeditor'.DS.'plugins'.DS.$value.DS.$value.'.xml');
|
||||||
|
|
||||||
|
|
||||||
|
$browseUrl = '';
|
||||||
|
$imageBrowseUrl = '';
|
||||||
|
$flashBrowseUrl = '';
|
||||||
|
|
||||||
|
if(isset($manifest->browseUrl));
|
||||||
|
$browseUrl = (string) $manifest->browseUrl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(isset($manifest->imageBrowseUrl))
|
||||||
|
$imageBrowseUrl = $manifest->imageBrowseUrl;
|
||||||
|
|
||||||
|
if(isset($manifest->flashBrowseUrl))
|
||||||
|
$flashBrowseUrl = $manifest->flashBrowseUrl;
|
||||||
|
|
||||||
|
|
||||||
|
if(!$browseUrl && $value == 'jckexplorer')
|
||||||
|
{
|
||||||
|
$browseUrl = 'index.php?editor=ckeditor';
|
||||||
|
$imageBrowseUrl = 'index.php?editor=ckeditor&filter=image';
|
||||||
|
$flashBrowseUrl = 'index.php?editor=ckeditor&filter=flash';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$browseUrl)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$pluginName = ucfirst($pluginName);
|
||||||
|
|
||||||
|
if($pluginName == 'Image' && $imageBrowseUrl)
|
||||||
|
$options .= "\"filebrowserImageBrowseUrl='".JURI::root()."plugins/editors/jckeditor/plugins/".$value."/".$imageBrowseUrl."'\",";
|
||||||
|
elseif(($pluginName == 'Flash' || $pluginName == 'Jflash') && $flashBrowseUrl)
|
||||||
|
$options .= "\"filebrowserFlashBrowseUrl='".JURI::root()."plugins/editors/jckeditor/plugins/".$value."/".$flashBrowseUrl."'\",";
|
||||||
|
else
|
||||||
|
$options .= "\"filebrowser".$pluginName."BrowseUrl='".JURI::root()."plugins/editors/jckeditor/plugins/".$value."/".$browseUrl."'\",";
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
class JCKConfigHandlerResizeRadio
|
||||||
|
{
|
||||||
|
function getOptions($key,$value,$default,$node,$params,$pluginName)
|
||||||
|
{
|
||||||
|
if(!isset($value))
|
||||||
|
$value = $default;
|
||||||
|
|
||||||
|
$options = '';
|
||||||
|
$value = (int) $value;
|
||||||
|
|
||||||
|
if($value)
|
||||||
|
$value = 'true';
|
||||||
|
else
|
||||||
|
$value = 'false';
|
||||||
|
$options .= "\"$key=".$value."\",";
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
class JCKConfigHandlerSmileyPath
|
||||||
|
{
|
||||||
|
function getOptions($key,$value,$default,$node,$params)
|
||||||
|
{
|
||||||
|
$options = '';
|
||||||
|
|
||||||
|
if($value)
|
||||||
|
$value = str_replace('/administrator','',JURI::base(true)).'/'.$value;
|
||||||
|
|
||||||
|
$options .= "\"$key='".$value."'\",";
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
class JCKConfigHandlerTextareaList
|
||||||
|
{
|
||||||
|
function getOptions($key,$value,$default,$node,$params)
|
||||||
|
{
|
||||||
|
$options = '';
|
||||||
|
|
||||||
|
$is_a_object = $node->attributes('is_object');
|
||||||
|
$is_a_array = $node->attributes('is_array');
|
||||||
|
$separator = $node->attributes('separator');
|
||||||
|
|
||||||
|
if(!$separator)
|
||||||
|
$separator = ','; //default to a comma separated list
|
||||||
|
|
||||||
|
if(strpos($value,'|'))
|
||||||
|
str_replace('|',chr(13),$value);
|
||||||
|
|
||||||
|
$value = str_replace(chr(13),$separator,$value);
|
||||||
|
|
||||||
|
if($is_a_object)
|
||||||
|
$value = '{'.$value.'}';
|
||||||
|
|
||||||
|
if($is_a_array)
|
||||||
|
$value = '['.$value.']';
|
||||||
|
|
||||||
|
$options .= "\"$key='".$value."'\",";
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
class JCKConfigHandlerWindowFeaturesList
|
||||||
|
{
|
||||||
|
function getOptions($key,$value,$default,$node,$params)
|
||||||
|
{
|
||||||
|
$options = '';
|
||||||
|
|
||||||
|
if(is_array($value))
|
||||||
|
{
|
||||||
|
$value = implode(",",$value);
|
||||||
|
}
|
||||||
|
elseif($value && preg_match('/^\[.*\]$/',$value))
|
||||||
|
{
|
||||||
|
|
||||||
|
$value = str_replace('\'','"',$value);
|
||||||
|
$value = json_decode($value);
|
||||||
|
$value = implode("",$value);
|
||||||
|
}
|
||||||
|
$options .= "\"$key='".$value."'\"\"";
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
class JCKManController extends JControllerLegacy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string The default view.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected $default_view = 'cpanel';
|
||||||
|
|
||||||
|
public function display($cachable = false, $urlparams = false)
|
||||||
|
{
|
||||||
|
parent::display();
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// no direct access
|
||||||
|
defined( '_JEXEC' ) or die();
|
||||||
|
|
||||||
|
class JCKManControllerCpanel extends JCKController
|
||||||
|
{
|
||||||
|
protected $canDo = false;
|
||||||
|
|
||||||
|
function __construct( $default = array())
|
||||||
|
{
|
||||||
|
parent::__construct( $default );
|
||||||
|
|
||||||
|
$this->canDo = JCKHelper::getActions();
|
||||||
|
}
|
||||||
|
|
||||||
|
function check()
|
||||||
|
{
|
||||||
|
$this->display();
|
||||||
|
}
|
||||||
|
|
||||||
|
function sync()
|
||||||
|
{
|
||||||
|
if( !$this->canDo->get('jckman.sync') )
|
||||||
|
{
|
||||||
|
$this->setRedirect( JRoute::_( 'index.php?option=com_jckman&view=cpanel', false ), JText::_( 'COM_JCKMAN_PLUGIN_PERM_NO_SYNC' ), 'error' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setRedirect( JRoute::_( 'index.php?option=com_jckman&view=cpanel' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
function export()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// no direct access
|
||||||
|
defined( '_JEXEC' ) or die();
|
||||||
|
// wrapper for com_installer controller
|
||||||
|
$language = JFactory::getLanguage();
|
||||||
|
$language->load( 'com_installer', JPATH_ADMINISTRATOR );
|
||||||
|
|
||||||
|
jimport('joomla.client.helper');
|
||||||
|
|
||||||
|
class JCKManControllerImport extends JControllerLegacy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Method to display a view.
|
||||||
|
*
|
||||||
|
* @param boolean If true, the view output will be cached
|
||||||
|
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
|
||||||
|
*
|
||||||
|
* @return JController This object to support chaining.
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
public function display($cachable = false, $urlparams = false)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Get the document object.
|
||||||
|
$document = JFactory::getDocument();
|
||||||
|
|
||||||
|
// Set the default view name and format from the Request.
|
||||||
|
$vName = JRequest::getCmd('view', 'import');
|
||||||
|
$vFormat = $document->getType();
|
||||||
|
$lName = JRequest::getCmd('layout', 'default');
|
||||||
|
|
||||||
|
// Get and render the view.
|
||||||
|
if ($view = $this->getView($vName, $vFormat)) {
|
||||||
|
$ftp = JClientHelper::setCredentialsFromRequest('ftp');
|
||||||
|
$view->assignRef('ftp', $ftp);
|
||||||
|
|
||||||
|
// Get the model for the view.
|
||||||
|
$model = $this->getModel($vName);
|
||||||
|
|
||||||
|
// Push the model into the view (as default).
|
||||||
|
$view->setModel($model, true);
|
||||||
|
$view->setLayout($lName);
|
||||||
|
|
||||||
|
// Push document object into the view.
|
||||||
|
$view->assignRef('document', $document);
|
||||||
|
$view->display();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function import()
|
||||||
|
{
|
||||||
|
// Check for request forgeries
|
||||||
|
JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
$model = $this->getModel('import');
|
||||||
|
if ($model->import()) {
|
||||||
|
$cache = JFactory::getCache('mod_menu');
|
||||||
|
$cache->clean();
|
||||||
|
}
|
||||||
|
//now updated editor
|
||||||
|
jckimport( 'event.observable.editor' );
|
||||||
|
$obs = new JCKEditorObservable( 'cpanel' );
|
||||||
|
$handle = $obs->getEventHandler();
|
||||||
|
$handle->onSync();
|
||||||
|
$this->display();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// no direct access
|
||||||
|
defined( '_JEXEC' ) or die();
|
||||||
|
// wrapper for com_installer controller
|
||||||
|
$language = JFactory::getLanguage();
|
||||||
|
$language->load( 'com_installer', JPATH_ADMINISTRATOR );
|
||||||
|
require_once( JPATH_ADMINISTRATOR .DS. 'components' .DS. 'com_installer' .DS. 'controller.php' );
|
||||||
|
require_once( JPATH_ADMINISTRATOR .DS. 'components' .DS. 'com_installer' .DS. 'controllers'. DS. 'install.php' );
|
||||||
@ -0,0 +1,225 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// no direct access
|
||||||
|
defined( '_JEXEC' ) or die();
|
||||||
|
|
||||||
|
class JCKManControllerList extends JCKController
|
||||||
|
{
|
||||||
|
protected $canDo = false;
|
||||||
|
|
||||||
|
function __construct( $default = array())
|
||||||
|
{
|
||||||
|
parent::__construct( $default );
|
||||||
|
|
||||||
|
$this->canDo = JCKHelper::getActions();
|
||||||
|
|
||||||
|
$this->registerTask( 'apply', 'save');
|
||||||
|
$this->registerTask( 'unpublish', 'publish');
|
||||||
|
$this->registerTask( 'edit', 'display' );
|
||||||
|
$this->registerTask( 'add', 'display' );
|
||||||
|
$this->registerTask( 'orderup', 'order' );
|
||||||
|
$this->registerTask( 'orderdown', 'order' );
|
||||||
|
}
|
||||||
|
|
||||||
|
function display($cachable = false, $urlparams = false )
|
||||||
|
{
|
||||||
|
switch($this->getTask())
|
||||||
|
{
|
||||||
|
case 'add' :
|
||||||
|
case 'edit' :
|
||||||
|
{
|
||||||
|
JRequest::setVar( 'hidemainmenu', 1 );
|
||||||
|
JRequest::setVar( 'layout', 'form' );
|
||||||
|
JRequest::setVar( 'view', 'editplugin' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::display($cachable, $urlparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
function save()
|
||||||
|
{
|
||||||
|
// Check for request forgeries
|
||||||
|
JRequest::checkToken() or die( JText::_( 'JINVALID_TOKEN' ) );
|
||||||
|
|
||||||
|
if( !$this->canDo->get('core.edit') )
|
||||||
|
{
|
||||||
|
$this->setRedirect( JRoute::_( 'index.php?option=com_jckman&view=list', false ), JText::_( 'COM_JCKMAN_PLUGIN_PERM_NO_SAVE' ), 'error' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$row = JCKHelper::getTable('plugin');
|
||||||
|
$task = $this->getTask();
|
||||||
|
$post = $app->input->get('jform', array(), 'array');
|
||||||
|
$params = $app->input->get('params', array(), 'array');
|
||||||
|
// $params = ( array_key_exists( 'params', $post ) ) ? $post['params'] : array();
|
||||||
|
$groups = ( array_key_exists( 'groups', $post ) ) ? $post['groups'] : array();
|
||||||
|
|
||||||
|
$post['params'] = $params;
|
||||||
|
|
||||||
|
JArrayHelper::toInteger($groups);
|
||||||
|
|
||||||
|
if (!$row->bind($post)) {
|
||||||
|
JCKHelper::error( $row->getError() );
|
||||||
|
}
|
||||||
|
|
||||||
|
$row->acl = json_encode($groups); //AW
|
||||||
|
|
||||||
|
if (!$row->check()) {
|
||||||
|
JCKHelper::error( $row->getError() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$row->store()) {
|
||||||
|
JCKHelper::error( $row->getError() );
|
||||||
|
}
|
||||||
|
|
||||||
|
$row->checkin();
|
||||||
|
|
||||||
|
//$row->reorder( 'type = '.$db->Quote($row->type).' AND ordering > -10000 AND ordering < 10000');
|
||||||
|
|
||||||
|
//update toolbar selections so set args for event
|
||||||
|
$selections = ( array_key_exists( 'selections', $post ) ) ? $post['selections'] : array();
|
||||||
|
$this->event_args = array('plugin' => $row,'pluginToolbarnames'=>$selections );
|
||||||
|
|
||||||
|
switch ( $task )
|
||||||
|
{
|
||||||
|
case 'apply':
|
||||||
|
$msg = JText::sprintf( 'COM_JCKMAN_PLUGIN_SAVE_CHANGES', ( $row->title ?: $row->name ) );
|
||||||
|
$this->setRedirect( JRoute::_( 'index.php?option=com_jckman&task=list.edit&cid[]='. $row->id, false ), $msg );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'jcksave':
|
||||||
|
default:
|
||||||
|
$msg = JText::sprintf( 'COM_JCKMAN_PLUGIN_SAVE', ( $row->title ?: $row->name ) );
|
||||||
|
$this->setRedirect( JRoute::_( 'index.php?option=com_jckman&view=list', false ), $msg );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function publish()
|
||||||
|
{
|
||||||
|
// Check for request forgeries
|
||||||
|
JRequest::checkToken() or die( JText::_( 'JINVALID_TOKEN' ) );
|
||||||
|
|
||||||
|
$lang = JFactory::getLanguage();
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
|
||||||
|
if( !$this->canDo->get('core.edit.state') )
|
||||||
|
{
|
||||||
|
$app->redirect( JRoute::_( 'index.php?option=com_jckman&view=list', false ), JText::_( 'COM_JCKMAN_PLUGIN_PERM_NO_STATE' ), 'error' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$cid = $app->input->get( 'cid', array(), 'array' );
|
||||||
|
JArrayHelper::toInteger($cid, array(0));
|
||||||
|
$publish = ( $this->getTask() == 'publish' ? 1 : 0 );
|
||||||
|
$action = $publish ? JText::_( 'JPUBLISHED' ) : JText::_( 'JUNPUBLISHED' );
|
||||||
|
$lang->load( 'com_plugins' );
|
||||||
|
|
||||||
|
if( count( $cid ) < 1 )
|
||||||
|
{
|
||||||
|
JCKHelper::error( JText::_( 'COM_PLUGINS_NO_ITEM_SELECTED' ) );
|
||||||
|
|
||||||
|
$app->redirect( JRoute::_( 'index.php?option=com_jckman&view=list', false ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$cids = implode( ',', $cid );
|
||||||
|
$sql = $db->getQuery( true );
|
||||||
|
$sql->update( '#__jckplugins' )
|
||||||
|
->set( 'published = '.(int) $publish )
|
||||||
|
->where( 'id IN ( '.$cids.' )' )
|
||||||
|
->where( '( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ))' );
|
||||||
|
|
||||||
|
if(!$db->setQuery( $sql )->query())
|
||||||
|
{
|
||||||
|
JCKHelper::error( $db->getErrorMsg() );
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->event_args = array('cid' => $cid,'value'=>$publish );
|
||||||
|
$plural = ( count( $cid ) > 1 ) ? '(s)' : '';
|
||||||
|
|
||||||
|
JCKHelper::error( (int)count( $cid ) . chr( 32 ) . 'plugin' . $plural . chr( 32 ) . $action, 'message' );
|
||||||
|
|
||||||
|
$this->setRedirect( JRoute::_( 'index.php?option=com_jckman&view=list', false ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancel()
|
||||||
|
{
|
||||||
|
// Check for request forgeries
|
||||||
|
JRequest::checkToken() or die( JText::_( 'JINVALID_TOKEN' ) );
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$form = $app->input->get( 'jform', array(), 'array' );
|
||||||
|
$row = JCKHelper::getTable('plugin');
|
||||||
|
$row->bind( $form );
|
||||||
|
$row->checkin();
|
||||||
|
|
||||||
|
$this->setRedirect( JRoute::_( 'index.php?option=com_jckman&view=list', false ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
function order()
|
||||||
|
{
|
||||||
|
// Check for request forgeries
|
||||||
|
JRequest::checkToken() or die( JText::_( 'JINVALID_TOKEN' ) );
|
||||||
|
$this->setRedirect( JRoute::_( 'index.php?option=com_jckman&view=list', false ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveorder()
|
||||||
|
{
|
||||||
|
//Check for request forgeries
|
||||||
|
JRequest::checkToken() or die( JText::_( 'JINVALID_TOKEN' ) );
|
||||||
|
$this->setRedirect( JRoute::_( 'index.php?option=com_jckman&view=list', false ), $msg );
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkin()
|
||||||
|
{
|
||||||
|
// Check for request forgeries
|
||||||
|
JRequest::checkToken() or die( JText::_( 'JINVALID_TOKEN' ) );
|
||||||
|
|
||||||
|
if( !$this->canDo->get('core.edit.state') )
|
||||||
|
{
|
||||||
|
$this->setRedirect( JRoute::_( 'index.php?option=com_jckman&view=list', false ), JText::_( 'COM_JCKMAN_PLUGIN_PERM_NO_CHECK' ), 'error' );
|
||||||
|
return false;
|
||||||
|
}//end if
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$cid = JRequest::getVar( 'cid', array(0), 'post', 'array' );
|
||||||
|
$sql = $db->getQuery( true );
|
||||||
|
JArrayHelper::toInteger($cid, array(0));
|
||||||
|
|
||||||
|
if( count( $cid ) < 1 )
|
||||||
|
{
|
||||||
|
JCKHelper::error( JText::_( 'COM_JCKMAN_PLUGIN_NO_CHECKIN' ) );
|
||||||
|
}//end if
|
||||||
|
|
||||||
|
$cids = implode( ',', $cid );
|
||||||
|
$sql->update( '#__jckplugins' )
|
||||||
|
->set( array( 'checked_out = 0', 'checked_out_time = "0000-00-00 00:00:00"' ) )
|
||||||
|
->where( 'id IN ( ' . $cids . ' )' )
|
||||||
|
->where( 'checked_out = ' . (int)$user->get('id') );
|
||||||
|
$db->setQuery( $sql );
|
||||||
|
|
||||||
|
if( !$db->query() )
|
||||||
|
{
|
||||||
|
JCKHelper::error( $db->getErrorMsg() );
|
||||||
|
}//end if
|
||||||
|
|
||||||
|
$this->event_args = array('cid' => $cid,'value'=> true );
|
||||||
|
$plural = ( count( $cid ) > 1 ) ? '(s)' : '';
|
||||||
|
|
||||||
|
JCKHelper::error( JText::sprintf( 'COM_JCKMAN_PLUGIN_CHECKIN', (int)count( $cid ), $plural ), 'message' );
|
||||||
|
|
||||||
|
$this->setRedirect( JRoute::_( 'index.php?option=com_jckman&view=list', false ) );
|
||||||
|
}//end function
|
||||||
|
}//end class
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// no direct access
|
||||||
|
defined( '_JEXEC' ) or die();
|
||||||
|
|
||||||
|
class JCKManControllerManage extends JControllerAdmin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param array An optional associative array of configuration settings.
|
||||||
|
* @see JController
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public function __construct($config = array())
|
||||||
|
{
|
||||||
|
parent::__construct($config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove an extension (Uninstall).
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
public function remove()
|
||||||
|
{
|
||||||
|
// Check for request forgeries
|
||||||
|
JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$cid = $app->input->get( 'cid', array(), 'array' );
|
||||||
|
$model = $this->getModel( 'Manage' );
|
||||||
|
JArrayHelper::toInteger( $cid, array() );
|
||||||
|
$result = $model->remove( $cid );
|
||||||
|
|
||||||
|
$redirect = 'index.php?option=com_jckman&view=extension';
|
||||||
|
$view = $app->input->get('view',false);
|
||||||
|
|
||||||
|
if($view && $view != 'plugin')
|
||||||
|
$redirect .= '&tab='.$view;
|
||||||
|
|
||||||
|
$this->setRedirect( JRoute::_($redirect , false ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,423 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die();
|
||||||
|
|
||||||
|
class JCKManControllerToolbars extends JCKController
|
||||||
|
{
|
||||||
|
protected $canDo = false;
|
||||||
|
|
||||||
|
function __construct( $default = array())
|
||||||
|
{
|
||||||
|
parent::__construct( $default );
|
||||||
|
|
||||||
|
$this->canDo = JCKHelper::getActions();
|
||||||
|
|
||||||
|
$this->registerTask( 'apply', 'save');
|
||||||
|
$this->registerTask( 'edit', 'display' );
|
||||||
|
$this->registerTask( 'add', 'display' );
|
||||||
|
$this->registerTask( 'trash', 'remove' ); // drop-down menu
|
||||||
|
$this->registerTask( 'remove', 'remove' );
|
||||||
|
}
|
||||||
|
|
||||||
|
function display($cachable = false, $urlparams = false )
|
||||||
|
{
|
||||||
|
switch($this->getTask())
|
||||||
|
{
|
||||||
|
case 'add' :
|
||||||
|
case 'edit' :
|
||||||
|
{
|
||||||
|
JRequest::setVar( 'hidemainmenu', 1 );
|
||||||
|
JRequest::setVar( 'layout', 'form' );
|
||||||
|
JRequest::setVar( 'view', 'toolbar' );
|
||||||
|
} break;
|
||||||
|
case 'preview' :
|
||||||
|
{
|
||||||
|
JRequest::setVar( 'view', 'toolbar' );
|
||||||
|
JRequest::setVar( 'layout', 'popup' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::display($cachable, $urlparams);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compiles information to add or edit a toolbar
|
||||||
|
* @param string The current GET/POST option
|
||||||
|
* @param integer The unique id of the record to edit
|
||||||
|
*/
|
||||||
|
function copy()
|
||||||
|
{
|
||||||
|
// Check for request forgeries
|
||||||
|
JRequest::checkToken() or die( JText::_( 'JINVALID_TOKEN' ) );
|
||||||
|
|
||||||
|
if( !$this->canDo->get('core.create') )
|
||||||
|
{
|
||||||
|
$this->setRedirect( JRoute::_( 'index.php?option=com_jckman&view=toolbars', false ), JText::_( 'COM_JCKMAN_PLUGIN_PERM_NO_COPY' ), 'error' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize some variables
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$cid = $app->input->get( 'cid', array(), 'array' );
|
||||||
|
$n = count( $cid );
|
||||||
|
|
||||||
|
if ($n == 0) {
|
||||||
|
return JCKHelper::error( JText::_( 'JERROR_NO_ITEMS_SELECTED' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$row =& JCKHelper::getTable('toolbar');
|
||||||
|
$toolbarpugins = array();
|
||||||
|
|
||||||
|
$i = 1;
|
||||||
|
|
||||||
|
$ncid = array();
|
||||||
|
|
||||||
|
foreach ($cid as $id)
|
||||||
|
{
|
||||||
|
// load the row from the db table
|
||||||
|
$row->load( (int) $id );
|
||||||
|
$row->title = 'Copy of ' . $row->title;
|
||||||
|
$row->id = 0;
|
||||||
|
$row->iscore = 0;
|
||||||
|
$row->published = 1;
|
||||||
|
$sql = $db->getQuery( true );
|
||||||
|
$sql->select( 'count(1)' )
|
||||||
|
->from( '#__jcktoolbars' )
|
||||||
|
->where( 'title = "'. $row->title . '"' );
|
||||||
|
|
||||||
|
//get offset for name of copy
|
||||||
|
$offset = $db->setQuery( $sql )->loadResult();
|
||||||
|
$row->name = $row->name . ($offset +1);
|
||||||
|
|
||||||
|
if (!$row->check()) {
|
||||||
|
return JCKHelper::error( $row->getError() );
|
||||||
|
}
|
||||||
|
if (!$row->store()) {
|
||||||
|
return JCKHelper::error( $row->getError() );
|
||||||
|
}
|
||||||
|
|
||||||
|
$row->checkin();
|
||||||
|
|
||||||
|
$ncid[] = $row->id;
|
||||||
|
$sql = $db->getQuery( true );
|
||||||
|
$sql->select( 'pluginid,row,ordering,state' )
|
||||||
|
->from( '#__jcktoolbarplugins' )
|
||||||
|
->where( 'toolbarid = '. (int) $id );
|
||||||
|
$rows = $db->setQuery( $sql )->loadObjectList();
|
||||||
|
|
||||||
|
foreach ($rows as $toolbar_plugin_row) {
|
||||||
|
$toolbarpugins[] = '('.(int) $row->id. ',' .(int) $toolbar_plugin_row->pluginid. ',' .(int) $toolbar_plugin_row->row. ','
|
||||||
|
.(int) $toolbar_plugin_row->ordering. ','.(int) $toolbar_plugin_row->state.')';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->event_args = array('cid' => $ncid);
|
||||||
|
|
||||||
|
if (!empty( $toolbarpugins ))
|
||||||
|
{
|
||||||
|
// Toolbar-Plugin Mapping: Do it in one query
|
||||||
|
$query = 'INSERT INTO #__jcktoolbarplugins (toolbarid,pluginid,row,ordering,state) VALUES '.implode( ',', $toolbarpugins );
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$db->query()) {
|
||||||
|
return JCKHelper::error( $row->getError() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$msg = JText::sprintf( 'COM_JCKMAN_TOOLBAR_COPY', $n );
|
||||||
|
$this->setRedirect( 'index.php?option=com_jckman&view=toolbars', $msg );
|
||||||
|
}
|
||||||
|
|
||||||
|
function save()
|
||||||
|
{
|
||||||
|
// Check for request forgeries
|
||||||
|
JRequest::checkToken() or die( JText::_( 'JINVALID_TOKEN' ) );
|
||||||
|
|
||||||
|
if( !$this->canDo->get('core.edit') )
|
||||||
|
{
|
||||||
|
$this->setRedirect( JRoute::_( 'index.php?option=com_jckman&view=toolbars', false ), JText::_( 'COM_JCKMAN_PLUGIN_PERM_NO_SAVE' ), 'error' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$row =& JCKHelper::getTable('toolbar');
|
||||||
|
$task = $this->getTask();
|
||||||
|
$form = $app->input->get( 'jform', array(), 'array' );
|
||||||
|
$form['rows'] = $app->input->get( 'rows', array(), 'array' );
|
||||||
|
$components = $app->input->get( 'components', array(), 'array' );
|
||||||
|
$params = array();
|
||||||
|
$params['components'] = $components;
|
||||||
|
$form['params'] = $params;
|
||||||
|
|
||||||
|
$id = $form['id'];
|
||||||
|
|
||||||
|
$oldname = '';
|
||||||
|
$isNew = false;
|
||||||
|
|
||||||
|
if(!$id)
|
||||||
|
{
|
||||||
|
$isNew = true;
|
||||||
|
$name = $form['name'];
|
||||||
|
$form['name'] = str_replace(array(' ','-'),array('','_'),$name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$row->load((int)$id);
|
||||||
|
$oldname = $row->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$row->bind($form)) {
|
||||||
|
JCKHelper::error( $row->getError() );
|
||||||
|
}
|
||||||
|
if (!$row->check()) {
|
||||||
|
JCKHelper::error( $row->getError() );
|
||||||
|
}
|
||||||
|
if (!$row->store()) {
|
||||||
|
JCKHelper::error( $row->getError() );
|
||||||
|
}
|
||||||
|
$row->checkin();
|
||||||
|
|
||||||
|
//code to add plugins from layout
|
||||||
|
$rows = JRequest::getVar( 'rows', '', 'post');
|
||||||
|
$rows = str_replace( ',/,,/,', ',/,', $rows );
|
||||||
|
$rows = explode('/',$rows);
|
||||||
|
|
||||||
|
if($rows[count($rows) -1] == ',')
|
||||||
|
array_pop($rows);
|
||||||
|
|
||||||
|
for($i = 0;$i < count($rows); $i++) $rows[$i] = explode(',',$rows[$i]);
|
||||||
|
|
||||||
|
$values = array();
|
||||||
|
$k = 1;
|
||||||
|
$j = 1;
|
||||||
|
$l = 1;
|
||||||
|
|
||||||
|
$rowcount = count($rows );
|
||||||
|
foreach($rows as $toolbar)
|
||||||
|
{
|
||||||
|
if(empty($toolbar))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
foreach($toolbar as $icon)
|
||||||
|
{
|
||||||
|
if($icon =='')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if($icon ==';')
|
||||||
|
{
|
||||||
|
$k++;
|
||||||
|
$j = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$pluginid = str_replace('icon','',$icon);
|
||||||
|
$values[] = '('.(int)$row->id.','.(int)$pluginid.','.$k.','.$j.',1)';
|
||||||
|
$j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$breakid = $l * -1;
|
||||||
|
if($l < $rowcount)
|
||||||
|
$values[] = '('.(int)$row->id.','.$breakid.','.$k.','.$j.',1)';
|
||||||
|
$l++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//first delete dependencies
|
||||||
|
$query = 'DELETE FROM #__jcktoolbarplugins'
|
||||||
|
. ' WHERE toolbarid = '.$row->id;
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$db->query()) {
|
||||||
|
JCKHelper::error( $db->getErrorMsg() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($values))
|
||||||
|
{
|
||||||
|
$query = 'INSERT INTO `#__jcktoolbarplugins` (toolbarid,pluginid,row,ordering,state) VALUES ' . implode(',',$values);
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if(!$db->query())
|
||||||
|
{
|
||||||
|
JCKHelper::error( $db->ErrorMsg() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//arguments for onSave Event
|
||||||
|
$this->event_args = array('id' => $row->id,'name'=>$row->name,'oldname'=>$oldname,'title'=>$row->title,'isNew'=>$isNew);
|
||||||
|
|
||||||
|
switch ( $task )
|
||||||
|
{
|
||||||
|
case 'apply':
|
||||||
|
$msg = JText::sprintf( 'COM_JCKMAN_TOOLBAR_APPLY', $row->title );
|
||||||
|
$this->setRedirect( 'index.php?option=com_jckman&task=toolbars.edit&cid[]='. $row->id, $msg );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'save':
|
||||||
|
default:
|
||||||
|
$msg = JText::sprintf( 'COM_JCKMAN_TOOLBAR_SAVE', $row->title );
|
||||||
|
$this->setRedirect( 'index.php?option=com_jckman&view=toolbars', $msg );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancel()
|
||||||
|
{
|
||||||
|
// Check for request forgeries
|
||||||
|
JRequest::checkToken() or die( JText::_( 'JINVALID_TOKEN' ) );
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$row = JCKHelper::getTable('toolbar');
|
||||||
|
$form = $app->input->get( 'jform', array(), 'array' );
|
||||||
|
$row->bind($form);
|
||||||
|
$row->checkin();
|
||||||
|
$this->setRedirect( 'index.php?option=com_jckman&view=toolbars');
|
||||||
|
}
|
||||||
|
|
||||||
|
function remove()
|
||||||
|
{
|
||||||
|
// Check for request forgeries
|
||||||
|
JRequest::checkToken() or die( JText::_( 'JINVALID_TOKEN' ) );
|
||||||
|
|
||||||
|
if( !$this->canDo->get('core.delete') )
|
||||||
|
{
|
||||||
|
$this->setRedirect( JRoute::_( 'index.php?option=com_jckman&view=toolbars', false ), JText::_( 'COM_JCKMAN_PLUGIN_PERM_NO_SAVE' ), 'error' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$cid = $app->input->get( 'cid', array(0), 'array' );
|
||||||
|
JArrayHelper::toInteger($cid, array(0));
|
||||||
|
|
||||||
|
if (count( $cid ) < 1) {
|
||||||
|
JCKHelper::error( JText::_( 'JWARNING_DELETE_MUST_SELECT' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty( $cid )) {
|
||||||
|
return JCKHelper::error( JText::_( 'JGLOBAL_NO_ITEM_SELECTED' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$cids = implode( ',', $cid );
|
||||||
|
|
||||||
|
$editor = JPluginHelper::getPlugin('editors','jckeditor');
|
||||||
|
$params = new JRegistry($editor->params);
|
||||||
|
$defaults = array(strtolower($params->get('toolbar','full')),strtolower($params->get('toolbar_ft','full')) );
|
||||||
|
|
||||||
|
$sql = $db->getQuery( true );
|
||||||
|
$sql->select( 'count(1)' )
|
||||||
|
->from( '#__jcktoolbars' )
|
||||||
|
->where( 'id IN ('.$cids.')' )
|
||||||
|
->where( 'LOWER(name) IN ("' . implode('","',$defaults) .'")' );
|
||||||
|
$total = $db->setQuery( $sql )->loadResult();
|
||||||
|
if($msg = $db->getErrorMsg())
|
||||||
|
{
|
||||||
|
return JCKHelper::error( $msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($total > 0){
|
||||||
|
$this->setRedirect( 'index.php?option=com_jckman&view=toolbars');
|
||||||
|
return JCKHelper::error( JText::_( 'COM_JCKMAN_TOOLBAR_NO_DEL_DEFAULT' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sql = $db->getQuery( true );
|
||||||
|
$sql->select( 'count(1)' )
|
||||||
|
->from( '#__jcktoolbars' )
|
||||||
|
->where( 'id IN ('.$cids.')' )
|
||||||
|
->where( 'iscore = 1' );
|
||||||
|
$total = $db->setQuery( $sql )->loadResult();
|
||||||
|
if($msg = $db->getErrorMsg())
|
||||||
|
{
|
||||||
|
return JCKHelper::error( $msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($total > 0){
|
||||||
|
$this->setRedirect( 'index.php?option=com_jckman&view=toolbars');
|
||||||
|
return JCKHelper::error( JText::_( 'COM_JCKMAN_TOOLBAR_NO_DEL_CORE' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = $db->getQuery( true );
|
||||||
|
$sql->select( 'name' )
|
||||||
|
->from( '#__jcktoolbars' )
|
||||||
|
->where( 'id IN ('.$cids.')' );
|
||||||
|
$rows = $db->setQuery( $sql )->loadColumn();
|
||||||
|
|
||||||
|
if (!$db->query()) {
|
||||||
|
return JCKHelper::error( $db->getErrorMsg() );
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->event_args = array('names' => $rows);
|
||||||
|
|
||||||
|
//first delete dependencies
|
||||||
|
$sql = $db->getQuery( true );
|
||||||
|
$sql->delete( '#__jcktoolbarplugins' )
|
||||||
|
->where( 'toolbarid IN ('.$cids.')' );
|
||||||
|
$db->setQuery( $sql );
|
||||||
|
if (!$db->query()) {
|
||||||
|
JCKHelper::error( $db->getErrorMsg() );
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete toolbars
|
||||||
|
$sql = $db->getQuery( true );
|
||||||
|
$sql->delete( '#__jcktoolbars' )
|
||||||
|
->where( 'id IN ('.$cids.')' );
|
||||||
|
$db->setQuery( $sql );
|
||||||
|
if (!$db->query()) {
|
||||||
|
JCKHelper::error( $db->getErrorMsg() );
|
||||||
|
}
|
||||||
|
|
||||||
|
$msg = JText::sprintf( 'COM_JCKMAN_TOOLBAR_DELETE', implode(',',$rows) );
|
||||||
|
$this->setRedirect( 'index.php?option=com_jckman&view=toolbars',$msg );
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkin()
|
||||||
|
{
|
||||||
|
// Check for request forgeries
|
||||||
|
JRequest::checkToken() or die( JText::_( 'JINVALID_TOKEN' ) );
|
||||||
|
|
||||||
|
if( !$this->canDo->get('core.edit.state') )
|
||||||
|
{
|
||||||
|
$this->setRedirect( JRoute::_( 'index.php?option=com_jckman&view=toolbars', false ), JText::_( 'COM_JCKMAN_PLUGIN_PERM_NO_CHECK' ), 'error' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$cid = $app->input->get( 'cid', array(0), 'array' );
|
||||||
|
$sql = $db->getQuery( true );
|
||||||
|
JArrayHelper::toInteger($cid, array(0));
|
||||||
|
|
||||||
|
if(count( $cid ) < 1)
|
||||||
|
{
|
||||||
|
JCKHelper::error( JText::_( 'COM_JCKMAN_TOOLBAR_NO_CHECKIN' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$cids = implode( ',', $cid );
|
||||||
|
$sql->update( '#__jcktoolbars' )
|
||||||
|
->set( array( 'checked_out = 0', 'checked_out_time = "0000-00-00 00:00:00"' ) )
|
||||||
|
->where( 'id IN ( ' . $cids . ' )' )
|
||||||
|
->where( 'checked_out = ' . (int)$user->get('id') );
|
||||||
|
$db->setQuery( $sql );
|
||||||
|
|
||||||
|
if( !$db->query() )
|
||||||
|
{
|
||||||
|
JCKHelper::error( $db->getErrorMsg() );
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->event_args = array('cid' => $cid,'value'=> true );
|
||||||
|
$plural = ( count( $cid ) > 1 ) ? '(s)' : '';
|
||||||
|
|
||||||
|
JCKHelper::error( JText::sprintf( 'COM_JCKMAN_TOOLBAR_CHECKIN', (int)count( $cid ), $plural ), 'message' );
|
||||||
|
|
||||||
|
$this->setRedirect( JRoute::_( 'index.php?option=com_jckman&view=' . $app->input->get( 'view', 'toolbars' ), false ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,219 @@
|
|||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
/*===============> */
|
||||||
|
/*==========> J3.0 */
|
||||||
|
/*===============> */
|
||||||
|
/* TOOLBAR BUTTONS */
|
||||||
|
.icon-cpanel:before
|
||||||
|
{
|
||||||
|
content : "7";
|
||||||
|
color : #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-export:before
|
||||||
|
{
|
||||||
|
content : "R";
|
||||||
|
color : #51A351;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SUBMENU BUTTONS */
|
||||||
|
#sidebar #submenu a[href*='com_jckman&view=cpanel']:before
|
||||||
|
{
|
||||||
|
font-family : 'IcoMoon';
|
||||||
|
content : "7 ";
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebar #submenu a[href*='com_jckman&view=list']:before
|
||||||
|
{
|
||||||
|
font-family : 'IcoMoon';
|
||||||
|
content : "4 ";
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebar #submenu a[href*='com_jckman&view=install']:before
|
||||||
|
{
|
||||||
|
font-family : 'IcoMoon';
|
||||||
|
content : "3 ";
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebar #submenu a[href*='com_jckman&view=extension']:before
|
||||||
|
{
|
||||||
|
font-family : 'IcoMoon';
|
||||||
|
content : "L ";
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebar #submenu a[href*='com_jckman&view=cpanel&taskbtn=system']:before
|
||||||
|
{
|
||||||
|
font-family : 'IcoMoon';
|
||||||
|
content : "j ";
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebar #submenu a[href*='com_jckman&view=toolbars']:before
|
||||||
|
{
|
||||||
|
font-family : 'IcoMoon';
|
||||||
|
content : "1 ";
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebar #submenu a[href*='com_jckman&view=import']:before
|
||||||
|
{
|
||||||
|
font-family : 'IcoMoon';
|
||||||
|
content : "l ";
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebar #submenu a[href*='com_jckman&view=cpanel&taskbtn=export']:before
|
||||||
|
{
|
||||||
|
font-family : 'IcoMoon';
|
||||||
|
content : "R ";
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebar #submenu a[href*='com_jckman&view=cpanel&taskbtn=sync']:before
|
||||||
|
{
|
||||||
|
font-family : 'IcoMoon';
|
||||||
|
content : "f ";
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebar #submenu a[href*='com_jckman&view=cpanel&taskbtn=editor']:before
|
||||||
|
{
|
||||||
|
font-family : 'IcoMoon';
|
||||||
|
content : "2 ";
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebar #submenu a[href*='com_installer']
|
||||||
|
{
|
||||||
|
display : none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* J3.0 STYLE FIXES */
|
||||||
|
.nav-tabs a:focus
|
||||||
|
{
|
||||||
|
outline : 0px none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-nav .nav-list a.nolink,
|
||||||
|
.sidebar-nav .nav-list a.nolink:hover,
|
||||||
|
.sidebar-nav .nav-list li.active a.nolink,
|
||||||
|
.sidebar-nav .nav-list li.active a.nolink:hover
|
||||||
|
{
|
||||||
|
color : #888888;
|
||||||
|
background-color : transparent;
|
||||||
|
text-shadow : none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* MOBILE STYLE FIXES */
|
||||||
|
#filter-bar .btn-group > .btn
|
||||||
|
{
|
||||||
|
max-width : 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jckbreak
|
||||||
|
{
|
||||||
|
word-break : break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ACCESSIBILITY TMPL FIXES */
|
||||||
|
/* installer */
|
||||||
|
body#minwidth-body .nav-tabs > li
|
||||||
|
{
|
||||||
|
float : left;
|
||||||
|
list-style : none outside none;
|
||||||
|
}
|
||||||
|
|
||||||
|
body#minwidth-body #main-container > div
|
||||||
|
{
|
||||||
|
padding : 20px;
|
||||||
|
clear : both;
|
||||||
|
}
|
||||||
|
|
||||||
|
body#minwidth-body #jform_selections_chzn
|
||||||
|
{
|
||||||
|
min-width : 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* installer tabs fix */
|
||||||
|
body#minwidth-body #main-container .nav li
|
||||||
|
{
|
||||||
|
margin : 3px 5px;
|
||||||
|
padding : 5px;
|
||||||
|
|
||||||
|
border : 1px solid #C7C8B2;
|
||||||
|
background-color : #F9FADE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* root tabs fix */
|
||||||
|
body#minwidth-body #submenu
|
||||||
|
{
|
||||||
|
padding-bottom : 31px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body#minwidth-body #submenu li
|
||||||
|
{
|
||||||
|
margin-top : 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body#minwidth-body .jckman_install #submenu li:nth-child(1),
|
||||||
|
body#minwidth-body .jckman_install #submenu li:nth-child(2),
|
||||||
|
body#minwidth-body .jckman_install #submenu li:nth-child(3),
|
||||||
|
body#minwidth-body .jckman_install #submenu li:nth-child(4),
|
||||||
|
body#minwidth-body .jckman_install #submenu li:nth-child(5),
|
||||||
|
body#minwidth-body .jckman_install #submenu li:nth-child(6),
|
||||||
|
body#minwidth-body .jckman_install #submenu li:nth-child(7)
|
||||||
|
{
|
||||||
|
display : none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*==========> END J3.0! */
|
||||||
|
|
||||||
|
.icon-48-cpanel {
|
||||||
|
background-image:url("../icons/icon-48-cpanel.png") !important;
|
||||||
|
}
|
||||||
|
.icon-32-cpanel {
|
||||||
|
background-image:url("../icons/icon-32-cpanel.png") !important;
|
||||||
|
}
|
||||||
|
.pane-sliders .content {
|
||||||
|
background:none repeat scroll 0 0 #FFFFFF !important;
|
||||||
|
}
|
||||||
|
.icon-48-plugin {
|
||||||
|
background-image:url("../icons/icon-48-plugin.png") !important;
|
||||||
|
}
|
||||||
|
.icon-48-layout {
|
||||||
|
background-image:url("../icons/icon-48-layout.png") !important;
|
||||||
|
}
|
||||||
|
.icon-48-installer {
|
||||||
|
background-image:url("../icons/icon-48-installer.png") !important;
|
||||||
|
}
|
||||||
|
.icon-48-import {
|
||||||
|
background-image:url("../icons/icon-48-import.png") !important;
|
||||||
|
}
|
||||||
|
.message small
|
||||||
|
{
|
||||||
|
font-size:inherit !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*J!1.6 StyleFixes - PF*/
|
||||||
|
fieldset.adminform input, fieldset.adminform textarea, fieldset.adminform select, fieldset.adminform img, fieldset.adminform button {
|
||||||
|
float: none !important;
|
||||||
|
}
|
||||||
|
fieldset.adminform label, fieldset.adminform span.faux-label {
|
||||||
|
float: none !important; display: inline !important;
|
||||||
|
}
|
||||||
|
div.width-60 {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
div.width-40 {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
div#element-box div.m {
|
||||||
|
padding: 0 10px !important;
|
||||||
|
}
|
||||||
|
table.adminform td {
|
||||||
|
padding: 15px !important; font-size: 11px !important;
|
||||||
|
}
|
||||||
|
#content-pane {margin: 0 !important;
|
||||||
|
}
|
||||||
|
input.button {
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
.cke_icon {
|
||||||
|
background-image:url(../icons/icons.png);
|
||||||
|
background-position:100px 50%;
|
||||||
|
background-repeat:no-repeat;
|
||||||
|
display:inline-block;
|
||||||
|
height:16px;
|
||||||
|
margin-top:1px;
|
||||||
|
width:16px;
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,135 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// no direct access
|
||||||
|
defined( '_JEXEC' ) or die();
|
||||||
|
|
||||||
|
error_reporting(E_ERROR);
|
||||||
|
|
||||||
|
jimport('joomla.event.plugin');
|
||||||
|
jimport('joomla.html.parameter');
|
||||||
|
jckimport('ckeditor.htmlwriter.javascript');
|
||||||
|
|
||||||
|
class plgEditorACL extends JPlugin
|
||||||
|
{
|
||||||
|
|
||||||
|
function plgEditorACL(& $subject, $config)
|
||||||
|
{
|
||||||
|
parent::__construct($subject, $config);
|
||||||
|
}
|
||||||
|
|
||||||
|
function beforeLoad(&$params)
|
||||||
|
{
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
|
||||||
|
|
||||||
|
if($user->authorise('core.admin'))
|
||||||
|
return;
|
||||||
|
|
||||||
|
$query = 'SELECT id,name,acl,parentid FROM #__jckplugins WHERE published = 1';
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$plugins = $db->loadObjectList();
|
||||||
|
|
||||||
|
if (!is_array($plugins)) {
|
||||||
|
JCKHelper::error( $db->getErrorMsg() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($plugins))
|
||||||
|
return;
|
||||||
|
|
||||||
|
$groups = $user->getAuthorisedGroups();
|
||||||
|
|
||||||
|
|
||||||
|
$js = '';
|
||||||
|
|
||||||
|
$deniedPlugins = array();
|
||||||
|
$removePlugins = array();
|
||||||
|
|
||||||
|
foreach($plugins as $plugin)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(is_null($plugin->acl))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$acl = json_decode($plugin->acl);
|
||||||
|
|
||||||
|
$allow = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(empty($acl))
|
||||||
|
{
|
||||||
|
$allow = false;
|
||||||
|
$deniedPlugins[] = $plugin->id;
|
||||||
|
$removePlugins[] = $plugin->name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
if( $groups )
|
||||||
|
{
|
||||||
|
$allow = false;
|
||||||
|
for( $n=0, $i=count($groups); $n<$i; $n++ )
|
||||||
|
{
|
||||||
|
if( in_array( $groups[$n], $acl) )
|
||||||
|
{
|
||||||
|
$allow = true;
|
||||||
|
break;
|
||||||
|
}//end if
|
||||||
|
|
||||||
|
}//end for loop
|
||||||
|
if(!$allow)
|
||||||
|
{
|
||||||
|
$deniedPlugins[] = $plugin->id;
|
||||||
|
$removePlugins[] = $plugin->name;
|
||||||
|
}
|
||||||
|
}//end if
|
||||||
|
|
||||||
|
// check to see if parent plugin access view level is denied. If is then parent settings override
|
||||||
|
if($allow && in_array( $plugin->parentid, $deniedPlugins))
|
||||||
|
{
|
||||||
|
$deniedPlugins[] = $plugin->id;
|
||||||
|
$removePlugins[] = $plugin->name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//var_dump($removePlugins);
|
||||||
|
|
||||||
|
if(empty($removePlugins))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//lets create JS object
|
||||||
|
$javascript = new JCKJavascript();
|
||||||
|
|
||||||
|
$plugs = implode(',',$removePlugins);
|
||||||
|
|
||||||
|
$javascript->addScriptDeclaration(
|
||||||
|
"editor.on( 'configLoaded', function()
|
||||||
|
{
|
||||||
|
if(editor.config.removePlugins)
|
||||||
|
editor.config.removePlugins += ',".$plugs."';
|
||||||
|
else
|
||||||
|
editor.config.removePlugins += '".$plugs."';
|
||||||
|
});"
|
||||||
|
);
|
||||||
|
|
||||||
|
return $javascript->toRaw();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
|
||||||
|
jimport('joomla.event.plugin');
|
||||||
|
jckimport('ckeditor.htmlwriter.javascript');
|
||||||
|
|
||||||
|
|
||||||
|
class plgToolbarComponents extends JPlugin
|
||||||
|
{
|
||||||
|
|
||||||
|
function plgToolbarComponents(& $subject, $config)
|
||||||
|
{
|
||||||
|
parent::__construct($subject, $config);
|
||||||
|
}
|
||||||
|
|
||||||
|
function load(&$params)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$defaults = array(strtolower($params->get('toolbar','full')),strtolower($params->get('toolbar_ft','full')) );
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->select('name,params')
|
||||||
|
->from('#__jcktoolbars')
|
||||||
|
->where('published = 1')
|
||||||
|
->where('LOWER(name) NOT IN("'. implode('","',$defaults).'")')
|
||||||
|
->order('id DESC');
|
||||||
|
$db->setQuery($query);
|
||||||
|
$toolbars = $db->loadObjectList();
|
||||||
|
|
||||||
|
if(empty($toolbars))
|
||||||
|
return;
|
||||||
|
|
||||||
|
$component = JFactory::getApplication()->input->get('option','');
|
||||||
|
|
||||||
|
foreach($toolbars as $toolbar)
|
||||||
|
{
|
||||||
|
$tparams = new JRegistry($toolbar->params);
|
||||||
|
$components = $tparams->get('components',array(0));
|
||||||
|
|
||||||
|
if(in_array($component,$components,true))
|
||||||
|
{
|
||||||
|
$name = ucfirst($toolbar->name);
|
||||||
|
$params->set('toolbar',$name);
|
||||||
|
$params->set('toolbar_ft',$name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,21 @@
|
|||||||
|
<extension version="1.7.0" type="backup" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Mar 2012</creationDate>
|
||||||
|
<description></description>
|
||||||
|
<license>GNU/GPL</license>
|
||||||
|
<author>Andrew Williams</author>
|
||||||
|
<authoremail>andrew@joomlackedior.com</authoremail>
|
||||||
|
<authorurl>http://www.joomlackedior.com</authorurl>
|
||||||
|
<copyright>2012 - 2013 WebxSolutions Ltd</copyright>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<install>
|
||||||
|
<sql>
|
||||||
|
<file driver="mysql" charset="utf8">plugins/sql.sql</file>
|
||||||
|
</sql>
|
||||||
|
</install>
|
||||||
|
<files>
|
||||||
|
<folder>plugins</folder>
|
||||||
|
<folder>toolbar</folder>
|
||||||
|
</files>
|
||||||
|
</extension>
|
||||||
@ -0,0 +1,89 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
define('DS',DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
|
define('CKEDITOR_INCLUDES_DIR','jckeditor/includes');
|
||||||
|
|
||||||
|
//Get root folder
|
||||||
|
$dir = explode(DS,dirname(__FILE__));
|
||||||
|
array_splice($dir,-3);
|
||||||
|
$base_folder = implode(DS,$dir);
|
||||||
|
$base_path = '';
|
||||||
|
$user = '';
|
||||||
|
|
||||||
|
define( '_JEXEC', 1 );
|
||||||
|
define('JPATH_BASE',$base_folder);
|
||||||
|
//Needed for 1.6
|
||||||
|
define('JDEBUG',false);
|
||||||
|
|
||||||
|
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
|
||||||
|
|
||||||
|
/* Load in the configuation file */
|
||||||
|
require_once( JPATH_CONFIGURATION .DS.'configuration.php' );
|
||||||
|
|
||||||
|
/*load loader class */
|
||||||
|
require_once(JPATH_LIBRARIES .DS.'loader.php' );
|
||||||
|
|
||||||
|
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
|
||||||
|
|
||||||
|
/*load joomla loader class */
|
||||||
|
require_once(JPATH_LIBRARIES .DS.'loader.php' );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
require_once(JPATH_LIBRARIES .DS.'joomla'.DS .'methods.php' );
|
||||||
|
|
||||||
|
jimport('joomla.base.object');
|
||||||
|
jimport('joomla.filter.filterinput');
|
||||||
|
jimport('joomla.factory');
|
||||||
|
jimport('joomla.error.error');
|
||||||
|
jimport('joomla.environment.uri');
|
||||||
|
jimport('joomla.environment.request');
|
||||||
|
jimport('joomla.environment.response');
|
||||||
|
jimport('joomla.language.language');
|
||||||
|
jimport('joomla.user.user');
|
||||||
|
jimport('joomla.application.component.model');
|
||||||
|
jimport('joomla.database.table');
|
||||||
|
jimport('joomla.html.parameter');
|
||||||
|
jimport('joomla.plugin.helper');
|
||||||
|
jimport('joomla.event.dispatcher');
|
||||||
|
|
||||||
|
|
||||||
|
/* load JCK loader class*/
|
||||||
|
require_once (CKEDITOR_INCLUDES_DIR . '/loader.php');
|
||||||
|
|
||||||
|
//lets set DB configuration
|
||||||
|
$config = new JConfig();
|
||||||
|
// Get the global configuration object
|
||||||
|
$registry =& JFactory::getConfig();
|
||||||
|
// Load the configuration values into the registry
|
||||||
|
$registry->loadObject($config);
|
||||||
|
|
||||||
|
//set session
|
||||||
|
jckimport('ckeditor.user.user');
|
||||||
|
$session =& JCKUser::getSession();
|
||||||
|
|
||||||
|
// system events trigger events
|
||||||
|
jckimport('ckeditor.plugins.helper');
|
||||||
|
|
||||||
|
//load CK System plugins
|
||||||
|
JCKPluginsHelper::storePlugins('default');
|
||||||
|
|
||||||
|
$dispatcher =& JDispatcher::getInstance();
|
||||||
|
|
||||||
|
$plugin =& JPluginHelper::getPlugin('editors','jckeditor');
|
||||||
|
$params = new JParameter($plugin->params);
|
||||||
|
|
||||||
|
//import System plugin first
|
||||||
|
JCKPluginsHelper::importPlugin('default');
|
||||||
|
|
||||||
|
$dispatcher->trigger('intialize',array(&$params));
|
||||||
|
|
||||||
|
$plugin->params = $params->toString();
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2013 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||||
|
|
||||||
|
jimport('joomla.event.plugin');
|
||||||
|
jckimport('ckeditor.htmlwriter.javascript');
|
||||||
|
|
||||||
|
|
||||||
|
class plgEditorlanguageOverrides extends JPlugin
|
||||||
|
{
|
||||||
|
|
||||||
|
function plgEditorlanguageOverrides(& $subject, $config)
|
||||||
|
{
|
||||||
|
parent::__construct($subject, $config);
|
||||||
|
}
|
||||||
|
|
||||||
|
function beforeLoad(&$params)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$basePath = JPATH_CONFIGURATION.'/administrator/components/com_jckman/editor/lang';
|
||||||
|
|
||||||
|
|
||||||
|
$languages = JFolder::files($basePath, '.js$', 1, true);
|
||||||
|
|
||||||
|
$js = "";
|
||||||
|
$default = $params->get("joomlaLang","en");
|
||||||
|
|
||||||
|
foreach($languages as $language)
|
||||||
|
{
|
||||||
|
$content = file_get_contents($language);
|
||||||
|
$content = preg_replace("/\/\*.*?\*\//s","",$content);
|
||||||
|
|
||||||
|
$content = str_replace('"',"'",$content);
|
||||||
|
$language = str_replace("\\","/",$language);
|
||||||
|
$parts = explode("/",$language);
|
||||||
|
$lang = preg_replace("/\.js$/","",array_pop($parts));
|
||||||
|
$plugin = array_pop($parts);
|
||||||
|
if(($lang != $default && $lang != 'en' ) || $plugin == 'lang' ) //make sure we always load in default english file
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$content = preg_replace("/\)$/",");",trim($content));
|
||||||
|
|
||||||
|
if($plugin == 'jflash')
|
||||||
|
$plug = 'flash';
|
||||||
|
else
|
||||||
|
$plug = $plugin;
|
||||||
|
$js .= "CKEDITOR.on('".$plugin."PluginLoaded', function(evt)
|
||||||
|
{
|
||||||
|
editor.lang.".$plug." = null;
|
||||||
|
evt.data.lang = ['".$default."'];
|
||||||
|
".$content."
|
||||||
|
});";
|
||||||
|
}
|
||||||
|
|
||||||
|
//lets create JS object
|
||||||
|
$javascript = new JCKJavascript();
|
||||||
|
$javascript->addScriptDeclaration($js);
|
||||||
|
return $javascript->toRaw();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,261 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// no direct access
|
||||||
|
defined( '_JEXEC' ) or die();
|
||||||
|
|
||||||
|
error_reporting(E_ERROR);
|
||||||
|
|
||||||
|
jimport('joomla.event.plugin');
|
||||||
|
jimport('joomla.html.parameter');
|
||||||
|
jckimport('ckeditor.htmlwriter.javascript');
|
||||||
|
|
||||||
|
require(JPATH_ADMINISTRATOR.'/components/com_jckman/config/handler.php');
|
||||||
|
require(JPATH_ADMINISTRATOR.'/components/com_jckman/helper.php');
|
||||||
|
|
||||||
|
class plgEditorPluginOverrides extends JPlugin
|
||||||
|
{
|
||||||
|
function plgEditorPluginOverrides(& $subject, $config)
|
||||||
|
{
|
||||||
|
parent::__construct($subject, $config);
|
||||||
|
}
|
||||||
|
|
||||||
|
function beforeLoad(&$registry)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
|
||||||
|
$query = 'SELECT * FROM #__jckplugins WHERE published = 1';
|
||||||
|
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$plugins = $db->loadObjectList();
|
||||||
|
|
||||||
|
if (!is_array($plugins)) {
|
||||||
|
JCKHelper::error( $db->getErrorMsg() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($plugins))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//lets create JS object
|
||||||
|
$javascript = new JCKJavascript();
|
||||||
|
$script = "CKEDITOR.jckplugins = {";
|
||||||
|
|
||||||
|
foreach($plugins as $plugin)
|
||||||
|
{
|
||||||
|
if(empty($plugin->params) || $plugin->params == '{}' )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if($plugin->iscore)
|
||||||
|
$params = new JCKParameter(trim($plugin->params),JPATH_ADMINISTRATOR.DS.'components'.DS.'com_jckman'.DS.'editor'.DS.'plugins'.DS.$plugin->name.'.xml');
|
||||||
|
else
|
||||||
|
$params = new JCKParameter(trim($plugin->params),JPATH_PLUGINS.DS.'editors'.DS.'jckeditor'.DS.'plugins'.DS.$plugin->name.DS.$plugin->name.'.xml');
|
||||||
|
$name = $plugin->name;
|
||||||
|
|
||||||
|
$dialogName = $params->get('dialogname','');
|
||||||
|
$title = $params->get('dialogtitle','');
|
||||||
|
$height = $params->get('height','');
|
||||||
|
$width = $params->get('width','');
|
||||||
|
$resizable = $params->get('resizable','');
|
||||||
|
|
||||||
|
if($dialogName)
|
||||||
|
$name = $dialogName; // overrwite plugin name with dialogname
|
||||||
|
|
||||||
|
//lets get plugin Joomla configurable options
|
||||||
|
|
||||||
|
if(trim((strtolower($title)) == 'default'))
|
||||||
|
$title = '';
|
||||||
|
|
||||||
|
$options = '';
|
||||||
|
$optionsXML = $params->getXML();
|
||||||
|
|
||||||
|
if (isset($optionsXML['options']))
|
||||||
|
{
|
||||||
|
foreach ($optionsXML['options']->children() as $node)
|
||||||
|
{
|
||||||
|
$key = $node->attributes('name');
|
||||||
|
$default = $node->attributes('default');
|
||||||
|
$value = $params->get($key,$default);
|
||||||
|
|
||||||
|
$handler = JCKConfigHandler::getInstance($node->attributes('type'));
|
||||||
|
$options.= $handler->getOptions($key,$value,$default,$node,$params,$name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($options)
|
||||||
|
{
|
||||||
|
$options = substr($options, 0, -1);
|
||||||
|
$options = '[' . $options . ']';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$options = 'false';
|
||||||
|
|
||||||
|
$script .= "$name:{'title':'$title','height':'$height','width':'$width','resizable':'$resizable','options': $options},";
|
||||||
|
|
||||||
|
}
|
||||||
|
if($script != "CKEDITOR.jckplugins = {")
|
||||||
|
$script = substr($script, 0, -1);
|
||||||
|
$script .= "};" . chr(13);
|
||||||
|
|
||||||
|
$actionscript = "
|
||||||
|
|
||||||
|
CKEDITOR.tools.removeSlashes = function(val)
|
||||||
|
{
|
||||||
|
val = val.replace(/(\\\"|\\\')/g,'');
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
CKEDITOR.on( 'dialogDefinition', function( ev )
|
||||||
|
{
|
||||||
|
// Take the dialog name and its definition from the event
|
||||||
|
// data.
|
||||||
|
var dialogName = ev.data.name;
|
||||||
|
var dialogDefinition = ev.data.definition;
|
||||||
|
|
||||||
|
if(CKEDITOR.jckplugins[dialogName ])
|
||||||
|
{
|
||||||
|
var jckplugin = CKEDITOR.jckplugins[dialogName ];
|
||||||
|
|
||||||
|
if(jckplugin.title) dialogDefinition.title = jckplugin.title;
|
||||||
|
if(jckplugin.height) dialogDefinition.minHeight = jckplugin.height;
|
||||||
|
if(jckplugin.width) dialogDefinition.minWidth = jckplugin.width;
|
||||||
|
if(jckplugin.resizable) dialogDefinition.resizable = jckplugin.resizable;
|
||||||
|
|
||||||
|
if(jckplugin.options)
|
||||||
|
{
|
||||||
|
for(var k = 0; k < jckplugin.options.length;k++)
|
||||||
|
{
|
||||||
|
eval('CKEDITOR.config.' + CKEDITOR.tools.removeSlashes(jckplugin.options[k]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for(var m in CKEDITOR.jckplugins)
|
||||||
|
{
|
||||||
|
var jckplugin = CKEDITOR.jckplugins[m];
|
||||||
|
|
||||||
|
if(jckplugin.options)
|
||||||
|
{
|
||||||
|
for(var n = 0; n < jckplugin.options.length;n++)
|
||||||
|
{
|
||||||
|
eval('editor.config.' + CKEDITOR.tools.removeSlashes(jckplugin.options[n]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
";
|
||||||
|
|
||||||
|
$javascript->addScriptDeclaration($script.$actionscript);
|
||||||
|
return $javascript->toRaw();
|
||||||
|
}
|
||||||
|
|
||||||
|
function afterLoad(&$params)
|
||||||
|
{
|
||||||
|
$javascript = new JCKJavascript();
|
||||||
|
|
||||||
|
$script = "for(var m in CKEDITOR.jckplugins)
|
||||||
|
{
|
||||||
|
var jckplugin = CKEDITOR.jckplugins[m];
|
||||||
|
|
||||||
|
if(jckplugin.options)
|
||||||
|
{
|
||||||
|
|
||||||
|
for(var n = 0; n < jckplugin.options.length;n++)
|
||||||
|
{
|
||||||
|
eval('editor.config.' + CKEDITOR.tools.removeSlashes(jckplugin.options[n]));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}";
|
||||||
|
|
||||||
|
$javascript->addScriptDeclaration($script);
|
||||||
|
return $javascript->toRaw();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class JCKParameter extends JRegistry
|
||||||
|
{
|
||||||
|
protected $_elementPath = array();
|
||||||
|
protected $_raw = false;
|
||||||
|
protected $_xml = false;
|
||||||
|
|
||||||
|
public function __construct($data = '', $path = '')
|
||||||
|
{
|
||||||
|
parent::__construct('_default');
|
||||||
|
|
||||||
|
// Set base path.
|
||||||
|
$this->_elementPath[] = dirname(__FILE__) . '/parameter/element';
|
||||||
|
|
||||||
|
if (!empty($data) && is_string($data))
|
||||||
|
{
|
||||||
|
$this->loadString($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($path)
|
||||||
|
{
|
||||||
|
$this->loadSetupFile($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_raw = $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getXML()
|
||||||
|
{
|
||||||
|
return $this->_xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setXML(&$xml)
|
||||||
|
{
|
||||||
|
if (is_object($xml))
|
||||||
|
{
|
||||||
|
if ($group = $xml->attributes('group'))
|
||||||
|
{
|
||||||
|
$this->_xml[$group] = $xml;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->_xml['_default'] = $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($dir = $xml->attributes('addpath'))
|
||||||
|
{
|
||||||
|
$this->addElementPath(JPATH_ROOT . str_replace('/', DS, $dir));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadSetupFile($path)
|
||||||
|
{
|
||||||
|
$result = false;
|
||||||
|
|
||||||
|
if ($path)
|
||||||
|
{
|
||||||
|
$xml = JCKHelper::getXMLParser('Simple');
|
||||||
|
|
||||||
|
if ($xml->loadFile($path))
|
||||||
|
{
|
||||||
|
if ($params = $xml->document->params)
|
||||||
|
{
|
||||||
|
foreach ($params as $param)
|
||||||
|
{
|
||||||
|
$this->setXML($param);
|
||||||
|
$result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// no direct access
|
||||||
|
defined( '_JEXEC' ) or die();
|
||||||
|
|
||||||
|
class JCKPlugins
|
||||||
|
{
|
||||||
|
|
||||||
|
var $_extraPlugins = '';
|
||||||
|
|
||||||
|
var $_removePlugins = '';
|
||||||
|
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
foreach (get_object_vars($this ) as $k => $v)
|
||||||
|
{
|
||||||
|
if (is_array($v) || is_object($v) || is_null($k)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($k[0] == '_') { // internal field
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(is_numeric($v) && $v == 0)
|
||||||
|
$this->_removePlugins .= "$k,";
|
||||||
|
|
||||||
|
if(is_numeric($v) && $v == 1)
|
||||||
|
$this->_extraPlugins .= "$k,";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (substr($this->_removePlugins, -1) == ',')
|
||||||
|
$this->_removePlugins = substr($this->_removePlugins, 0, -1);
|
||||||
|
|
||||||
|
if (substr($this->_extraPlugins, -1) == ',')
|
||||||
|
$this->_extraPlugins = substr($this->_extraPlugins, 0, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getExtraPlugins()
|
||||||
|
{
|
||||||
|
return $this->_extraPlugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRemovedPlugins()
|
||||||
|
{
|
||||||
|
return $this->_removePlugins;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="audio" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params>
|
||||||
|
<param name="dialogtitle_switcher" type="jsradio" default="0" label="PLG_JCK_DIALOG_TITLESHWN" description="PLG_JCK_DIALOG_TITLESHWN_DESC" >
|
||||||
|
<option value="0">Default</option>
|
||||||
|
<option value="1">Enter new title</option>
|
||||||
|
</param>
|
||||||
|
<param name="dialogtitle" type="text" default="Default" label="PLG_JCK_DIALOG_TITLEENT" description="PLG_JCK_DIALOG_TITLEENT_DESC" />
|
||||||
|
<param name="height" type="text" default="200" label="PLG_JCK_DIALOG_HEIGHT" description="PLG_JCK_DIALOG_HEIGHT_DESC" />
|
||||||
|
<param name="width" type="text" default="400" label="PLG_JCK_DIALOG_WIDTH" description="PLG_JCK_DIALOG_WIDTH_DESC"/>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="autogrow" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="autoGrow_maxHeight" type="list" default="500" label="PLG_JCK_AUTOGROW_MAX_HEIGHT" description="PLG_JCK_AUTOGROW_MAX_HEIGHT_DESC">
|
||||||
|
<option value="500">500</option>
|
||||||
|
<option value="1000">1000</option>
|
||||||
|
<option value="1500">1500</option>
|
||||||
|
<option value="2000">2000</option>
|
||||||
|
<option value="2500">2500</option>
|
||||||
|
<option value="3000">3000</option>
|
||||||
|
<option value="0">Unlimted</option>
|
||||||
|
</param>
|
||||||
|
<param name="autoGrow_minHeight" type="list" default="250" label="PLG_JCK_AUTOGROW_MIN_HEIGHT" description="PLG_JCK_AUTOGROW_MIN_HEIGHT_DESC">
|
||||||
|
<option value="250">250</option>
|
||||||
|
<option value="300">300</option>
|
||||||
|
<option value="350">350</option>
|
||||||
|
<option value="400">400</option>
|
||||||
|
<option value="450">450</option>
|
||||||
|
<option value="500">500</option>
|
||||||
|
</param>
|
||||||
|
<param name="autoGrow_onStartup" type="radio" default="0" label="PLG_JCK_ENABLE_AUTO_GROW_ON_STARTUP" description="PLG_JCK_ENABLE_AUTO_GROW_ON_STARTUP_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="colorbutton" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="colorButton_colors" type="addcolorlist" default="" label="PLG_JCK_COLOR_LIST" description="PLG_JCK_COLOR_LIST_DESC">
|
||||||
|
<option value="000">000</option>
|
||||||
|
<option value="800000">800000</option>
|
||||||
|
<option value="8B4513">8B4513</option>
|
||||||
|
<option value="2F4F4F">2F4F4F</option>
|
||||||
|
<option value="008080">008080</option>
|
||||||
|
<option value="000080">000080</option>
|
||||||
|
<option value="4B0082">4B0082</option>
|
||||||
|
<option value="696969">696969</option>
|
||||||
|
<option value="B22222">B22222</option>
|
||||||
|
<option value="A52A2A">A52A2A</option>
|
||||||
|
<option value="DAA520">DAA520</option>
|
||||||
|
<option value="006400">006400</option>
|
||||||
|
<option value="40E0D0">40E0D0</option>
|
||||||
|
<option value="0000CD">0000CD</option>
|
||||||
|
<option value="800080">800080</option>
|
||||||
|
<option value="808080">808080</option>
|
||||||
|
<option value="F00">F00</option>
|
||||||
|
<option value="FF8C00">FF8C00</option>
|
||||||
|
<option value="FFD700">FFD700</option>
|
||||||
|
<option value="008000">008000</option>
|
||||||
|
<option value="0FF">0FF</option>
|
||||||
|
<option value="00F">00F</option>
|
||||||
|
<option value="A9A9A9">A9A9A9</option>
|
||||||
|
<option value="FFA07A">FFA07A</option>
|
||||||
|
<option value="FFA500">FFA500</option>
|
||||||
|
<option value="FFFF00">FFFF00</option>
|
||||||
|
<option value="00FF00">00FF00</option>
|
||||||
|
<option value="FFFF00">FFFF00</option>
|
||||||
|
<option value="AFEEEE">AFEEEE</option>
|
||||||
|
<option value="ADD8E6">ADD8E6</option>
|
||||||
|
<option value="DDA0DD">DDA0DD</option>
|
||||||
|
<option value="D3D3D3">D3D3D3</option>
|
||||||
|
<option value="FFF0F5">FFF0F5</option>
|
||||||
|
<option value="FAEBD7">FAEBD7</option>
|
||||||
|
<option value="FAEBD7">FAEBD7</option>
|
||||||
|
<option value="FFFFE0">FFFFE0</option>
|
||||||
|
<option value="F0FFF0">F0FFF0</option>
|
||||||
|
<option value="F0FFFF">F0FFFF</option>
|
||||||
|
<option value="F0F8FF">F0F8FF</option>
|
||||||
|
<option value="E6E6FA">E6E6FA</option>
|
||||||
|
<option value="FFF">FFF</option>
|
||||||
|
</param>
|
||||||
|
<param name="colorButton_enableMore" type="radio" default="1" label="PLG_JCK_ENABLE_MORE_COLORS" description="PLG_JCK_ENABLE_MORE_COLORS_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="colordialog" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params>
|
||||||
|
<param name="PLG_JCK_DIALOG_TITLESHWN" type="jsradio" default="0" label="Dialog Title" description="PLG_JCK_DIALOG_TITLESHWN_DESC" >
|
||||||
|
<option value="0">Default</option>
|
||||||
|
<option value="1">Enter new title</option>
|
||||||
|
</param>
|
||||||
|
<param name="dialogtitle" type="text" default="Default" label="PLG_JCK_DIALOG_TITLEENT" description="PLG_JCK_DIALOG_TITLEENT_DESC" />
|
||||||
|
<param name="height" type="text" default="220" label="PLG_JCK_DIALOG_HEIGHT" description="PLG_JCK_DIALOG_HEIGHT_DESC" />
|
||||||
|
<param name="width" type="text" default="360" label="PLG_JCK_DIALOG_WIDTH" description="The width of dialog"/>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="contextmenu" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="browserContextMenuOnCtrl" type="radio" default="1" label="PLG_JCK_SHOW_BROWSER _CONTEXT_MENU_ON_CTRL_KEY" description="PLG_JCK_SHOW_BROWSER _CONTEXT_MENU_ON_CTRL_KEY_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="dialog" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="baseFloatZIndex" type="text" default="10000" label="PLG_JCK_DIALOG_FLOAT_INDEX" description="PLG_JCK_DIALOG_FLOAT_INDEX_DESC"/>
|
||||||
|
<param name="dialog_backgroundCoverColor" type="jscolor" default="#FFFFFF" label="PLG_JCK_DIALOG_BACKGROUND_COVER_COLOR" description="PLG_JCK_DIALOG_BACKGROUND_COVER_COLOR_DESC"/>
|
||||||
|
<param name="indentOffset" type="list" default="0.7" label="PLG_JCK_DIALOG_INDENT_OFFSET" description="PLG_JCK_DIALOG_INDENT_OFFSET_DESC">
|
||||||
|
<option value="0.1">0.1</option>
|
||||||
|
<option value="0.2">0.2</option>
|
||||||
|
<option value="0.3">0.3</option>
|
||||||
|
<option value="0.4">0.4</option>
|
||||||
|
<option value="0.5">0.5</option>
|
||||||
|
<option value="0.6">0.6</option>
|
||||||
|
<option value="0.7">0.7</option>
|
||||||
|
<option value="0.8">0.8</option>
|
||||||
|
<option value="0.9">0.9</option>
|
||||||
|
<option value="1.0">1.0</option>
|
||||||
|
</param>
|
||||||
|
<param name="dialog_buttonsOrder" type="list" default="OS" label="PLG_JCK_DIALOG_BUTTON_ORDER" description="PLG_JCK_DIALOG_BUTTON_ORDER_DESC">
|
||||||
|
<option value="OS">Operating System</option>
|
||||||
|
<option value="ltr">Left to Right</option>
|
||||||
|
<option value="rtl">Right to Left</option>
|
||||||
|
</param>
|
||||||
|
<param name="dialog_startupFocusTab" type="radio" default="0" label="PLG_JCK_DIALOG_STARTUP_FOCUS _TAB" description="PLG_JCK_DIALOG_STARTUP_FOCUS _TAB_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="editingblock" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="autoParagraph" type="radio" default="1" label="PLG_JCK_AUTO_PARAGRAH" description="PLG_JCK_AUTO_PARAGRAH_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
<param name="startupMode" type="radio" default="wysiwyg" label="PLG_JCK_STARTUP_MODE" description="PLG_JCK_STARTUP_MODE_DESC">
|
||||||
|
<option value="wysiwyg">WYSISYG</option>
|
||||||
|
<option value="source">Source</option>
|
||||||
|
</param>
|
||||||
|
<param name="useComputedState" type="radio" default="0" label="PLG_JCK_USE_COMPUTED_STATE" description="PLG_JCK_USE_COMPUTED_STATE_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="enterkey" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="forceEnterMode" type="radio" default="0" label="PLG_JCK_FORCE_ENTER_MODE" description="PLG_JCK_FORCE_ENTER_MODE_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="find" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params>
|
||||||
|
<param name="dialogtitle_switcher" type="jsradio" default="0" label="PLG_JCK_DIALOG_TITLESHWN" description="PLG_JCK_DIALOG_TITLESHWN_DESC" >
|
||||||
|
<option value="0">Default</option>
|
||||||
|
<option value="1">Enter new title</option>
|
||||||
|
</param>
|
||||||
|
<param name="dialogtitle" type="text" default="Default" label="PLG_JCK_DIALOG_TITLEENT" description="PLG_JCK_DIALOG_TITLEENT_DESC" />
|
||||||
|
<param name="height" type="text" default="165" label="PLG_JCK_DIALOG_HEIGHT" description="PLG_JCK_DIALOG_HEIGHT_DESC" />
|
||||||
|
<param name="width" type="text" default="350" label="PLG_JCK_DIALOG_WIDTH" description="TPLG_JCK_DIALOG_WIDTH_DESC"/>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="font" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="font_names" type="dualaddselectlist" separator=";" default="" label="PLG_JCK_FONT_LIST_NAMES" description="PLG_JCK_FONT_LIST_NAMES_DESC">
|
||||||
|
<option value="Arial, Helvetica, sans-serif">Arial</option>
|
||||||
|
<option value="Comic Sans MS, cursiv">Comic Sans MS</option>
|
||||||
|
<option value="Georgia, serif">Georgia</option>
|
||||||
|
<option value="Courier New, Courier, monospace">Courier New</option>
|
||||||
|
<option value="Lucida Sans Unicode">Lucida Sans Unicode</option>
|
||||||
|
<option value="Tahoma, Geneva, sans-serif">Tahoma</option>
|
||||||
|
<option value="Times New Roman, Times, serif">Times New Roman</option>
|
||||||
|
<option value="Trebuchet MS, Helvetica, sans-serif">Trebuchet MS</option>
|
||||||
|
<option value="Verdana, Geneva, sans-serif">Verdana</option>
|
||||||
|
</param>
|
||||||
|
<param name="fontSize_sizes" type="dualaddselectlist" separator=";" default="" label="PLG_JCK_FONT_LIST_SIZES" description="PLG_JCK_FONT_LIST_SIZES_DESC">
|
||||||
|
<option value="8px">8</option>
|
||||||
|
<option value="9px">9</option>
|
||||||
|
<option value="10px">10</option>
|
||||||
|
<option value="11px">11</option>
|
||||||
|
<option value="12px">12</option>
|
||||||
|
<option value="14px">14</option>
|
||||||
|
<option value="16px">16</option>
|
||||||
|
<option value="18px">18</option>
|
||||||
|
<option value="20px">20</option>
|
||||||
|
<option value="22px">22</option>
|
||||||
|
<option value="24px">24</option>
|
||||||
|
<option value="26px">26</option>
|
||||||
|
<option value="28px">28</option>
|
||||||
|
<option value="36px">36</option>
|
||||||
|
<option value="48px">48</option>
|
||||||
|
<option value="72px">72</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="image" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params>
|
||||||
|
<param name="dialogtitle_switcher" type="jsradio" default="0" label="PLG_JCK_DIALOG_TITLESHWN" description="PLG_JCK_DIALOG_TITLESHWN_DESC" >
|
||||||
|
<option value="0">Default</option>
|
||||||
|
<option value="1">Enter new title</option>
|
||||||
|
</param>
|
||||||
|
<param name="dialogtitle" type="text" default="Default" label="PLG_JCK_DIALOG_TITLEENT" description="PLG_JCK_DIALOG_TITLEENT_DESC" />
|
||||||
|
<param name="height" type="text" default="310" label="PLG_JCK_DIALOG_HEIGHT" description="PLG_JCK_DIALOG_HEIGHT_DESC" />
|
||||||
|
<param name="width" type="text" default="420" label="PLG_JCK_DIALOG_WIDTH" description="PLG_JCK_DIALOG_WIDTH_DESC"/>
|
||||||
|
</params>
|
||||||
|
<params group="options">
|
||||||
|
<param name="image_removeLinkByEmptyURL" type="radio" default="1" label="PLG_JCK_IMAGE_REMOVE_EMPTY_LINK" description="PLG_JCK_IMAGE_REMOVE_EMPTY_LINK_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
<param name="filebrowser" type="filebrowsers" label="PLG_JCK_CHOOSE_A_FILEBROWSER" description = "PLG_JCK_CHOOSE_A_FILEBROWSER_DESC"/>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="imagedragndrop" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>DEC 2011</creationDate>
|
||||||
|
<author>WebxSolution Ltd</author>
|
||||||
|
<authorUrl>http://www.webxsolution.com</authorUrl>
|
||||||
|
<copyright>Copyright (C) 2011 - 2012 WebxSolution Ltd</copyright>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<files>
|
||||||
|
<file>plugin.js</file>
|
||||||
|
</files>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="indent" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="indentOffsetSwitcher" type="jscombo" default="40" label="PLG_JCK_INDENT _OFFSET" description="PLG_JCK_INDENT _OFFSET_DESC">
|
||||||
|
<option value="5">5</option>
|
||||||
|
<option value="10">10</option>
|
||||||
|
<option value="15">15</option>
|
||||||
|
<option value="20">20</option>
|
||||||
|
<option value="25">25</option>
|
||||||
|
<option value="30">30</option>
|
||||||
|
<option value="35">35</option>
|
||||||
|
<option value="40">40</option>
|
||||||
|
<option value="45">45</option>
|
||||||
|
<option value="50">50</option>
|
||||||
|
<option value="55">55</option>
|
||||||
|
<option value="60">60</option>
|
||||||
|
<option value="65">65</option>
|
||||||
|
<option value="70">70</option>
|
||||||
|
<option value="75">75</option>
|
||||||
|
<option value="80">80</option>
|
||||||
|
<option value="85">85</option>
|
||||||
|
<option value="90">90</option>
|
||||||
|
<option value="95">95</option>
|
||||||
|
<option value="100">100</option>
|
||||||
|
</param>
|
||||||
|
<param name="indentOffset" type="text" default="40" label="PLG_JCK_CUSTOM_INDENT_OFFSET" description="PLG_JCK_CUSTOM_INDENT_OFFSET_DESC" />
|
||||||
|
<param name="indentUnit" type="list" default="px" label="PLG_JCK_INDENT_UNIT" description="PLG_JCK_INDENT_UNIT_DESC">
|
||||||
|
<option value="px">Pixels</option>
|
||||||
|
<option value="pt">Points</option>
|
||||||
|
<option value="%">Percentage</option>
|
||||||
|
<option value="em">Em</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="jabout" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params>
|
||||||
|
<param name="dialogname" type="hidden" default="PLG_JCK_DIALOG_NAME" />
|
||||||
|
<param name="dialogtitle_switcher" type="jsradio" default="0" label="PLG_JCK_DIALOG_TITLESHWN" description="PLG_JCK_DIALOG_TITLESHWN_DESC" >
|
||||||
|
<option value="0">Default</option>
|
||||||
|
<option value="1">Enter new title</option>
|
||||||
|
</param>
|
||||||
|
<param name="dialogtitle" type="text" default="Default" label="PLG_JCK_DIALOG_TITLEENT" description="PLG_JCK_DIALOG_TITLEENT_DESC" />
|
||||||
|
<param name="height" type="text" default="315" label="PLG_JCK_DIALOG_HEIGHT" description="PLG_JCK_DIALOG_HEIGHT_DESC" />
|
||||||
|
<param name="width" type="text" default="390" label="PLG_JCK_DIALOG_WIDTH" description="PLG_JCK_DIALOG_WIDTH_DESC"/>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="jfilebrowser" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<browseUrl>core/connector/php/connector.php</browseUrl>
|
||||||
|
<imageBrowseUrl>core/connector/php/connector.php?type=Images</imageBrowseUrl>
|
||||||
|
<flashBrowseUrl>core/connector/php/connector.php?type=Flash</flashBrowseUrl>
|
||||||
|
<params group="options">
|
||||||
|
<param name="filebrowserWindowHeight" type="text" default="70%" label="PLG_JCK_HEIGHT" description="PLG_JCK_HEIGHT_DESC"/>
|
||||||
|
<param name="filebrowserWindowWidth" type="text" default="80%" label="PLG_JCK_WIDTH" description="PLG_JCK_FONT_LIST_SIZES_DESC"/>
|
||||||
|
<param name="filebrowserWindowFeatures" type="WindowFeatureslist" default="['location=no','menubar=no','toolbar=no','dependent=yes','minimizable=yes','modal=yes','alwaysRaised=yes','scrollbars=yes']" label="PLG_JCK_FILEBROWSER_WINDOW_FEATURES" description="PLG_JCK_FILEBROWSER_WINDOW_FEATURES_DESC">
|
||||||
|
<option value="location=yes">Location</option>
|
||||||
|
<option value="menubar=yes">Menubar</option>
|
||||||
|
<option value="toolbar=yes">Toolbar</option>
|
||||||
|
<option value="dependent=yes">Dependent</option>
|
||||||
|
<option value="minimizable=yes">Minimizable</option>
|
||||||
|
<option value="modal=yes">Modal</option>
|
||||||
|
<option value="alwaysRaised=yes">AlwaysRaised</option>
|
||||||
|
<option value="scrollbars=yes">Scrollbars</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
|
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="jflash" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params>
|
||||||
|
<param name="dialogname" type="hidden" default="flash" />
|
||||||
|
<param name="dialogtitle_switcher" type="jsradio" default="0" label="PLG_JCK_DIALOG_TITLESHWN" description="PLG_JCK_DIALOG_TITLESHWN_DESC">
|
||||||
|
<option value="0">Default</option>
|
||||||
|
<option value="1">Enter new title</option>
|
||||||
|
</param>
|
||||||
|
<param name="dialogtitle" type="text" default="Default" label="PLG_JCK_DIALOG_TITLEENT" description="PLG_JCK_DIALOG_TITLEENT_DESC" />
|
||||||
|
<param name="height" type="text" default="310" label="PLG_JCK_DIALOG_HEIGHT" description="PLG_JCK_DIALOG_HEIGHT_DESC" />
|
||||||
|
<param name="width" type="text" default="420" label="PLG_JCK_DIALOG_WIDTH" description="PLG_JCK_DIALOG_WIDTH_DESC"/>
|
||||||
|
</params>
|
||||||
|
<params group="options">
|
||||||
|
<param name="filebrowser" type="filebrowsers" label="PLG_JCK_CHOOSE_A_FILEBROWSER" description = "PLG_JCK_CHOOSE_A_FILEBROWSER_DESC"/>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="jtreelink" method="upgrade">
|
||||||
|
<name>JTreeLink</name>
|
||||||
|
<version>1.1</version>
|
||||||
|
<creationDate>MARCH 2011</creationDate>
|
||||||
|
<author>WebxSolution Ltd</author>
|
||||||
|
<authorUrl>http://www.webxsolution.com</authorUrl>
|
||||||
|
<copyright>Copyright (C) 2011 - 2013 WebxSolution Ltd</copyright>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<icon>images/jtreelink.png</icon>
|
||||||
|
<files>
|
||||||
|
<filename>plugin.js</filename>
|
||||||
|
<folder>dialogs</folder>
|
||||||
|
<folder>images</folder>
|
||||||
|
<folder>lang</folder>
|
||||||
|
</files>
|
||||||
|
<params>
|
||||||
|
<param name="dialogtitle_switcher" type="jsradio" default="0" label="PLG_JCK_DIALOG_TITLESHWN" description="PLG_JCK_DIALOG_TITLESHWN_DESC">
|
||||||
|
<option value="0">Default</option>
|
||||||
|
<option value="1">Enter new title</option>
|
||||||
|
</param>
|
||||||
|
<param name="dialogtitle" type="text" default="" label="PLG_JCK_DIALOG_TITLEENT" description="PLG_JCK_DIALOG_TITLEENT_DESC" />
|
||||||
|
<param name="height" type="text" default="330" label="PLG_JCK_DIALOG_HEIGHT" description="PLG_JCK_DIALOG_HEIGHT_DESC" />
|
||||||
|
<param name="width" type="text" default="590" label="PLG_JCK_DIALOG_WIDTH" description="PLG_JCK_DIALOG_WIDTH_DESCg"/>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="link" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params>
|
||||||
|
<param name="dialogtitle_switcher" type="jsradio" default="0" label="PLG_JCK_DIALOG_TITLESHWN" description="PLG_JCK_DIALOG_TITLESHWN_DESC">
|
||||||
|
<option value="0">Default</option>
|
||||||
|
<option value="1">Enter new title</option>
|
||||||
|
</param>
|
||||||
|
<param name="dialogtitle" type="text" default="Default" label="PLG_JCK_DIALOG_TITLEENT" description="PLG_JCK_DIALOG_TITLEENT_DESC" />
|
||||||
|
<param name="height" type="text" default="230" label="PLG_JCK_DIALOG_HEIGHT" description="PLG_JCK_DIALOG_HEIGHT_DESC" />
|
||||||
|
<param name="width" type="text" default="350" label="PLG_JCK_DIALOG_WIDTH" description="PLG_JCK_DIALOG_WIDTH_DESC"/>
|
||||||
|
</params>
|
||||||
|
<params group="options">
|
||||||
|
<param name="emailProtection" type="radio" default="0" label="PLG_JCK_ENABLE_EMAIL_CLOAKING" description="PLG_JCK_ENABLE_EMAIL_CLOAKING_DESC">
|
||||||
|
<option value="">No</option>
|
||||||
|
<option value="encode">Yes</option>
|
||||||
|
</param>
|
||||||
|
<param name="filebrowser" type="filebrowsers" label="PLG_JCK_CHOOSE_A_FILEBROWSER" description = "PLG_JCK_CHOOSE_A_FILEBROWSER_DESC"/>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="pastefromword" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="pasteFromWordCleanupFile" type="filelist" default="default" label="PLG_JCK_PASTEFROMWORD_CLEANUPFILE" description="PLG_JCK_PASTEFROMWORD_CLEANUPFILE_DESC" directory="plugins/editors/jckeditor/plugins/pastefromword/filter" filter="" exclude="" stripext="1" hide_none="1" hide_default="1"/>
|
||||||
|
<param name="pasteFromWordNumberedHeadingToList" type="radio" default="0" label="PLG_JCK_CONVERT_NUMBER_HEADINGS_TO_LIST" description="PLG_JCK_CONVERT_NUMBER_HEADINGS_TO_LIST_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
<param name="pasteFromWordPromptCleanup" type="radio" default="0" label="PLG_JCK_ALWAYS_PROMPT_WHEN_PASTING_FROM_MS_WORD" description="PLG_JCK_ALWAYS_PROMPT_WHEN_PASTING_FROM_MS_WORD_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
<param name="pasteFromWordRemoveStyles" type="radio" default="1" label="PLG_JCK_IGNORE_STYLES" description="PLG_JCK_IGNORE_STYLES_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="pastetext" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params>
|
||||||
|
<param name="dialogtitle_switcher" type="jsradio" default="0" label="PLG_JCK_DIALOG_TITLESHWN" description="PLG_JCK_DIALOG_TITLESHWN_DESC">
|
||||||
|
<option value="0">Default</option>
|
||||||
|
<option value="1">Enter new title</option>
|
||||||
|
</param>
|
||||||
|
<param name="dialogtitle" type="text" default="Default" label="PLG_JCK_DIALOG_TITLEENT" description="PLG_JCK_DIALOG_TITLEENT_DESC" />
|
||||||
|
<param name="height" type="text" default="240" label="PLG_JCK_DIALOG_HEIGHT" description="TPLG_JCK_DIALOG_HEIGHT_DESC" />
|
||||||
|
<param name="width" type="text" default="350" label="PLG_JCK_DIALOG_WIDTH" description="PLG_JCK_DIALOG_WIDTH_DESC"/>
|
||||||
|
</params>
|
||||||
|
<params group="options">
|
||||||
|
<param name="forcePasteAsPlainText" type="radio" default="0" label="PLG_JCK_FORCE_PASTE_PLAIN_TEXT" description="PLG_JCK_FORCE_PASTE_PLAIN_TEXT_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="removeformat" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="removeFormatAttributes" type="addselectlist" default="" label="PLG_JCK_REMOVE_FORMAT_ATTRIBUTES" description="PLG_JCK_REMOVE_FORMAT_ATTRIBUTES_DESC">
|
||||||
|
<option value="class">class</option>
|
||||||
|
<option value="style">style</option>
|
||||||
|
<option value="lang">lang</option>
|
||||||
|
<option value="width">width</option>
|
||||||
|
<option value="height">height</option>
|
||||||
|
<option value="align">align</option>
|
||||||
|
<option value="hspace">hspace</option>
|
||||||
|
<option value="valign">valign</option>
|
||||||
|
</param>
|
||||||
|
<param name="removeFormatTags" type="addselectlist" default="" label="PLG_JCK_REMOVE_FORMAT_TAGS" description="PLG_JCK_REMOVE_FORMAT_TAGS_DESC">
|
||||||
|
<option value="b">b</option>
|
||||||
|
<option value="big">big</option>
|
||||||
|
<option value="code">code</option>
|
||||||
|
<option value="del">del</option>
|
||||||
|
<option value="dfn">dfn</option>
|
||||||
|
<option value="em">em</option>
|
||||||
|
<option value="i">i</option>
|
||||||
|
<option value="ins">ins</option>
|
||||||
|
<option value="kbd">kbd</option>
|
||||||
|
<option value="q">q</option>
|
||||||
|
<option value="samp">samp</option>
|
||||||
|
<option value="small">small</option>
|
||||||
|
<option value="span">span</option>
|
||||||
|
<option value="strike">strike</option>
|
||||||
|
<option value="strong">strong</option>
|
||||||
|
<option value="sub">sub</option>
|
||||||
|
<option value="sup">sup</option>
|
||||||
|
<option value="tt">tt</option>
|
||||||
|
<option value="u">u</option>
|
||||||
|
<option value="var">var</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="replace" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params>
|
||||||
|
<param name="dialogtitle_switcher" type="jsradio" default="0" label="PLG_JCK_DIALOG_TITLESHWN" description="PLG_JCK_DIALOG_TITLESHWN_DESC" >
|
||||||
|
<option value="0">Default</option>
|
||||||
|
<option value="1">Enter new title</option>
|
||||||
|
</param>
|
||||||
|
<param name="dialogtitle" type="text" default="Default" label="PLG_JCK_DIALOG_TITLEENT" description="PLG_JCK_DIALOG_TITLEENT_DESC" />
|
||||||
|
<param name="height" type="text" default="165" label="PLG_JCK_DIALOG_HEIGHT" description="PLG_JCK_DIALOG_HEIGHT_DESC" />
|
||||||
|
<param name="width" type="text" default="350" label="PLG_JCK_DIALOG_WIDTH" description="PLG_JCK_DIALOG_WIDTH_DESC"/>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="scayt" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>June2010</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<files>
|
||||||
|
<filename>plugin.js</filename>
|
||||||
|
<folder>dialogs</folder>
|
||||||
|
</files>
|
||||||
|
|
||||||
|
<params group="options">
|
||||||
|
<param name="scayt_autoStartup" type="radio" default="0" label="PLG_JCK_DESC" description="PLG_JCK_AUTOSTART_SPELL_CHECK_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
<param name="scayt_maxSuggestions" type="text" default="5" label="PLG_JCK_MAXIMUM_SUGGESTIONS" description="PLG_JCK_MAXIMUM_SUGGESTIONS_DESC"/>
|
||||||
|
<param name="scayt_moreSuggestions" type="radio" default="on" label="PLG_JCK_ENABLE_MORE_SUGGESTIONS" description="PLG_JCK_ENABLE_MORE_SUGGESTIONS_DESC">
|
||||||
|
<option value="off">No</option>
|
||||||
|
<option value="on">Yes</option>
|
||||||
|
</param>
|
||||||
|
<param name="scayt_sLang" type="text" default="en_GB" label="PLG_JCK_SPELL_CHECK_DEFAULT_LANGUAGE" description="PLG_JCK_SPELL_CHECK_DEFAULT_LANGUAGE_DESC"/>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="showblocks" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="startupOutlineBlocks" type="radio" default="0" label="PLG_JCK_OUTLINE_BLOCKS_ON_STARTUP" description="PLG_JCK_OUTLINE_BLOCKS_ON_STARTUP_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="showborders" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="startupShowBorders " type="radio" default="1" label="PLG_JCK_SHOW_TABLE_BORDERS" description="PLG_JCK_SHOW_TABLE_BORDERS_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="smiley" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params>
|
||||||
|
<param name="dialogtitle_switcher" type="jsradio" default="0" label="PLG_JCK_DIALOG_TITLESHWN" description="PLG_JCK_DIALOG_TITLESHWN_DESC" >
|
||||||
|
<option value="0">Default</option>
|
||||||
|
<option value="1">Enter new title</option>
|
||||||
|
</param>
|
||||||
|
<param name="dialogtitle" type="text" default="Default" label="PLG_JCK_DIALOG_TITLEENT" description="PLG_JCK_DIALOG_TITLEENT_DESC" />
|
||||||
|
<param name="height" type="text" default="120" label="PLG_JCK_DIALOG_HEIGHT" description="PLG_JCK_DIALOG_HEIGHT_DESC" />
|
||||||
|
<param name="width" type="text" default="270" label="PLG_JCK_DIALOG_WIDTH" description="PLG_JCK_DIALOG_WIDTH_DESC"/>
|
||||||
|
</params>
|
||||||
|
<params group="options">
|
||||||
|
<param name="smiley_path" type="smileypath" default="plugins/editors/jckeditor/plugins/smiley/images/" label="PLG_JCK_SIMLEY_IMAGE_PATH" description="PLG_JCK_SIMLEY_IMAGE_PATH_DESC"/>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="sourcearea" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="autoUpdateElement" type="radio" default="1" label="PLG_JCK_AUTO_UPDATE_ELEMENT" description="PLG_JCK_AUTO_UPDATE_ELEMENT_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="tab" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="tabSpaces" type="list" default="4" label="PLG_JCK_TAB_SPACES" description="PLG_JCK_TAB_SPACES_DESC">
|
||||||
|
<option value="0">0</option>
|
||||||
|
<option value="1">1</option>
|
||||||
|
<option value="2">2</option>
|
||||||
|
<option value="3">3</option>
|
||||||
|
<option value="4">4</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="templates" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="templates" type="filelist" default="default" label="PLG_JCK_TEMPLATES_TO_USE" description="PLG_JCK_TEMPLATES_TO_USE_DESC" directory="plugins/editors/jckeditor/plugins/templates/templates" filter="" exclude="" stripext="1" hide_none="1" hide_default="1" />
|
||||||
|
<param name="templates_replaceContent" type="radio" default="0" label="PLG_JCK_REPLACE_CONTENT" description="DPLG_JCK_REPLACE_CONTENT_DESC.">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="toolbar" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="toolbarCanCollapse" type="radio" default="1" label="PLG_JCK_ENABLE_TOOLBAR_COLLAPSE" description="PLG_JCK_ENABLE_TOOLBAR_COLLAPSE_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
<param name="toolbarLocation" type="radio" default="top" label="PLG_JCK_TOOLBAR_LOCATION" description="PLG_JCK_TOOLBAR_LOCATION_DESC">
|
||||||
|
<option value="top">Top</option>
|
||||||
|
<option value="bottom">Bottom</option>
|
||||||
|
</param>
|
||||||
|
<param name="toolbarGroupCycling" type="radio" default="1" label="PLG_JCK_ENABLE_TOOLBAR_GROUP_CYCLING" description="PLG_JCK_ENABLE_TOOLBAR_GROUP_CYCLING_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
<param name="toolbarStartupExpanded" type="radio" default="1" label="PLG_JCK_SPELL_TOOLBAR_STARTUP_EXPANDED" description="PLG_JCK_SPELL_TOOLBAR_STARTUP_EXPANDED_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="undo" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="undoStackSize " type="list" default="20" label="PLG_JCK_MAXIUM_UNDO_STEPS" description="PLG_JCK_MAXIUM_UNDO_STEPS_DESC">
|
||||||
|
<option value="5">5</option>
|
||||||
|
<option value="10">10</option>
|
||||||
|
<option value="15">15</option>
|
||||||
|
<option value="20">20</option>
|
||||||
|
<option value="25">25</option>
|
||||||
|
<option value="30">30</option>
|
||||||
|
<option value="35">35</option>
|
||||||
|
<option value="40">40</option>
|
||||||
|
<option value="45">45</option>
|
||||||
|
<option value="50">50</option>
|
||||||
|
<option value="55">55</option>
|
||||||
|
<option value="60">60</option>
|
||||||
|
<option value="65">65</option>
|
||||||
|
<option value="70">70</option>
|
||||||
|
<option value="75">75</option>
|
||||||
|
<option value="80">80</option>
|
||||||
|
<option value="85">85</option>
|
||||||
|
<option value="90">90</option>
|
||||||
|
<option value="95">95</option>
|
||||||
|
<option value="100">100</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="video" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params>
|
||||||
|
<param name="dialogtitle_switcher" type="jsradio" default="0" label="PLG_JCK_DIALOG_TITLESHWN" description="PLG_JCK_DIALOG_TITLESHWN_DESC" >
|
||||||
|
<option value="0">Default</option>
|
||||||
|
<option value="1">Enter new title</option>
|
||||||
|
</param>
|
||||||
|
<param name="dialogtitle" type="text" default="Default" label="PLG_JCK_DIALOG_TITLEENT" description="PLG_JCK_DIALOG_TITLEENT_DESC" />
|
||||||
|
<param name="height" type="text" default="200" label="PLG_JCK_DIALOG_HEIGHT" description="PLG_JCK_DIALOG_HEIGHT_DESC" />
|
||||||
|
<param name="width" type="text" default="400" label="PLG_JCK_DIALOG_WIDTH" description="PLG_JCK_DIALOG_WIDTH_DESC"/>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,76 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="wysiwygarea" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>Feb 2012</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>PLG_JCK_DESC</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<params group="options">
|
||||||
|
<param name="resize_enabled" type="resizeradio" default="1" label="PLG_JCK_ENABLE_RESIZING" description="PLG_JCK_ENABLE_RESIZING_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
<param name="resize_dir" type="list" default="both" label="PLG_JCK_RESIZE_DIRECTION" description="PLG_JCK_RESIZE_DIRECTION_DESC">
|
||||||
|
<option value="both">Both</option>
|
||||||
|
<option value="vertical">Vertical</option>
|
||||||
|
<option value="horizontal">Horizontal</option>
|
||||||
|
</param>
|
||||||
|
<param name="resize_maxHeight" type="list" default="500" label="PLG_JCK_RESIZE_MAX_HEIGHT" description="PLG_JCK_RESIZE_MAX_HEIGHT_DESC">
|
||||||
|
<option value="500">500</option>
|
||||||
|
<option value="1000">1000</option>
|
||||||
|
<option value="1500">1500</option>
|
||||||
|
<option value="2000">2000</option>
|
||||||
|
<option value="2500">2500</option>
|
||||||
|
<option value="3000">3000</option>
|
||||||
|
</param>
|
||||||
|
<param name="resize_maxWidth" type="list" default="1500" label="PLG_JCK_RESIZE_MAX_WIDTH" description="PLG_JCK_RESIZE_MAX_WIDTH_DESC">
|
||||||
|
<option value="750">750</option>
|
||||||
|
<option value="1000">1000</option>
|
||||||
|
<option value="1500">1500</option>
|
||||||
|
<option value="2000">2000</option>
|
||||||
|
<option value="2500">2500</option>
|
||||||
|
<option value="3000">3000</option>
|
||||||
|
</param>
|
||||||
|
<param name="resize_minHeight" type="list" default="250" label="PLG_JCK_RESIZE_MIN_HEIGHT" description="PLG_JCK_RESIZE_MIN_HEIGHT_DESC">
|
||||||
|
<option value="250">250</option>
|
||||||
|
<option value="300">300</option>
|
||||||
|
<option value="350">350</option>
|
||||||
|
<option value="400">400</option>
|
||||||
|
<option value="450">450</option>
|
||||||
|
<option value="500">500</option>
|
||||||
|
</param>
|
||||||
|
<param name="resize_minWidth" type="list" default="300" label="PLG_JCK_RESIZE_MIN_WIDTH" description="PLG_JCK_RESIZE_MIN_WIDTH_DESC">
|
||||||
|
<option value="300">300</option>
|
||||||
|
<option value="400">400</option>
|
||||||
|
<option value="450">450</option>
|
||||||
|
<option value="500">500</option>
|
||||||
|
<option value="550">550</option>
|
||||||
|
<option value="600">600</option>
|
||||||
|
<option value="650">650</option>
|
||||||
|
<option value="700">700</option>
|
||||||
|
<option value="750">750</option>
|
||||||
|
</param>
|
||||||
|
<param name="startupFocus" type="radio" default="0" label="PLG_JCK_ENABLE_FOCUS_ON_STARTUP" description="PLG_JCK_ENABLE_FOCUS_ON_STARTUP_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
<param name="ignoreEmptyParagraph" type="radio" default="1" label="PLG_JCK_IGNORE_EMPTY_PARAGRAPH" description="PLG_JCK_IGNORE_EMPTY_PARAGRAPH_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
<param name="bodyClass" type="text" default="" label="PLG_JCK_RESIZE_BODY_CLASS" description="PLG_JCK_RESIZE_BODY_CLASS_DESC"/>
|
||||||
|
<param name="bodyId" type="text" default="" label="PLG_JCK_RESIZE_BODY_ID" description="PLG_JCK_RESIZE_BODY_ID_DESC"/>
|
||||||
|
<param name="disableObjectResizing" type="radio" default="1" label="PLG_JCK_DISABLE_OBJECT_RESIZING" description="PLG_JCK_DISABLE_OBJECT_RESIZING_DESC">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
<param name="docType" type="documenttypelist" default="<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">" label="PLG_JCK_RESIZE_HTML_DOCUMENT_TYPE" description="PLG_JCK_RESIZE_HTML_DOCUMENT_TYPE_DESC">
|
||||||
|
<option value="<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">">XHTML</option>
|
||||||
|
<option value="<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">">HTML4</option>
|
||||||
|
<option value="<!DOCTYPE html>">HTML5</option>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<install version="1.5" type="plugin" plugin="scayt" method="upgrade">
|
||||||
|
<version>0.1</version>
|
||||||
|
<creationDate>June2010</creationDate>
|
||||||
|
<author>CKSource.com</author>
|
||||||
|
<authorUrl>http://cksource.com/</authorUrl>
|
||||||
|
<license>GNU/GPLv2</license>
|
||||||
|
<description>Spell check as you type</description>
|
||||||
|
<languages>
|
||||||
|
</languages>
|
||||||
|
<files>
|
||||||
|
<filename>plugin.js</filename>
|
||||||
|
<folder>dialogs</folder>
|
||||||
|
</files>
|
||||||
|
|
||||||
|
<params group="options">
|
||||||
|
<param name="scayt_autoStartup" type="radio" default="0" label="Autostart Spell check" description="">
|
||||||
|
<option value="0">No</option>
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
</param>
|
||||||
|
<param name="scayt_maxSuggestions" type="text" default="5" label="Maximum Suggestions" description="Defines the number of SCAYT suggestions to show in the main context menu. The possible values are:
|
||||||
|
* 0 (zero): All suggestions are displayed in the main context menu.
|
||||||
|
* Positive number: The maximum number of suggestions to shown in context menu. Other entries will be shown in 'More Suggestions' sub-menu.
|
||||||
|
* Negative number: No suggestions are shown in the main context menu. All entries will be listed in the 'Suggestions' sub-menu."/>
|
||||||
|
<param name="scayt_moreSuggestions" type="radio" default="on" label="Enable More Suggestions" description="">
|
||||||
|
<option value="off">No</option>
|
||||||
|
<option value="on">Yes</option>
|
||||||
|
</param>
|
||||||
|
<param name="scayt_sLang" type="text" default="en_GB" label="Spell Check Default Language" description=""/>
|
||||||
|
</params>
|
||||||
|
</install>
|
||||||
@ -0,0 +1,514 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_BASE') or die();
|
||||||
|
|
||||||
|
jimport( 'joomla.event.event' );
|
||||||
|
|
||||||
|
class JCKCpanelControllerListener extends JEvent
|
||||||
|
{
|
||||||
|
protected $canDo = false;
|
||||||
|
protected $app = false;
|
||||||
|
|
||||||
|
function __construct( &$subject )
|
||||||
|
{
|
||||||
|
parent::__construct( $subject );
|
||||||
|
|
||||||
|
$this->canDo = JCKHelper::getActions();
|
||||||
|
$this->app = JFactory::getApplication();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A JParameter object holding the parameters for the plugin
|
||||||
|
*
|
||||||
|
* @var A JParameter object
|
||||||
|
* @access public
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
public function onCheck()
|
||||||
|
{
|
||||||
|
//Check System requirements for the editor
|
||||||
|
define('JCK_BASE',JPATH_CONFIGURATION .DS.'plugins'.DS.'editors'.DS.'jckeditor');
|
||||||
|
|
||||||
|
if(!JFolder::exists(JCK_BASE))
|
||||||
|
return;
|
||||||
|
|
||||||
|
$perms = fileperms(JPATH_CONFIGURATION.DS.'index.php');
|
||||||
|
$perms = (decoct($perms & 0777));
|
||||||
|
|
||||||
|
$default_fperms = '0644';
|
||||||
|
$default_dperms = '0755';
|
||||||
|
|
||||||
|
if($perms == 777 || $perms == 666)
|
||||||
|
{
|
||||||
|
$default_fperms = '0666';
|
||||||
|
$default_dperms = '0777';
|
||||||
|
}
|
||||||
|
|
||||||
|
$fperms = JCK_BASE.DS.'config.js';
|
||||||
|
|
||||||
|
if(!stristr(PHP_OS,'WIN') && JPath::canChmod(JCK_BASE) && $perms != decoct(fileperms($fperms) & 0777))
|
||||||
|
{
|
||||||
|
|
||||||
|
$path = JCK_BASE.DS.'plugins';
|
||||||
|
|
||||||
|
if(!JPath::setPermissions($path,$default_fperms,$default_dperms))
|
||||||
|
{
|
||||||
|
$this->app->enqueueMessage( JText::_('COM_JCKMAN_CPANEL_AUTO_CORRECTION_FAILED_INCORRECT_FILE_PERMISSION'),'error' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->app->enqueueMessage( JText::_('COM_JCKMAN_CPANEL_SYSTEM_CHECKED_AND_UPDATED'));
|
||||||
|
|
||||||
|
}//end function
|
||||||
|
|
||||||
|
public function onSync()
|
||||||
|
{
|
||||||
|
if( !$this->canDo->get('jckman.sync') )
|
||||||
|
{
|
||||||
|
$this->app->redirect( JRoute::_( 'index.php?option=com_jckman&view=cpanel', false ), JText::_( 'COM_JCKMAN_PLUGIN_PERM_NO_SYNC' ), 'error' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
jimport('joomla.filesystem.file');
|
||||||
|
|
||||||
|
$src = JPATH_ADMINISTRATOR.DS.'components' .DS. 'com_jckman' .DS. 'editor' .DS. 'pluginoverrides.php';
|
||||||
|
$dest = JPATH_PLUGINS.DS.'editors'.DS.'jckeditor'.DS.'jckeditor'.DS.'includes'.DS.'ckeditor'.DS.'plugins'.DS.'editor'.DS. 'pluginoverrides.php';
|
||||||
|
|
||||||
|
if( !JFile::copy( $src, $dest) ){
|
||||||
|
$this->app->enqueueMessage( JText::_('COM_JCKMAN_CPANEL_UNABLE_MOVE_PLUGINOVERRIDES_PLUGIN') );
|
||||||
|
}
|
||||||
|
|
||||||
|
$src = JPATH_ADMINISTRATOR.DS.'components' .DS. 'com_jckman' .DS. 'editor' .DS. 'acl.php';
|
||||||
|
$dest = JPATH_PLUGINS.DS.'editors'.DS.'jckeditor'.DS.'jckeditor'.DS.'includes'.DS.'ckeditor'.DS.'plugins'.DS.'editor'.DS. 'acl.php';
|
||||||
|
|
||||||
|
if( !JFile::copy( $src, $dest) ){
|
||||||
|
$this->app->enqueueMessage( JText::_('COM_JCKMAN_CPANEL_UNABLE_MOVE_ACL_PLUGIN') );
|
||||||
|
}
|
||||||
|
|
||||||
|
$src = JPATH_ADMINISTRATOR.DS.'components' .DS. 'com_jckman' .DS. 'editor' .DS. 'components.php';
|
||||||
|
$dest = JPATH_PLUGINS.DS.'editors'.DS.'jckeditor'.DS.'jckeditor'.DS.'includes'.DS.'ckeditor'.DS.'plugins'.DS.'toolbar'.DS. 'components.php';
|
||||||
|
|
||||||
|
if( !JFile::copy( $src, $dest) ){
|
||||||
|
$this->app->enqueueMessage( JText::_('COM_JCKMAN_CPANEL_UNABLE_MOVE_COMPONENTS_PLUGIN') );
|
||||||
|
}
|
||||||
|
|
||||||
|
$src = JPATH_ADMINISTRATOR.DS .'components' .DS. 'com_jckman' .DS. 'editor'.DS.'plugins.php';
|
||||||
|
$dest = JPATH_PLUGINS.DS.'editors'.DS.'jckeditor'.DS.'jckeditor'.DS.'includes'.DS.'ckeditor'.DS.'plugins.php';
|
||||||
|
|
||||||
|
if( !JFile::copy( $src, $dest) ){
|
||||||
|
$this->app->enqueueMessage( JText::_('COM_JCKMAN_CPANEL_UNABLE_MOVE_BASE_PLUGIN') );
|
||||||
|
}
|
||||||
|
|
||||||
|
$src = JPATH_ADMINISTRATOR.DS.'components' .DS. 'com_jckman' .DS. 'editor' .DS. 'scayt.xml';
|
||||||
|
$dest = JPATH_PLUGINS.DS.'editors'.DS.'jckeditor'.DS.'plugins'.DS.'scayt'.DS. 'scayt.xml';
|
||||||
|
|
||||||
|
if( !JFile::copy( $src, $dest) ){
|
||||||
|
$this->app->enqueueMessage( JText::_('COM_JCKMAN_CPANEL_UNABLE_MOVE_SCAYT_PLUGIN') );
|
||||||
|
}
|
||||||
|
|
||||||
|
//Lets try and restore broken or removed plugins from backup
|
||||||
|
require_once( JPATH_ADMINISTRATOR.DS.'components' .DS. 'com_jckman' .DS. 'helpers' .DS.'restorer.php' );
|
||||||
|
$restorer = JCKRestorer::getInstance();
|
||||||
|
|
||||||
|
$srcBase = JPATH_ADMINISTRATOR.DS.'components' .DS. 'com_jckman' .DS. 'editor' .DS.'plugins'.DS;
|
||||||
|
$destBase = JPATH_PLUGINS.DS.'editors'.DS.'jckeditor'.DS.'plugins'.DS;
|
||||||
|
|
||||||
|
$folders = JFolder::folders($srcBase);
|
||||||
|
|
||||||
|
foreach($folders as $folder)
|
||||||
|
{
|
||||||
|
$src = $srcBase.$folder;
|
||||||
|
|
||||||
|
if (!$restorer->install($src))
|
||||||
|
{
|
||||||
|
$this->app->enqueueMessage(JText::sprintf('COM_JCKMAN_CPANEL_UNABLE_RESTORE_FOLDER',$folder), 'error' );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->app->enqueueMessage(JText::sprintf('COM_JCKMAN_CPANEL_SUCESSFULLY_RESTORE_FOLDER',$folder));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//check whether plugin is not a core plugin
|
||||||
|
//if its not iterate through and see if there are files missing
|
||||||
|
//then delete the plugin if there are
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$query = 'SELECT p.id, p.name FROM `#__jckplugins` p WHERE p.iscore = 0';
|
||||||
|
$results = $db->setQuery( $query )->loadObjectList();
|
||||||
|
|
||||||
|
if(!empty($results))
|
||||||
|
{
|
||||||
|
for($i = 0; $i < count($results);$i++)
|
||||||
|
{
|
||||||
|
if(!JFolder::exists(JPATH_PLUGINS.DS.'editors'.DS.'jckeditor'.DS.'plugins'.DS.$results[$i]->name))
|
||||||
|
{
|
||||||
|
$query = 'DELETE FROM #__jcktoolbarplugins
|
||||||
|
WHERE pluginid ='. $results[$i]->id;
|
||||||
|
$db->setQuery( $query )->query();
|
||||||
|
|
||||||
|
$query = 'DELETE FROM #__jckplugins
|
||||||
|
WHERE id ='. $results[$i]->id;
|
||||||
|
$db->setQuery( $query )->query();
|
||||||
|
}
|
||||||
|
}//end for loop
|
||||||
|
}
|
||||||
|
|
||||||
|
//check for plugins that have not been added to layout -- legacy check
|
||||||
|
$query = 'SELECT id,name FROM `#__jcktoolbars`';
|
||||||
|
$toolbars = $db->setQuery( $query )->loadObjectList();
|
||||||
|
|
||||||
|
$JCKfolder = CKEDITOR_LIBRARY.DS . 'toolbar';
|
||||||
|
|
||||||
|
$values = array();
|
||||||
|
|
||||||
|
if(!empty($toolbars))
|
||||||
|
{
|
||||||
|
require_once(CKEDITOR_LIBRARY.DS . 'toolbar.php');
|
||||||
|
|
||||||
|
//update core plugins layout if needed
|
||||||
|
foreach($toolbars as $row)
|
||||||
|
{
|
||||||
|
// get the total number of core plugin records
|
||||||
|
$sql = $db->getQuery( true );
|
||||||
|
$sql->select( 'COUNT(*)' )
|
||||||
|
->from( '#__jcktoolbarplugins tp' )
|
||||||
|
->join( 'INNER', '#__jckplugins p ON tp.pluginid = p.id' )
|
||||||
|
->where( 'tp.toolbarid ='.(int) $row->id )
|
||||||
|
->where( 'p.iscore = 1' );
|
||||||
|
$totalRows = $db->setQuery( $sql )->loadResult();
|
||||||
|
|
||||||
|
if(!$totalRows) //lets get plugins from class file
|
||||||
|
{
|
||||||
|
$filename = $JCKfolder.DS.$row->name.'.php';
|
||||||
|
require_once($filename);
|
||||||
|
$classname = 'JCK'. ucfirst($row->name);
|
||||||
|
$toolbar = new $classname();
|
||||||
|
|
||||||
|
$sql = $db->getQuery( true );
|
||||||
|
$sql->select( 'p.id, p.title' )
|
||||||
|
->from( '#__jckplugins p' )
|
||||||
|
->join( 'LEFT', '#__jckplugins parent ON parent.id = p.parentid AND parent.published = 1' )
|
||||||
|
->where( 'p.title != ""' )
|
||||||
|
->where( 'p.published = 1' )
|
||||||
|
->where( 'p.iscore = 1' )
|
||||||
|
->where( '(p.parentid IS NULL OR parent.published = 1)' );
|
||||||
|
$allplugins = $db->setQuery( $sql )->loadObjectList();
|
||||||
|
|
||||||
|
$values = array();
|
||||||
|
//fix toolbar values or they will get wiped out
|
||||||
|
$l = 1;
|
||||||
|
$n = 1;
|
||||||
|
$j = 1;
|
||||||
|
|
||||||
|
foreach (get_object_vars( $toolbar ) as $k => $v)
|
||||||
|
{
|
||||||
|
if($v)
|
||||||
|
{
|
||||||
|
$n = ($n > $v ? $n : $v);
|
||||||
|
}
|
||||||
|
if($l < $n)
|
||||||
|
{
|
||||||
|
$l = $n;
|
||||||
|
$j = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for($m = 0; $m< count($allplugins); $m++)
|
||||||
|
{
|
||||||
|
if($k == $allplugins[$m]->title)
|
||||||
|
{
|
||||||
|
$values[] = '('.(int)$row->id.','.(int)$allplugins[$m]->id.','.$n.','.$j.',1)';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strpos($k,'brk_') !== false)
|
||||||
|
{
|
||||||
|
$id = preg_match('/[0-9]+$/',$k);
|
||||||
|
$id = $id * -1;
|
||||||
|
$values[] = '('.(int)$row->id.','.$id.','.$n.','.$j.',1)';
|
||||||
|
$n++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$j++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($values))
|
||||||
|
{
|
||||||
|
$query = 'INSERT INTO #__jcktoolbarplugins(toolbarid,pluginid,row,ordering,state) VALUES ' . implode(',',$values);
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if(!$db->query())
|
||||||
|
{
|
||||||
|
JCKHelper::error( $db->getErrorMsg() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//update non core plugins layout
|
||||||
|
$values = array();
|
||||||
|
|
||||||
|
foreach($toolbars as $row)
|
||||||
|
{
|
||||||
|
$query = 'SELECT id,title FROM `#__jckplugins` p WHERE p.title != "" AND p.iscore = 0 AND p.published = 1'
|
||||||
|
.' AND NOT EXISTS(SELECT 1 FROM #__jcktoolbarplugins tp WHERE tp.pluginid = p.id AND tp.toolbarid = ' .$row->id. ')';
|
||||||
|
$plugins = $db->setQuery( $query )->loadObjectList();
|
||||||
|
|
||||||
|
$tmpfilename = $JCKfolder.DS.$row->name.'.php';
|
||||||
|
|
||||||
|
if(!file_exists($tmpfilename))
|
||||||
|
continue; //skip
|
||||||
|
|
||||||
|
require_once($tmpfilename);
|
||||||
|
|
||||||
|
$classname = 'JCK'. ucfirst($row->name);
|
||||||
|
|
||||||
|
$toolbar = new $classname();
|
||||||
|
|
||||||
|
$rowDetail = JCKHelper::getNextLayoutRow($row->id);
|
||||||
|
|
||||||
|
foreach (get_object_vars( $toolbar ) as $k => $v)
|
||||||
|
{
|
||||||
|
foreach($plugins as $plugin)
|
||||||
|
{
|
||||||
|
if($plugin->title == $k)
|
||||||
|
{
|
||||||
|
$values[] = '('.$row->id.','. $plugin->id.','.$rowDetail->rowid.','.$rowDetail->rowordering.',1)';
|
||||||
|
$rowDetail->rowordering++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Now add plugins to layouts
|
||||||
|
if(!empty($values))
|
||||||
|
{
|
||||||
|
$query = 'INSERT INTO #__jcktoolbarplugins(toolbarid,pluginid,row,ordering,state) VALUES ' . implode(',',$values)
|
||||||
|
.' ON DUPLICATE KEY UPDATE toolbarid = VALUES(toolbarid),pluginid = VALUES(pluginid)';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if(!$db->query())
|
||||||
|
{
|
||||||
|
JCKHelper::error( $db->getErrorMsg() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Reload Toolbar if editor is re-installed
|
||||||
|
jckimport( 'event.observable.editor' );
|
||||||
|
|
||||||
|
$obs = new JCKEditorObservable( 'toolbars' );
|
||||||
|
$handle = $obs->getEventHandler();
|
||||||
|
|
||||||
|
$query = 'SELECT * FROM `#__jcktoolbars` t WHERE exists(SELECT 1 FROM #__jcktoolbarplugins tp WHERE tp.toolbarid = t.id)';
|
||||||
|
$rowresults = $db->setQuery( $query )->loadObjectList();
|
||||||
|
|
||||||
|
foreach($rowresults as $row)
|
||||||
|
{
|
||||||
|
$id = $row->id;
|
||||||
|
$name = $row->name;
|
||||||
|
$title = $row->title;
|
||||||
|
|
||||||
|
switch( $name )
|
||||||
|
{
|
||||||
|
case 'publisher' :
|
||||||
|
case 'full':
|
||||||
|
case 'basic' :
|
||||||
|
case 'blog' :
|
||||||
|
case 'image' :
|
||||||
|
case 'mobile':
|
||||||
|
$isNew = false;
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
$isNew = true;
|
||||||
|
break;
|
||||||
|
}//end switch
|
||||||
|
|
||||||
|
$handle->onSave( $id, $name, $name, $title, $isNew );
|
||||||
|
}
|
||||||
|
|
||||||
|
//restore state of published/unpublished plugins
|
||||||
|
$obs = new JCKEditorObservable( 'list' );
|
||||||
|
$handle = $obs->getEventHandler();
|
||||||
|
|
||||||
|
$where = array();
|
||||||
|
$where[] = ' WHERE p.published = 1';
|
||||||
|
$where[] = ' WHERE p.published = 0';
|
||||||
|
$state = array(1,0);
|
||||||
|
$count = count($where);
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
|
||||||
|
for( $i = 0; $i < $count; $i++ )
|
||||||
|
{
|
||||||
|
$query = 'SELECT id FROM `#__jckplugins` p' . $where[$i] . ' AND p.iscore = 1 AND type="plugin"';
|
||||||
|
$results = $db->setQuery( $query )->loadColumn();
|
||||||
|
|
||||||
|
$handle->onPublish($results, $state[$i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//restore language overrides
|
||||||
|
|
||||||
|
$src = JPATH_ADMINISTRATOR.DS.'components' .DS. 'com_jckman' .DS. 'editor'.DS.'overrides';
|
||||||
|
$dest = JPATH_ADMINISTRATOR.DS.'components' .DS. 'com_jckman' .DS. 'language'.DS.'overrides';
|
||||||
|
|
||||||
|
|
||||||
|
$files = JFolder::files($src);
|
||||||
|
|
||||||
|
foreach($files as $file)
|
||||||
|
{
|
||||||
|
|
||||||
|
if($file == 'index.html')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$source = $src .'/'. $file;
|
||||||
|
$path = $dest.'/'.$file;
|
||||||
|
|
||||||
|
|
||||||
|
if(JFile::exists($file))
|
||||||
|
{
|
||||||
|
$this->app->enqueueMessage(JText::sprintf('COM_JCKMAN_CPANEL_LANGUAGE_EXISTS',$file), 'warning' );
|
||||||
|
}
|
||||||
|
elseif(!JFile::copy($source,$path))
|
||||||
|
{
|
||||||
|
$this->app->enqueueMessage(JText::sprintf('COM_JCKMAN_CPANEL_UNABLE_RESTORE_LANGUAGE',$file), 'error' );
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->app->enqueueMessage(JText::sprintf('COM_JCKMAN_CPANEL_SUCESSFULLY_RESTORE_LANGUAGE',$file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$this->app->enqueueMessage( JText::_('COM_JCKMAN_CPANEL_EDITOR_SYNCHRONIZED'));
|
||||||
|
|
||||||
|
}//end function
|
||||||
|
|
||||||
|
public function onImport()
|
||||||
|
{
|
||||||
|
}//end function
|
||||||
|
|
||||||
|
public function onExport()
|
||||||
|
{
|
||||||
|
ini_set('max_execution_time', 5000);
|
||||||
|
|
||||||
|
//require(JPATH_COMPONENT.'/helpers/archive.php');
|
||||||
|
require(JPATH_COMPONENT.'/helpers/archivefactory.php');
|
||||||
|
|
||||||
|
//copy XML file
|
||||||
|
jimport('joomla.filesystem.file');
|
||||||
|
|
||||||
|
$src = JPATH_PLUGINS.DS.'editors'.DS.'jckeditor'.DS.'jckeditor.xml';
|
||||||
|
$dest = JPATH_ADMINISTRATOR.DS.'components' .DS. 'com_jckman' .DS. 'editor'.DS.'plugins'.DS.'jckeditor.xml';
|
||||||
|
|
||||||
|
if( !JFile::copy( $src, $dest) ){
|
||||||
|
$this->app->enqueueMessage( JText::_('COM_JCKMAN_CPANEL_UNABLE_TO_COPY_MANIFEST') );
|
||||||
|
}
|
||||||
|
|
||||||
|
$src = JPATH_PLUGINS.DS.'editors'.DS.'jckeditor'.DS.'jckeditor'.DS.'includes'.DS.'ckeditor'.DS.'toolbar';
|
||||||
|
$dest = JPATH_ADMINISTRATOR.DS.'components' .DS. 'com_jckman' .DS. 'editor'.DS.'toolbar';
|
||||||
|
|
||||||
|
if( !JFolder::copy( $src, $dest,'',true) ){
|
||||||
|
$this->app->enqueueMessage( JText::_('COM_JCKMAN_CPANEL_UNABLE_TO_COPY_TOOLBARS') );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$src = JPATH_ADMINISTRATOR.DS.'components' .DS. 'com_jckman' .DS. 'language'.DS.'overrides';
|
||||||
|
$dest = JPATH_ADMINISTRATOR.DS.'components' .DS. 'com_jckman' .DS. 'editor'.DS.'overrides';
|
||||||
|
|
||||||
|
if( !JFolder::copy( $src, $dest,'',true) ){
|
||||||
|
$this->app->enqueueMessage( JText::_('COM_JCKMAN_CPANEL_UNABLE_TO_COPY_TOOLBARS') );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//process SQL
|
||||||
|
if($this->_createSQL())
|
||||||
|
{
|
||||||
|
|
||||||
|
// Create a new gzip file test.tgz in htdocs/test
|
||||||
|
$backup_file_name = 'bak_jckeditor'.date('dmyHis');
|
||||||
|
/*
|
||||||
|
$tgz = new gzip_file($backup_file_name);
|
||||||
|
$tgz->set_options(array('basedir' => JPATH_COMPONENT."/editor", 'overwrite' =>1,'inmemory'=>1,level=>5));
|
||||||
|
$tgz->add_files('import.xml');
|
||||||
|
$tgz->add_files('toolbar');
|
||||||
|
$tgz->add_files('plugins');
|
||||||
|
$tgz->create_archive();
|
||||||
|
$tgz->download_file();
|
||||||
|
exit;
|
||||||
|
*/
|
||||||
|
$tgz = new ArchiveFactory(JPATH_COMPONENT."/editor",$backup_file_name);
|
||||||
|
$tgz->downloadFile();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
JCKHelper::error( JText::_("COM_JCKMAN_CPANEL_COULD_NOT_CREATE_SQL"));
|
||||||
|
}
|
||||||
|
}//end function
|
||||||
|
|
||||||
|
private function _createSQL()
|
||||||
|
{
|
||||||
|
$tables = array('#__jckplugins','#__jcktoolbars','#__jcktoolbarplugins','#__jcklanguages');
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$sql = array();
|
||||||
|
|
||||||
|
foreach($tables as $table)
|
||||||
|
{
|
||||||
|
$sql[] = 'DROP TABLE IF EXISTS '. $table.';'.chr(13);
|
||||||
|
$query = 'SHOW CREATE TABLE '. $table;
|
||||||
|
$db->setQuery($query);
|
||||||
|
$row = $db->loadRow();
|
||||||
|
$struct = str_replace($db->getPrefix(),'#__',$row[1]);
|
||||||
|
$sql[] = $struct.';'.chr(13);
|
||||||
|
$query = 'SELECT * FROM '. $table;
|
||||||
|
$db->setQuery($query);
|
||||||
|
$rows = $db-> loadRowList();
|
||||||
|
|
||||||
|
if(!empty($rows))
|
||||||
|
{
|
||||||
|
$sql[] = 'INSERT INTO '. $table. ' VALUES ';
|
||||||
|
|
||||||
|
$fieldcount = count($rows[0]);
|
||||||
|
$rowcount = count($rows);
|
||||||
|
$fieldcount--;
|
||||||
|
$rowcount--;
|
||||||
|
foreach($rows as $k=>$row)
|
||||||
|
{
|
||||||
|
if(!$row[$fieldcount])
|
||||||
|
$row[$fieldcount] = 'NULL';
|
||||||
|
if(!$row[$fieldcount-2])
|
||||||
|
$row[$fieldcount-2] = 'NULL';
|
||||||
|
|
||||||
|
if($k < $rowcount)
|
||||||
|
$tupples = "('".implode("','",$row)."'),";
|
||||||
|
else
|
||||||
|
$tupples = "('".implode("','",$row)."');";
|
||||||
|
$tupples = str_replace("'NULL'","NULL",$tupples);
|
||||||
|
$sql[] = $tupples;
|
||||||
|
}
|
||||||
|
$sql[] = chr(13);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = "SELECT params FROM #__extensions WHERE folder='editors' AND element = 'jckeditor'";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$result = $db-> loadResult();
|
||||||
|
|
||||||
|
$sql[] = "UPDATE #__extensions";
|
||||||
|
$sql[] = "SET params = '".$db->escape($result)."'";
|
||||||
|
$sql[] = "WHERE folder='editors' AND element = 'jckeditor'";
|
||||||
|
$sql[] = chr(13);
|
||||||
|
|
||||||
|
$buffer = implode(chr(13),$sql);
|
||||||
|
$file = JPATH_COMPONENT.'/editor/plugins/sql.sql';
|
||||||
|
return JFile::write($file, $buffer);
|
||||||
|
}//end function
|
||||||
|
}//end class
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,213 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_BASE') or die();
|
||||||
|
|
||||||
|
jimport( 'joomla.event.event' );
|
||||||
|
|
||||||
|
class JCKListControllerListener extends JEvent
|
||||||
|
{
|
||||||
|
protected $canDo = false;
|
||||||
|
protected $app = false;
|
||||||
|
|
||||||
|
function __construct( &$subject )
|
||||||
|
{
|
||||||
|
parent::__construct( $subject );
|
||||||
|
|
||||||
|
$this->canDo = JCKHelper::getActions();
|
||||||
|
$this->app = JFactory::getApplication();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A JParameter object holding the parameters for the plugin
|
||||||
|
*
|
||||||
|
* @var A JParameter object
|
||||||
|
* @access public
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
function onSave($plugin,$pluginToolbarnames)
|
||||||
|
{
|
||||||
|
if( !$this->canDo->get('core.edit') )
|
||||||
|
{
|
||||||
|
$this->app->redirect( JRoute::_( 'index.php?option=com_jckman&view=list', false ), JText::_( 'COM_JCKMAN_PLUGIN_PERM_NO_SAVE' ), 'error' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once(CKEDITOR_LIBRARY.DS . 'toolbar.php');
|
||||||
|
|
||||||
|
$CKfolder = CKEDITOR_LIBRARY.DS . 'toolbar';
|
||||||
|
|
||||||
|
jckimport('helper');
|
||||||
|
$toolbarnames = JCKHelper::getEditorToolbars();
|
||||||
|
|
||||||
|
if(!empty( $toolbarnames))
|
||||||
|
{
|
||||||
|
foreach($toolbarnames as $toolbarname)
|
||||||
|
{
|
||||||
|
$tmpfilename = $CKfolder.DS.$toolbarname.'.php';
|
||||||
|
|
||||||
|
require($tmpfilename);
|
||||||
|
|
||||||
|
$classname = 'JCK'. ucfirst($toolbarname);
|
||||||
|
|
||||||
|
$toolbar = new $classname();
|
||||||
|
|
||||||
|
if(!$plugin->title)
|
||||||
|
{
|
||||||
|
//publish or unpblish plugin
|
||||||
|
$this->onPublish(array($plugin->id),$plugin->published);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pluginTitle = str_replace(' ','',$plugin->title);
|
||||||
|
$pluginTitle = $pluginTitle;
|
||||||
|
|
||||||
|
//fix toolbar values or they will get wiped out
|
||||||
|
foreach (get_object_vars( $toolbar ) as $k => $v)
|
||||||
|
{
|
||||||
|
if(is_null($v))
|
||||||
|
{
|
||||||
|
$toolbar->$k = '';
|
||||||
|
}
|
||||||
|
if($k[0] == '_')
|
||||||
|
$toolbar->$k = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
$toolbar->$pluginTitle = NULL;
|
||||||
|
|
||||||
|
if(!empty($pluginToolbarnames) && in_array($toolbarname,$pluginToolbarnames))
|
||||||
|
$toolbar->$pluginTitle = '';
|
||||||
|
|
||||||
|
$toolbarConfig = new JRegistry('toolbar');
|
||||||
|
|
||||||
|
$toolbarConfig->loadObject($toolbar);
|
||||||
|
|
||||||
|
// Get the config registry in PHP class format and write it to file
|
||||||
|
if (!JFile::write($tmpfilename, $toolbarConfig->toString('PHP', array('class' => $classname . ' extends JCKToolbar')))) {
|
||||||
|
|
||||||
|
JCKHelper::error(JText::sprintf('COM_JCK_PLUGIN_LIST_FAILED_TO_MODIFY_TOOLBAR',$pname,$classname));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//layout stuff
|
||||||
|
$cids = array(0);
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
|
||||||
|
if(!empty($pluginToolbarnames))
|
||||||
|
{
|
||||||
|
$values = array();
|
||||||
|
foreach($pluginToolbarnames as $plugintoolbarname)
|
||||||
|
{
|
||||||
|
|
||||||
|
$query = 'SELECT id'
|
||||||
|
. ' FROM #__jcktoolbars'
|
||||||
|
. ' WHERE name = "'. $plugintoolbarname .'"';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$toolbarid = $db->loadResult();
|
||||||
|
|
||||||
|
if($toolbarid)
|
||||||
|
{
|
||||||
|
|
||||||
|
$rowDetail = JCKHelper::getNextLayoutRow($toolbarid);
|
||||||
|
|
||||||
|
$values[] = '('.$toolbarid.','. $plugin->id.','.$rowDetail->rowid.','.$rowDetail->rowordering.',1)';
|
||||||
|
|
||||||
|
$cids[] = $toolbarid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//First remove plugin from every layout that has not been selected
|
||||||
|
$query = 'DELETE FROM #__jcktoolbarplugins'
|
||||||
|
. ' WHERE pluginid ='. $plugin->id
|
||||||
|
. ' AND toolbarid NOT IN (' . implode(',',$cids).')';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if (!$db->query()) {
|
||||||
|
JCKHelper::error( $db->getErrorMsg() );
|
||||||
|
}
|
||||||
|
|
||||||
|
//Now add plugin to selected layouts
|
||||||
|
if(!empty($values))
|
||||||
|
{
|
||||||
|
$query = 'INSERT INTO #__jcktoolbarplugins(toolbarid,pluginid,row,ordering,state) VALUES ' . implode(',',$values)
|
||||||
|
.' ON DUPLICATE KEY UPDATE toolbarid = VALUES(toolbarid),pluginid = VALUES(pluginid)';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
if(!$db->query())
|
||||||
|
{
|
||||||
|
JCKHelper::error( $db->getErrorMsg() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//publish or unpblish plugin
|
||||||
|
$this->onPublish(array($plugin->id),$plugin->published);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPublish($cid,$value)
|
||||||
|
{
|
||||||
|
if( !$this->canDo->get('core.edit.state') )
|
||||||
|
{
|
||||||
|
$this->app->redirect( JRoute::_( 'index.php?option=com_jckman&view=list', false ), JText::_( 'COM_JCKMAN_PLUGIN_PERM_NO_PUB' ), 'error' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$cids = implode( ',', $cid );
|
||||||
|
|
||||||
|
$query = 'SELECT name FROM #__jckplugins'
|
||||||
|
. ' WHERE id IN ( '.$cids.' )'
|
||||||
|
. ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ))'
|
||||||
|
;
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$pluginnames = $db->loadColumn();
|
||||||
|
if (!$pluginnames) {
|
||||||
|
JCKHelper::error( $db->getErrorMsg() );
|
||||||
|
}
|
||||||
|
|
||||||
|
jckimport('helper');
|
||||||
|
|
||||||
|
$config = JCKHelper::getEditorPluginConfig();
|
||||||
|
|
||||||
|
foreach($pluginnames as $pname)
|
||||||
|
$config->set($pname,$value);
|
||||||
|
|
||||||
|
$cfgFile = CKEDITOR_LIBRARY.DS . 'plugins' . DS . 'toolbarplugins.php';
|
||||||
|
|
||||||
|
// Get the toolbar registry in PHP class format and write it to file
|
||||||
|
$buffer = $config->toString('PHP', array('class' => 'JCKToolbarPlugins extends JCKPlugins'));
|
||||||
|
if (!JFile::write($cfgFile,$buffer)) {
|
||||||
|
$modify = ($value ? 'publish ' : 'unpublish ');
|
||||||
|
JCKHelper::error(JText::sprintf('COM_JCK_PLUGIN_LIST_FAILED_TO_PUBLISH_UNPUBLISH_PLUGINS',$modify));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onApply($plugin,$pluginToolbarnames)
|
||||||
|
{
|
||||||
|
if( !$this->canDo->get('core.edit') )
|
||||||
|
{
|
||||||
|
$this->app->redirect( JRoute::_( 'index.php?option=com_jckman&view=list', false ), JText::_( 'COM_JCKMAN_PLUGIN_PERM_NO_SAVE' ), 'error' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->onSave($plugin,$pluginToolbarnames);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onUnpublish($cid,$value)
|
||||||
|
{
|
||||||
|
if( !$this->canDo->get('core.edit.state') )
|
||||||
|
{
|
||||||
|
$this->app->redirect( JRoute::_( 'index.php?option=com_jckman&view=list', false ), JText::_( 'COM_JCKMAN_PLUGIN_PERM_NO_UNPUB' ), 'error' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->onPublish($cid,$value);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_BASE') or die();
|
||||||
|
|
||||||
|
jimport('joomla.event.dispatcher');
|
||||||
|
jimport('joomla.base.observable'); //AW added for Joomla 2.5
|
||||||
|
|
||||||
|
class JCKEditorObservable extends JObservable
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Plugin Manager controller event handler name
|
||||||
|
*
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
var $eventHandlerName = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin Manager controller event handler object
|
||||||
|
*
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
var $_eventHandler = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* constructor
|
||||||
|
*
|
||||||
|
* @access protected
|
||||||
|
* @param string The event handler
|
||||||
|
*/
|
||||||
|
function __construct($eventHandlerName)
|
||||||
|
{
|
||||||
|
$eventListenerClassName = 'JCK' . JString::ucfirst($eventHandlerName) . 'ControllerListener';
|
||||||
|
|
||||||
|
if(class_exists($eventListenerClassName))
|
||||||
|
{
|
||||||
|
$this->_eventHandler = new $eventListenerClassName($this);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
JCKHelper::error('No Event listener ' . $eventListenerClassName .' class found.');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update Editor
|
||||||
|
*
|
||||||
|
* @param string event
|
||||||
|
*@param array arguments for function call of event handller
|
||||||
|
*/
|
||||||
|
function update($event, $args )
|
||||||
|
{
|
||||||
|
|
||||||
|
$args['event'] = $event;
|
||||||
|
|
||||||
|
$this->_eventHandler->update($args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload Toolbar
|
||||||
|
*
|
||||||
|
* Used to restore toolbar if editor is re-installed
|
||||||
|
*/
|
||||||
|
function getEventHandler()
|
||||||
|
{
|
||||||
|
return $this->_eventHandler;
|
||||||
|
}//end function getEventHandler
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,314 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_BASE') or die();
|
||||||
|
|
||||||
|
jimport( 'joomla.event.event' );
|
||||||
|
|
||||||
|
class JCKToolbarsControllerListener extends JEvent
|
||||||
|
{
|
||||||
|
protected $canDo = false;
|
||||||
|
protected $app = false;
|
||||||
|
|
||||||
|
function __construct( &$subject )
|
||||||
|
{
|
||||||
|
parent::__construct( $subject );
|
||||||
|
|
||||||
|
$this->canDo = JCKHelper::getActions();
|
||||||
|
$this->app = JFactory::getApplication();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A JParameter object holding the parameters for the plugin
|
||||||
|
*
|
||||||
|
* @var A JParameter object
|
||||||
|
* @access public
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
function onCopy($cid)
|
||||||
|
{
|
||||||
|
if( !$this->canDo->get('core.create') )
|
||||||
|
{
|
||||||
|
$this->app->redirect( JRoute::_( 'index.php?option=com_jckman&view=toolbars', false ), JText::_( 'COM_JCKMAN_PLUGIN_PERM_NO_COPY' ), 'error' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
$sql = $db->getQuery( true );
|
||||||
|
$sql->select( 'id,name,title' )
|
||||||
|
->from( '#__jcktoolbars' )
|
||||||
|
->where( 'id IN ('. implode($cid) .')' );
|
||||||
|
$toolbars = $db->setQuery( $sql )->loadObjectList();
|
||||||
|
|
||||||
|
$this->_createEditorToolbarOption($toolbars);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function onSave($id,$name,$oldname,$title,$isNew)
|
||||||
|
{
|
||||||
|
$toolbar = new stdclass;
|
||||||
|
$toolbar->id = $id;
|
||||||
|
$toolbar->oldname = $oldname;
|
||||||
|
$toolbar->name = $name;
|
||||||
|
$toolbar->title = $title;
|
||||||
|
|
||||||
|
$folder = CKEDITOR_LIBRARY.DS.'toolbar';
|
||||||
|
$newfile = $folder.DS.$name.'.php';
|
||||||
|
|
||||||
|
if(!$isNew || JFile::exists($newfile)) // Also check to see if toolbar file already exists. If so then it is just a simple update
|
||||||
|
{
|
||||||
|
$this->_createEditorToolbar($id,$name,$oldname);
|
||||||
|
$this->_updateEditorToolbarOption(array($toolbar));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->_createEditorToolbarOption(array($toolbar));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onRemove($names)
|
||||||
|
{
|
||||||
|
if( !$this->canDo->get('core.delete') )
|
||||||
|
{
|
||||||
|
$this->app->redirect( JRoute::_( 'index.php?option=com_jckman&view=toolbars', false ), JText::_( 'COM_JCKMAN_PLUGIN_PERM_NO_DELETE' ), 'error' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete toolbar files
|
||||||
|
$paths = array_map(create_function('$name','return CKEDITOR_LIBRARY.DS."toolbar".DS.$name.".php";'),$names);
|
||||||
|
//JFile::delete($paths);
|
||||||
|
//update Editor Manifest
|
||||||
|
$this->_deleteEditorToolbarOption($names);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function _createEditorToolbarOption($toolbars)
|
||||||
|
{
|
||||||
|
// get editor installfile
|
||||||
|
$JCKManifestFile = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' .DS . 'jckeditor.xml';
|
||||||
|
|
||||||
|
$jckeditorXML = JCKHelper::getXMLParser('Simple');
|
||||||
|
if(!$jckeditorXML->loadFile($JCKManifestFile))
|
||||||
|
{
|
||||||
|
JCKHelper::error( 'Editor Install: '.JText::_('COM_JCK_LAYOUT_MANAGER_NOT_LOAD_JCK_MANIFEST'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$JCKManifest = $jckeditorXML->document;
|
||||||
|
|
||||||
|
$paramsElement = $JCKManifest->config[0]->fields[0]->fieldset[0];
|
||||||
|
|
||||||
|
foreach($toolbars as $toolbar)
|
||||||
|
{
|
||||||
|
$this->_createEditorToolbar($toolbar->id,$toolbar->name,$toolbar->name); //Write to toolbar file
|
||||||
|
foreach ($paramsElement->children() as $param)
|
||||||
|
{
|
||||||
|
|
||||||
|
if($param->attributes('name') == 'toolbar')
|
||||||
|
{
|
||||||
|
$child = $param->AddChild('option',array('value' => $toolbar->name));
|
||||||
|
$child->setData($toolbar->title);
|
||||||
|
}
|
||||||
|
if($param->attributes('name') == 'toolbar_ft')
|
||||||
|
{
|
||||||
|
$child = $param->AddChild('option',array('value' => $toolbar->name));
|
||||||
|
$child->setData($toolbar->title);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$JCKOutputXMl = $JCKManifest->toString();
|
||||||
|
|
||||||
|
if(!JFile::write($JCKManifestFile,$JCKOutputXMl)) //Write to editor manifest file
|
||||||
|
{
|
||||||
|
JCKHelper::error( 'Toolbar Copy: '.JText::_('COM_JCK_LAYOUT_MANAGER_NOT_WRITE_JCK_MANIFEST'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _deleteEditorToolbarOption($names)
|
||||||
|
{
|
||||||
|
// get editor installfile
|
||||||
|
$JCKManifestFile = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'jckeditor.xml';
|
||||||
|
|
||||||
|
$jckeditorXML = JCKHelper::getXMLParser('Simple');
|
||||||
|
if(!$jckeditorXML->loadFile($JCKManifestFile))
|
||||||
|
{
|
||||||
|
JCKHelper::error( 'Editor Install: '.JText::_('COM_JCK_LAYOUT_MANAGER_NOT_LOAD_JCK_MANIFEST'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$JCKManifest = $jckeditorXML->document;
|
||||||
|
|
||||||
|
$paramsElement = $JCKManifest->config[0]->fields[0]->fieldset[0];
|
||||||
|
|
||||||
|
foreach($names as $name)
|
||||||
|
{
|
||||||
|
foreach ($paramsElement->children() as $param)
|
||||||
|
{
|
||||||
|
if($param->attributes('name') == 'toolbar')
|
||||||
|
{
|
||||||
|
foreach($param->children() as $child)
|
||||||
|
{
|
||||||
|
if($child->attributes('value') == $name)
|
||||||
|
{
|
||||||
|
$param->removeChild($child);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($param->attributes('name') == 'toolbar_ft')
|
||||||
|
{
|
||||||
|
foreach($param->children() as $child)
|
||||||
|
{
|
||||||
|
if($child->attributes('value') == $name)
|
||||||
|
{
|
||||||
|
$param->removeChild($child);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$JCKOutputXMl = $JCKManifest->toString();
|
||||||
|
|
||||||
|
if(!JFile::write($JCKManifestFile,$JCKOutputXMl)) //Write to editor manifest file
|
||||||
|
{
|
||||||
|
JCKHelper::error( 'Toolbar Delete: '.JText::_('COM_JCK_LAYOUT_MANAGER_NOT_WRITE_JCK_MANIFEST'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _updateEditorToolbarOption($toolbars)
|
||||||
|
{
|
||||||
|
// get editor installfile
|
||||||
|
$JCKManifestFile = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'jckeditor.xml';
|
||||||
|
|
||||||
|
$jckeditorXML = JCKHelper::getXMLParser('Simple');
|
||||||
|
if(!$jckeditorXML->loadFile($JCKManifestFile))
|
||||||
|
{
|
||||||
|
JCKHelper::error( 'Editor Install: '.JText::_('COM_JCK_LAYOUT_MANAGER_NOT_LOAD_JCK_MANIFEST'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$JCKManifest = $jckeditorXML->document;
|
||||||
|
|
||||||
|
$paramsElement = $JCKManifest->config[0]->fields[0]->fieldset[0];
|
||||||
|
|
||||||
|
foreach($toolbars as $toolbar)
|
||||||
|
{
|
||||||
|
foreach ($paramsElement->children() as $param)
|
||||||
|
{
|
||||||
|
if($param->attributes('name') == 'toolbar')
|
||||||
|
{
|
||||||
|
foreach($param->children() as $child)
|
||||||
|
{
|
||||||
|
if($child->attributes('value') == $toolbar->oldname)
|
||||||
|
{
|
||||||
|
$child->removeAttribute('value');
|
||||||
|
$child->addAttribute('value',$toolbar->name);
|
||||||
|
$child->setData($toolbar->title);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($param->attributes('name') == 'toolbar_ft')
|
||||||
|
{
|
||||||
|
foreach($param->children() as $child)
|
||||||
|
{
|
||||||
|
if($child->attributes('value') == $toolbar->oldname)
|
||||||
|
{
|
||||||
|
$child->removeAttribute('value');
|
||||||
|
$child->addAttribute('value',$toolbar->name);
|
||||||
|
$child->setData($toolbar->title);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$JCKOutputXMl = $JCKManifest->toString();
|
||||||
|
|
||||||
|
if(!JFile::write($JCKManifestFile,$JCKOutputXMl)) //Write to editor manifest file
|
||||||
|
{
|
||||||
|
JCKHelper::error( 'Toolbar Update: '.JText::_('COM_JCK_LAYOUT_MANAGER_NOT_WRITE_JCK_MANIFEST'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _createEditorToolbar($id,$name,$oldname)
|
||||||
|
{
|
||||||
|
require_once(CKEDITOR_LIBRARY.DS . 'toolbar.php');
|
||||||
|
|
||||||
|
$CKfolder = CKEDITOR_LIBRARY.DS . 'toolbar';
|
||||||
|
|
||||||
|
$newfilename = $CKfolder.DS.$name.'.php';
|
||||||
|
$oldfilename = $CKfolder.DS.$oldname.'.php';
|
||||||
|
|
||||||
|
$classname = 'JCK'. ucfirst($name);
|
||||||
|
$toolbar = new stdclass;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$toolbarConfig = new JRegistry('toolbar');
|
||||||
|
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
|
||||||
|
$query = 'SELECT tp.pluginid AS id,p.title,tp.row'
|
||||||
|
. ' FROM #__jcktoolbarplugins tp'
|
||||||
|
. ' LEFT JOIN #__jckplugins p ON p.id = tp.pluginid'
|
||||||
|
. ' WHERE tp.state = 1'
|
||||||
|
. ' AND tp.toolbarid = '.$id
|
||||||
|
. ' ORDER BY tp.row ASC,tp.ordering ASC';
|
||||||
|
$db->setQuery( $query );
|
||||||
|
$toolbarplugins = $db->loadObjectList();
|
||||||
|
|
||||||
|
if($toolbarplugins)
|
||||||
|
{
|
||||||
|
foreach($toolbarplugins as $plugin)
|
||||||
|
{
|
||||||
|
if($plugin->id < 0) // we have a break
|
||||||
|
{
|
||||||
|
$property = 'brk_' .($plugin->id*-1);
|
||||||
|
$toolbar->$property = $plugin->row;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$property = $plugin->title;
|
||||||
|
$toolbar->$property = $plugin->row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$toolbarConfig->loadObject($toolbar);
|
||||||
|
|
||||||
|
// Get the config registry in PHP class format and write it to file
|
||||||
|
$buffer = $toolbarConfig->toString('PHP', array('class' => $classname . ' extends JCKToolbar'));
|
||||||
|
|
||||||
|
if (!JFile::write($oldfilename,$buffer)) {
|
||||||
|
JCKHelper::error( JText::sprintf('COM_JCKMAN_LAYOUT_MANAGER_FAILED_WRITE_FILE',$classname));
|
||||||
|
}
|
||||||
|
|
||||||
|
if($newfilename != $oldfilename)
|
||||||
|
{
|
||||||
|
if( !JFile::move($oldfilename, $newfilename) ){
|
||||||
|
JCKHelper::error(JText::sprintf('COM_JCKMAN_LAYOUT_MANAGER_FAILED_WRITE_FILE',$classname));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onApply($id,$name,$oldname,$title,$isNew)
|
||||||
|
{
|
||||||
|
$this->onSave($id,$name,$oldname,$title,$isNew);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
<div>
|
||||||
|
|
||||||
|
</div>
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
<div>
|
||||||
|
To restore a back it is very easy! All you need to do is click in the Restore's icon, navigate to the tar.gz backup file and click in the Upload File & install's button. Or if you want to migrate your configuration from one server to another, all you need to do is install the JCK Editor & Manager first, and repeat the above - job done!
|
||||||
|
</div>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
<div>
|
||||||
|
The Plugin installer allows you to install and uninstall JCK plugins. A JCK plugin consists of an extension that interacts with the editor. These plugins or extensions are used to enable the user to quickly and simply customise or expand the functionality of the editor. This could be done to meet your needs to portfolio images in a stylish gallery light-box or to expand the editor with media or image editing extensions. The possibilities are endless!
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
Please click here to visit the official Plug-in Store: <a href="http://www.joomlackeditor.com/downloads/jck-plugins-store">http://www.joomlackeditor.com/downloads/jck-plugins-store</a>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
<div>
|
||||||
|
The Plugin Manager controls what buttons are displayed in the editor's interface. It allows plugins to be published, unpublished, and assigned to specific tool-bars with the ability to setup user permissions.
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
In addition to these great features the Plugin Manager will also allow you to define three default parameters for the dialog popup screens: Height, Title and Width. And if this was not enough you can add further customizable options for your JCK plugins as parameters are just like any standard Joomla extensions!
|
||||||
|
</div>
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
<div>
|
||||||
|
It allows complete control over the editor's layout. You can create your own bespoke toolbars, position plugins, create new toolbars, publish and unpublish toolbars! It's surprisingly easy do thanks to its simple drag-and-drop interface.
|
||||||
|
</div>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
885
deployed/jckman/administrator/components/com_jckman/helper.php
Normal file
885
deployed/jckman/administrator/components/com_jckman/helper.php
Normal file
@ -0,0 +1,885 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_BASE') or die();
|
||||||
|
|
||||||
|
jimport( 'joomla.html.parameter' );
|
||||||
|
|
||||||
|
class JCKHelper
|
||||||
|
{
|
||||||
|
protected static $errors = array();
|
||||||
|
|
||||||
|
protected static $language = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -PC-
|
||||||
|
* Centralise error handling so when Joomla change their API again we only change in one place!
|
||||||
|
* Throw a Joomla error - JCKHelper::error( $results[0]->msg );
|
||||||
|
*
|
||||||
|
* $message = (string) The message to throw
|
||||||
|
* $type = (string) The type of error
|
||||||
|
* $location = (string) How to throw the error. Currently - 'database', 'echo', 'formattedtext', 'messagequeue', 'syslog', 'w3c'
|
||||||
|
*/
|
||||||
|
public static function error( $message = false, $type = 'error', $location = 'messagequeue' )
|
||||||
|
{
|
||||||
|
if( !$message || in_array( $message, self::$errors ) ) return false;
|
||||||
|
|
||||||
|
// Prevent throwing the same error multiple times
|
||||||
|
self::$errors[] = $message;
|
||||||
|
|
||||||
|
switch( $type )
|
||||||
|
{
|
||||||
|
default :
|
||||||
|
case 'warning' : // Can't throw warning thanks to Joomla
|
||||||
|
case 'error' :
|
||||||
|
$level = JLog::ERROR;
|
||||||
|
break;
|
||||||
|
case 'notice' :
|
||||||
|
$level = JLog::NOTICE;
|
||||||
|
break;
|
||||||
|
case 'message' :
|
||||||
|
case 'info' :
|
||||||
|
$level = JLog::INFO;
|
||||||
|
break;
|
||||||
|
}//end switch
|
||||||
|
|
||||||
|
// Generate unique ID to avoid Joomla bug of throwing Joomla depreciated messages as well
|
||||||
|
$id = time() . chr( 95 ) . base_convert( mt_rand( 0x19A100, 0x39AA3FF ), 10, 36 );
|
||||||
|
|
||||||
|
//JLog::addLogger( array( 'logger' => $location, 'com_jckman' => $id ), $level );
|
||||||
|
JLog::add( $message, $level );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}//end function
|
||||||
|
|
||||||
|
public static function addSubmenu( $vName = false )
|
||||||
|
{
|
||||||
|
$canDo = JCKHelper::getActions();
|
||||||
|
$subMenus = array(
|
||||||
|
'COM_JCKMAN_SUBMENU_CPANEL_NAME' => array( 'extension' => 'cpanel', 'permission' => '', 'hideinmob' => false, 'hideinipad' => false ),
|
||||||
|
'COM_JCKMAN_SUBMENU_PLUGIN_NAME' => array( 'extension' => 'list', 'permission' => '', 'hideinmob' => false, 'hideinipad' => false ),
|
||||||
|
'COM_JCKMAN_SUBMENU_INSTALL_NAME' => array( 'extension' => 'install', 'permission' => 'jckman.install', 'hideinmob' => false, 'hideinipad' => false ),
|
||||||
|
'COM_JCKMAN_SUBMENU_UNINSTALL_NAME' => array( 'extension' => 'extension', 'permission' => 'jckman.uninstall', 'hideinmob' => false, 'hideinipad' => false ),
|
||||||
|
'COM_JCKMAN_SUBMENU_SYSTEMCHECK_NAME' => array( 'extension' => 'cpanel&taskbtn=system', 'permission' => 'core.edit', 'hideinmob' => true, 'hideinipad' => true ),
|
||||||
|
'COM_JCKMAN_SUBMENU_LAYOUT_NAME' => array( 'extension' => 'toolbars', 'permission' => '', 'hideinmob' => true, 'hideinipad' => true ),
|
||||||
|
'COM_JCKMAN_SUBMENU_IMPORT_NAME' => array( 'extension' => 'import', 'permission' => 'core.edit', 'hideinmob' => true, 'hideinipad' => true ),
|
||||||
|
'COM_JCKMAN_SUBMENU_BACKUP_NAME' => array( 'extension' => 'cpanel&taskbtn=export', 'permission' => '', 'hideinmob' => true, 'hideinipad' => true ),
|
||||||
|
'COM_JCKMAN_SUBMENU_SYNC_NAME' => array( 'extension' => 'cpanel&taskbtn=sync', 'permission' => 'jckman.sync', 'hideinmob' => false, 'hideinipad' => false ),
|
||||||
|
'COM_JCKMAN_SUBMENU_JCKEDITOR_NAME' => array( 'extension' => 'cpanel&taskbtn=editor', 'permission' => '', 'hideinmob' => false, 'hideinipad' => false )
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach( $subMenus as $name => $params )
|
||||||
|
{
|
||||||
|
// hide in iPad
|
||||||
|
if( !$params['hideinipad'] || ( $params['hideinipad'] && !self::isiPad() ) )
|
||||||
|
{
|
||||||
|
// hide in mobile
|
||||||
|
if( !$params['hideinmob'] || ( $params['hideinmob'] && !self::isMobile() ) )
|
||||||
|
{
|
||||||
|
// perform any permissions
|
||||||
|
if( !$params['permission'] || $canDo->get($params['permission']) )
|
||||||
|
{
|
||||||
|
JHtmlSidebar::addEntry(JText::_( $name ), 'index.php?option=com_jckman&view='.$params['extension'], ($params['extension'] == $vName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}//end function
|
||||||
|
|
||||||
|
public static function isiPad()
|
||||||
|
{
|
||||||
|
$browser = JBrowser::getInstance();
|
||||||
|
|
||||||
|
return ( stripos( $browser->getAgentString(), 'iPad' ) === false ) ? false : true;
|
||||||
|
}//end function
|
||||||
|
|
||||||
|
public static function isMobile()
|
||||||
|
{
|
||||||
|
$browser = JBrowser::getInstance();
|
||||||
|
$isMob = false;
|
||||||
|
$isMob = ( $browser->isMobile() ) ? true : $isMob;
|
||||||
|
$isMob = ( stripos( $browser->getAgentString(), 'iPhone' ) === false ) ? $isMob : true;
|
||||||
|
//$isMob = ( stripos( $browser->getAgentString(), 'YOUR_PHONE_HERE' ) === false ) ? $isMob : true;
|
||||||
|
|
||||||
|
return $isMob;
|
||||||
|
}//end function
|
||||||
|
|
||||||
|
public static function fixBug()
|
||||||
|
{
|
||||||
|
// FIX JOOMLA BUG! - NONE OF THEIR DISABLED LEFT HAND MENU's HAVE CLOSING TAGS SO STOP OUR PAGE DISTORTING HERE
|
||||||
|
// TODO: TELL JOOMLA & REMOVE BELOW LINE
|
||||||
|
echo '</a>';
|
||||||
|
}//end function
|
||||||
|
|
||||||
|
static function & getTable( $name, $prefix = 'JCKTable', $config = array())
|
||||||
|
{
|
||||||
|
|
||||||
|
$path = JPATH_COMPONENT.DS.'tables';
|
||||||
|
JTable::addIncludePath($path);
|
||||||
|
|
||||||
|
// Clean the name
|
||||||
|
$prefix = preg_replace( '/[^A-Z0-9_]/i', '', $prefix );
|
||||||
|
|
||||||
|
//Make sure we are returning a DBO object
|
||||||
|
if (!array_key_exists('dbo', $config)) {
|
||||||
|
$config['dbo'] = JFactory::getDBO();
|
||||||
|
}
|
||||||
|
|
||||||
|
$instance =@ JTable::getInstance($name, $prefix, $config );
|
||||||
|
return $instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function & geTtoolbarParams($editor,$args = array())
|
||||||
|
{
|
||||||
|
|
||||||
|
if( count($args) > 1)
|
||||||
|
{
|
||||||
|
$row = $args[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(is_a($args[0] ,'JParameter'))
|
||||||
|
{
|
||||||
|
$params = $args[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ if( $row)
|
||||||
|
{
|
||||||
|
$params = new JParameter($row->params);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$row = & JCKHelper::getTable('toolbar');
|
||||||
|
// load the row from the db table
|
||||||
|
$row->load( $args[0]);
|
||||||
|
//get toolbar parameter
|
||||||
|
$params = new JParameter($row->params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$editor_params = new JParameter($editor->params);
|
||||||
|
$toolbar = $params->get('toolbar',$row->name);
|
||||||
|
$skins = $params->get('skin', $editor_params->def( 'skin','office2003'));
|
||||||
|
$width = $params->get('wwidth', $editor_params->def( 'wwidth','100%'));
|
||||||
|
|
||||||
|
|
||||||
|
$editor_params->set( 'toolbar',$toolbar);
|
||||||
|
$editor_params->set( 'skin', $skins );
|
||||||
|
$editor_params->set( 'wwidth', $width);
|
||||||
|
$editor_params->Set( 'hheight',300);
|
||||||
|
return $editor_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static function & getEditorPluginConfig($namspace = 'config')
|
||||||
|
{
|
||||||
|
static $config;
|
||||||
|
|
||||||
|
if(!isset($config))
|
||||||
|
{
|
||||||
|
$path = CKEDITOR_LIBRARY;
|
||||||
|
|
||||||
|
require_once($path.DS.'plugins.php');
|
||||||
|
require_once($path.DS.'plugins'.DS.'toolbarplugins.php');
|
||||||
|
|
||||||
|
$config = new JRegistry();
|
||||||
|
|
||||||
|
$pluginConfig = new JCKToolbarPlugins();
|
||||||
|
|
||||||
|
$config->loadObject($pluginConfig);
|
||||||
|
$data = $config->toObject();
|
||||||
|
$properties = get_object_vars($data);
|
||||||
|
|
||||||
|
foreach($properties as $key=>$value)
|
||||||
|
{
|
||||||
|
if(strpos('p'.$key,'_'))
|
||||||
|
unset($data->$key);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Forcibly remove the save plugin due to it causing the icon
|
||||||
|
//to disappear in editor version 6.0.4+
|
||||||
|
unset( $data->save );
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function & getEditorToolbars()
|
||||||
|
{
|
||||||
|
$path = CKEDITOR_LIBRARY.DS.'toolbar';
|
||||||
|
|
||||||
|
$files = JFolder::files($path);
|
||||||
|
|
||||||
|
$toolbars = array();
|
||||||
|
|
||||||
|
foreach($files as $file)
|
||||||
|
{
|
||||||
|
if(strpos($file,"index") === false && strpos(strrev($file), 'php.') === 0)
|
||||||
|
{
|
||||||
|
$toolbars[] = preg_replace('/\.php$/','',$file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $toolbars;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function getNextAvailablePluginRowId()
|
||||||
|
{
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
|
||||||
|
$db->setQuery('SELECT `row` AS id,count(`row`) AS total FROM `#__jckplugins`'.
|
||||||
|
' GROUP BY row'.
|
||||||
|
' HAVING `row` > 2 ORDER BY `row` DESC LIMIT 1');
|
||||||
|
$row = $db->loadObject();
|
||||||
|
|
||||||
|
if(!$row && is_null($row))
|
||||||
|
{
|
||||||
|
$row = new stdclass;
|
||||||
|
$row->id = 4;
|
||||||
|
$row->order = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $row->id;
|
||||||
|
if($row->total = 26)
|
||||||
|
$id++;
|
||||||
|
|
||||||
|
return $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function getNextLayoutRow($toolbarid)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDBO();
|
||||||
|
|
||||||
|
$db->setQuery('SELECT `row` AS rowid,MAX(`ordering`) +1 AS rowordering FROM `#__jcktoolbarplugins`'
|
||||||
|
.' WHERE `toolbarid`='.(int) $toolbarid
|
||||||
|
.' GROUP BY `row`'
|
||||||
|
.' ORDER BY `row` DESC LIMIT 1');
|
||||||
|
$row = $db->loadObject();
|
||||||
|
|
||||||
|
if(!$row && is_null($row))
|
||||||
|
{
|
||||||
|
$row = new stdclass;
|
||||||
|
$row->rowid = 4;
|
||||||
|
$row->rowordering = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of plugins to be hidden in list & edit views
|
||||||
|
*/
|
||||||
|
public static function getHiddenPlugins( $asString = false )
|
||||||
|
{
|
||||||
|
$hide = array( 'about', 'save', 'flash' );
|
||||||
|
|
||||||
|
return ( $asString ) ? '"' . implode( '","', $hide ) . '"' : $hide;
|
||||||
|
}//end function
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a list of the actions that can be performed.
|
||||||
|
*
|
||||||
|
* @return JObject
|
||||||
|
*/
|
||||||
|
public static function getActions()
|
||||||
|
{
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$result = new JObject;
|
||||||
|
|
||||||
|
$actions = JAccess::getActions('com_jckman');
|
||||||
|
|
||||||
|
foreach ($actions as $action)
|
||||||
|
{
|
||||||
|
$result->set($action->name, $user->authorise($action->name, 'com_jckman'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}//end function
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of filter options for the state of a module.
|
||||||
|
*
|
||||||
|
* @return array An array of JHtmlOption elements.
|
||||||
|
*/
|
||||||
|
public static function getStateOptions()
|
||||||
|
{
|
||||||
|
// Build the filter options.
|
||||||
|
$options = array();
|
||||||
|
$options[] = JHtml::_('select.option', '1', JText::_('JPUBLISHED'));
|
||||||
|
$options[] = JHtml::_('select.option', '0', JText::_('JUNPUBLISHED'));
|
||||||
|
//$options[] = JHtml::_('select.option', '-2', JText::_('JTRASHED'));
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an XML document
|
||||||
|
*
|
||||||
|
* @param string $type The type of XML parser needed 'DOM', 'RSS' or 'Simple'
|
||||||
|
* @param array $options ['rssUrl'] the rss url to parse when using "RSS", ['cache_time'] with '
|
||||||
|
* RSS' - feed cache time. If not defined defaults to 3600 sec
|
||||||
|
*
|
||||||
|
* @return object Parsed XML document object
|
||||||
|
*
|
||||||
|
* @deprecated 12.1 Use JXMLElement instead.
|
||||||
|
* @see JXMLElement
|
||||||
|
*/
|
||||||
|
public static function getXMLParser($type = '', $options = array())
|
||||||
|
{
|
||||||
|
$doc = null;
|
||||||
|
|
||||||
|
switch (strtolower($type))
|
||||||
|
{
|
||||||
|
case 'simple':
|
||||||
|
require_once( dirname( __FILE__ ) . DS . 'helpers' . DS . 'simplexml.php' );
|
||||||
|
$doc = new JSimpleXML;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'dom':
|
||||||
|
JCKHelper::error( JText::_('JLIB_UTIL_ERROR_DOMIT') );
|
||||||
|
$doc = null;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$doc = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $doc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads a XML file.
|
||||||
|
*
|
||||||
|
* @param string $data Full path and file name.
|
||||||
|
* @param boolean $isFile true to load a file or false to load a string.
|
||||||
|
*
|
||||||
|
* @return mixed JXMLElement on success or false on error.
|
||||||
|
*
|
||||||
|
* @see JXMLElement
|
||||||
|
* @since 11.1
|
||||||
|
* @todo This may go in a separate class - error reporting may be improved.
|
||||||
|
*/
|
||||||
|
public static function getXML($data, $isFile = true)
|
||||||
|
{
|
||||||
|
require_once( dirname( __FILE__ ) . DS . 'helpers' . DS . 'xmlelement.php' );
|
||||||
|
|
||||||
|
// Disable libxml errors and allow to fetch error information as needed
|
||||||
|
libxml_use_internal_errors(true);
|
||||||
|
|
||||||
|
if ($isFile)
|
||||||
|
{
|
||||||
|
// Try to load the XML file
|
||||||
|
$xml = simplexml_load_file($data, 'JXMLElement');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Try to load the XML string
|
||||||
|
$xml = simplexml_load_string($data, 'JXMLElement');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($xml))
|
||||||
|
{
|
||||||
|
// There was an error
|
||||||
|
JCKHelper::error( JText::_('JLIB_UTIL_ERROR_XML_LOAD') );
|
||||||
|
|
||||||
|
if ($isFile)
|
||||||
|
{
|
||||||
|
JCKHelper::error( $data );
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (libxml_get_errors() as $error)
|
||||||
|
{
|
||||||
|
JCKHelper::error( 'XML: ' . $error->message );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse a XML install manifest file.
|
||||||
|
*
|
||||||
|
* XML Root tag should be 'install' except for languages which use meta file.
|
||||||
|
*
|
||||||
|
* @param string $path Full path to XML file.
|
||||||
|
*
|
||||||
|
* @return array XML metadata.
|
||||||
|
*
|
||||||
|
* @since 12.1
|
||||||
|
*/
|
||||||
|
public static function parseXMLInstallFile($path)
|
||||||
|
{
|
||||||
|
// Read the file to see if it's a valid component XML file
|
||||||
|
$xml = simplexml_load_file($path);
|
||||||
|
if (!$xml)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for a valid XML root tag.
|
||||||
|
|
||||||
|
// Extensions use 'extension' as the root tag. Languages use 'metafile' instead
|
||||||
|
|
||||||
|
if ($xml->getName() != 'extension' && $xml->getName() != 'install' && $xml->getName() != 'metafile')
|
||||||
|
{
|
||||||
|
unset($xml);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
|
||||||
|
$data['name'] = (string) $xml->name;
|
||||||
|
|
||||||
|
// Check if we're a language. If so use metafile.
|
||||||
|
$data['type'] = $xml->getName() == 'metafile' ? 'language' : (string) $xml->attributes()->type;
|
||||||
|
|
||||||
|
$data['plugin'] = ($xml->attributes->plugin ? (string) $xml->attributes()->plugin : '');
|
||||||
|
|
||||||
|
$data['creationDate'] = ( $xml->creationDate ? (string) $xml->creationDate : JText::_('Unknown'));
|
||||||
|
$data['author'] = ( $xml->author ? (string) $xml->author : JText::_('Unknown'));
|
||||||
|
|
||||||
|
$data['copyright'] = (string) $xml->copyright;
|
||||||
|
$data['authorEmail'] = (string) $xml->authorEmail;
|
||||||
|
$data['authorUrl'] = (string) $xml->authorUrl;
|
||||||
|
$data['version'] = (string) $xml->version;
|
||||||
|
$data['description'] = (string) $xml->description;
|
||||||
|
$data['group'] = (string) $xml->group;
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getLanguage()
|
||||||
|
{
|
||||||
|
if (!self::$language)
|
||||||
|
{
|
||||||
|
self::$language = JCKLanguage::getInstance('en-GB');
|
||||||
|
$lang = Jfactory::getLanguage();
|
||||||
|
self::$language->merge($lang);
|
||||||
|
}
|
||||||
|
return self::$language;
|
||||||
|
}
|
||||||
|
}//end class
|
||||||
|
|
||||||
|
jimport('joomla.application.component.helper');
|
||||||
|
|
||||||
|
abstract class JCKModuleHelper extends JModuleHelper
|
||||||
|
{
|
||||||
|
public static function &getModules($position)
|
||||||
|
{
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$position = strtolower($position);
|
||||||
|
$result = array();
|
||||||
|
|
||||||
|
$modules = self::_load();
|
||||||
|
|
||||||
|
$total = count($modules);
|
||||||
|
for ($i = 0; $i < $total; $i++)
|
||||||
|
{
|
||||||
|
if ($modules[$i]->position == $position) {
|
||||||
|
$result[] = &$modules[$i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count($result) == 0)
|
||||||
|
{
|
||||||
|
if (JRequest::getBool('tp') && JComponentHelper::getParams('com_templates')->get('template_positions_display'))
|
||||||
|
{
|
||||||
|
$result[0] = self::getModule('mod_'.$position);
|
||||||
|
$result[0]->title = $position;
|
||||||
|
$result[0]->content = $position;
|
||||||
|
$result[0]->position = $position;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Load published modules
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected static function &_load()
|
||||||
|
{
|
||||||
|
static $clean;
|
||||||
|
|
||||||
|
if (isset($clean)) {
|
||||||
|
return $clean;
|
||||||
|
}
|
||||||
|
|
||||||
|
$Itemid = JRequest::getInt('Itemid');
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||||
|
$lang = JFactory::getLanguage()->getTag();
|
||||||
|
$clientId = (int) $app->getClientId();
|
||||||
|
|
||||||
|
$cache = JFactory::getCache ('com_modules', '');
|
||||||
|
$cacheid = md5(serialize(array('com_jckman', $groups, $clientId, $lang)));
|
||||||
|
|
||||||
|
|
||||||
|
if (!($clean = $cache->get($cacheid))) {
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
|
||||||
|
$query = $db->getQuery(true); //new JDatabaseQuery;
|
||||||
|
$query->select('id, title, module, position, content, showtitle, params, mm.menuid');
|
||||||
|
$query->from('#__modules AS m');
|
||||||
|
$query->join('LEFT','#__modules_menu AS mm ON mm.moduleid = m.id');
|
||||||
|
$query->where('m.published = 1');
|
||||||
|
|
||||||
|
$date = JFactory::getDate();
|
||||||
|
$now = $date->toSQL();
|
||||||
|
$nullDate = $db->getNullDate();
|
||||||
|
$query->where('(m.publish_up = '.$db->Quote($nullDate).' OR m.publish_up <= '.$db->Quote($now).')');
|
||||||
|
$query->where('(m.publish_down = '.$db->Quote($nullDate).' OR m.publish_down >= '.$db->Quote($now).')');
|
||||||
|
|
||||||
|
$query->where('m.access IN ('.$groups.')');
|
||||||
|
$query->where('m.client_id = '. $clientId);
|
||||||
|
$query->where('(mm.menuid = '. (int) $Itemid .' OR (mm.menuid <= 0 OR mm.menuid IS NULL))'); //fix as this is suppose to be a LEFT JOIN!!!
|
||||||
|
|
||||||
|
// Filter by language
|
||||||
|
if ($app->isSite() && $app->getLanguageFilter()) {
|
||||||
|
$query->where('m.language IN (' . $db->Quote($lang) . ',' . $db->Quote('*') . ')');
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->order('position, ordering');
|
||||||
|
|
||||||
|
// Set the query
|
||||||
|
$db->setQuery($query);
|
||||||
|
if (!($modules = $db->loadObjectList())) {
|
||||||
|
JCKHelper::error( JText::sprintf('JLIB_APPLICATION_ERROR_MODULE_LOAD', $db->getErrorMsg()) );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply negative selections and eliminate duplicates
|
||||||
|
$negId = $Itemid ? -(int)$Itemid : false;
|
||||||
|
$dupes = array();
|
||||||
|
$clean = array();
|
||||||
|
for ($i = 0, $n = count($modules); $i < $n; $i++)
|
||||||
|
{
|
||||||
|
$module = &$modules[$i];
|
||||||
|
|
||||||
|
// The module is excluded if there is an explicit prohibition, or if
|
||||||
|
// the Itemid is missing or zero and the module is in exclude mode.
|
||||||
|
$negHit = ($negId === (int) $module->menuid)
|
||||||
|
|| (!$negId && (int)$module->menuid < 0);
|
||||||
|
|
||||||
|
if (isset($dupes[$module->id]))
|
||||||
|
{
|
||||||
|
// If this item has been excluded, keep the duplicate flag set,
|
||||||
|
// but remove any item from the cleaned array.
|
||||||
|
if ($negHit) {
|
||||||
|
unset($clean[$module->id]);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$dupes[$module->id] = true;
|
||||||
|
|
||||||
|
// Only accept modules without explicit exclusions.
|
||||||
|
if (!$negHit)
|
||||||
|
{
|
||||||
|
//determine if this is a custom module
|
||||||
|
$file = $module->module;
|
||||||
|
$custom = substr($file, 0, 4) == 'mod_' ? 0 : 1;
|
||||||
|
$module->user = $custom;
|
||||||
|
// Custom module name is given by the title field, otherwise strip off "com_"
|
||||||
|
$module->name = $custom ? $module->title : substr($file, 4);
|
||||||
|
$module->style = null;
|
||||||
|
$module->position = strtolower($module->position);
|
||||||
|
$clean[$module->id] = $module;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($dupes);
|
||||||
|
// Return to simple indexing that matches the query order.
|
||||||
|
$clean = array_values($clean);
|
||||||
|
|
||||||
|
$cache->store($clean, $cacheid);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $clean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jimport( 'joomla.form.form' );
|
||||||
|
class JCKForm extends JForm
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Method to get an instance of a form.
|
||||||
|
*
|
||||||
|
* @param string $name The name of the form.
|
||||||
|
* @param string $data The name of an XML file or string to load as the form definition.
|
||||||
|
* @param array $options An array of form options.
|
||||||
|
* @param string $replace Flag to toggle whether form fields should be replaced if a field
|
||||||
|
* already exists with the same group/name.
|
||||||
|
* @param string $xpath An optional xpath to search for the fields.
|
||||||
|
*
|
||||||
|
* @return object JForm instance.
|
||||||
|
* @throws Exception if an error occurs.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public static function getInstance($name, $data = null, $options = array(), $replace = true, $xpath = false)
|
||||||
|
{
|
||||||
|
// Reference to array with form instances
|
||||||
|
$forms = &self::$forms;
|
||||||
|
|
||||||
|
// Only instantiate the form if it does not already exist.
|
||||||
|
if (!isset($forms[$name]))
|
||||||
|
{
|
||||||
|
$data = trim($data);
|
||||||
|
|
||||||
|
if (empty($data))
|
||||||
|
{
|
||||||
|
throw new InvalidArgumentException(sprintf('JForm::getInstance(name, *%s*)', gettype($data)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Instantiate the form.
|
||||||
|
$forms[$name] = new JCKForm($name, $options);
|
||||||
|
|
||||||
|
// Load the data.
|
||||||
|
if (substr(trim($data), 0, 1) == '<')
|
||||||
|
{
|
||||||
|
if ($forms[$name]->load($data, $replace, $xpath) == false)
|
||||||
|
{
|
||||||
|
throw new RuntimeException('JForm::getInstance could not load form');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($forms[$name]->loadFile($data, $replace, $xpath) == false)
|
||||||
|
{
|
||||||
|
throw new RuntimeException('JForm::getInstance could not load file');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $forms[$name];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get a form field represented as an XML element object.
|
||||||
|
*
|
||||||
|
* @param string $name The name of the form field.
|
||||||
|
* @param string $group The optional dot-separated form group path on which to find the field.
|
||||||
|
*
|
||||||
|
* @return mixed The XML element object for the field or boolean false on error.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function findField($name, $group = null)
|
||||||
|
{
|
||||||
|
$element = false;
|
||||||
|
$fields = array();
|
||||||
|
|
||||||
|
// Make sure there is a valid JForm XML document.
|
||||||
|
if (!($this->xml instanceof SimpleXMLElement))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Let's get the appropriate field element based on the method arguments.
|
||||||
|
if ($group)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Get the fields elements for a given group.
|
||||||
|
$elements = &$this->findGroup($group);
|
||||||
|
|
||||||
|
// Get all of the field elements with the correct name for the fields elements.
|
||||||
|
foreach ($elements as $element)
|
||||||
|
{
|
||||||
|
// If there are matching field elements add them to the fields array.
|
||||||
|
if ($tmp = $element->xpath('descendant::field[@name="' . $name . '"]'))
|
||||||
|
{
|
||||||
|
$fields = array_merge($fields, $tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure something was found.
|
||||||
|
if (!$fields)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use the first correct match in the given group.
|
||||||
|
$groupNames = explode('.', $group);
|
||||||
|
foreach ($fields as &$field)
|
||||||
|
{
|
||||||
|
// Get the group names as strings for ancestor fields elements.
|
||||||
|
$attrs = $field->xpath('ancestor::fields[@name]/@name');
|
||||||
|
$names = array_map('strval', $attrs ? $attrs : array());
|
||||||
|
|
||||||
|
// If the field is in the exact group use it and break out of the loop.
|
||||||
|
if ($names == (array) $groupNames)
|
||||||
|
{
|
||||||
|
$element = &$field;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Get an array of fields with the correct name.
|
||||||
|
$fields = $this->xml->xpath('//field[@name="' . $name . '"]');
|
||||||
|
|
||||||
|
// Make sure something was found.
|
||||||
|
if (!$fields)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search through the fields for the right one.
|
||||||
|
foreach ($fields as &$field)
|
||||||
|
{
|
||||||
|
// -PC- exact copy of JForm findField except their ancestor lookup was blocking the bind for our plugins
|
||||||
|
// If we find an ancestor fields element with a group name then it isn't what we want.
|
||||||
|
if ($field->xpath('ancestor::fields[@name="params"]'))
|
||||||
|
{
|
||||||
|
$element = &$field;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $element;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the value of a field.
|
||||||
|
*
|
||||||
|
* @param string $name The name of the field for which to get the value.
|
||||||
|
* @param string $group The optional dot-separated form group path on which to get the value.
|
||||||
|
* @param mixed $default The optional default value of the field value is empty.
|
||||||
|
*
|
||||||
|
* @return mixed The value of the field or the default value if empty.
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public function getValue($name, $group = null, $default = null)
|
||||||
|
{
|
||||||
|
$return = $this->data->get($name, $default);
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
}//end class JCKForm
|
||||||
|
|
||||||
|
|
||||||
|
class JCKLanguage extends JLanguage
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function getInstance($lang, $debug = false)
|
||||||
|
{
|
||||||
|
if (!isset(self::$languages[$lang . $debug]))
|
||||||
|
{
|
||||||
|
self::$languages[$lang . $debug] = new static($lang, $debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$languages[$lang . $debug];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function merge (Jlanguage $language)
|
||||||
|
{
|
||||||
|
|
||||||
|
$lang = $language->getTag();
|
||||||
|
|
||||||
|
$this->setLanguage($lang);
|
||||||
|
$this->setDebug($language->getDebug());
|
||||||
|
$this->setDefault($language->getDefault());
|
||||||
|
$paths = $language->getPaths();
|
||||||
|
$this->paths = array_merge($this->paths,$paths);
|
||||||
|
foreach($paths as $extension=>$path)
|
||||||
|
{
|
||||||
|
$keys = array_keys($path);
|
||||||
|
$this->loadLanguage($keys[0],$extension); //rebuild strings array
|
||||||
|
}
|
||||||
|
|
||||||
|
$filename = JPATH_BASE . "/language/overrides/$lang.override.ini";
|
||||||
|
|
||||||
|
if (file_exists($filename) && $contents = $this->parse($filename))
|
||||||
|
{
|
||||||
|
if (is_array($contents))
|
||||||
|
{
|
||||||
|
// Sort the underlying heap by key values to optimize merging
|
||||||
|
ksort($contents, SORT_STRING);
|
||||||
|
$this->override = $contents;
|
||||||
|
}
|
||||||
|
unset($contents);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look for a language specific localise class
|
||||||
|
$class = str_replace('-', '_', $lang . 'Localise');
|
||||||
|
$paths = array();
|
||||||
|
|
||||||
|
if (defined('JPATH_ADMINISTRATOR'))
|
||||||
|
{
|
||||||
|
// Note: Manual indexing to enforce load order.
|
||||||
|
$paths[1] = JPATH_ADMINISTRATOR . "/language/overrides/$lang.localise.php";
|
||||||
|
$paths[3] = JPATH_ADMINISTRATOR . "/language/$lang/$lang.localise.php";
|
||||||
|
}
|
||||||
|
|
||||||
|
ksort($paths);
|
||||||
|
$path = reset($paths);
|
||||||
|
|
||||||
|
while (!class_exists($class) && $path)
|
||||||
|
{
|
||||||
|
if (file_exists($path))
|
||||||
|
{
|
||||||
|
require_once $path;
|
||||||
|
}
|
||||||
|
$path = next($paths);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (class_exists($class))
|
||||||
|
{
|
||||||
|
/* Class exists. Try to find
|
||||||
|
* -a transliterate method,
|
||||||
|
* -a getPluralSuffixes method,
|
||||||
|
* -a getIgnoredSearchWords method
|
||||||
|
* -a getLowerLimitSearchWord method
|
||||||
|
* -a getUpperLimitSearchWord method
|
||||||
|
* -a getSearchDisplayCharactersNumber method
|
||||||
|
*/
|
||||||
|
if (method_exists($class, 'transliterate'))
|
||||||
|
{
|
||||||
|
$this->transliterator = array($class, 'transliterate');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (method_exists($class, 'getPluralSuffixes'))
|
||||||
|
{
|
||||||
|
$this->pluralSuffixesCallback = array($class, 'getPluralSuffixes');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (method_exists($class, 'getIgnoredSearchWords'))
|
||||||
|
{
|
||||||
|
$this->ignoredSearchWordsCallback = array($class, 'getIgnoredSearchWords');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (method_exists($class, 'getLowerLimitSearchWord'))
|
||||||
|
{
|
||||||
|
$this->lowerLimitSearchWordCallback = array($class, 'getLowerLimitSearchWord');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (method_exists($class, 'getUpperLimitSearchWord'))
|
||||||
|
{
|
||||||
|
$this->upperLimitSearchWordCallback = array($class, 'getUpperLimitSearchWord');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (method_exists($class, 'getSearchDisplayedCharactersNumber'))
|
||||||
|
{
|
||||||
|
$this->searchDisplayedCharactersNumberCallback = array($class, 'getSearchDisplayedCharactersNumber');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->load();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadFile($filename, $extension)
|
||||||
|
{
|
||||||
|
if(isset($this->paths[$extension][$filename]))
|
||||||
|
return $this->paths[$extension][$filename];
|
||||||
|
|
||||||
|
return $this->loadLanguage($filename, $extension);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,667 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// no direct access
|
||||||
|
defined( '_JEXEC' ) or die();
|
||||||
|
|
||||||
|
class archive
|
||||||
|
{
|
||||||
|
function archive($name)
|
||||||
|
{
|
||||||
|
$this->options = array (
|
||||||
|
'basedir' => ".",
|
||||||
|
'name' => $name,
|
||||||
|
'prepend' => "",
|
||||||
|
'inmemory' => 0,
|
||||||
|
'overwrite' => 0,
|
||||||
|
'recurse' => 1,
|
||||||
|
'storepaths' => 1,
|
||||||
|
'followlinks' => 0,
|
||||||
|
'level' => 3,
|
||||||
|
'method' => 1,
|
||||||
|
'sfx' => "",
|
||||||
|
'type' => "",
|
||||||
|
'comment' => ""
|
||||||
|
);
|
||||||
|
$this->files = array ();
|
||||||
|
$this->exclude = array ();
|
||||||
|
$this->storeonly = array ();
|
||||||
|
$this->error = array ();
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_options($options)
|
||||||
|
{
|
||||||
|
foreach ($options as $key => $value)
|
||||||
|
$this->options[$key] = $value;
|
||||||
|
if (!empty ($this->options['basedir']))
|
||||||
|
{
|
||||||
|
$this->options['basedir'] = str_replace("\\", "/", $this->options['basedir']);
|
||||||
|
$this->options['basedir'] = preg_replace("/\/+/", "/", $this->options['basedir']);
|
||||||
|
$this->options['basedir'] = preg_replace("/\/$/", "", $this->options['basedir']);
|
||||||
|
}
|
||||||
|
if (!empty ($this->options['name']))
|
||||||
|
{
|
||||||
|
$this->options['name'] = str_replace("\\", "/", $this->options['name']);
|
||||||
|
$this->options['name'] = preg_replace("/\/+/", "/", $this->options['name']);
|
||||||
|
}
|
||||||
|
if (!empty ($this->options['prepend']))
|
||||||
|
{
|
||||||
|
$this->options['prepend'] = str_replace("\\", "/", $this->options['prepend']);
|
||||||
|
$this->options['prepend'] = preg_replace("/^(\.*\/+)+/", "", $this->options['prepend']);
|
||||||
|
$this->options['prepend'] = preg_replace("/\/+/", "/", $this->options['prepend']);
|
||||||
|
$this->options['prepend'] = preg_replace("/\/$/", "", $this->options['prepend']) . "/";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function create_archive()
|
||||||
|
{
|
||||||
|
$this->make_list();
|
||||||
|
|
||||||
|
if ($this->options['inmemory'] == 0)
|
||||||
|
{
|
||||||
|
$pwd = getcwd();
|
||||||
|
chdir($this->options['basedir']);
|
||||||
|
if ($this->options['overwrite'] == 0 && file_exists($this->options['name'] . ($this->options['type'] == "gzip" || $this->options['type'] == "bzip" ? ".tmp" : "")))
|
||||||
|
{
|
||||||
|
$this->error[] = "File {$this->options['name']} already exists.";
|
||||||
|
chdir($pwd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if ($this->archive = @fopen($this->options['name'] . ($this->options['type'] == "gzip" || $this->options['type'] == "bzip" ? ".tmp" : ""), "wb+"))
|
||||||
|
chdir($pwd);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error[] = "Could not open {$this->options['name']} for writing.";
|
||||||
|
chdir($pwd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$this->archive = "";
|
||||||
|
|
||||||
|
switch ($this->options['type'])
|
||||||
|
{
|
||||||
|
case "zip":
|
||||||
|
if (!$this->create_zip())
|
||||||
|
{
|
||||||
|
$this->error[] = "Could not create zip file.";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "bzip":
|
||||||
|
if (!$this->create_tar())
|
||||||
|
{
|
||||||
|
$this->error[] = "Could not create tar file.";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (!$this->create_bzip())
|
||||||
|
{
|
||||||
|
$this->error[] = "Could not create bzip2 file.";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "gzip":
|
||||||
|
if (!$this->create_tar())
|
||||||
|
{
|
||||||
|
$this->error[] = "Could not create tar file.";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (!$this->create_gzip())
|
||||||
|
{
|
||||||
|
$this->error[] = "Could not create gzip file.";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "tar":
|
||||||
|
if (!$this->create_tar())
|
||||||
|
{
|
||||||
|
$this->error[] = "Could not create tar file.";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->options['inmemory'] == 0)
|
||||||
|
{
|
||||||
|
fclose($this->archive);
|
||||||
|
if ($this->options['type'] == "gzip" || $this->options['type'] == "bzip")
|
||||||
|
unlink($this->options['basedir'] . "/" . $this->options['name'] . ".tmp");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_data($data)
|
||||||
|
{
|
||||||
|
if ($this->options['inmemory'] == 0)
|
||||||
|
fwrite($this->archive, $data);
|
||||||
|
else
|
||||||
|
$this->archive .= $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function make_list()
|
||||||
|
{
|
||||||
|
if (!empty ($this->exclude))
|
||||||
|
foreach ($this->files as $key => $value)
|
||||||
|
foreach ($this->exclude as $current)
|
||||||
|
if ($value['name'] == $current['name'])
|
||||||
|
unset ($this->files[$key]);
|
||||||
|
if (!empty ($this->storeonly))
|
||||||
|
foreach ($this->files as $key => $value)
|
||||||
|
foreach ($this->storeonly as $current)
|
||||||
|
if ($value['name'] == $current['name'])
|
||||||
|
$this->files[$key]['method'] = 0;
|
||||||
|
unset ($this->exclude, $this->storeonly);
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_files($list)
|
||||||
|
{
|
||||||
|
$temp = $this->list_files($list);
|
||||||
|
foreach ($temp as $current)
|
||||||
|
$this->files[] = $current;
|
||||||
|
}
|
||||||
|
|
||||||
|
function exclude_files($list)
|
||||||
|
{
|
||||||
|
$temp = $this->list_files($list);
|
||||||
|
foreach ($temp as $current)
|
||||||
|
$this->exclude[] = $current;
|
||||||
|
}
|
||||||
|
|
||||||
|
function store_files($list)
|
||||||
|
{
|
||||||
|
$temp = $this->list_files($list);
|
||||||
|
foreach ($temp as $current)
|
||||||
|
$this->storeonly[] = $current;
|
||||||
|
}
|
||||||
|
|
||||||
|
function list_files($list)
|
||||||
|
{
|
||||||
|
if (!is_array ($list))
|
||||||
|
{
|
||||||
|
$temp = $list;
|
||||||
|
$list = array ($temp);
|
||||||
|
unset ($temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
$files = array ();
|
||||||
|
|
||||||
|
$pwd = getcwd();
|
||||||
|
chdir($this->options['basedir']);
|
||||||
|
|
||||||
|
foreach ($list as $current)
|
||||||
|
{
|
||||||
|
$current = str_replace("\\", "/", $current);
|
||||||
|
$current = preg_replace("/\/+/", "/", $current);
|
||||||
|
$current = preg_replace("/\/$/", "", $current);
|
||||||
|
if (strstr($current, "*"))
|
||||||
|
{
|
||||||
|
$regex = preg_replace("/([\\\^\$\.\[\]\|\(\)\?\+\{\}\/])/", "\\\\\\1", $current);
|
||||||
|
$regex = str_replace("*", ".*", $regex);
|
||||||
|
$dir = strstr($current, "/") ? substr($current, 0, strrpos($current, "/")) : ".";
|
||||||
|
$temp = $this->parse_dir($dir);
|
||||||
|
foreach ($temp as $current2)
|
||||||
|
if (preg_match("/^{$regex}$/i", $current2['name']))
|
||||||
|
$files[] = $current2;
|
||||||
|
unset ($regex, $dir, $temp, $current);
|
||||||
|
}
|
||||||
|
else if (@is_dir($current))
|
||||||
|
{
|
||||||
|
$temp = $this->parse_dir($current);
|
||||||
|
foreach ($temp as $file)
|
||||||
|
$files[] = $file;
|
||||||
|
unset ($temp, $file);
|
||||||
|
}
|
||||||
|
else if (@file_exists($current))
|
||||||
|
$files[] = array ('name' => $current, 'name2' => $this->options['prepend'] .
|
||||||
|
preg_replace("/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr($current, "/")) ?
|
||||||
|
substr($current, strrpos($current, "/") + 1) : $current),
|
||||||
|
'type' => @is_link($current) && $this->options['followlinks'] == 0 ? 2 : 0,
|
||||||
|
'ext' => substr($current, strrpos($current, ".")), 'stat' => stat($current));
|
||||||
|
}
|
||||||
|
|
||||||
|
chdir($pwd);
|
||||||
|
|
||||||
|
unset ($current, $pwd);
|
||||||
|
|
||||||
|
usort($files, array ("archive", "sort_files"));
|
||||||
|
|
||||||
|
return $files;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parse_dir($dirname)
|
||||||
|
{
|
||||||
|
if ($this->options['storepaths'] == 1 && !preg_match("/^(\.+\/*)+$/", $dirname))
|
||||||
|
$files = array (array ('name' => $dirname, 'name2' => $this->options['prepend'] .
|
||||||
|
preg_replace("/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr($dirname, "/")) ?
|
||||||
|
substr($dirname, strrpos($dirname, "/") + 1) : $dirname), 'type' => 5, 'stat' => stat($dirname)));
|
||||||
|
else
|
||||||
|
$files = array ();
|
||||||
|
$dir = @opendir($dirname);
|
||||||
|
|
||||||
|
while ($file = @readdir($dir))
|
||||||
|
{
|
||||||
|
$fullname = $dirname . "/" . $file;
|
||||||
|
if ($file == "." || $file == "..")
|
||||||
|
continue;
|
||||||
|
else if (@is_dir($fullname))
|
||||||
|
{
|
||||||
|
if (empty ($this->options['recurse']))
|
||||||
|
continue;
|
||||||
|
$temp = $this->parse_dir($fullname);
|
||||||
|
foreach ($temp as $file2)
|
||||||
|
$files[] = $file2;
|
||||||
|
}
|
||||||
|
else if (@file_exists($fullname))
|
||||||
|
$files[] = array ('name' => $fullname, 'name2' => $this->options['prepend'] .
|
||||||
|
preg_replace("/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr($fullname, "/")) ?
|
||||||
|
substr($fullname, strrpos($fullname, "/") + 1) : $fullname),
|
||||||
|
'type' => @is_link($fullname) && $this->options['followlinks'] == 0 ? 2 : 0,
|
||||||
|
'ext' => substr($file, strrpos($file, ".")), 'stat' => stat($fullname));
|
||||||
|
}
|
||||||
|
|
||||||
|
@closedir($dir);
|
||||||
|
|
||||||
|
return $files;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sort_files($a, $b)
|
||||||
|
{
|
||||||
|
if ($a['type'] != $b['type'])
|
||||||
|
if ($a['type'] == 5 || $b['type'] == 2)
|
||||||
|
return -1;
|
||||||
|
else if ($a['type'] == 2 || $b['type'] == 5)
|
||||||
|
return 1;
|
||||||
|
else if ($a['type'] == 5)
|
||||||
|
return strcmp(strtolower($a['name']), strtolower($b['name']));
|
||||||
|
else if ($a['ext'] != $b['ext'])
|
||||||
|
return strcmp($a['ext'], $b['ext']);
|
||||||
|
else if ($a['stat'][7] != $b['stat'][7])
|
||||||
|
return $a['stat'][7] > $b['stat'][7] ? -1 : 1;
|
||||||
|
else
|
||||||
|
return strcmp(strtolower($a['name']), strtolower($b['name']));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function download_file()
|
||||||
|
{
|
||||||
|
if ($this->options['inmemory'] == 0)
|
||||||
|
{
|
||||||
|
$this->error[] = "Can only use download_file() if archive is in memory. Redirect to file otherwise, it is faster.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch ($this->options['type'])
|
||||||
|
{
|
||||||
|
case "zip":
|
||||||
|
header("Content-Type: application/zip");
|
||||||
|
break;
|
||||||
|
case "bzip":
|
||||||
|
header("Content-Type: application/x-bzip2");
|
||||||
|
break;
|
||||||
|
case "gzip":
|
||||||
|
header("Content-Type: application/x-gzip");
|
||||||
|
break;
|
||||||
|
case "tar":
|
||||||
|
header("Content-Type: application/x-tar");
|
||||||
|
}
|
||||||
|
$header = "Content-Disposition: attachment; filename=\"";
|
||||||
|
$header .= strstr($this->options['name'], "/") ? substr($this->options['name'], strrpos($this->options['name'], "/") + 1) : $this->options['name'];
|
||||||
|
$header .= "\"";
|
||||||
|
header($header);
|
||||||
|
header("Content-Length: " . strlen($this->archive));
|
||||||
|
header("Content-Transfer-Encoding: binary");
|
||||||
|
header("Cache-Control: no-cache, must-revalidate, max-age=60");
|
||||||
|
header("Expires: Sat, 01 Jan 2000 12:00:00 GMT");
|
||||||
|
print($this->archive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class tar_file extends archive
|
||||||
|
{
|
||||||
|
function tar_file($name)
|
||||||
|
{
|
||||||
|
$this->archive($name);
|
||||||
|
$this->options['type'] = "tar";
|
||||||
|
}
|
||||||
|
|
||||||
|
function create_tar()
|
||||||
|
{
|
||||||
|
$pwd = getcwd();
|
||||||
|
chdir($this->options['basedir']);
|
||||||
|
|
||||||
|
foreach ($this->files as $current)
|
||||||
|
{
|
||||||
|
if ($current['name'] == $this->options['name'])
|
||||||
|
continue;
|
||||||
|
if (strlen($current['name2']) > 99)
|
||||||
|
{
|
||||||
|
$path = substr($current['name2'], 0, strpos($current['name2'], "/", strlen($current['name2']) - 100) + 1);
|
||||||
|
$current['name2'] = substr($current['name2'], strlen($path));
|
||||||
|
if (strlen($path) > 154 || strlen($current['name2']) > 99)
|
||||||
|
{
|
||||||
|
$this->error[] = "Could not add {$path}{$current['name2']} to archive because the filename is too long.";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$block = pack("a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155a12", $current['name2'], sprintf("%07o",
|
||||||
|
$current['stat'][2]), sprintf("%07o", $current['stat'][4]), sprintf("%07o", $current['stat'][5]),
|
||||||
|
sprintf("%011o", $current['type'] == 2 ? 0 : $current['stat'][7]), sprintf("%011o", $current['stat'][9]),
|
||||||
|
" ", $current['type'], $current['type'] == 2 ? @readlink($current['name']) : "", "ustar ", " ",
|
||||||
|
"Unknown", "Unknown", "", "", !empty ($path) ? $path : "", "");
|
||||||
|
|
||||||
|
$checksum = 0;
|
||||||
|
for ($i = 0; $i < 512; $i++)
|
||||||
|
$checksum += ord(substr($block, $i, 1));
|
||||||
|
$checksum = pack("a8", sprintf("%07o", $checksum));
|
||||||
|
$block = substr_replace($block, $checksum, 148, 8);
|
||||||
|
|
||||||
|
if ($current['type'] == 2 || $current['stat'][7] == 0)
|
||||||
|
$this->add_data($block);
|
||||||
|
else if ($fp = @fopen($current['name'], "rb"))
|
||||||
|
{
|
||||||
|
$this->add_data($block);
|
||||||
|
while ($temp = fread($fp, 1048576))
|
||||||
|
$this->add_data($temp);
|
||||||
|
if ($current['stat'][7] % 512 > 0)
|
||||||
|
{
|
||||||
|
$temp = "";
|
||||||
|
for ($i = 0; $i < 512 - $current['stat'][7] % 512; $i++)
|
||||||
|
$temp .= "\0";
|
||||||
|
$this->add_data($temp);
|
||||||
|
}
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$this->error[] = "Could not open file {$current['name']} for reading. It was not added.";
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->add_data(pack("a1024", ""));
|
||||||
|
|
||||||
|
chdir($pwd);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function extract_files()
|
||||||
|
{
|
||||||
|
$pwd = getcwd();
|
||||||
|
chdir($this->options['basedir']);
|
||||||
|
|
||||||
|
if ($fp = $this->open_archive())
|
||||||
|
{
|
||||||
|
if ($this->options['inmemory'] == 1)
|
||||||
|
$this->files = array ();
|
||||||
|
|
||||||
|
while ($block = fread($fp, 512))
|
||||||
|
{
|
||||||
|
$temp = unpack("a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100symlink/a6magic/a2temp/a32temp/a32temp/a8temp/a8temp/a155prefix/a12temp", $block);
|
||||||
|
$file = array (
|
||||||
|
'name' => $temp['prefix'] . $temp['name'],
|
||||||
|
'stat' => array (
|
||||||
|
2 => $temp['mode'],
|
||||||
|
4 => octdec($temp['uid']),
|
||||||
|
5 => octdec($temp['gid']),
|
||||||
|
7 => octdec($temp['size']),
|
||||||
|
9 => octdec($temp['mtime']),
|
||||||
|
),
|
||||||
|
'checksum' => octdec($temp['checksum']),
|
||||||
|
'type' => $temp['type'],
|
||||||
|
'magic' => $temp['magic'],
|
||||||
|
);
|
||||||
|
if ($file['checksum'] == 0x00000000)
|
||||||
|
break;
|
||||||
|
else if (substr($file['magic'], 0, 5) != "ustar")
|
||||||
|
{
|
||||||
|
$this->error[] = "This script does not support extracting this type of tar file.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$block = substr_replace($block, " ", 148, 8);
|
||||||
|
$checksum = 0;
|
||||||
|
for ($i = 0; $i < 512; $i++)
|
||||||
|
$checksum += ord(substr($block, $i, 1));
|
||||||
|
if ($file['checksum'] != $checksum)
|
||||||
|
$this->error[] = "Could not extract from {$this->options['name']}, it is corrupt.";
|
||||||
|
|
||||||
|
if ($this->options['inmemory'] == 1)
|
||||||
|
{
|
||||||
|
$file['data'] = fread($fp, $file['stat'][7]);
|
||||||
|
fread($fp, (512 - $file['stat'][7] % 512) == 512 ? 0 : (512 - $file['stat'][7] % 512));
|
||||||
|
unset ($file['checksum'], $file['magic']);
|
||||||
|
$this->files[] = $file;
|
||||||
|
}
|
||||||
|
else if ($file['type'] == 5)
|
||||||
|
{
|
||||||
|
if (!is_dir($file['name']))
|
||||||
|
mkdir($file['name'], $file['stat'][2]);
|
||||||
|
}
|
||||||
|
else if ($this->options['overwrite'] == 0 && file_exists($file['name']))
|
||||||
|
{
|
||||||
|
$this->error[] = "{$file['name']} already exists.";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if ($file['type'] == 2)
|
||||||
|
{
|
||||||
|
symlink($temp['symlink'], $file['name']);
|
||||||
|
chmod($file['name'], $file['stat'][2]);
|
||||||
|
}
|
||||||
|
else if ($new = @fopen($file['name'], "wb"))
|
||||||
|
{
|
||||||
|
fwrite($new, fread($fp, $file['stat'][7]));
|
||||||
|
fread($fp, (512 - $file['stat'][7] % 512) == 512 ? 0 : (512 - $file['stat'][7] % 512));
|
||||||
|
fclose($new);
|
||||||
|
chmod($file['name'], $file['stat'][2]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error[] = "Could not open {$file['name']} for writing.";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
chown($file['name'], $file['stat'][4]);
|
||||||
|
chgrp($file['name'], $file['stat'][5]);
|
||||||
|
touch($file['name'], $file['stat'][9]);
|
||||||
|
unset ($file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$this->error[] = "Could not open file {$this->options['name']}";
|
||||||
|
|
||||||
|
chdir($pwd);
|
||||||
|
}
|
||||||
|
|
||||||
|
function open_archive()
|
||||||
|
{
|
||||||
|
return @fopen($this->options['name'], "rb");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class gzip_file extends tar_file
|
||||||
|
{
|
||||||
|
function gzip_file($name)
|
||||||
|
{
|
||||||
|
$this->tar_file($name);
|
||||||
|
$this->options['type'] = "gzip";
|
||||||
|
}
|
||||||
|
|
||||||
|
function create_gzip()
|
||||||
|
{
|
||||||
|
if ($this->options['inmemory'] == 0)
|
||||||
|
{
|
||||||
|
$pwd = getcwd();
|
||||||
|
chdir($this->options['basedir']);
|
||||||
|
if ($fp = gzopen($this->options['name'], "wb{$this->options['level']}"))
|
||||||
|
{
|
||||||
|
fseek($this->archive, 0);
|
||||||
|
while ($temp = fread($this->archive, 1048576))
|
||||||
|
gzwrite($fp, $temp);
|
||||||
|
gzclose($fp);
|
||||||
|
chdir($pwd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error[] = "Could not open {$this->options['name']} for writing.";
|
||||||
|
chdir($pwd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$this->archive = gzencode($this->archive, $this->options['level']);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function open_archive()
|
||||||
|
{
|
||||||
|
return @gzopen($this->options['name'], "rb");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class bzip_file extends tar_file
|
||||||
|
{
|
||||||
|
function bzip_file($name)
|
||||||
|
{
|
||||||
|
$this->tar_file($name);
|
||||||
|
$this->options['type'] = "bzip";
|
||||||
|
}
|
||||||
|
|
||||||
|
function create_bzip()
|
||||||
|
{
|
||||||
|
if ($this->options['inmemory'] == 0)
|
||||||
|
{
|
||||||
|
$pwd = getcwd();
|
||||||
|
chdir($this->options['basedir']);
|
||||||
|
if ($fp = bzopen($this->options['name'], "wb"))
|
||||||
|
{
|
||||||
|
fseek($this->archive, 0);
|
||||||
|
while ($temp = fread($this->archive, 1048576))
|
||||||
|
bzwrite($fp, $temp);
|
||||||
|
bzclose($fp);
|
||||||
|
chdir($pwd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error[] = "Could not open {$this->options['name']} for writing.";
|
||||||
|
chdir($pwd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$this->archive = bzcompress($this->archive, $this->options['level']);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function open_archive()
|
||||||
|
{
|
||||||
|
return @bzopen($this->options['name'], "rb");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class zip_file extends archive
|
||||||
|
{
|
||||||
|
function zip_file($name)
|
||||||
|
{
|
||||||
|
$this->archive($name);
|
||||||
|
$this->options['type'] = "zip";
|
||||||
|
}
|
||||||
|
|
||||||
|
function create_zip()
|
||||||
|
{
|
||||||
|
$files = 0;
|
||||||
|
$offset = 0;
|
||||||
|
$central = "";
|
||||||
|
|
||||||
|
if (!empty ($this->options['sfx']))
|
||||||
|
if ($fp = @fopen($this->options['sfx'], "rb"))
|
||||||
|
{
|
||||||
|
$temp = fread($fp, filesize($this->options['sfx']));
|
||||||
|
fclose($fp);
|
||||||
|
$this->add_data($temp);
|
||||||
|
$offset += strlen($temp);
|
||||||
|
unset ($temp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$this->error[] = "Could not open sfx module from {$this->options['sfx']}.";
|
||||||
|
|
||||||
|
$pwd = getcwd();
|
||||||
|
chdir($this->options['basedir']);
|
||||||
|
|
||||||
|
foreach ($this->files as $current)
|
||||||
|
{
|
||||||
|
if ($current['name'] == $this->options['name'])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$timedate = explode(" ", date("Y n j G i s", $current['stat'][9]));
|
||||||
|
$timedate = ($timedate[0] - 1980 << 25) | ($timedate[1] << 21) | ($timedate[2] << 16) |
|
||||||
|
($timedate[3] << 11) | ($timedate[4] << 5) | ($timedate[5]);
|
||||||
|
|
||||||
|
$block = pack("VvvvV", 0x04034b50, 0x000A, 0x0000, (isset($current['method']) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate);
|
||||||
|
|
||||||
|
if ($current['stat'][7] == 0 && $current['type'] == 5)
|
||||||
|
{
|
||||||
|
$block .= pack("VVVvv", 0x00000000, 0x00000000, 0x00000000, strlen($current['name2']) + 1, 0x0000);
|
||||||
|
$block .= $current['name2'] . "/";
|
||||||
|
$this->add_data($block);
|
||||||
|
$central .= pack("VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000,
|
||||||
|
(isset($current['method']) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate,
|
||||||
|
0x00000000, 0x00000000, 0x00000000, strlen($current['name2']) + 1, 0x0000, 0x0000, 0x0000, 0x0000, $current['type'] == 5 ? 0x00000010 : 0x00000000, $offset);
|
||||||
|
$central .= $current['name2'] . "/";
|
||||||
|
$files++;
|
||||||
|
$offset += (31 + strlen($current['name2']));
|
||||||
|
}
|
||||||
|
else if ($current['stat'][7] == 0)
|
||||||
|
{
|
||||||
|
$block .= pack("VVVvv", 0x00000000, 0x00000000, 0x00000000, strlen($current['name2']), 0x0000);
|
||||||
|
$block .= $current['name2'];
|
||||||
|
$this->add_data($block);
|
||||||
|
$central .= pack("VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000,
|
||||||
|
(isset($current['method']) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate,
|
||||||
|
0x00000000, 0x00000000, 0x00000000, strlen($current['name2']), 0x0000, 0x0000, 0x0000, 0x0000, $current['type'] == 5 ? 0x00000010 : 0x00000000, $offset);
|
||||||
|
$central .= $current['name2'];
|
||||||
|
$files++;
|
||||||
|
$offset += (30 + strlen($current['name2']));
|
||||||
|
}
|
||||||
|
else if ($fp = @fopen($current['name'], "rb"))
|
||||||
|
{
|
||||||
|
$temp = fread($fp, $current['stat'][7]);
|
||||||
|
fclose($fp);
|
||||||
|
$crc32 = crc32($temp);
|
||||||
|
if (!isset($current['method']) && $this->options['method'] == 1)
|
||||||
|
{
|
||||||
|
$temp = gzcompress($temp, $this->options['level']);
|
||||||
|
$size = strlen($temp) - 6;
|
||||||
|
$temp = substr($temp, 2, $size);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$size = strlen($temp);
|
||||||
|
$block .= pack("VVVvv", $crc32, $size, $current['stat'][7], strlen($current['name2']), 0x0000);
|
||||||
|
$block .= $current['name2'];
|
||||||
|
$this->add_data($block);
|
||||||
|
$this->add_data($temp);
|
||||||
|
unset ($temp);
|
||||||
|
$central .= pack("VvvvvVVVVvvvvvVV", 0x02014b50, 0x0014, $this->options['method'] == 0 ? 0x0000 : 0x000A, 0x0000,
|
||||||
|
(isset($current['method']) || $this->options['method'] == 0) ? 0x0000 : 0x0008, $timedate,
|
||||||
|
$crc32, $size, $current['stat'][7], strlen($current['name2']), 0x0000, 0x0000, 0x0000, 0x0000, 0x00000000, $offset);
|
||||||
|
$central .= $current['name2'];
|
||||||
|
$files++;
|
||||||
|
$offset += (30 + strlen($current['name2']) + $size);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$this->error[] = "Could not open file {$current['name']} for reading. It was not added.";
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->add_data($central);
|
||||||
|
|
||||||
|
$this->add_data(pack("VvvvvVVv", 0x06054b50, 0x0000, 0x0000, $files, $files, strlen($central), $offset,
|
||||||
|
!empty ($this->options['comment']) ? strlen($this->options['comment']) : 0x0000));
|
||||||
|
|
||||||
|
if (!empty ($this->options['comment']))
|
||||||
|
$this->add_data($this->options['comment']);
|
||||||
|
|
||||||
|
chdir($pwd);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
} ?>
|
||||||
@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
|
||||||
|
class ArchiveFactory
|
||||||
|
{
|
||||||
|
|
||||||
|
private $phar = null;
|
||||||
|
private $baseDir = '';
|
||||||
|
private $name = '';
|
||||||
|
private $archive = null;
|
||||||
|
|
||||||
|
public function __construct($baseDir,$name)
|
||||||
|
{
|
||||||
|
$this->baseDir = $baseDir;
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function build()
|
||||||
|
{
|
||||||
|
if(class_exists('PharData'))
|
||||||
|
$this->pharBuild();
|
||||||
|
else
|
||||||
|
$this->zipBuild();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function pharBuild()
|
||||||
|
{
|
||||||
|
$this->type = $type = 'tar.gz';
|
||||||
|
$this->phar = new PharData($this->name.'.tar');
|
||||||
|
$this->phar->buildFromDirectory($this->baseDir);
|
||||||
|
$this->phar->convertToData(Phar::TAR,Phar::GZ,'.'.$this->type);
|
||||||
|
unset( $this->phar ); // remove any references to this file!
|
||||||
|
unlink($this->name .'.tar');
|
||||||
|
$this->archive = file_get_contents($this->name.'.'.$this->type);
|
||||||
|
unlink($this->name. '.'.$this->type);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function zipBuild()
|
||||||
|
{
|
||||||
|
$this->type = $type = 'zip';
|
||||||
|
|
||||||
|
$zip = new ZipArchive();
|
||||||
|
// open archive
|
||||||
|
|
||||||
|
$name = $this->name.'.zip';
|
||||||
|
if ($zip->open($name, ZIPARCHIVE::CREATE) !== TRUE)
|
||||||
|
throw new Exception ("Could not open archive");
|
||||||
|
|
||||||
|
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->baseDir,FilesystemIterator::SKIP_DOTS));
|
||||||
|
|
||||||
|
foreach ($iterator as $key=>$value)
|
||||||
|
{
|
||||||
|
$filterKey = str_replace($this->baseDir.'/','',$key);
|
||||||
|
|
||||||
|
if(!$zip->addFile(realpath($key),$filterKey))
|
||||||
|
throw new Exception('ERROR: Could not add file: '.$filterKey);
|
||||||
|
}
|
||||||
|
$zip->close();
|
||||||
|
$this->archive = file_get_contents($name);
|
||||||
|
unlink($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function downloadFile()
|
||||||
|
{
|
||||||
|
$this->build();
|
||||||
|
|
||||||
|
switch ($this->type)
|
||||||
|
{
|
||||||
|
case "tar.gz":
|
||||||
|
case "tgz":
|
||||||
|
header("Content-Type: application/x-gzip");
|
||||||
|
break;
|
||||||
|
case "bzip":
|
||||||
|
header("Content-Type: application/x-bzip2");
|
||||||
|
break;
|
||||||
|
case "zip":
|
||||||
|
header("Content-Type: application/zip");
|
||||||
|
break;
|
||||||
|
case "tar":
|
||||||
|
header("Content-Type: application/x-tar");
|
||||||
|
}
|
||||||
|
$name = $this->name. '.'. $this->type;
|
||||||
|
|
||||||
|
$header = "Content-Disposition: attachment; filename=\"";
|
||||||
|
$header .= $name;
|
||||||
|
$header .= "\"";
|
||||||
|
header($header);
|
||||||
|
header("Content-Length: " . strlen($this->archive));
|
||||||
|
header("Content-Transfer-Encoding: binary");
|
||||||
|
header("Cache-Control: no-cache, must-revalidate, max-age=60");
|
||||||
|
header("Expires: Sat, 01 Jan 2000 12:00:00 GMT");
|
||||||
|
echo $this->archive;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<html><body bgcolor="#FFFFFF"></body></html>
|
||||||
@ -0,0 +1,211 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_BASE') or die();
|
||||||
|
|
||||||
|
jimport('joomla.installer.installer');
|
||||||
|
|
||||||
|
class JCKInstaller extends JInstaller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns a reference to the global Installer object, only creating it
|
||||||
|
* if it doesn't already exist.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @return object An installer object
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
public static function &getInstance()
|
||||||
|
{
|
||||||
|
static $instance;
|
||||||
|
|
||||||
|
if (!isset ($instance)) {
|
||||||
|
$instance = new JCKInstaller();
|
||||||
|
}
|
||||||
|
return $instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an installer adapter by name
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param string $name Adapter name
|
||||||
|
* @param object $adapter Installer adapter object
|
||||||
|
* @return boolean True if successful
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
public function setAdapter($name, &$adapter = null,$options = Array())
|
||||||
|
{
|
||||||
|
// Check if valid extension type
|
||||||
|
if( $name == 'plugin' || $name == 'language' || $name == 'skin'){
|
||||||
|
if (!is_object($adapter))
|
||||||
|
{
|
||||||
|
// Try to load the adapter object
|
||||||
|
require_once(dirname(__FILE__).DS. '..'.DS.'adapters'.DS.strtolower($name).'.php');
|
||||||
|
$class = 'JCKInstaller'.ucfirst($name);
|
||||||
|
if (!class_exists($class)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$adapter = new $class($this);
|
||||||
|
$adapter->parent =& $this;
|
||||||
|
}
|
||||||
|
$this->_adapters[$name] = $adapter;
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
$this->abort(JText::_('Incorrect version!'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadAdapter($adapter, $options = array())
|
||||||
|
{
|
||||||
|
$class = 'JCKInstaller' . ucfirst($adapter);
|
||||||
|
|
||||||
|
if( !($adapter == 'plugin' || $adapter == 'language'))
|
||||||
|
{
|
||||||
|
throw new InvalidArgumentException(sprintf('The %s install adapter does not exist.', $adapter));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!class_exists($class))
|
||||||
|
{
|
||||||
|
// @deprecated 4.0 - The adapter should be autoloaded or manually included by the caller
|
||||||
|
$path = dirname(__FILE__) . '/../adapters/' . $adapter . '.php';
|
||||||
|
|
||||||
|
// Try to load the adapter object
|
||||||
|
if (!file_exists($path))
|
||||||
|
{
|
||||||
|
throw new InvalidArgumentException(sprintf('The %s install adapter does not exist.', $adapter));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try once more to find the class
|
||||||
|
require_once $path;
|
||||||
|
|
||||||
|
if (!class_exists($class))
|
||||||
|
{
|
||||||
|
throw new InvalidArgumentException(sprintf('The %s install adapter does not exist.', $adapter));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure the adapter type is part of the options array
|
||||||
|
$options['type'] = $adapter;
|
||||||
|
|
||||||
|
return new $class($this, $this->getDBO(), $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the XML file a valid Joomla installation manifest file.
|
||||||
|
*
|
||||||
|
* @param string $file An xmlfile path to check
|
||||||
|
*
|
||||||
|
* @return mixed A JXMLElement, or null if the file failed to parse
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function isManifest($file)
|
||||||
|
{
|
||||||
|
// Initialise variables.
|
||||||
|
$xml = JFactory::getXML($file);
|
||||||
|
|
||||||
|
// If we cannot load the XML file return null
|
||||||
|
if (!$xml)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for a valid XML root tag.
|
||||||
|
// @todo: Remove backwards compatibility in a future version
|
||||||
|
// Should be 'extension', but for backward compatibility we will accept 'extension' or 'install'.
|
||||||
|
|
||||||
|
// 1.5 uses 'install'
|
||||||
|
// 1.6 uses 'extension'
|
||||||
|
if ($xml->getName() != 'install' && $xml->getName() != 'extension')
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Valid manifest file return the object
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to find the package manifest file
|
||||||
|
*
|
||||||
|
* @return boolean True on success, False on error
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function findManifest()
|
||||||
|
{
|
||||||
|
// Get an array of all the XML files from the installation directory
|
||||||
|
$xmlfiles = JFolder::files($this->getPath('source'), '.xml$', 1, true);
|
||||||
|
|
||||||
|
// If at least one XML file exists
|
||||||
|
if (!empty($xmlfiles))
|
||||||
|
{
|
||||||
|
|
||||||
|
foreach ($xmlfiles as $file)
|
||||||
|
{
|
||||||
|
// Is it a valid Joomla installation manifest file?
|
||||||
|
$manifest = $this->isManifest($file);
|
||||||
|
|
||||||
|
if (!is_null($manifest))
|
||||||
|
{
|
||||||
|
// If the root method attribute is set to upgrade, allow file overwrite
|
||||||
|
if ((string) $manifest->attributes()->method == 'upgrade')
|
||||||
|
{
|
||||||
|
$this->upgrade = true;
|
||||||
|
$this->overwrite = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the overwrite option is set, allow file overwriting
|
||||||
|
if ((string) $manifest->attributes()->overwrite == 'true')
|
||||||
|
{
|
||||||
|
$this->overwrite = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the manifest object and path
|
||||||
|
$this->manifest = $manifest;
|
||||||
|
$this->setPath('manifest', $file);
|
||||||
|
|
||||||
|
// Set the installation source path to that of the manifest file
|
||||||
|
$this->setPath('source', dirname($file));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// None of the XML files found were valid install files
|
||||||
|
JCKHelper::error(JText::_('JLIB_INSTALLER_ERROR_NOTFINDJOOMLAXMLSETUPFILE'));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No XML files were found in the install folder
|
||||||
|
JCKHelper::error(JText::_('JLIB_INSTALLER_ERROR_NOTFINDXMLSETUPFILE'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//dummy class that does nothing
|
||||||
|
class InstallerHelper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Configure the Linkbar.
|
||||||
|
*
|
||||||
|
* @param string The name of the active view.
|
||||||
|
*/
|
||||||
|
public static function addSubmenu($vName = 'install')
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,134 @@
|
|||||||
|
<?php
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2005-2012 WebxSolution Ltd. All Rights Reserved.
|
||||||
|
# @license - GPLv2.0
|
||||||
|
# Author: WebxSolution Ltd
|
||||||
|
# Websites: http://www.webxsolution.com
|
||||||
|
# Terms of Use: An extension that is derived from the JoomlaCK editor will only be allowed under the following conditions: http://joomlackeditor.com/terms-of-use
|
||||||
|
# ------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_BASE') or die();
|
||||||
|
|
||||||
|
jimport('joomla.installer.installer');
|
||||||
|
|
||||||
|
class JCKRestorer extends JInstaller
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a reference to the global Installer object, only creating it
|
||||||
|
* if it doesn't already exist.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @return object An installer object
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
public static function &getInstance()
|
||||||
|
{
|
||||||
|
static $instance;
|
||||||
|
|
||||||
|
if (!isset ($instance)) {
|
||||||
|
$instance = new JCKRestorer();
|
||||||
|
}
|
||||||
|
return $instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an installer adapter by name
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param string $name Adapter name
|
||||||
|
* @param object $adapter Installer adapter object
|
||||||
|
* @return boolean True if successful
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
public function setAdapter($name, &$adapter = null,$options = array())
|
||||||
|
{
|
||||||
|
// Check if valid extension type
|
||||||
|
if( $name == 'plugin' || $name == 'language' || $name == 'skin' || $name== 'backup'){
|
||||||
|
if (!is_object($adapter))
|
||||||
|
{
|
||||||
|
// Try to load the adapter object
|
||||||
|
require_once(dirname(__FILE__).DS. '..'.DS.'restorers'.DS.strtolower($name).'.php');
|
||||||
|
$class = 'JCKRestorer'.ucfirst($name);
|
||||||
|
if (!class_exists($class)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$adapter = new $class($this);
|
||||||
|
$adapter->parent =& $this;
|
||||||
|
}
|
||||||
|
$this->_adapters[$name] = $adapter;
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
$this->abort(JText::_('Incorrect version!'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadAdapter($adapter, $options = array())
|
||||||
|
{
|
||||||
|
$class = 'JCKRestorer' . ucfirst($adapter);
|
||||||
|
|
||||||
|
if( !($adapter == 'plugin' || $adapter == 'backup'))
|
||||||
|
{
|
||||||
|
throw new InvalidArgumentException(sprintf('The %s install adapter does not exist.', $adapter));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (!class_exists($class))
|
||||||
|
{
|
||||||
|
// @deprecated 4.0 - The adapter should be autoloaded or manually included by the caller
|
||||||
|
$path = dirname(__FILE__) . '/../restorers/' . $adapter . '.php';
|
||||||
|
|
||||||
|
// Try to load the adapter object
|
||||||
|
if (!file_exists($path))
|
||||||
|
{
|
||||||
|
throw new InvalidArgumentException(sprintf('The %s install adapter does not exist.', $adapter));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try once more to find the class
|
||||||
|
require_once $path;
|
||||||
|
|
||||||
|
if (!class_exists($class))
|
||||||
|
{
|
||||||
|
throw new InvalidArgumentException(sprintf('The %s install adapter does not exist.', $adapter));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure the adapter type is part of the options array
|
||||||
|
$options['type'] = $adapter;
|
||||||
|
|
||||||
|
return new $class($this, $this->getDBO(), $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the XML file a valid Joomla installation manifest file.
|
||||||
|
*
|
||||||
|
* @param string $file An xmlfile path to check
|
||||||
|
*
|
||||||
|
* @return mixed A SimpleXMLElement, or null if the file failed to parse
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function isManifest($file)
|
||||||
|
{
|
||||||
|
$xml = simplexml_load_file($file);
|
||||||
|
|
||||||
|
// If we cannot load the XML file return null
|
||||||
|
if (!$xml)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for a valid XML root tag.
|
||||||
|
if ($xml->getName() != 'extension' && $xml->getName() != 'install')
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Valid manifest file return the object
|
||||||
|
return $xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,809 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Utilities
|
||||||
|
*
|
||||||
|
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SimpleXML implementation.
|
||||||
|
*
|
||||||
|
* The XML Parser extension (expat) is required to use JSimpleXML.
|
||||||
|
*
|
||||||
|
* The class provides a pure PHP4 implementation of the PHP5
|
||||||
|
* interface SimpleXML. As with PHP5's SimpleXML it is what it says:
|
||||||
|
* simple. Nevertheless, it is an easy way to deal with XML data,
|
||||||
|
* especially for read only access.
|
||||||
|
*
|
||||||
|
* Because it's not possible to use the PHP5 ArrayIterator interface
|
||||||
|
* with PHP4 there are some differences between this implementation
|
||||||
|
* and that of PHP5:
|
||||||
|
*
|
||||||
|
* The access to the root node has to be explicit in
|
||||||
|
* JSimpleXML, not implicit as with PHP5. Write
|
||||||
|
* $xml->document->node instead of $xml->node
|
||||||
|
* You cannot access CDATA using array syntax. Use the method data() instead
|
||||||
|
* You cannot access attributes directly with array syntax. Use attributes()
|
||||||
|
* to read them.
|
||||||
|
* Comments are ignored.
|
||||||
|
* Last and least, this is not as fast as PHP5 SimpleXML--it is pure PHP4.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* <code>
|
||||||
|
* :simple.xml:
|
||||||
|
* <?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||||
|
* <document>
|
||||||
|
* <node>
|
||||||
|
* <child gender="m">Tom Foo</child>
|
||||||
|
* <child gender="f">Tamara Bar</child>
|
||||||
|
* <node>
|
||||||
|
* </document>
|
||||||
|
*
|
||||||
|
* ---
|
||||||
|
*
|
||||||
|
* // read and write a document
|
||||||
|
* $xml = new JSimpleXML;
|
||||||
|
* $xml->loadFile('simple.xml');
|
||||||
|
* print $xml->document->toString();
|
||||||
|
*
|
||||||
|
* // access a given node's CDATA
|
||||||
|
* print $xml->root->node->child[0]->data(); // Tom Foo
|
||||||
|
*
|
||||||
|
* // access attributes
|
||||||
|
* $attr = $xml->root->node->child[1]->attributes();
|
||||||
|
* print $attr['gender']; // f
|
||||||
|
*
|
||||||
|
* // access children
|
||||||
|
* foreach($xml->root->node->children() as $child) {
|
||||||
|
* print $child->data();
|
||||||
|
* }
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* Note: JSimpleXML cannot be used to access sophisticated XML doctypes
|
||||||
|
* using datatype ANY (e.g. XHTML). With a DOM implementation you can
|
||||||
|
* handle this.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Utilities
|
||||||
|
* @see http://www.php.net/manual/en/book.simplexml.php
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
class JSimpleXML extends JObject
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The XML parser
|
||||||
|
*
|
||||||
|
* @var resource
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
private $_parser = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document element
|
||||||
|
*
|
||||||
|
* @var object
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public $document = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current object depth
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
private $_stack = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param array $options Options
|
||||||
|
*
|
||||||
|
* @deprecated 12.1 Use SimpleXML instead.
|
||||||
|
* @see http://www.php.net/manual/en/book.simplexml.php
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function __construct($options = null)
|
||||||
|
{
|
||||||
|
if (! function_exists('xml_parser_create'))
|
||||||
|
{
|
||||||
|
// TODO throw warning
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the parser resource and make sure both versions of PHP autodetect the format.
|
||||||
|
$this->_parser = xml_parser_create('');
|
||||||
|
|
||||||
|
// Check parser resource
|
||||||
|
xml_set_object($this->_parser, $this);
|
||||||
|
xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, 0);
|
||||||
|
if (is_array($options))
|
||||||
|
{
|
||||||
|
foreach ($options as $option => $value)
|
||||||
|
{
|
||||||
|
xml_parser_set_option($this->_parser, $option, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the handlers
|
||||||
|
xml_set_element_handler($this->_parser, '_startElement', '_endElement');
|
||||||
|
xml_set_character_data_handler($this->_parser, '_characterData');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interprets a string of XML into an object
|
||||||
|
*
|
||||||
|
* This function will take the well-formed XML string data and return an object of class
|
||||||
|
* JSimpleXMLElement with properties containing the data held within the XML document.
|
||||||
|
* If any errors occur, it returns FALSE.
|
||||||
|
*
|
||||||
|
* @param string $string Well-formed XML string data
|
||||||
|
* @param string $classname currently ignored
|
||||||
|
*
|
||||||
|
* @return object JSimpleXMLElement
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
*
|
||||||
|
* @deprecated 12.1 Use simpleXML_load_string
|
||||||
|
* @see http://www.php.net/manual/en/function.simplexml-load-string.php
|
||||||
|
*/
|
||||||
|
public function loadString($string, $classname = null)
|
||||||
|
{
|
||||||
|
$this->_parse($string);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interprets an XML file into an object
|
||||||
|
*
|
||||||
|
* This function will convert the well-formed XML document in the file specified by filename
|
||||||
|
* to an object of class JSimpleXMLElement. If any errors occur during file access or
|
||||||
|
* interpretation, the function returns FALSE.
|
||||||
|
*
|
||||||
|
* @param string $path Path to XML file containing a well-formed XML document
|
||||||
|
* @param string $classname currently ignored
|
||||||
|
*
|
||||||
|
* @return boolean True if successful, false if file empty
|
||||||
|
*
|
||||||
|
* @deprecated 12.1 Use simplexml_load_file instead
|
||||||
|
* @see http://www.php.net/manual/en/function.simplexml-load-file.php
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function loadFile($path, $classname = null)
|
||||||
|
{
|
||||||
|
//Check to see of the path exists
|
||||||
|
if (!file_exists($path))
|
||||||
|
{
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Get the XML document loaded into a variable
|
||||||
|
$xml = trim(file_get_contents($path));
|
||||||
|
if ($xml == '')
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->_parse($xml);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a JSimpleXMLElement object from a DOM node.
|
||||||
|
*
|
||||||
|
* This function takes a node of a DOM document and makes it into a JSimpleXML node.
|
||||||
|
* This new object can then be used as a native JSimpleXML element. If any errors occur,
|
||||||
|
* it returns FALSE.
|
||||||
|
*
|
||||||
|
* @param string $node DOM document
|
||||||
|
* @param string $classname currently ignored
|
||||||
|
*
|
||||||
|
* @return mixed JSimpleXMLElement or false if any errors occur
|
||||||
|
*
|
||||||
|
* @deprecated 12.1 use simplexml_import_dom instead.
|
||||||
|
* @see http://www.php.net/manual/en/function.simplexml-import-dom.php
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function importDOM($node, $classname = null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the parser
|
||||||
|
*
|
||||||
|
* @return resource XML parser resource handle
|
||||||
|
*
|
||||||
|
* @deprecated 12.1 Use SimpleXMLElement
|
||||||
|
* @see http://www.php.net/manual/en/class.simplexmlelement.php
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function getParser()
|
||||||
|
{
|
||||||
|
return $this->_parser;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the parser
|
||||||
|
*
|
||||||
|
* @param resource $parser XML parser resource handle.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @deprecated 12.1 Use SimpleXML
|
||||||
|
* @see http://www.php.net/manual/en/class.simplexml.php
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function setParser($parser)
|
||||||
|
{
|
||||||
|
$this->_parser = $parser;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start parsing an XML document
|
||||||
|
*
|
||||||
|
* Parses an XML document. The handlers for the configured events are called as many times as necessary.
|
||||||
|
*
|
||||||
|
* @param string $data data to parse
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @deprecated 12.1
|
||||||
|
* @see http://www.php.net/manual/en/class.simplexml.php
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
protected function _parse($data = '')
|
||||||
|
{
|
||||||
|
//Error handling
|
||||||
|
if (!xml_parse($this->_parser, $data))
|
||||||
|
{
|
||||||
|
$this->_handleError(
|
||||||
|
xml_get_error_code($this->_parser), xml_get_current_line_number($this->_parser),
|
||||||
|
xml_get_current_column_number($this->_parser)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Free the parser
|
||||||
|
xml_parser_free($this->_parser);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles an XML parsing error
|
||||||
|
*
|
||||||
|
* @param integer $code XML Error Code.
|
||||||
|
* @param integer $line Line on which the error happened.
|
||||||
|
* @param integer $col Column on which the error happened.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @deprecated 12.1
|
||||||
|
* @since 11.1
|
||||||
|
*
|
||||||
|
* @deprecated 12.1 Use PHP Exception
|
||||||
|
*/
|
||||||
|
protected function _handleError($code, $line, $col)
|
||||||
|
{
|
||||||
|
JCKHelper::error( 'XML Parsing Error at ' . $line . ':' . $col . '. Error ' . $code . ': ' . xml_error_string($code));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the reference to the current direct parent
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
*
|
||||||
|
* @deprecated 12.1
|
||||||
|
*/
|
||||||
|
protected function _getStackLocation()
|
||||||
|
{
|
||||||
|
$return = '';
|
||||||
|
foreach ($this->_stack as $stack)
|
||||||
|
{
|
||||||
|
$return .= $stack . '->';
|
||||||
|
}
|
||||||
|
|
||||||
|
return rtrim($return, '->');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler function for the start of a tag
|
||||||
|
*
|
||||||
|
* @param resource $parser The XML parser.
|
||||||
|
* @param string $name The name of the element.
|
||||||
|
* @param array $attrs A key-value array (optional) of the attributes for the element.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
*
|
||||||
|
* @deprecated 12.1
|
||||||
|
*/
|
||||||
|
protected function _startElement($parser, $name, $attrs = array())
|
||||||
|
{
|
||||||
|
// Check to see if tag is root-level
|
||||||
|
$count = count($this->_stack);
|
||||||
|
if ($count == 0)
|
||||||
|
{
|
||||||
|
// If so, set the document as the current tag
|
||||||
|
$classname = get_class($this) . 'Element';
|
||||||
|
$this->document = new $classname($name, $attrs);
|
||||||
|
|
||||||
|
// And start out the stack with the document tag
|
||||||
|
$this->_stack = array('document');
|
||||||
|
}
|
||||||
|
// If it isn't root level, use the stack to find the parent
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Get the name which points to the current direct parent, relative to $this
|
||||||
|
$parent = $this->_getStackLocation();
|
||||||
|
|
||||||
|
// Add the child
|
||||||
|
eval('$this->' . $parent . '->addChild($name, $attrs, ' . $count . ');');
|
||||||
|
|
||||||
|
// Update the stack
|
||||||
|
eval('$this->_stack[] = $name.\'[\'.(count($this->' . $parent . '->' . $name . ') - 1).\']\';');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler function for the end of a tag
|
||||||
|
*
|
||||||
|
* @param resource $parser The XML parser.
|
||||||
|
* @param string $name The name of the element.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @deprecated 12.1
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
protected function _endElement($parser, $name)
|
||||||
|
{
|
||||||
|
//Update stack by removing the end value from it as the parent
|
||||||
|
array_pop($this->_stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler function for the character data within a tag
|
||||||
|
*
|
||||||
|
* @param resource $parser The XML parser.
|
||||||
|
* @param string $data The CDATA for the element.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @deprecated 12.1
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
protected function _characterData($parser, $data)
|
||||||
|
{
|
||||||
|
// Get the reference to the current parent object
|
||||||
|
$tag = $this->_getStackLocation();
|
||||||
|
|
||||||
|
// Assign data to it
|
||||||
|
eval('$this->' . $tag . '->_data .= $data;');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SimpleXML Element
|
||||||
|
*
|
||||||
|
* This object stores all of the direct children of itself in the $children array.
|
||||||
|
* They are also stored by type as arrays. So, if, for example, this tag had 2 <font>
|
||||||
|
* tags as children, there would be a class member called $font created as an array.
|
||||||
|
* $font[0] would be the first font tag, and $font[1] would be the second.
|
||||||
|
*
|
||||||
|
* To loop through all of the direct children of this object, the $children member
|
||||||
|
* should be used.
|
||||||
|
*
|
||||||
|
* To loop through all of the direct children of a specific tag for this object, it
|
||||||
|
* is probably easier to use the arrays of the specific tag names, as explained above.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Utilities
|
||||||
|
* @see http://www.php.net/manual/en/class.simplexmlelement.php
|
||||||
|
* @since 11.1
|
||||||
|
* @deprecated 12.1 Use SimpleXMLElement instead
|
||||||
|
*/
|
||||||
|
class JSimpleXMLElement extends JObject
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Array with the attributes of this XML element
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public $_attributes = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the element
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public $_name = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The data the element contains
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public $_data = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of references to the objects of all direct children of this XML object
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public $_children = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The level of this XML element
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public $_level = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor, sets up all the default values
|
||||||
|
*
|
||||||
|
* @param string $name The name of the element.
|
||||||
|
* @param array $attrs A key-value array (optional) of the attributes for the element.
|
||||||
|
* @param integer $level The level (optional) of the element.
|
||||||
|
*
|
||||||
|
* @deprecated 12.1 Use SimpleXMLElement
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function __construct($name, $attrs = array(), $level = 0)
|
||||||
|
{
|
||||||
|
//Make the keys of the attr array lower case, and store the value
|
||||||
|
$this->_attributes = array_change_key_case($attrs, CASE_LOWER);
|
||||||
|
|
||||||
|
//Make the name lower case and store the value
|
||||||
|
$this->_name = strtolower($name);
|
||||||
|
|
||||||
|
//Set the level
|
||||||
|
$this->_level = $level;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the element
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @deprecated 12.1
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function name()
|
||||||
|
{
|
||||||
|
return $this->_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the an attribute of the element
|
||||||
|
*
|
||||||
|
* @param string $attribute The name of the attribute
|
||||||
|
*
|
||||||
|
* @return mixed If an attribute is given will return the attribute if it exist.
|
||||||
|
* If no attribute is given will return the complete attributes array
|
||||||
|
*
|
||||||
|
* @deprecated 12.1
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function attributes($attribute = null)
|
||||||
|
{
|
||||||
|
if (!isset($attribute))
|
||||||
|
{
|
||||||
|
return $this->_attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isset($this->_attributes[$attribute]) ? $this->_attributes[$attribute] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the data of the element
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @deprecated 12.1 Use SimpleXMLElement
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function data()
|
||||||
|
{
|
||||||
|
return $this->_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the data of the element
|
||||||
|
*
|
||||||
|
* @param string $data The CDATA for the element.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @deprecated 12.1 Use SimpleXMLElement
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function setData($data)
|
||||||
|
{
|
||||||
|
$this->_data = $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the children of the element
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @deprecated 12.1
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function children()
|
||||||
|
{
|
||||||
|
return $this->_children;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the level of the element
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
* @deprecated 12.1
|
||||||
|
*/
|
||||||
|
public function level()
|
||||||
|
{
|
||||||
|
return $this->_level;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an attribute to the element
|
||||||
|
*
|
||||||
|
* @param string $name The key
|
||||||
|
* @param array $value The value for the key
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @deprecated 12.1
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function addAttribute($name, $value)
|
||||||
|
{
|
||||||
|
// Add the attribute to the element, override if it already exists
|
||||||
|
$this->_attributes[$name] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes an attribute from the element
|
||||||
|
*
|
||||||
|
* @param string $name The name of the attribute.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @deprecated 12.1
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function removeAttribute($name)
|
||||||
|
{
|
||||||
|
unset($this->_attributes[$name]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a direct child to the element
|
||||||
|
*
|
||||||
|
* @param string $name The name of the element.
|
||||||
|
* @param array $attrs An key-value array of the element attributes.
|
||||||
|
* @param integer $level The level of the element (optional).
|
||||||
|
*
|
||||||
|
* @return JSimpleXMLElement The added child object
|
||||||
|
*
|
||||||
|
* @deprecated 12.1
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function addChild($name, $attrs = array(), $level = null)
|
||||||
|
{
|
||||||
|
//If there is no array already set for the tag name being added,
|
||||||
|
//create an empty array for it
|
||||||
|
if (!isset($this->$name))
|
||||||
|
{
|
||||||
|
$this->$name = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the level if not already specified
|
||||||
|
if ($level == null)
|
||||||
|
{
|
||||||
|
$level = ($this->_level + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create the child object itself
|
||||||
|
$classname = get_class($this);
|
||||||
|
$child = new $classname($name, $attrs, $level);
|
||||||
|
|
||||||
|
//Add the reference of it to the end of an array member named for the elements name
|
||||||
|
$this->{$name}[] = &$child;
|
||||||
|
|
||||||
|
//Add the reference to the children array member
|
||||||
|
$this->_children[] = &$child;
|
||||||
|
|
||||||
|
//return the new child
|
||||||
|
return $child;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the child node.
|
||||||
|
*
|
||||||
|
* @param JSimpleXmlElement &$child The child element to remove.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
* @deprecated 12.1
|
||||||
|
*/
|
||||||
|
public function removeChild(&$child)
|
||||||
|
{
|
||||||
|
$name = $child->name();
|
||||||
|
for ($i = 0, $n = count($this->_children); $i < $n; $i++)
|
||||||
|
{
|
||||||
|
if ($this->_children[$i] == $child)
|
||||||
|
{
|
||||||
|
unset($this->_children[$i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for ($i = 0, $n = count($this->{$name}); $i < $n; $i++)
|
||||||
|
{
|
||||||
|
if ($this->{$name}[$i] == $child)
|
||||||
|
{
|
||||||
|
unset($this->{$name}[$i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->_children = array_values($this->_children);
|
||||||
|
$this->{$name} = array_values($this->{$name});
|
||||||
|
unset($child);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an element in the document by / separated path
|
||||||
|
*
|
||||||
|
* @param string $path The / separated path to the element
|
||||||
|
*
|
||||||
|
* @return object JSimpleXMLElement
|
||||||
|
*
|
||||||
|
* @deprecated 12.1
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function getElementByPath($path)
|
||||||
|
{
|
||||||
|
$tmp = &$this;
|
||||||
|
$parts = explode('/', trim($path, '/'));
|
||||||
|
|
||||||
|
foreach ($parts as $node)
|
||||||
|
{
|
||||||
|
$found = false;
|
||||||
|
foreach ($tmp->_children as $child)
|
||||||
|
{
|
||||||
|
if (strtoupper($child->_name) == strtoupper($node))
|
||||||
|
{
|
||||||
|
$tmp = &$child;
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$found)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($found)
|
||||||
|
{
|
||||||
|
return $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Traverses the tree calling the $callback(JSimpleXMLElement
|
||||||
|
* $this, mixed $args=array()) function with each JSimpleXMLElement.
|
||||||
|
*
|
||||||
|
* @param string $callback Function name
|
||||||
|
* @param array $args The arguments (optional) for the function callback.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @deprecated 12.1
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function map($callback, $args = array())
|
||||||
|
{
|
||||||
|
$callback($this, $args);
|
||||||
|
// Map to all children
|
||||||
|
if ($n = count($this->_children))
|
||||||
|
{
|
||||||
|
for ($i = 0; $i < $n; $i++)
|
||||||
|
{
|
||||||
|
$this->_children[$i]->map($callback, $args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a well-formed XML string based on SimpleXML element
|
||||||
|
*
|
||||||
|
* @param boolean $whitespace True if whitespace should be prepended to the string
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @deprecated 12.1
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function toString($whitespace = true)
|
||||||
|
{
|
||||||
|
// Start a new line, indent by the number indicated in $this->level, add a <, and add the name of the tag
|
||||||
|
if ($whitespace)
|
||||||
|
{
|
||||||
|
$out = "\n" . str_repeat("\t", $this->_level) . '<' . $this->_name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$out = '<' . $this->_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For each attribute, add attr="value"
|
||||||
|
foreach ($this->_attributes as $attr => $value)
|
||||||
|
{
|
||||||
|
$out .= ' ' . $attr . '="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"';
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there are no children and it contains no data, end it off with a />
|
||||||
|
if (empty($this->_children) && empty($this->_data))
|
||||||
|
{
|
||||||
|
$out .= " />";
|
||||||
|
}
|
||||||
|
// Otherwise...
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If there are children
|
||||||
|
if (!empty($this->_children))
|
||||||
|
{
|
||||||
|
// Close off the start tag
|
||||||
|
$out .= '>';
|
||||||
|
|
||||||
|
// For each child, call the asXML function (this will ensure that all children are added recursively)
|
||||||
|
foreach ($this->_children as $child)
|
||||||
|
{
|
||||||
|
$out .= $child->toString($whitespace);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the newline and indentation to go along with the close tag
|
||||||
|
if ($whitespace)
|
||||||
|
{
|
||||||
|
$out .= "\n" . str_repeat("\t", $this->_level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If there is data, close off the start tag and add the data
|
||||||
|
elseif (!empty($this->_data))
|
||||||
|
$out .= '>' . htmlspecialchars($this->_data, ENT_COMPAT, 'UTF-8');
|
||||||
|
|
||||||
|
// Add the end tag
|
||||||
|
$out .= '</' . $this->_name . '>';
|
||||||
|
}
|
||||||
|
|
||||||
|
//Return the final output
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,141 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Utilities
|
||||||
|
*
|
||||||
|
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined( '_JEXEC' ) or die;
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper class for php SimpleXMLElement.
|
||||||
|
*
|
||||||
|
* @package Joomla.Platform
|
||||||
|
* @subpackage Utilities
|
||||||
|
* @since 11.1
|
||||||
|
* @deprecated 13.3 Use SimpleXMLElement instead.
|
||||||
|
*/
|
||||||
|
class JXMLElement extends SimpleXMLElement
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the name of the element.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
* @deprecated 13.3 Use SimpleXMLElement::getName() instead.
|
||||||
|
*/
|
||||||
|
public function name()
|
||||||
|
{
|
||||||
|
JLog::add('JXMLElement::name() is deprecated, use SimpleXMLElement::getName() instead.', JLog::WARNING, 'deprecated');
|
||||||
|
return (string) $this->getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legacy method to get the element data.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @deprecated 12.1
|
||||||
|
* @since 11.1
|
||||||
|
*/
|
||||||
|
public function data()
|
||||||
|
{
|
||||||
|
// Deprecation warning.
|
||||||
|
JLog::add('JXMLElement::data() is deprecated.', JLog::WARNING, 'deprecated');
|
||||||
|
|
||||||
|
return (string) $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legacy method gets an elements attribute by name.
|
||||||
|
*
|
||||||
|
* @param string $name Attribute to get
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
*
|
||||||
|
* @deprecated 12.1
|
||||||
|
* @see SimpleXMLElement::attributes
|
||||||
|
*/
|
||||||
|
public function getAttribute($name)
|
||||||
|
{
|
||||||
|
// Deprecation warning.
|
||||||
|
JLog::add('JXMLelement::getAttributes() is deprecated.', JLog::WARNING, 'deprecated');
|
||||||
|
|
||||||
|
return (string) $this->attributes()->$name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a well-formed XML string based on SimpleXML element
|
||||||
|
*
|
||||||
|
* @param boolean $compressed Should we use indentation and newlines ?
|
||||||
|
* @param integer $indent Indention level.
|
||||||
|
* @param integer $level The level within the document which informs the indentation.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @since 11.1
|
||||||
|
* @deprecated 13.3 Use SimpleXMLElement::asXML() instead.
|
||||||
|
*/
|
||||||
|
public function asFormattedXML($compressed = false, $indent = "\t", $level = 0)
|
||||||
|
{
|
||||||
|
JLog::add('JXMLElement::asFormattedXML() is deprecated, use SimpleXMLElement::asXML() instead.', JLog::WARNING, 'deprecated');
|
||||||
|
$out = '';
|
||||||
|
|
||||||
|
// Start a new line, indent by the number indicated in $level
|
||||||
|
$out .= ($compressed) ? '' : "\n" . str_repeat($indent, $level);
|
||||||
|
|
||||||
|
// Add a <, and add the name of the tag
|
||||||
|
$out .= '<' . $this->getName();
|
||||||
|
|
||||||
|
// For each attribute, add attr="value"
|
||||||
|
foreach ($this->attributes() as $attr)
|
||||||
|
{
|
||||||
|
$out .= ' ' . $attr->getName() . '="' . htmlspecialchars((string) $attr, ENT_COMPAT, 'UTF-8') . '"';
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there are no children and it contains no data, end it off with a />
|
||||||
|
if (!count($this->children()) && !(string) $this)
|
||||||
|
{
|
||||||
|
$out .= " />";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If there are children
|
||||||
|
if (count($this->children()))
|
||||||
|
{
|
||||||
|
// Close off the start tag
|
||||||
|
$out .= '>';
|
||||||
|
|
||||||
|
$level++;
|
||||||
|
|
||||||
|
// For each child, call the asFormattedXML function (this will ensure that all children are added recursively)
|
||||||
|
foreach ($this->children() as $child)
|
||||||
|
{
|
||||||
|
$out .= $child->asFormattedXML($compressed, $indent, $level);
|
||||||
|
}
|
||||||
|
|
||||||
|
$level--;
|
||||||
|
|
||||||
|
// Add the newline and indentation to go along with the close tag
|
||||||
|
$out .= ($compressed) ? '' : "\n" . str_repeat($indent, $level);
|
||||||
|
|
||||||
|
}
|
||||||
|
elseif ((string) $this)
|
||||||
|
{
|
||||||
|
// If there is data, close off the start tag and add the data
|
||||||
|
$out .= '>' . htmlspecialchars((string) $this, ENT_COMPAT, 'UTF-8');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the end tag
|
||||||
|
$out .= '</' . $this->getName() . '>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user