first commit
This commit is contained in:
22
administrator/components/com_jce/controller/config.php
Normal file
22
administrator/components/com_jce/controller/config.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
class JceControllerConfig extends JControllerForm
|
||||
{
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
// return to control panel on cancel/close
|
||||
$this->view_list = 'cpanel';
|
||||
}
|
||||
}
|
||||
26
administrator/components/com_jce/controller/cpanel.php
Normal file
26
administrator/components/com_jce/controller/cpanel.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
class JceControllerCpanel extends JControllerLegacy
|
||||
{
|
||||
public function feed()
|
||||
{
|
||||
$model = $this->getModel('cpanel');
|
||||
|
||||
echo json_encode(array(
|
||||
'feeds' => $model->getFeeds()
|
||||
));
|
||||
|
||||
// Close the application
|
||||
JFactory::getApplication()->close();
|
||||
}
|
||||
}
|
||||
34
administrator/components/com_jce/controller/editor.php
Normal file
34
administrator/components/com_jce/controller/editor.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 3 - http://www.gnu.org/copyleft/gpl.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
require_once JPATH_SITE . '/components/com_jce/editor/libraries/classes/application.php';
|
||||
|
||||
class JceControllerEditor extends JControllerLegacy
|
||||
{
|
||||
public function execute($task)
|
||||
{
|
||||
// check for session token
|
||||
JSession::checkToken('get') or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$editor = new WFEditor();
|
||||
|
||||
if (strpos($task, '.') !== false) {
|
||||
list($name, $task) = explode('.', $task);
|
||||
}
|
||||
|
||||
if (method_exists($editor, $task)) {
|
||||
$editor->$task();
|
||||
}
|
||||
|
||||
jexit();
|
||||
}
|
||||
}
|
||||
21
administrator/components/com_jce/controller/mediabox.php
Normal file
21
administrator/components/com_jce/controller/mediabox.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
class JceControllerMediabox extends JControllerForm
|
||||
{
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct($config);
|
||||
// return to control panel on cancel/close
|
||||
$this->view_list = 'cpanel';
|
||||
}
|
||||
}
|
||||
108
administrator/components/com_jce/controller/plugin.php
Normal file
108
administrator/components/com_jce/controller/plugin.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 3 - http://www.gnu.org/copyleft/gpl.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
require_once JPATH_SITE . '/components/com_jce/editor/libraries/classes/application.php';
|
||||
|
||||
class JceControllerPlugin extends JControllerLegacy
|
||||
{
|
||||
private static $map = array(
|
||||
'image' => 'imgmanager',
|
||||
'imagepro' => 'imgmanager_ext'
|
||||
);
|
||||
|
||||
private function createClassName($name) {
|
||||
$delim = array('-', '_');
|
||||
|
||||
$name = str_replace($delim, ' ', $name);
|
||||
|
||||
$className = 'WF' . ucwords($name) . 'Plugin';
|
||||
|
||||
// remove space
|
||||
$className = str_replace(' ', '', $className);
|
||||
|
||||
return $className;
|
||||
}
|
||||
|
||||
public function execute($task)
|
||||
{
|
||||
$wf = WFApplication::getInstance();
|
||||
|
||||
// check a valid profile exists
|
||||
$wf->getProfile() or jexit('Invalid Profile');
|
||||
|
||||
// load language files
|
||||
$language = JFactory::getLanguage();
|
||||
|
||||
$language->load('com_jce', JPATH_ADMINISTRATOR);
|
||||
|
||||
if (WF_EDITOR_PRO) {
|
||||
$language->load('com_jce_pro', JPATH_SITE);
|
||||
}
|
||||
|
||||
$plugin = $this->input->get('plugin');
|
||||
|
||||
// get plugin name
|
||||
if (strpos($plugin, '.') !== false) {
|
||||
list($plugin, $caller) = explode('.', $plugin);
|
||||
}
|
||||
|
||||
// map plugin name to internal / legacy name
|
||||
if (array_key_exists($plugin, self::$map)) {
|
||||
$plugin = self::$map[$plugin];
|
||||
$mapped = $plugin;
|
||||
|
||||
if (!empty($caller)) {
|
||||
$mapped = $plugin . '.' . $caller;
|
||||
}
|
||||
|
||||
$this->input->set('plugin', $mapped);
|
||||
}
|
||||
|
||||
$path = WF_EDITOR_PLUGINS . '/' . $plugin;
|
||||
|
||||
if (strpos($plugin, 'editor-') !== false) {
|
||||
$path = JPATH_PLUGINS . '/jce/' . $plugin;
|
||||
}
|
||||
|
||||
if (!file_exists($path . '/' . $plugin . '.php')) {
|
||||
throw new InvalidArgumentException(ucfirst($plugin) . '" not found!');
|
||||
}
|
||||
|
||||
include_once $path . '/' . $plugin . '.php';
|
||||
|
||||
$className = $this->createClassName($plugin);
|
||||
|
||||
if (class_exists($className)) {
|
||||
// load language file if any
|
||||
$language->load('plg_jce_' . basename($path), $path);
|
||||
|
||||
$instance = new $className();
|
||||
|
||||
if (strpos($task, '.') !== false) {
|
||||
list($name, $task) = explode('.', $task);
|
||||
}
|
||||
|
||||
if ($task === 'display') {
|
||||
$task = 'execute';
|
||||
}
|
||||
|
||||
// default to execute if task is not available
|
||||
if (is_callable(array($instance, $task)) === false) {
|
||||
$task = 'execute';
|
||||
}
|
||||
|
||||
$instance->$task();
|
||||
}
|
||||
|
||||
jexit();
|
||||
}
|
||||
}
|
||||
36
administrator/components/com_jce/controller/profile.php
Normal file
36
administrator/components/com_jce/controller/profile.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
class JceControllerProfile extends JControllerForm
|
||||
{
|
||||
/**
|
||||
* The URL option for the component.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $option = 'com_jce';
|
||||
|
||||
/**
|
||||
* The URL view item variable.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $view_item = 'profile';
|
||||
|
||||
/**
|
||||
* The URL view list variable.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $view_list = 'profiles';
|
||||
}
|
||||
130
administrator/components/com_jce/controller/profiles.php
Normal file
130
administrator/components/com_jce/controller/profiles.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
class JceControllerProfiles extends JControllerAdmin
|
||||
{
|
||||
/**
|
||||
* Method to import profile data from an XML file.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function import()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
$model = $this->getModel();
|
||||
|
||||
$result = $model->import();
|
||||
|
||||
// Get redirect URL
|
||||
$redirect_url = JRoute::_('index.php?option=com_jce&view=profiles', false);
|
||||
|
||||
// Push message queue to session because we will redirect page by Javascript, not $app->redirect().
|
||||
// The "application.queue" is only set in redirect() method, so we must manually store it.
|
||||
$app->getSession()->set('application.queue', $app->getMessageQueue());
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
echo new JResponseJson(array('redirect' => $redirect_url), "", !$result);
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
public function repair()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken('get') or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$model = $this->getModel('profiles');
|
||||
|
||||
try {
|
||||
$model->repair();
|
||||
} catch (Exception $e) {
|
||||
$this->setMessage($e->getMessage(), 'error');
|
||||
}
|
||||
|
||||
$this->setRedirect('index.php?option=com_jce&view=profiles');
|
||||
}
|
||||
|
||||
public function copy()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$cid = $this->input->get('cid', array(), 'array');
|
||||
|
||||
// Access checks.
|
||||
if (!$user->authorise('core.create', 'com_jce')) {
|
||||
throw new Exception(JText::_('JLIB_APPLICATION_ERROR_CREATE_NOT_PERMITTED'));
|
||||
}
|
||||
|
||||
if (empty($cid)) {
|
||||
throw new Exception(JText::_('No Item Selected'));
|
||||
} else {
|
||||
$model = $this->getModel();
|
||||
// Copy the items.
|
||||
try {
|
||||
$model->copy($cid);
|
||||
$ntext = $this->text_prefix . '_N_ITEMS_COPIED';
|
||||
$this->setMessage(JText::plural($ntext, count($cid)));
|
||||
} catch (Exception $e) {
|
||||
$this->setMessage($e->getMessage(), 'error');
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect('index.php?option=com_jce&view=profiles');
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$ids = $this->input->get('cid', array(), 'array');
|
||||
|
||||
// Access checks.
|
||||
if (!$user->authorise('core.create', 'com_jce')) {
|
||||
throw new Exception(JText::_('JLIB_APPLICATION_ERROR_CREATE_NOT_PERMITTED'));
|
||||
}
|
||||
|
||||
if (empty($ids)) {
|
||||
throw new Exception(JText::_('No Item Selected'));
|
||||
} else {
|
||||
$model = $this->getModel();
|
||||
// Publish the items.
|
||||
if (!$model->export($ids)) {
|
||||
throw new Exception($model->getError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Proxy for getModel.
|
||||
*
|
||||
* @param string $name The model name. Optional
|
||||
* @param string $prefix The class prefix. Optional
|
||||
* @param array $config The array of possible config values. Optional
|
||||
*
|
||||
* @return object The model
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = 'Profile', $prefix = 'JceModel', $config = array('ignore_request' => true))
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user