first commit

This commit is contained in:
2026-02-08 21:16:11 +01:00
commit e17b7026fd
8881 changed files with 1160453 additions and 0 deletions

View File

@@ -0,0 +1,467 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
/**
* Convert Forms Plugin
*/
class PlgSystemConvertForms extends JPlugin
{
/**
* Application Object
*
* @var object
*/
protected $app;
/**
* Component's param object
*
* @var JRegistry
*/
private $param;
/**
* The loaded indicator of helper
*
* @var boolean
*/
private $init;
/**
* Log Object
*
* @var Object
*/
private $log;
/**
* AJAX Response
*
* @var stdClass
*/
private $response;
/**
* Plugin constructor
*
* @param mixed &$subject
* @param array $config
*/
public function __construct(&$subject, $config = array())
{
$component = JComponentHelper::getComponent('com_convertforms', true);
/**
* Εxecute parent constructor early as $app is not available when
* we uninstall the administrator component.
*/
parent::__construct($subject, $config);
if (!$component->enabled)
{
return;
}
$this->param = $component->params;
// Load required classes
if (!$this->loadClasses())
{
return;
}
// Declare extension logger
JLog::addLogger(
array('text_file' => 'com_convertforms.php'),
JLog::ALL,
array('com_convertforms')
);
}
/**
* onAfterRoute Event
*/
public function onAfterRoute()
{
// Get Helper
if (!$this->getHelper())
{
return;
}
}
/**
* Handles the content preparation event fired by Joomla!
*
* @param mixed $context Unused in this plugin.
* @param stdClass $article An object containing the article being processed.
* @param mixed $params Unused in this plugin.
* @param int $limitstart Unused in this plugin.
*
* @return bool
*/
public function onContentPrepare($context, &$article, &$params, $limitstart = 0)
{
// Get Helper
if (!$this->getHelper())
{
return true;
}
// Check whether the plugin should process or not
if (Joomla\String\StringHelper::strpos($article->text, 'convertforms') === false)
{
return true;
}
// Search for this tag in the content
$regex = "#{convertforms(\s)(\d+)(\s?)(.*?)}#s";
$article->text = preg_replace_callback($regex, array('self', 'process'), $article->text);
}
/**
* Improve performance and prevent conflicts by not allowing modules to be rendered in the form builder.
*
* @param array $modules The list of modules to be rendered in the page
*
* @return void
*/
public function onPrepareModuleList(&$modules)
{
if ($this->app->isClient('administrator') && $this->app->input->get('option') == 'com_convertforms' && $this->app->input->get('view') == 'form')
{
$modules = [];
}
}
/**
* Callback to preg_replace_callback in the onContentPrepare event handler of this plugin.
*
* @param array $match A match to the {convertforms} plugin tag
*
* @return string The processed result
*/
private static function process($match)
{
$form_id = $match[2];
$task = $match[4];
switch ($task)
{
case 'submissions_total':
return ConvertForms\Api::getFormSubmissionsTotal($form_id);
break;
default:
return ConvertForms\Helper::renderFormById($form_id);
}
}
/**
* Listens to AJAX requests on ?option=com_ajax&format=raw&plugin=convertforms
* Method aborts on invalid token or task
*
* @return void
*/
public function onAjaxConvertForms()
{
// Disable all PHP reporting to ensure a success AJAX response.
$debug = ConvertForms\Helper::getComponentParams()->get('debug', false);
if (!$debug)
{
error_reporting(E_ALL & ~E_NOTICE);
}
$input = $this->app->input;
$form_id = isset($input->getArray()['cf']) ? $input->getArray()['cf']['form_id'] : 0;
// Check if we have a valid task
$task = $input->get('task', null);
if (is_null($task))
{
die('Invalid task');
}
// An access token is required on all requests except on the API task which
// has a native authentication method through an API Key
if (!in_array($task, ['api']) && !JSession::checkToken('request'))
{
ConvertForms\Helper::triggerError(JText::_('JINVALID_TOKEN'), $task, $form_id, $input->request->getArray());
jexit(JText::_('JINVALID_TOKEN'));
}
// Cool access granted.
$componentPath = JPATH_ADMINISTRATOR . '/components/com_convertforms/';
JModelLegacy::addIncludePath($componentPath . 'models');
JTable::addIncludePath($componentPath . 'tables');
// Load component language file
NRFramework\Functions::loadLanguage('com_convertforms');
// Check if we have a valid method task
$taskMethod = 'ajaxTask' . $task;
if (!method_exists($this, $taskMethod))
{
die('Task not found');
}
// Success! Let's call the method.
$this->response = new stdClass();
try
{
$this->$taskMethod();
}
catch (Exception $e)
{
ConvertForms\Helper::triggerError($e->getMessage(), $task, $form_id, $input->request->getArray());
$this->response->error = $e->getMessage();
}
echo json_encode($this->response);
// Stop execution
jexit();
}
# PRO-START
/**
* AJAX Method to retrieve service account lists
*
* Listens to requests on ?option=com_ajax&format=raw&plugin=convertforms&task=lists
* Required arguments: service=[SERVICENAME]&key=[APIKEY/ACCESSTOKEN]
*
* @return void
*/
private function ajaxTaskLists()
{
$campaignData = $this->app->input->get('jform', null, 'array');
if (is_null($campaignData) || empty($campaignData))
{
die('No Campaign Data Found');
}
// Yeah! We have a service! Dispatcher call the plugins please!
JPluginHelper::importPlugin('convertforms');
$lists = JFactory::getApplication()->triggerEvent('onConvertFormsServiceLists', array($campaignData));
if (is_array($lists[0]))
{
$this->response->lists = $lists[0];
} else
{
$this->response->error = $lists[0];
}
}
/**
* API Task help us query ConvertForms tables and output the result as JSON
*
* @return void
*/
private function ajaxTaskAPI()
{
// Run only if API is enabled
if (!ConvertForms\Helper::getComponentParams()->get('api', false))
{
ConvertForms\Helper::log('JSON-API is disabled. Enable it through ConvertForms configuration page.');
die();
}
$endpoint = $this->app->input->get('endpoint', 'forms');
$apikey = $this->app->input->get('api_key');
$api = new ConvertForms\JsonApi($apikey);
$this->response = $api->route($endpoint);
// JFactory::getDocument()->setMimeEncoding('application/json'); doesn't work here
header('Content-Type: application/json');
}
# PRO-END
/**
* Map onContentAfterSave event to onConvertFormsConversionAfterSave
*
* Content is passed by reference, but after the save, so no changes will be saved.
* Method is called right after the content is saved.
*
* @param string $context The context of the content passed to the plugin (added in 1.6)
* @param object $article A JTableContent object
* @param bool $isNew If the content has just been created
*
* @return void
*
* @deprecated Remove this code block and update the onConvertFormsConversionAfterSave() method to use onConvertFormsSubmissionAfterSave().
*/
public function onContentAfterSave($context, $article, $isNew)
{
if ($context != 'com_convertforms.conversion' || $this->app->isClient('administrator'))
{
return;
}
JPluginHelper::importPlugin('convertforms');
JPluginHelper::importPlugin('convertformstools');
// Load item row
$model = JModelLegacy::getInstance('Conversion', 'ConvertFormsModel', array('ignore_request' => true));
if (!$conversion = $model->getItem($article->id))
{
return;
}
JFactory::getApplication()->triggerEvent('onConvertFormsConversionAfterSave', array($conversion, $model, $isNew));
}
/**
* Prepare form.
*
* @param JForm $form The form to be altered.
* @param mixed $data The associated data for the form.
*
* @return boolean
*/
public function onContentPrepareForm($form, $data)
{
// Return if we are in frontend
if ($this->app->isClient('site'))
{
return true;
}
// Check we have a form
if (!($form instanceof JForm))
{
return false;
}
// Check we have a valid form context
$validForms = array(
"com_convertforms.campaign",
"com_convertforms.form"
);
if (!in_array($form->getName(), $validForms))
{
return true;
}
// Load ConvertForms plugins
JPluginHelper::importPlugin('convertforms');
JPluginHelper::importPlugin('convertformstools');
// Campaign Forms
if ($form->getName() == 'com_convertforms.campaign')
{
if (!isset($data->service) || !$service = $data->service)
{
return true;
}
$result = \JFactory::getApplication()->triggerEvent('onConvertFormsCampaignPrepareForm', [$form, $data, $service]);
}
// Form Editing Page
if ($form->getName() == 'com_convertforms.form')
{
$result = \JFactory::getApplication()->triggerEvent('onConvertFormsFormPrepareForm', [$form, $data]);
}
return true;
}
/**
* Silent load of Convert Forms and Framework classes
*
* @return boolean
*/
private function loadClasses()
{
// Initialize Convert Forms Library
if (!@include_once(JPATH_ADMINISTRATOR . '/components/com_convertforms/autoload.php'))
{
return false;
}
// Load Framework
if (!@include_once(JPATH_PLUGINS . '/system/nrframework/autoload.php'))
{
return false;
}
// Declare extension's error log file
JLog::addLogger(
[
'text_file' => 'convertforms_errors.php',
'text_entry_format' => '{MESSAGE}'
],
JLog::ERROR,
['convertforms_errors']
);
return true;
}
/**
* Loads the helper classes of plugin
*
* @return bool
*/
private function getHelper()
{
// Return if is helper is already loaded
if ($this->init)
{
return true;
}
// Return if we are not in frontend
if (!$this->app->isClient('site'))
{
return false;
}
// Handle the component execution when the tmpl request paramter is overriden
if (!$this->param->get("executeoutputoverride", false) && $this->app->input->get('tmpl', null, "cmd") != null)
{
return false;
}
// Handle the component execution when the format request paramter is overriden
if (!$this->param->get("executeonformat", false) && $this->app->input->get('format', "html", "cmd") != "html")
{
return false;
}
// Return if document type is Feed
if (NRFramework\Functions::isFeed())
{
return false;
}
// Load language
JFactory::getLanguage()->load('com_convertforms', JPATH_ADMINISTRATOR . '/components/com_convertforms');
return ($this->init = true);
}
}

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.4.0" type="plugin" group="system" method="upgrade">
<name>PLG_SYSTEM_CONVERTFORMS</name>
<description>PLG_SYSTEM_CONVERTFORMS_DESC</description>
<version>1.0</version>
<creationDate>September 2016</creationDate>
<copyright>Copyright © 2020 Tassos Marinos All Rights Reserved</copyright>
<license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL</license>
<author>Tassos Marinos</author>
<authorEmail>info@tassos.gr</authorEmail>
<authorUrl>http://www.tassos.gr</authorUrl>
<scriptfile>script.install.php</scriptfile>
<files>
<filename plugin="convertforms">convertforms.php</filename>
<filename>script.install.helper.php</filename>
<folder>language</folder>
</files>
</extension>

View File

@@ -0,0 +1,10 @@
; @package Convert Forms
; @version 3.2.12 Free
;
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
; @license http://www.tassos.gr
CONVERTFORMS="Convert Forms"
PLG_SYSTEM_CONVERTFORMS="System - Convert Forms"
PLG_SYSTEM_CONVERTFORMS_DESC="System - Convert Forms"

View File

@@ -0,0 +1,9 @@
; @package Convert Forms
; @version 3.2.12 Free
;
; @author Tassos Marinos - http://www.tassos.gr/joomla-extensions
; @copyright Copyright (c) 2016 Tassos Marinos. All rights reserved.
; @license http://www.tassos.gr
PLG_SYSTEM_CONVERTFORMS="System - Convert Forms"
PLG_SYSTEM_CONVERTFORMS_DESC="System - Convert Forms"

View File

@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@@ -0,0 +1,637 @@
<?php
/**
* Installer Script Helper
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2016 Tassos Marinos All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
*/
defined('_JEXEC') or die;
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
class PlgSystemConvertformsInstallerScriptHelper
{
public $name = '';
public $alias = '';
public $extname = '';
public $extension_type = '';
public $plugin_folder = 'system';
public $module_position = 'status';
public $client_id = 1;
public $install_type = 'install';
public $show_message = true;
public $autopublish = true;
public $db = null;
public $app = null;
public $installedVersion;
public function __construct(&$params)
{
$this->extname = $this->extname ?: $this->alias;
$this->db = JFactory::getDbo();
$this->app = JFactory::getApplication();
$this->installedVersion = $this->getVersion($this->getInstalledXMLFile());
}
/**
* Preflight event
*
* @param string
* @param JAdapterInstance
*
* @return boolean
*/
public function preflight($route, $adapter)
{
if (!in_array($route, array('install', 'update')))
{
return;
}
JFactory::getLanguage()->load('plg_system_novaraininstaller', JPATH_PLUGINS . '/system/novaraininstaller');
if ($this->show_message && $this->isInstalled())
{
$this->install_type = 'update';
}
if ($this->onBeforeInstall() === false)
{
return false;
}
}
/**
* Preflight event
*
* @param string
* @param JAdapterInstance
*
* @return boolean
*/
public function postflight($route, $adapter)
{
JFactory::getLanguage()->load($this->getPrefix() . '_' . $this->extname, $this->getMainFolder());
if (!in_array($route, array('install', 'update')))
{
return;
}
if ($this->onAfterInstall() === false)
{
return false;
}
if ($route == 'install' && $this->autopublish)
{
$this->publishExtension();
}
if ($this->show_message)
{
$this->addInstalledMessage();
}
JFactory::getCache()->clean('com_plugins');
JFactory::getCache()->clean('_system');
}
public function isInstalled()
{
if (!is_file($this->getInstalledXMLFile()))
{
return false;
}
$query = $this->db->getQuery(true)
->select('extension_id')
->from('#__extensions')
->where($this->db->quoteName('type') . ' = ' . $this->db->quote($this->extension_type))
->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->getElementName()));
$this->db->setQuery($query, 0, 1);
$result = $this->db->loadResult();
return empty($result) ? false : true;
}
public function getMainFolder()
{
switch ($this->extension_type)
{
case 'plugin' :
return JPATH_SITE . '/plugins/' . $this->plugin_folder . '/' . $this->extname;
case 'component' :
return JPATH_ADMINISTRATOR . '/components/com_' . $this->extname;
case 'module' :
return JPATH_ADMINISTRATOR . '/modules/mod_' . $this->extname;
case 'library' :
return JPATH_SITE . '/libraries/' . $this->extname;
}
}
public function getInstalledXMLFile()
{
return $this->getXMLFile($this->getMainFolder());
}
public function getCurrentXMLFile()
{
return $this->getXMLFile(__DIR__);
}
public function getXMLFile($folder)
{
switch ($this->extension_type)
{
case 'module' :
return $folder . '/mod_' . $this->extname . '.xml';
default :
return $folder . '/' . $this->extname . '.xml';
}
}
public function foldersExist($folders = array())
{
foreach ($folders as $folder)
{
if (is_dir($folder))
{
return true;
}
}
return false;
}
public function publishExtension()
{
switch ($this->extension_type)
{
case 'plugin' :
$this->publishPlugin();
case 'module' :
$this->publishModule();
}
}
public function publishPlugin()
{
$query = $this->db->getQuery(true)
->update('#__extensions')
->set($this->db->quoteName('enabled') . ' = 1')
->where($this->db->quoteName('type') . ' = ' . $this->db->quote('plugin'))
->where($this->db->quoteName('element') . ' = ' . $this->db->quote($this->extname))
->where($this->db->quoteName('folder') . ' = ' . $this->db->quote($this->plugin_folder));
$this->db->setQuery($query);
$this->db->execute();
}
public function publishModule()
{
// Get module id
$query = $this->db->getQuery(true)
->select('id')
->from('#__modules')
->where($this->db->quoteName('module') . ' = ' . $this->db->quote('mod_' . $this->extname))
->where($this->db->quoteName('client_id') . ' = ' . (int) $this->client_id);
$this->db->setQuery($query, 0, 1);
$id = $this->db->loadResult();
if (!$id)
{
return;
}
// check if module is already in the modules_menu table (meaning is is already saved)
$query->clear()
->select('moduleid')
->from('#__modules_menu')
->where($this->db->quoteName('moduleid') . ' = ' . (int) $id);
$this->db->setQuery($query, 0, 1);
$exists = $this->db->loadResult();
if ($exists)
{
return;
}
// Get highest ordering number in position
$query->clear()
->select('ordering')
->from('#__modules')
->where($this->db->quoteName('position') . ' = ' . $this->db->quote($this->module_position))
->where($this->db->quoteName('client_id') . ' = ' . (int) $this->client_id)
->order('ordering DESC');
$this->db->setQuery($query, 0, 1);
$ordering = $this->db->loadResult();
$ordering++;
// publish module and set ordering number
$query->clear()
->update('#__modules')
->set($this->db->quoteName('published') . ' = 1')
->set($this->db->quoteName('ordering') . ' = ' . (int) $ordering)
->set($this->db->quoteName('position') . ' = ' . $this->db->quote($this->module_position))
->where($this->db->quoteName('id') . ' = ' . (int) $id);
$this->db->setQuery($query);
$this->db->execute();
// add module to the modules_menu table
$query->clear()
->insert('#__modules_menu')
->columns(array($this->db->quoteName('moduleid'), $this->db->quoteName('menuid')))
->values((int) $id . ', 0');
$this->db->setQuery($query);
$this->db->execute();
}
public function addInstalledMessage()
{
JFactory::getApplication()->enqueueMessage(
JText::sprintf(
JText::_($this->install_type == 'update' ? 'NRI_THE_EXTENSION_HAS_BEEN_UPDATED_SUCCESSFULLY' : 'NRI_THE_EXTENSION_HAS_BEEN_INSTALLED_SUCCESSFULLY'),
'<strong>' . JText::_($this->name) . '</strong>',
'<strong>' . $this->getVersion() . '</strong>',
$this->getFullType()
)
);
}
public function getPrefix()
{
switch ($this->extension_type)
{
case 'plugin';
return JText::_('plg_' . strtolower($this->plugin_folder));
case 'component':
return JText::_('com');
case 'module':
return JText::_('mod');
case 'library':
return JText::_('lib');
default:
return $this->extension_type;
}
}
public function getElementName($type = null, $extname = null)
{
$type = is_null($type) ? $this->extension_type : $type;
$extname = is_null($extname) ? $this->extname : $extname;
switch ($type)
{
case 'component' :
return 'com_' . $extname;
case 'module' :
return 'mod_' . $extname;
case 'plugin' :
default:
return $extname;
}
}
public function getFullType()
{
return JText::_('NRI_' . strtoupper($this->getPrefix()));
}
public function isPro()
{
$versionFile = __DIR__ . "/version.php";
// If version file does not exist we assume a PRO version
if (!JFile::exists($versionFile))
{
return true;
}
// Load version file
require_once $versionFile;
return (bool) $NR_PRO;
}
public function getVersion($file = '')
{
$file = $file ?: $this->getCurrentXMLFile();
if (!is_file($file))
{
return '';
}
$xml = JInstaller::parseXMLInstallFile($file);
if (!$xml || !isset($xml['version']))
{
return '';
}
return $xml['version'];
}
/**
* Checks wether the extension can be installed or not
*
* @return boolean
*/
public function canInstall()
{
// The extension is not installed yet. Accept Install.
if (!$installed_version = $this->getVersion($this->getInstalledXMLFile()))
{
return true;
}
// Path to extension's version file
$versionFile = $this->getMainFolder() . "/version.php";
$NR_PRO = true;
// If version file does not exist we assume we have a PRO version installed
if (file_exists($versionFile))
{
require_once($versionFile);
}
// The free version is installed. Accept install.
if (!(bool)$NR_PRO)
{
return true;
}
// Current package is a PRO version. Accept install.
if ($this->isPro())
{
return true;
}
// User is trying to update from PRO version to FREE. Do not accept install.
JFactory::getLanguage()->load($this->getPrefix() . '_' . $this->extname, __DIR__);
JFactory::getApplication()->enqueueMessage(
JText::_('NRI_ERROR_PRO_TO_FREE'), 'error'
);
JFactory::getApplication()->enqueueMessage(
html_entity_decode(
JText::sprintf(
'NRI_ERROR_UNINSTALL_FIRST',
'<a href="http://www.tassos.gr/joomla-extensions/' . $this->alias . '" target="_blank">',
'</a>',
JText::_($this->name)
)
), 'error'
);
return false;
}
/**
* Checks if current version is newer than the installed one
* Used for Novarain Framework
*
* @return boolean [description]
*/
public function isNewer()
{
if (!$installed_version = $this->getVersion($this->getInstalledXMLFile()))
{
return true;
}
$package_version = $this->getVersion();
return version_compare($installed_version, $package_version, '<=');
}
/**
* Helper method triggered before installation
*
* @return bool
*/
public function onBeforeInstall()
{
if (!$this->canInstall())
{
return false;
}
}
/**
* Helper method triggered after installation
*/
public function onAfterInstall()
{
}
/**
* Delete files
*
* @param array $folders
*/
public function deleteFiles($files = array())
{
foreach ($files as $key => $file)
{
JFile::delete($file);
}
}
/**
* Deletes folders
*
* @param array $folders
*/
public function deleteFolders($folders = array())
{
foreach ($folders as $folder)
{
if (!is_dir($folder))
{
continue;
}
JFolder::delete($folder);
}
}
public function dropIndex($table, $index)
{
$db = $this->db;
// Check if index exists first
$query = 'SHOW INDEX FROM ' . $db->quoteName('#__' . $table) . ' WHERE KEY_NAME = ' . $db->quote($index);
$db->setQuery($query);
$db->execute();
if (!$db->loadResult())
{
return;
}
// Remove index
$query = 'ALTER TABLE ' . $db->quoteName('#__' . $table) . ' DROP INDEX ' . $db->quoteName($index);
$db->setQuery($query);
$db->execute();
}
public function dropUnwantedTables($tables) {
if (!$tables) {
return;
}
foreach ($tables as $table) {
$query = "DROP TABLE IF EXISTS #__".$this->db->escape($table);
$this->db->setQuery($query);
$this->db->execute();
}
}
public function dropUnwantedColumns($table, $columns) {
if (!$columns || !$table) {
return;
}
$db = $this->db;
// Check if columns exists in database
function qt($n) {
return(JFactory::getDBO()->quote($n));
}
$query = 'SHOW COLUMNS FROM #__'.$table.' WHERE Field IN ('.implode(",", array_map("qt", $columns)).')';
$db->setQuery($query);
$rows = $db->loadColumn(0);
// Abort if we don't have any rows
if (!$rows) {
return;
}
// Let's remove the columns
$q = "";
foreach ($rows as $key => $column) {
$comma = (($key+1) < count($rows)) ? "," : "";
$q .= "drop ".$this->db->escape($column).$comma;
}
$query = "alter table #__".$table." $q";
$db->setQuery($query);
$db->execute();
}
public function fetch($table, $columns = "*", $where = null, $singlerow = false) {
if (!$table) {
return;
}
$db = $this->db;
$query = $db->getQuery(true);
$query
->select($columns)
->from("#__$table");
if (isset($where)) {
$query->where("$where");
}
$db->setQuery($query);
return ($singlerow) ? $db->loadObject() : $db->loadObjectList();
}
/**
* Load the Novarain Framework
*
* @return boolean
*/
public function loadFramework()
{
if (is_file(JPATH_PLUGINS . '/system/nrframework/autoload.php'))
{
include_once JPATH_PLUGINS . '/system/nrframework/autoload.php';
}
}
/**
* Re-orders plugin after passed array of plugins
*
* @param string $plugin Plugin element name
* @param array $lowerPluginOrder Array of plugin element names
*
* @return boolean
*/
public function pluginOrderAfter($lowerPluginOrder)
{
if (!is_array($lowerPluginOrder) || !count($lowerPluginOrder))
{
return;
}
$db = $this->db;
// Get plugins max order
$query = $db->getQuery(true);
$query
->select($db->quoteName('b.ordering'))
->from($db->quoteName('#__extensions', 'b'))
->where($db->quoteName('b.element') . ' IN ("'.implode("\",\"",$lowerPluginOrder).'")')
->order('b.ordering desc');
$db->setQuery($query);
$maxOrder = $db->loadResult();
if (is_null($maxOrder))
{
return;
}
// Get plugin details
$query
->clear()
->select(array($db->quoteName('extension_id'), $db->quoteName('ordering')))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('element') . ' = ' . $db->quote($this->alias));
$db->setQuery($query);
$pluginInfo = $db->loadObject();
if (!isset($pluginInfo->ordering) || $pluginInfo->ordering > $maxOrder)
{
return;
}
// Update the new plugin order
$object = new stdClass();
$object->extension_id = $pluginInfo->extension_id;
$object->ordering = ($maxOrder + 1);
try {
$db->updateObject('#__extensions', $object, 'extension_id');
} catch (Exception $e) {
return $e->getMessage();
}
}
}

View File

@@ -0,0 +1,23 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
require_once __DIR__ . '/script.install.helper.php';
class PlgSystemConvertFormsInstallerScript extends PlgSystemConvertFormsInstallerScriptHelper
{
public $name = 'CONVERTFORMS';
public $alias = 'convertforms';
public $extension_type = 'plugin';
public $show_message = false;
}