2016-01-30 20:28:43 +00:00
|
|
|
<?php
|
|
|
|
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
|
|
|
__ __ _ _____ _ _ __ __ _ _ _
|
|
|
|
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
|
|
|
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
|
|
|
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
|
|
|
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
|
|
|
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
|
|
|
| |
|
|
|
|
|_|
|
|
|
|
/-------------------------------------------------------------------------------------------------------------------------------/
|
|
|
|
|
2017-10-06 14:53:22 +00:00
|
|
|
@version @update number 385 of this MVC
|
|
|
|
@build 6th October, 2017
|
2017-02-01 13:17:04 +00:00
|
|
|
@created 6th May, 2015
|
2016-01-30 20:28:43 +00:00
|
|
|
@package Component Builder
|
2017-02-16 14:02:23 +00:00
|
|
|
@subpackage joomla_component.php
|
2016-12-22 21:32:13 +00:00
|
|
|
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
2016-01-30 20:28:43 +00:00
|
|
|
@copyright Copyright (C) 2015. All Rights Reserved
|
|
|
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
|
|
|
|
Builds Complex Joomla Components
|
|
|
|
|
|
|
|
/-----------------------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
|
|
|
use Joomla\Registry\Registry;
|
|
|
|
|
|
|
|
// import Joomla modelform library
|
|
|
|
jimport('joomla.application.component.modeladmin');
|
|
|
|
|
|
|
|
/**
|
2017-02-16 14:02:23 +00:00
|
|
|
* Componentbuilder Joomla_component Model
|
2016-01-30 20:28:43 +00:00
|
|
|
*/
|
2017-02-16 14:02:23 +00:00
|
|
|
class ComponentbuilderModelJoomla_component extends JModelAdmin
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var string The prefix to use with controller messages.
|
|
|
|
* @since 1.6
|
|
|
|
*/
|
|
|
|
protected $text_prefix = 'COM_COMPONENTBUILDER';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type alias for this content type.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
* @since 3.2
|
|
|
|
*/
|
2017-02-16 14:02:23 +00:00
|
|
|
public $typeAlias = 'com_componentbuilder.joomla_component';
|
2016-01-30 20:28:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a Table object, always creating it
|
|
|
|
*
|
|
|
|
* @param type $type The table type to instantiate
|
|
|
|
* @param string $prefix A prefix for the table class name. Optional.
|
|
|
|
* @param array $config Configuration array for model. Optional.
|
|
|
|
*
|
|
|
|
* @return JTable A database object
|
|
|
|
*
|
|
|
|
* @since 1.6
|
|
|
|
*/
|
2017-02-16 14:02:23 +00:00
|
|
|
public function getTable($type = 'joomla_component', $prefix = 'ComponentbuilderTable', $config = array())
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
return JTable::getInstance($type, $prefix, $config);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to get a single record.
|
|
|
|
*
|
|
|
|
* @param integer $pk The id of the primary key.
|
|
|
|
*
|
|
|
|
* @return mixed Object on success, false on failure.
|
|
|
|
*
|
|
|
|
* @since 1.6
|
|
|
|
*/
|
|
|
|
public function getItem($pk = null)
|
|
|
|
{
|
|
|
|
if ($item = parent::getItem($pk))
|
|
|
|
{
|
|
|
|
if (!empty($item->params))
|
|
|
|
{
|
|
|
|
// Convert the params field to an array.
|
|
|
|
$registry = new Registry;
|
|
|
|
$registry->loadString($item->params);
|
|
|
|
$item->params = $registry->toArray();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($item->metadata))
|
|
|
|
{
|
|
|
|
// Convert the metadata field to an array.
|
|
|
|
$registry = new Registry;
|
|
|
|
$registry->loadString($item->metadata);
|
|
|
|
$item->metadata = $registry->toArray();
|
|
|
|
}
|
|
|
|
|
2017-10-06 14:53:22 +00:00
|
|
|
if (!empty($item->sql))
|
2017-02-02 11:54:07 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
// base64 Decode sql.
|
|
|
|
$item->sql = base64_decode($item->sql);
|
2017-02-02 11:54:07 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 14:53:22 +00:00
|
|
|
if (!empty($item->php_preflight_update))
|
2016-11-25 02:56:16 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
// base64 Decode php_preflight_update.
|
|
|
|
$item->php_preflight_update = base64_decode($item->php_preflight_update);
|
2016-11-25 02:56:16 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 14:53:22 +00:00
|
|
|
if (!empty($item->php_postflight_update))
|
2016-06-03 06:28:32 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
// base64 Decode php_postflight_update.
|
|
|
|
$item->php_postflight_update = base64_decode($item->php_postflight_update);
|
2016-06-03 06:28:32 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 14:53:22 +00:00
|
|
|
if (!empty($item->php_preflight_install))
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
// base64 Decode php_preflight_install.
|
|
|
|
$item->php_preflight_install = base64_decode($item->php_preflight_install);
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 14:53:22 +00:00
|
|
|
if (!empty($item->php_postflight_install))
|
2016-03-04 20:58:05 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
// base64 Decode php_postflight_install.
|
|
|
|
$item->php_postflight_install = base64_decode($item->php_postflight_install);
|
2017-03-18 11:16:07 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 14:53:22 +00:00
|
|
|
if (!empty($item->php_method_uninstall))
|
2017-03-18 11:16:07 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
// base64 Decode php_method_uninstall.
|
|
|
|
$item->php_method_uninstall = base64_decode($item->php_method_uninstall);
|
2017-03-03 21:53:18 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 14:53:22 +00:00
|
|
|
if (!empty($item->readme))
|
2017-03-03 21:53:18 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
// base64 Decode readme.
|
|
|
|
$item->readme = base64_decode($item->readme);
|
2016-03-04 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
2017-03-18 11:16:07 +00:00
|
|
|
if (!empty($item->php_helper_both))
|
|
|
|
{
|
|
|
|
// base64 Decode php_helper_both.
|
|
|
|
$item->php_helper_both = base64_decode($item->php_helper_both);
|
|
|
|
}
|
|
|
|
|
2016-12-30 10:47:19 +00:00
|
|
|
if (!empty($item->php_helper_admin))
|
2016-03-04 20:58:05 +00:00
|
|
|
{
|
2016-12-30 10:47:19 +00:00
|
|
|
// base64 Decode php_helper_admin.
|
|
|
|
$item->php_helper_admin = base64_decode($item->php_helper_admin);
|
2016-03-04 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
2016-12-30 10:47:19 +00:00
|
|
|
if (!empty($item->php_admin_event))
|
2016-03-04 20:58:05 +00:00
|
|
|
{
|
2016-12-30 10:47:19 +00:00
|
|
|
// base64 Decode php_admin_event.
|
|
|
|
$item->php_admin_event = base64_decode($item->php_admin_event);
|
2016-03-04 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
2016-12-30 10:47:19 +00:00
|
|
|
if (!empty($item->php_helper_site))
|
2016-06-03 06:28:32 +00:00
|
|
|
{
|
2016-12-30 10:47:19 +00:00
|
|
|
// base64 Decode php_helper_site.
|
|
|
|
$item->php_helper_site = base64_decode($item->php_helper_site);
|
2016-10-23 22:48:26 +00:00
|
|
|
}
|
|
|
|
|
2016-12-30 10:47:19 +00:00
|
|
|
if (!empty($item->php_site_event))
|
2016-10-23 22:48:26 +00:00
|
|
|
{
|
2016-12-30 10:47:19 +00:00
|
|
|
// base64 Decode php_site_event.
|
|
|
|
$item->php_site_event = base64_decode($item->php_site_event);
|
2016-10-23 22:48:26 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 14:53:22 +00:00
|
|
|
if (!empty($item->javascript))
|
|
|
|
{
|
|
|
|
// base64 Decode javascript.
|
|
|
|
$item->javascript = base64_decode($item->javascript);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($item->css))
|
|
|
|
{
|
|
|
|
// base64 Decode css.
|
|
|
|
$item->css = base64_decode($item->css);
|
|
|
|
}
|
|
|
|
|
2016-12-30 10:47:19 +00:00
|
|
|
if (!empty($item->php_dashboard_methods))
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-12-30 10:47:19 +00:00
|
|
|
// base64 Decode php_dashboard_methods.
|
|
|
|
$item->php_dashboard_methods = base64_decode($item->php_dashboard_methods);
|
|
|
|
}
|
|
|
|
|
2017-03-18 11:16:07 +00:00
|
|
|
if (!empty($item->buildcompsql))
|
|
|
|
{
|
|
|
|
// base64 Decode buildcompsql.
|
|
|
|
$item->buildcompsql = base64_decode($item->buildcompsql);
|
|
|
|
}
|
|
|
|
|
2017-09-13 00:37:43 +00:00
|
|
|
// Get the basic encryption.
|
2016-01-30 20:28:43 +00:00
|
|
|
$basickey = ComponentbuilderHelper::getCryptKey('basic');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Get the encryption object.
|
2016-01-30 20:28:43 +00:00
|
|
|
$basic = new FOFEncryptAes($basickey, 128);
|
|
|
|
|
2016-12-30 10:47:19 +00:00
|
|
|
if (!empty($item->whmcs_key) && $basickey && !is_numeric($item->whmcs_key) && $item->whmcs_key === base64_encode(base64_decode($item->whmcs_key, true)))
|
|
|
|
{
|
2017-09-13 00:37:43 +00:00
|
|
|
// basic decrypt data whmcs_key.
|
2016-12-30 10:47:19 +00:00
|
|
|
$item->whmcs_key = rtrim($basic->decryptString($item->whmcs_key), "\0");
|
2017-03-18 11:16:07 +00:00
|
|
|
}
|
|
|
|
|
2017-03-28 14:57:59 +00:00
|
|
|
if (!empty($item->export_key) && $basickey && !is_numeric($item->export_key) && $item->export_key === base64_encode(base64_decode($item->export_key, true)))
|
|
|
|
{
|
2017-09-13 00:37:43 +00:00
|
|
|
// basic decrypt data export_key.
|
2017-03-28 14:57:59 +00:00
|
|
|
$item->export_key = rtrim($basic->decryptString($item->export_key), "\0");
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($item->id))
|
|
|
|
{
|
|
|
|
$item->tags = new JHelperTags;
|
2017-02-16 14:02:23 +00:00
|
|
|
$item->tags->getTagIds($item->id, 'com_componentbuilder.joomla_component');
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
}
|
2016-02-26 13:57:30 +00:00
|
|
|
$this->idvvvv = $item->addadmin_views;
|
2016-12-30 10:47:19 +00:00
|
|
|
$this->idvvvw = $item->addcustom_admin_views;
|
2017-04-05 16:26:17 +00:00
|
|
|
$this->idvvvx = $item->addsite_views;
|
|
|
|
$this->componentsvvvy = $item->id;
|
2016-01-30 20:28:43 +00:00
|
|
|
|
|
|
|
return $item;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to get list data.
|
|
|
|
*
|
|
|
|
* @return mixed An array of data items on success, false on failure.
|
|
|
|
*/
|
2017-10-06 14:53:22 +00:00
|
|
|
public function getVwnadmin_views()
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
// Get the user object.
|
|
|
|
$user = JFactory::getUser();
|
|
|
|
// Create a new query object.
|
|
|
|
$db = JFactory::getDBO();
|
|
|
|
$query = $db->getQuery(true);
|
|
|
|
|
|
|
|
// Select some fields
|
|
|
|
$query->select('a.*');
|
|
|
|
|
|
|
|
// From the componentbuilder_admin_view table
|
|
|
|
$query->from($db->quoteName('#__componentbuilder_admin_view', 'a'));
|
|
|
|
|
|
|
|
// Join over the asset groups.
|
|
|
|
$query->select('ag.title AS access_level');
|
|
|
|
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
|
|
|
// Filter by access level.
|
|
|
|
if ($access = $this->getState('filter.access'))
|
|
|
|
{
|
|
|
|
$query->where('a.access = ' . (int) $access);
|
|
|
|
}
|
|
|
|
// Implement View Level Access
|
|
|
|
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
|
|
|
{
|
|
|
|
$groups = implode(',', $user->getAuthorisedViewLevels());
|
|
|
|
$query->where('a.access IN (' . $groups . ')');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Order the results by ordering
|
2016-04-22 12:03:43 +00:00
|
|
|
$query->order('a.published ASC');
|
2016-01-30 20:28:43 +00:00
|
|
|
$query->order('a.ordering ASC');
|
|
|
|
|
|
|
|
// Load the items
|
|
|
|
$db->setQuery($query);
|
|
|
|
$db->execute();
|
|
|
|
if ($db->getNumRows())
|
|
|
|
{
|
|
|
|
$items = $db->loadObjectList();
|
|
|
|
|
|
|
|
// set values to display correctly.
|
|
|
|
if (ComponentbuilderHelper::checkArray($items))
|
|
|
|
{
|
|
|
|
// get user object.
|
|
|
|
$user = JFactory::getUser();
|
|
|
|
foreach ($items as $nr => &$item)
|
|
|
|
{
|
|
|
|
$access = ($user->authorise('admin_view.access', 'com_componentbuilder.admin_view.' . (int) $item->id) && $user->authorise('admin_view.access', 'com_componentbuilder'));
|
|
|
|
if (!$access)
|
|
|
|
{
|
|
|
|
unset($items[$nr]);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Filter by id Repetable Field
|
2016-02-26 13:57:30 +00:00
|
|
|
$idvvvv = json_decode($this->idvvvv,true);
|
|
|
|
if (ComponentbuilderHelper::checkArray($items) && isset($idvvvv) && ComponentbuilderHelper::checkArray($idvvvv))
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
foreach ($items as $nr => &$item)
|
|
|
|
{
|
2016-02-26 13:57:30 +00:00
|
|
|
if ($item->id && isset($idvvvv['adminview']) && ComponentbuilderHelper::checkArray($idvvvv['adminview']))
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-02-26 13:57:30 +00:00
|
|
|
if (!in_array($item->id,$idvvvv['adminview']))
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
unset($items[$nr]);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2017-01-20 00:16:50 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
unset($items[$nr]);
|
|
|
|
continue;
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return $items;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to get list data.
|
|
|
|
*
|
|
|
|
* @return mixed An array of data items on success, false on failure.
|
|
|
|
*/
|
2017-10-06 14:53:22 +00:00
|
|
|
public function getVwocustom_admin_views()
|
2016-12-30 10:47:19 +00:00
|
|
|
{
|
|
|
|
// Get the user object.
|
|
|
|
$user = JFactory::getUser();
|
|
|
|
// Create a new query object.
|
|
|
|
$db = JFactory::getDBO();
|
|
|
|
$query = $db->getQuery(true);
|
|
|
|
|
|
|
|
// Select some fields
|
|
|
|
$query->select('a.*');
|
|
|
|
|
|
|
|
// From the componentbuilder_custom_admin_view table
|
|
|
|
$query->from($db->quoteName('#__componentbuilder_custom_admin_view', 'a'));
|
|
|
|
|
|
|
|
// From the componentbuilder_snippet table.
|
|
|
|
$query->select($db->quoteName('g.name','snippet_name'));
|
|
|
|
$query->join('LEFT', $db->quoteName('#__componentbuilder_snippet', 'g') . ' ON (' . $db->quoteName('a.snippet') . ' = ' . $db->quoteName('g.id') . ')');
|
|
|
|
|
|
|
|
// Join over the asset groups.
|
|
|
|
$query->select('ag.title AS access_level');
|
|
|
|
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
|
|
|
// Filter by access level.
|
|
|
|
if ($access = $this->getState('filter.access'))
|
|
|
|
{
|
|
|
|
$query->where('a.access = ' . (int) $access);
|
|
|
|
}
|
|
|
|
// Implement View Level Access
|
|
|
|
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
|
|
|
{
|
|
|
|
$groups = implode(',', $user->getAuthorisedViewLevels());
|
|
|
|
$query->where('a.access IN (' . $groups . ')');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Order the results by ordering
|
|
|
|
$query->order('a.published ASC');
|
|
|
|
$query->order('a.ordering ASC');
|
|
|
|
|
|
|
|
// Load the items
|
|
|
|
$db->setQuery($query);
|
|
|
|
$db->execute();
|
|
|
|
if ($db->getNumRows())
|
|
|
|
{
|
|
|
|
$items = $db->loadObjectList();
|
|
|
|
|
|
|
|
// set values to display correctly.
|
|
|
|
if (ComponentbuilderHelper::checkArray($items))
|
|
|
|
{
|
|
|
|
// get user object.
|
|
|
|
$user = JFactory::getUser();
|
|
|
|
foreach ($items as $nr => &$item)
|
|
|
|
{
|
|
|
|
$access = ($user->authorise('custom_admin_view.access', 'com_componentbuilder.custom_admin_view.' . (int) $item->id) && $user->authorise('custom_admin_view.access', 'com_componentbuilder'));
|
|
|
|
if (!$access)
|
|
|
|
{
|
|
|
|
unset($items[$nr]);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Filter by id Repetable Field
|
|
|
|
$idvvvw = json_decode($this->idvvvw,true);
|
|
|
|
if (ComponentbuilderHelper::checkArray($items) && isset($idvvvw) && ComponentbuilderHelper::checkArray($idvvvw))
|
|
|
|
{
|
|
|
|
foreach ($items as $nr => &$item)
|
|
|
|
{
|
|
|
|
if ($item->id && isset($idvvvw['customadminview']) && ComponentbuilderHelper::checkArray($idvvvw['customadminview']))
|
|
|
|
{
|
|
|
|
if (!in_array($item->id,$idvvvw['customadminview']))
|
|
|
|
{
|
|
|
|
unset($items[$nr]);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2017-01-20 00:16:50 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
unset($items[$nr]);
|
|
|
|
continue;
|
|
|
|
}
|
2016-12-30 10:47:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return $items;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to get list data.
|
|
|
|
*
|
|
|
|
* @return mixed An array of data items on success, false on failure.
|
|
|
|
*/
|
2017-10-06 14:53:22 +00:00
|
|
|
public function getVwpsite_views()
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
// Get the user object.
|
|
|
|
$user = JFactory::getUser();
|
|
|
|
// Create a new query object.
|
|
|
|
$db = JFactory::getDBO();
|
|
|
|
$query = $db->getQuery(true);
|
|
|
|
|
|
|
|
// Select some fields
|
|
|
|
$query->select('a.*');
|
|
|
|
|
|
|
|
// From the componentbuilder_site_view table
|
|
|
|
$query->from($db->quoteName('#__componentbuilder_site_view', 'a'));
|
|
|
|
|
|
|
|
// From the componentbuilder_snippet table.
|
|
|
|
$query->select($db->quoteName('g.name','snippet_name'));
|
|
|
|
$query->join('LEFT', $db->quoteName('#__componentbuilder_snippet', 'g') . ' ON (' . $db->quoteName('a.snippet') . ' = ' . $db->quoteName('g.id') . ')');
|
|
|
|
|
|
|
|
// Join over the asset groups.
|
|
|
|
$query->select('ag.title AS access_level');
|
|
|
|
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
|
|
|
// Filter by access level.
|
|
|
|
if ($access = $this->getState('filter.access'))
|
|
|
|
{
|
|
|
|
$query->where('a.access = ' . (int) $access);
|
|
|
|
}
|
|
|
|
// Implement View Level Access
|
|
|
|
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
|
|
|
{
|
|
|
|
$groups = implode(',', $user->getAuthorisedViewLevels());
|
|
|
|
$query->where('a.access IN (' . $groups . ')');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Order the results by ordering
|
2016-04-22 12:03:43 +00:00
|
|
|
$query->order('a.published ASC');
|
2016-01-30 20:28:43 +00:00
|
|
|
$query->order('a.ordering ASC');
|
|
|
|
|
|
|
|
// Load the items
|
|
|
|
$db->setQuery($query);
|
|
|
|
$db->execute();
|
|
|
|
if ($db->getNumRows())
|
|
|
|
{
|
|
|
|
$items = $db->loadObjectList();
|
|
|
|
|
|
|
|
// set values to display correctly.
|
|
|
|
if (ComponentbuilderHelper::checkArray($items))
|
|
|
|
{
|
|
|
|
// get user object.
|
|
|
|
$user = JFactory::getUser();
|
|
|
|
foreach ($items as $nr => &$item)
|
|
|
|
{
|
|
|
|
$access = ($user->authorise('site_view.access', 'com_componentbuilder.site_view.' . (int) $item->id) && $user->authorise('site_view.access', 'com_componentbuilder'));
|
|
|
|
if (!$access)
|
|
|
|
{
|
|
|
|
unset($items[$nr]);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Filter by id Repetable Field
|
2016-12-30 10:47:19 +00:00
|
|
|
$idvvvx = json_decode($this->idvvvx,true);
|
|
|
|
if (ComponentbuilderHelper::checkArray($items) && isset($idvvvx) && ComponentbuilderHelper::checkArray($idvvvx))
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
foreach ($items as $nr => &$item)
|
|
|
|
{
|
2016-12-30 10:47:19 +00:00
|
|
|
if ($item->id && isset($idvvvx['siteview']) && ComponentbuilderHelper::checkArray($idvvvx['siteview']))
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-12-30 10:47:19 +00:00
|
|
|
if (!in_array($item->id,$idvvvx['siteview']))
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
unset($items[$nr]);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2017-01-20 00:16:50 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
unset($items[$nr]);
|
|
|
|
continue;
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return $items;
|
|
|
|
}
|
|
|
|
return false;
|
2017-04-05 16:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to get list data.
|
|
|
|
*
|
|
|
|
* @return mixed An array of data items on success, false on failure.
|
|
|
|
*/
|
2017-10-06 14:53:22 +00:00
|
|
|
public function getVwqtranslation()
|
2017-04-05 16:26:17 +00:00
|
|
|
{
|
|
|
|
// Get the user object.
|
|
|
|
$user = JFactory::getUser();
|
|
|
|
// Create a new query object.
|
|
|
|
$db = JFactory::getDBO();
|
|
|
|
$query = $db->getQuery(true);
|
|
|
|
|
|
|
|
// Select some fields
|
|
|
|
$query->select('a.*');
|
|
|
|
|
|
|
|
// From the componentbuilder_language_translation table
|
|
|
|
$query->from($db->quoteName('#__componentbuilder_language_translation', 'a'));
|
|
|
|
|
|
|
|
// Join over the asset groups.
|
|
|
|
$query->select('ag.title AS access_level');
|
|
|
|
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
|
|
|
// Filter by access level.
|
|
|
|
if ($access = $this->getState('filter.access'))
|
|
|
|
{
|
|
|
|
$query->where('a.access = ' . (int) $access);
|
|
|
|
}
|
|
|
|
// Implement View Level Access
|
|
|
|
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
|
|
|
{
|
|
|
|
$groups = implode(',', $user->getAuthorisedViewLevels());
|
|
|
|
$query->where('a.access IN (' . $groups . ')');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Order the results by ordering
|
|
|
|
$query->order('a.published ASC');
|
|
|
|
$query->order('a.ordering ASC');
|
|
|
|
|
|
|
|
// Load the items
|
|
|
|
$db->setQuery($query);
|
|
|
|
$db->execute();
|
|
|
|
if ($db->getNumRows())
|
|
|
|
{
|
|
|
|
$items = $db->loadObjectList();
|
|
|
|
|
|
|
|
// set values to display correctly.
|
|
|
|
if (ComponentbuilderHelper::checkArray($items))
|
|
|
|
{
|
|
|
|
// get user object.
|
|
|
|
$user = JFactory::getUser();
|
|
|
|
foreach ($items as $nr => &$item)
|
|
|
|
{
|
|
|
|
$access = ($user->authorise('language_translation.access', 'com_componentbuilder.language_translation.' . (int) $item->id) && $user->authorise('language_translation.access', 'com_componentbuilder'));
|
|
|
|
if (!$access)
|
|
|
|
{
|
|
|
|
unset($items[$nr]);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Filter by componentsvvvy Array Field
|
|
|
|
$componentsvvvy = $this->componentsvvvy;
|
|
|
|
if (ComponentbuilderHelper::checkArray($items) && $componentsvvvy)
|
|
|
|
{
|
2017-09-13 00:37:43 +00:00
|
|
|
foreach ($items as $nr => &$item)
|
|
|
|
{
|
|
|
|
if (ComponentbuilderHelper::checkJson($item->components))
|
|
|
|
{
|
|
|
|
$item->components = json_decode($item->components, true);
|
|
|
|
}
|
|
|
|
elseif (!isset($item->components) || !ComponentbuilderHelper::checkArray($item->components))
|
|
|
|
{
|
|
|
|
unset($items[$nr]);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (!in_array($componentsvvvy,$item->components))
|
|
|
|
{
|
|
|
|
unset($items[$nr]);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// show all languages that are already set for this string
|
|
|
|
if (!isset($_export) && ComponentbuilderHelper::checkArray($items))
|
|
|
|
{
|
|
|
|
foreach ($items as $nr => &$item)
|
|
|
|
{
|
|
|
|
$langBucket = array();
|
|
|
|
if (ComponentbuilderHelper::checkJson($item->translation))
|
|
|
|
{
|
|
|
|
$translations = json_decode($item->translation, true);
|
2017-09-18 00:18:23 +00:00
|
|
|
if (ComponentbuilderHelper::checkArray($translations))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
2017-09-18 00:18:23 +00:00
|
|
|
foreach ($translations as $language)
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
2017-09-18 00:18:23 +00:00
|
|
|
if (isset($language['translation']) && ComponentbuilderHelper::checkString($language['translation'])
|
|
|
|
&& isset($language['language']) && ComponentbuilderHelper::checkString($language['language']))
|
|
|
|
{
|
|
|
|
$langBucket[$language['language']] = $language['language'];
|
|
|
|
}
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// set how many component use this string
|
|
|
|
$componentCounter = '';
|
|
|
|
if (ComponentbuilderHelper::checkJson($item->components))
|
|
|
|
{
|
|
|
|
$item->components = json_decode($item->components, true);
|
|
|
|
}
|
|
|
|
if (ComponentbuilderHelper::checkArray($item->components))
|
|
|
|
{
|
|
|
|
$componentCounter = ' - <small>' . JText::_('COM_COMPONENTBUILDER_USED_IN') . ' ' . count($item->components) . '</small>';
|
|
|
|
}
|
|
|
|
// load the languages to the string
|
|
|
|
if (ComponentbuilderHelper::checkArray($langBucket))
|
|
|
|
{
|
|
|
|
$item->entranslation = '<small><em>(' . implode(', ', $langBucket) . ')</em></small> ' . ComponentbuilderHelper::htmlEscape($item->entranslation, 'UTF-8', true, 150) . $componentCounter;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$item->entranslation = '<small><em>(' . JText::_('COM_COMPONENTBUILDER_NOTRANSLATION') . ')</em></small> ' . ComponentbuilderHelper::htmlEscape($item->entranslation, 'UTF-8', true, 150) . $componentCounter;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $items;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to get the record form.
|
|
|
|
*
|
|
|
|
* @param array $data Data for the form.
|
|
|
|
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
|
|
|
*
|
|
|
|
* @return mixed A JForm object on success, false on failure
|
|
|
|
*
|
|
|
|
* @since 1.6
|
|
|
|
*/
|
|
|
|
public function getForm($data = array(), $loadData = true)
|
|
|
|
{
|
|
|
|
// Get the form.
|
|
|
|
$form = $this->loadForm('com_componentbuilder.joomla_component', 'joomla_component', array('control' => 'jform', 'load_data' => $loadData));
|
|
|
|
|
|
|
|
if (empty($form))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$jinput = JFactory::getApplication()->input;
|
|
|
|
|
|
|
|
// The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
|
|
|
|
if ($jinput->get('a_id'))
|
|
|
|
{
|
|
|
|
$id = $jinput->get('a_id', 0, 'INT');
|
|
|
|
}
|
|
|
|
// The back end uses id so we use that the rest of the time and set it to 0 by default.
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$id = $jinput->get('id', 0, 'INT');
|
|
|
|
}
|
|
|
|
|
|
|
|
$user = JFactory::getUser();
|
|
|
|
|
|
|
|
// Check for existing item.
|
|
|
|
// Modify the form based on Edit State access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('core.edit.state', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('core.edit.state', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('ordering', 'disabled', 'true');
|
|
|
|
$form->setFieldAttribute('published', 'disabled', 'true');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('ordering', 'filter', 'unset');
|
|
|
|
$form->setFieldAttribute('published', 'filter', 'unset');
|
|
|
|
}
|
|
|
|
// If this is a new item insure the greated by is set.
|
|
|
|
if (0 == $id)
|
|
|
|
{
|
|
|
|
// Set the created_by to this user
|
|
|
|
$form->setValue('created_by', null, $user->id);
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Creaded By access controls.
|
|
|
|
if (!$user->authorise('core.edit.created_by', 'com_componentbuilder'))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('created_by', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('created_by', 'readonly', 'true');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('created_by', 'filter', 'unset');
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Creaded Date access controls.
|
|
|
|
if (!$user->authorise('core.edit.created', 'com_componentbuilder'))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('created', 'disabled', 'true');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('created', 'filter', 'unset');
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit System Name access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.system_name', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.system_name', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('system_name', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('system_name', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('system_name'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('system_name', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('system_name', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Name Code access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.name_code', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.name_code', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('name_code', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('name_code', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('name_code'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('name_code', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('name_code', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Component Version access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.component_version', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.component_version', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('component_version', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('component_version', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('component_version'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('component_version', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('component_version', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Short Description access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.short_description', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.short_description', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('short_description', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('short_description', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('short_description'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('short_description', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('short_description', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Companyname access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.companyname', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.companyname', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('companyname', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('companyname', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('companyname'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('companyname', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('companyname', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Author access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.author', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.author', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('author', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('author', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('author'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('author', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('author', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Sql access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.sql', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.sql', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('sql', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('sql', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('sql'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('sql', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('sql', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Add Css access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_css', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_css', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_css', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_css', 'readonly', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable radio button for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$class = $form->getFieldAttribute('add_css', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_css', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_css'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_css', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_css', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Description access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.description', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.description', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('description', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('description', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('description'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('description', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('description', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Add Admin Event access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_admin_event', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_admin_event', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_admin_event', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_admin_event', 'readonly', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable radio button for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$class = $form->getFieldAttribute('add_admin_event', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_admin_event', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_admin_event'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_admin_event', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_admin_event', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Copyright access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.copyright', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.copyright', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('copyright', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('copyright', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('copyright'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('copyright', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('copyright', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Php Preflight Update access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.php_preflight_update', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.php_preflight_update', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_preflight_update', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_preflight_update', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('php_preflight_update'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_preflight_update', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_preflight_update', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Debug Linenr access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.debug_linenr', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.debug_linenr', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('debug_linenr', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('debug_linenr', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('debug_linenr', 'class', '');
|
|
|
|
$form->setFieldAttribute('debug_linenr', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('debug_linenr'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('debug_linenr', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('debug_linenr', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Mvc Versiondate access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.mvc_versiondate', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.mvc_versiondate', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('mvc_versiondate', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('mvc_versiondate', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('mvc_versiondate', 'class', '');
|
|
|
|
$form->setFieldAttribute('mvc_versiondate', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('mvc_versiondate'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('mvc_versiondate', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('mvc_versiondate', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Add Site Event access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_site_event', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_site_event', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_site_event', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_site_event', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('add_site_event', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_site_event', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_site_event'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_site_event', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_site_event', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Name access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.name', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.name', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('name', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('name', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('name'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('name', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('name', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Dashboard Tab access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.dashboard_tab', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.dashboard_tab', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('dashboard_tab', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('dashboard_tab', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('dashboard_tab', 'class', '');
|
|
|
|
$form->setFieldAttribute('dashboard_tab', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('dashboard_tab'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('dashboard_tab', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('dashboard_tab', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Creatuserhelper access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.creatuserhelper', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.creatuserhelper', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('creatuserhelper', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('creatuserhelper', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('creatuserhelper', 'class', '');
|
|
|
|
$form->setFieldAttribute('creatuserhelper', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('creatuserhelper'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('creatuserhelper', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('creatuserhelper', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Php Postflight Update access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.php_postflight_update', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.php_postflight_update', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_postflight_update', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_postflight_update', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('php_postflight_update'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_postflight_update', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_postflight_update', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Add Php Helper Both access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_php_helper_both', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_php_helper_both', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_php_helper_both', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_php_helper_both', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('add_php_helper_both', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_php_helper_both', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_php_helper_both'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_php_helper_both', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_php_helper_both', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Version Update access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.version_update', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.version_update', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('version_update', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('version_update', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('version_update', 'class', '');
|
|
|
|
$form->setFieldAttribute('version_update', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('version_update'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('version_update', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('version_update', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Email access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.email', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.email', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('email', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('email', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('email'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('email', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('email', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Sales Server Ftp access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.sales_server_ftp', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.sales_server_ftp', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('sales_server_ftp', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('sales_server_ftp', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('sales_server_ftp'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('sales_server_ftp', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('sales_server_ftp', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Website access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.website', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.website', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('website', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('website', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('website'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('website', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('website', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Export Package Link access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.export_package_link', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.export_package_link', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('export_package_link', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('export_package_link', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('export_package_link'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('export_package_link', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('export_package_link', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Add License access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_license', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_license', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_license', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_license', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('add_license', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_license', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_license'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_license', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_license', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Addfootable access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.addfootable', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.addfootable', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addfootable', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addfootable', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('addfootable', 'class', '');
|
|
|
|
$form->setFieldAttribute('addfootable', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('addfootable'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addfootable', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addfootable', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit License Type access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.license_type', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.license_type', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('license_type', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('license_type', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('license_type'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('license_type', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('license_type', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Add Php Helper Admin access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_php_helper_admin', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_php_helper_admin', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_php_helper_admin', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_php_helper_admin', 'readonly', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable radio button for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$class = $form->getFieldAttribute('add_php_helper_admin', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_php_helper_admin', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_php_helper_admin'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_php_helper_admin', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_php_helper_admin', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Add Php Helper Site access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_php_helper_site', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_php_helper_site', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_php_helper_site', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_php_helper_site', 'readonly', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable radio button for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$class = $form->getFieldAttribute('add_php_helper_site', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_php_helper_site', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_php_helper_site'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_php_helper_site', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_php_helper_site', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Whmcs Key access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.whmcs_key', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.whmcs_key', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('whmcs_key', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('whmcs_key', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('whmcs_key'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('whmcs_key', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('whmcs_key', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Add Javascript access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_javascript', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_javascript', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_javascript', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_javascript', 'readonly', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable radio button for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$class = $form->getFieldAttribute('add_javascript', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_javascript', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_javascript'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_javascript', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_javascript', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Whmcs Url access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.whmcs_url', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.whmcs_url', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('whmcs_url', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('whmcs_url', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('whmcs_url'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('whmcs_url', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('whmcs_url', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Add Php Dashboard Methods access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_php_dashboard_methods', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_php_dashboard_methods', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_php_dashboard_methods', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_php_dashboard_methods', 'readonly', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable radio button for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$class = $form->getFieldAttribute('add_php_dashboard_methods', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_php_dashboard_methods', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_php_dashboard_methods'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_php_dashboard_methods', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_php_dashboard_methods', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit License access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.license', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.license', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('license', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('license', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('license'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('license', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('license', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Php Preflight Install access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.php_preflight_install', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.php_preflight_install', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_preflight_install', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_preflight_install', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('php_preflight_install'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_preflight_install', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_preflight_install', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Bom access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.bom', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.bom', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('bom', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('bom', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('bom'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('bom', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('bom', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Php Postflight Install access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.php_postflight_install', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.php_postflight_install', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_postflight_install', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_postflight_install', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('php_postflight_install'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_postflight_install', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_postflight_install', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Image access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.image', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.image', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('image', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('image', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('image'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('image', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('image', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Php Method Uninstall access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.php_method_uninstall', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.php_method_uninstall', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_method_uninstall', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_method_uninstall', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('php_method_uninstall'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_method_uninstall', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('php_method_uninstall', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Add Update Server access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_update_server', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_update_server', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_update_server', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_update_server', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('add_update_server', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_update_server', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_update_server'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_update_server', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_update_server', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Readme access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.readme', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.readme', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('readme', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('readme', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('readme'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('readme', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('readme', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Update Server Target access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.update_server_target', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.update_server_target', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('update_server_target', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('update_server_target', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('update_server_target', 'class', '');
|
|
|
|
$form->setFieldAttribute('update_server_target', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('update_server_target'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('update_server_target', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('update_server_target', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Update Server Ftp access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.update_server_ftp', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.update_server_ftp', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('update_server_ftp', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('update_server_ftp', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('update_server_ftp'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('update_server_ftp', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('update_server_ftp', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Addadmin Views access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.addadmin_views', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.addadmin_views', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addadmin_views', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addadmin_views', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('addadmin_views', 'class', '');
|
|
|
|
$form->setFieldAttribute('addadmin_views', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('addadmin_views'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addadmin_views', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addadmin_views', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Buildcomp access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.buildcomp', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.buildcomp', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('buildcomp', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('buildcomp', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('buildcomp', 'class', '');
|
|
|
|
$form->setFieldAttribute('buildcomp', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('buildcomp'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('buildcomp', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('buildcomp', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Addcustom Admin Views access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.addcustom_admin_views', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.addcustom_admin_views', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addcustom_admin_views', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addcustom_admin_views', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('addcustom_admin_views', 'class', '');
|
|
|
|
$form->setFieldAttribute('addcustom_admin_views', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('addcustom_admin_views'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addcustom_admin_views', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addcustom_admin_views', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Export Key access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.export_key', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.export_key', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('export_key', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('export_key', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('export_key'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('export_key', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('export_key', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Addsite Views access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.addsite_views', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.addsite_views', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addsite_views', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addsite_views', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('addsite_views', 'class', '');
|
|
|
|
$form->setFieldAttribute('addsite_views', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('addsite_views'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addsite_views', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addsite_views', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Export Buy Link access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.export_buy_link', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.export_buy_link', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('export_buy_link', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('export_buy_link', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('export_buy_link'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('export_buy_link', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('export_buy_link', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Adduikit access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.adduikit', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.adduikit', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('adduikit', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('adduikit', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('adduikit', 'class', '');
|
|
|
|
$form->setFieldAttribute('adduikit', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('adduikit'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('adduikit', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('adduikit', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Add Email Helper access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_email_helper', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_email_helper', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_email_helper', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_email_helper', 'readonly', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable radio button for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$class = $form->getFieldAttribute('add_email_helper', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_email_helper', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_email_helper'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_email_helper', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('add_email_helper', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Sql Tweak access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.sql_tweak', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.sql_tweak', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('sql_tweak', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('sql_tweak', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('sql_tweak', 'class', '');
|
|
|
|
$form->setFieldAttribute('sql_tweak', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('sql_tweak'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('sql_tweak', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('sql_tweak', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Php Helper Both access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.php_helper_both', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.php_helper_both', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('php_helper_both', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('php_helper_both', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('php_helper_both'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('php_helper_both', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('php_helper_both', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Php Helper Admin access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.php_helper_admin', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.php_helper_admin', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('php_helper_admin', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('php_helper_admin', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('php_helper_admin'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('php_helper_admin', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('php_helper_admin', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Php Admin Event access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.php_admin_event', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.php_admin_event', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('php_admin_event', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('php_admin_event', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('php_admin_event'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('php_admin_event', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('php_admin_event', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-09-13 00:37:43 +00:00
|
|
|
// Modify the form based on Edit Addcustommenus access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.addcustommenus', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.addcustommenus', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addcustommenus', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addcustommenus', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('addcustommenus', 'class', '');
|
|
|
|
$form->setFieldAttribute('addcustommenus', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('addcustommenus'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addcustommenus', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addcustommenus', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Php Helper Site access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.php_helper_site', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.php_helper_site', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('php_helper_site', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('php_helper_site', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('php_helper_site'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('php_helper_site', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('php_helper_site', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Php Site Event access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.php_site_event', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.php_site_event', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('php_site_event', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('php_site_event', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('php_site_event'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('php_site_event', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('php_site_event', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Javascript access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.javascript', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.javascript', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('javascript', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('javascript', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('javascript'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('javascript', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('javascript', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-09-13 00:37:43 +00:00
|
|
|
// Modify the form based on Edit Addconfig access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.addconfig', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.addconfig', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addconfig', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addconfig', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('addconfig', 'class', '');
|
|
|
|
$form->setFieldAttribute('addconfig', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('addconfig'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addconfig', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addconfig', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Css access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.css', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.css', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('css', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('css', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('css'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('css', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('css', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-09-13 00:37:43 +00:00
|
|
|
// Modify the form based on Edit Php Dashboard Methods access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.php_dashboard_methods', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.php_dashboard_methods', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('php_dashboard_methods', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('php_dashboard_methods', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('php_dashboard_methods'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('php_dashboard_methods', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('php_dashboard_methods', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Addcontributors access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.addcontributors', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.addcontributors', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addcontributors', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addcontributors', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('addcontributors', 'class', '');
|
|
|
|
$form->setFieldAttribute('addcontributors', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('addcontributors'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addcontributors', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addcontributors', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-09-13 00:37:43 +00:00
|
|
|
// Modify the form based on Edit Add Php Preflight Install access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_php_preflight_install', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_php_preflight_install', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_php_preflight_install', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_php_preflight_install', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('add_php_preflight_install', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_php_preflight_install', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_php_preflight_install'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_php_preflight_install', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_php_preflight_install', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Emptycontributors access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.emptycontributors', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.emptycontributors', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('emptycontributors', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('emptycontributors', 'readonly', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable radio button for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$class = $form->getFieldAttribute('emptycontributors', 'class', '');
|
|
|
|
$form->setFieldAttribute('emptycontributors', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('emptycontributors'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('emptycontributors', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('emptycontributors', 'required', 'false');
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Modify the form based on Edit Add Php Preflight Update access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_php_preflight_update', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_php_preflight_update', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_php_preflight_update', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_php_preflight_update', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('add_php_preflight_update', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_php_preflight_update', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_php_preflight_update'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_php_preflight_update', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_php_preflight_update', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Number access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.number', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.number', 'com_componentbuilder')))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('number', 'disabled', 'true');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('number', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('number'))
|
2017-09-13 00:37:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('number', 'filter', 'unset');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('number', 'required', 'false');
|
2017-04-05 16:26:17 +00:00
|
|
|
}
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
// Modify the form based on Edit Add Php Postflight Install access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_php_postflight_install', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_php_postflight_install', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_php_postflight_install', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_php_postflight_install', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('add_php_postflight_install', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_php_postflight_install', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_php_postflight_install'))
|
2017-04-05 16:26:17 +00:00
|
|
|
{
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_php_postflight_install', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_php_postflight_install', 'required', 'false');
|
2017-04-05 16:26:17 +00:00
|
|
|
}
|
2017-09-13 00:37:43 +00:00
|
|
|
}
|
|
|
|
// Modify the form based on Edit Add Php Postflight Update access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_php_postflight_update', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_php_postflight_update', 'com_componentbuilder')))
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_php_postflight_update', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_php_postflight_update', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('add_php_postflight_update', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_php_postflight_update', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_php_postflight_update'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_php_postflight_update', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_php_postflight_update', 'required', 'false');
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2017-09-13 00:37:43 +00:00
|
|
|
// Modify the form based on Edit Add Php Method Uninstall access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_php_method_uninstall', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_php_method_uninstall', 'com_componentbuilder')))
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_php_method_uninstall', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_php_method_uninstall', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('add_php_method_uninstall', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_php_method_uninstall', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_php_method_uninstall'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_php_method_uninstall', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_php_method_uninstall', 'required', 'false');
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2017-09-13 00:37:43 +00:00
|
|
|
// Modify the form based on Edit Addfiles access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.addfiles', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.addfiles', 'com_componentbuilder')))
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-09-13 00:37:43 +00:00
|
|
|
$form->setFieldAttribute('addfiles', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addfiles', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('addfiles', 'class', '');
|
|
|
|
$form->setFieldAttribute('addfiles', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('addfiles'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addfiles', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addfiles', 'required', 'false');
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Add Sql access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_sql', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_sql', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_sql', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_sql', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('add_sql', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_sql', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_sql'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_sql', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_sql', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-09-13 00:37:43 +00:00
|
|
|
// Modify the form based on Edit Addreadme access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.addreadme', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.addreadme', 'com_componentbuilder')))
|
2016-02-20 18:13:00 +00:00
|
|
|
{
|
2017-09-13 00:37:43 +00:00
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addreadme', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addreadme', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('addreadme', 'class', '');
|
|
|
|
$form->setFieldAttribute('addreadme', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('addreadme'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addreadme', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addreadme', 'required', 'false');
|
|
|
|
}
|
2016-02-20 18:13:00 +00:00
|
|
|
}
|
2017-09-13 00:37:43 +00:00
|
|
|
// Modify the form based on Edit Addfolders access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.addfolders', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.addfolders', 'com_componentbuilder')))
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-09-13 00:37:43 +00:00
|
|
|
$form->setFieldAttribute('addfolders', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('addfolders', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('addfolders', 'class', '');
|
|
|
|
$form->setFieldAttribute('addfolders', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('addfolders'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addfolders', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('addfolders', 'required', 'false');
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Update Server access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.update_server', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.update_server', 'com_componentbuilder')))
|
2017-02-16 14:02:23 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('update_server', 'disabled', 'true');
|
2017-02-16 14:02:23 +00:00
|
|
|
// Disable fields for display.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('update_server', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('update_server'))
|
2017-02-16 14:02:23 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('update_server', 'filter', 'unset');
|
2017-02-16 14:02:23 +00:00
|
|
|
// Disable fields while saving.
|
2017-10-06 14:53:22 +00:00
|
|
|
$form->setFieldAttribute('update_server', 'required', 'false');
|
2017-02-16 14:02:23 +00:00
|
|
|
}
|
|
|
|
}
|
2017-09-13 00:37:43 +00:00
|
|
|
// Modify the form based on Edit Toignore access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.toignore', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.toignore', 'com_componentbuilder')))
|
2017-02-16 14:02:23 +00:00
|
|
|
{
|
|
|
|
// Disable fields for display.
|
2017-09-13 00:37:43 +00:00
|
|
|
$form->setFieldAttribute('toignore', 'disabled', 'true');
|
2017-02-16 14:02:23 +00:00
|
|
|
// Disable fields for display.
|
2017-09-13 00:37:43 +00:00
|
|
|
$form->setFieldAttribute('toignore', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('toignore'))
|
2017-02-16 14:02:23 +00:00
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
2017-09-13 00:37:43 +00:00
|
|
|
$form->setFieldAttribute('toignore', 'filter', 'unset');
|
2017-02-16 14:02:23 +00:00
|
|
|
// Disable fields while saving.
|
2017-09-13 00:37:43 +00:00
|
|
|
$form->setFieldAttribute('toignore', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-10-06 14:53:22 +00:00
|
|
|
// Modify the form based on Edit Add Sales Server access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.add_sales_server', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.add_sales_server', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_sales_server', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('add_sales_server', 'readonly', 'true');
|
|
|
|
// Disable radio button for display.
|
|
|
|
$class = $form->getFieldAttribute('add_sales_server', 'class', '');
|
|
|
|
$form->setFieldAttribute('add_sales_server', 'class', $class.' disabled no-click');
|
|
|
|
if (!$form->getValue('add_sales_server'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_sales_server', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('add_sales_server', 'required', 'false');
|
|
|
|
}
|
|
|
|
}
|
2017-09-13 00:37:43 +00:00
|
|
|
// Modify the form based on Edit Buildcompsql access controls.
|
|
|
|
if ($id != 0 && (!$user->authorise('joomla_component.edit.buildcompsql', 'com_componentbuilder.joomla_component.' . (int) $id))
|
|
|
|
|| ($id == 0 && !$user->authorise('joomla_component.edit.buildcompsql', 'com_componentbuilder')))
|
|
|
|
{
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('buildcompsql', 'disabled', 'true');
|
|
|
|
// Disable fields for display.
|
|
|
|
$form->setFieldAttribute('buildcompsql', 'readonly', 'true');
|
|
|
|
if (!$form->getValue('buildcompsql'))
|
|
|
|
{
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('buildcompsql', 'filter', 'unset');
|
|
|
|
// Disable fields while saving.
|
|
|
|
$form->setFieldAttribute('buildcompsql', 'required', 'false');
|
2017-02-16 14:02:23 +00:00
|
|
|
}
|
|
|
|
}
|
2016-02-20 18:13:00 +00:00
|
|
|
// Only load these values if no id is found
|
|
|
|
if (0 == $id)
|
|
|
|
{
|
|
|
|
// Set redirected field name
|
|
|
|
$redirectedField = $jinput->get('ref', null, 'STRING');
|
|
|
|
// Set redirected field value
|
|
|
|
$redirectedValue = $jinput->get('refid', 0, 'INT');
|
|
|
|
if (0 != $redirectedValue && $redirectedField)
|
|
|
|
{
|
|
|
|
// Now set the local-redirected field default value
|
|
|
|
$form->setValue($redirectedField, null, $redirectedValue);
|
|
|
|
}
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
|
|
|
|
return $form;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to get the script that have to be included on the form
|
|
|
|
*
|
|
|
|
* @return string script files
|
|
|
|
*/
|
|
|
|
public function getScript()
|
|
|
|
{
|
2017-02-16 14:02:23 +00:00
|
|
|
return 'administrator/components/com_componentbuilder/models/forms/joomla_component.js';
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to test whether a record can be deleted.
|
|
|
|
*
|
|
|
|
* @param object $record A record object.
|
|
|
|
*
|
|
|
|
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
|
|
|
|
*
|
|
|
|
* @since 1.6
|
|
|
|
*/
|
|
|
|
protected function canDelete($record)
|
|
|
|
{
|
|
|
|
if (!empty($record->id))
|
|
|
|
{
|
|
|
|
if ($record->published != -2)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$user = JFactory::getUser();
|
|
|
|
// The record has been set. Check the record permissions.
|
2017-02-16 14:02:23 +00:00
|
|
|
return $user->authorise('core.delete', 'com_componentbuilder.joomla_component.' . (int) $record->id);
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to test whether a record can have its state edited.
|
|
|
|
*
|
|
|
|
* @param object $record A record object.
|
|
|
|
*
|
|
|
|
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
|
|
|
|
*
|
|
|
|
* @since 1.6
|
|
|
|
*/
|
|
|
|
protected function canEditState($record)
|
|
|
|
{
|
|
|
|
$user = JFactory::getUser();
|
|
|
|
$recordId = (!empty($record->id)) ? $record->id : 0;
|
|
|
|
|
|
|
|
if ($recordId)
|
|
|
|
{
|
|
|
|
// The record has been set. Check the record permissions.
|
2017-02-16 14:02:23 +00:00
|
|
|
$permission = $user->authorise('core.edit.state', 'com_componentbuilder.joomla_component.' . (int) $recordId);
|
2016-01-30 20:28:43 +00:00
|
|
|
if (!$permission && !is_null($permission))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// In the absense of better information, revert to the component permissions.
|
|
|
|
return parent::canEditState($record);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method override to check if you can edit an existing record.
|
|
|
|
*
|
|
|
|
* @param array $data An array of input data.
|
|
|
|
* @param string $key The name of the key for the primary key.
|
|
|
|
*
|
|
|
|
* @return boolean
|
|
|
|
* @since 2.5
|
|
|
|
*/
|
|
|
|
protected function allowEdit($data = array(), $key = 'id')
|
|
|
|
{
|
|
|
|
// Check specific edit permission then general edit permission.
|
|
|
|
|
2017-02-16 14:02:23 +00:00
|
|
|
return JFactory::getUser()->authorise('core.edit', 'com_componentbuilder.joomla_component.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepare and sanitise the table data prior to saving.
|
|
|
|
*
|
|
|
|
* @param JTable $table A JTable object.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*
|
|
|
|
* @since 1.6
|
|
|
|
*/
|
|
|
|
protected function prepareTable($table)
|
|
|
|
{
|
|
|
|
$date = JFactory::getDate();
|
|
|
|
$user = JFactory::getUser();
|
|
|
|
|
|
|
|
if (isset($table->name))
|
|
|
|
{
|
|
|
|
$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($table->alias) && empty($table->alias))
|
|
|
|
{
|
|
|
|
$table->generateAlias();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (empty($table->id))
|
|
|
|
{
|
|
|
|
$table->created = $date->toSql();
|
|
|
|
// set the user
|
2016-02-20 18:13:00 +00:00
|
|
|
if ($table->created_by == 0 || empty($table->created_by))
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
$table->created_by = $user->id;
|
|
|
|
}
|
|
|
|
// Set ordering to the last item if not set
|
|
|
|
if (empty($table->ordering))
|
|
|
|
{
|
|
|
|
$db = JFactory::getDbo();
|
|
|
|
$query = $db->getQuery(true)
|
|
|
|
->select('MAX(ordering)')
|
2017-02-16 14:02:23 +00:00
|
|
|
->from($db->quoteName('#__componentbuilder_joomla_component'));
|
2016-01-30 20:28:43 +00:00
|
|
|
$db->setQuery($query);
|
|
|
|
$max = $db->loadResult();
|
|
|
|
|
|
|
|
$table->ordering = $max + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$table->modified = $date->toSql();
|
|
|
|
$table->modified_by = $user->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($table->id))
|
|
|
|
{
|
|
|
|
// Increment the items version number.
|
|
|
|
$table->version++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to get the data that should be injected in the form.
|
|
|
|
*
|
|
|
|
* @return mixed The data for the form.
|
|
|
|
*
|
|
|
|
* @since 1.6
|
|
|
|
*/
|
|
|
|
protected function loadFormData()
|
|
|
|
{
|
|
|
|
// Check the session for previously entered form data.
|
2017-02-16 14:02:23 +00:00
|
|
|
$data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.joomla_component.data', array());
|
2016-01-30 20:28:43 +00:00
|
|
|
|
|
|
|
if (empty($data))
|
|
|
|
{
|
|
|
|
$data = $this->getItem();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to validate the form data.
|
|
|
|
*
|
|
|
|
* @param JForm $form The form to validate against.
|
|
|
|
* @param array $data The data to validate.
|
|
|
|
* @param string $group The name of the field group to validate.
|
|
|
|
*
|
|
|
|
* @return mixed Array of filtered data if valid, false otherwise.
|
|
|
|
*
|
|
|
|
* @see JFormRule
|
|
|
|
* @see JFilterInput
|
|
|
|
* @since 12.2
|
|
|
|
*/
|
|
|
|
public function validate($form, $data, $group = null)
|
|
|
|
{
|
|
|
|
// check if the not_required field is set
|
|
|
|
if (ComponentbuilderHelper::checkString($data['not_required']))
|
|
|
|
{
|
|
|
|
$requiredFields = (array) explode(',',(string) $data['not_required']);
|
|
|
|
$requiredFields = array_unique($requiredFields);
|
|
|
|
// now change the required field attributes value
|
|
|
|
foreach ($requiredFields as $requiredField)
|
|
|
|
{
|
|
|
|
// make sure there is a string value
|
|
|
|
if (ComponentbuilderHelper::checkString($requiredField))
|
|
|
|
{
|
|
|
|
// change to false
|
|
|
|
$form->setFieldAttribute($requiredField, 'required', 'false');
|
|
|
|
// also clear the data set
|
|
|
|
$data[$requiredField] = '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return parent::validate($form, $data, $group);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to get the unique fields of this table.
|
|
|
|
*
|
|
|
|
* @return mixed An array of field names, boolean false if none is set.
|
|
|
|
*
|
|
|
|
* @since 3.0
|
|
|
|
*/
|
2016-02-26 12:46:15 +00:00
|
|
|
protected function getUniqeFields()
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to delete one or more records.
|
|
|
|
*
|
|
|
|
* @param array &$pks An array of record primary keys.
|
|
|
|
*
|
|
|
|
* @return boolean True if successful, false if an error occurs.
|
|
|
|
*
|
|
|
|
* @since 12.2
|
|
|
|
*/
|
|
|
|
public function delete(&$pks)
|
|
|
|
{
|
|
|
|
if (!parent::delete($pks))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2016-09-07 21:20:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to change the published state of one or more records.
|
|
|
|
*
|
|
|
|
* @param array &$pks A list of the primary keys to change.
|
|
|
|
* @param integer $value The value of the published state.
|
|
|
|
*
|
|
|
|
* @return boolean True on success.
|
|
|
|
*
|
|
|
|
* @since 12.2
|
|
|
|
*/
|
|
|
|
public function publish(&$pks, $value = 1)
|
|
|
|
{
|
|
|
|
if (!parent::publish($pks, $value))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to perform batch operations on an item or a set of items.
|
|
|
|
*
|
|
|
|
* @param array $commands An array of commands to perform.
|
|
|
|
* @param array $pks An array of item ids.
|
|
|
|
* @param array $contexts An array of item contexts.
|
|
|
|
*
|
|
|
|
* @return boolean Returns true on success, false on failure.
|
|
|
|
*
|
|
|
|
* @since 12.2
|
|
|
|
*/
|
|
|
|
public function batch($commands, $pks, $contexts)
|
|
|
|
{
|
|
|
|
// Sanitize ids.
|
|
|
|
$pks = array_unique($pks);
|
|
|
|
JArrayHelper::toInteger($pks);
|
|
|
|
|
|
|
|
// Remove any values of zero.
|
|
|
|
if (array_search(0, $pks, true))
|
|
|
|
{
|
|
|
|
unset($pks[array_search(0, $pks, true)]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (empty($pks))
|
|
|
|
{
|
|
|
|
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$done = false;
|
|
|
|
|
|
|
|
// Set some needed variables.
|
|
|
|
$this->user = JFactory::getUser();
|
|
|
|
$this->table = $this->getTable();
|
|
|
|
$this->tableClassName = get_class($this->table);
|
|
|
|
$this->contentType = new JUcmType;
|
|
|
|
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
2017-02-16 14:02:23 +00:00
|
|
|
$this->canDo = ComponentbuilderHelper::getActions('joomla_component');
|
2016-01-30 20:28:43 +00:00
|
|
|
$this->batchSet = true;
|
|
|
|
|
|
|
|
if (!$this->canDo->get('core.batch'))
|
|
|
|
{
|
|
|
|
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($this->type == false)
|
|
|
|
{
|
|
|
|
$type = new JUcmType;
|
|
|
|
$this->type = $type->getTypeByAlias($this->typeAlias);
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
|
|
|
|
|
|
|
|
if (!empty($commands['move_copy']))
|
|
|
|
{
|
|
|
|
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c');
|
|
|
|
|
|
|
|
if ($cmd == 'c')
|
|
|
|
{
|
|
|
|
$result = $this->batchCopy($commands, $pks, $contexts);
|
|
|
|
|
|
|
|
if (is_array($result))
|
|
|
|
{
|
|
|
|
foreach ($result as $old => $new)
|
|
|
|
{
|
|
|
|
$contexts[$new] = $contexts[$old];
|
|
|
|
}
|
|
|
|
$pks = array_values($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$done = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$done)
|
|
|
|
{
|
|
|
|
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Clear the cache
|
|
|
|
$this->cleanCache();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Batch copy items to a new category or current.
|
|
|
|
*
|
|
|
|
* @param integer $values The new values.
|
|
|
|
* @param array $pks An array of row IDs.
|
|
|
|
* @param array $contexts An array of item contexts.
|
|
|
|
*
|
|
|
|
* @return mixed An array of new IDs on success, boolean false on failure.
|
|
|
|
*
|
|
|
|
* @since 12.2
|
|
|
|
*/
|
2016-02-26 12:46:15 +00:00
|
|
|
protected function batchCopy($values, $pks, $contexts)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
if (empty($this->batchSet))
|
|
|
|
{
|
|
|
|
// Set some needed variables.
|
|
|
|
$this->user = JFactory::getUser();
|
|
|
|
$this->table = $this->getTable();
|
|
|
|
$this->tableClassName = get_class($this->table);
|
|
|
|
$this->contentType = new JUcmType;
|
|
|
|
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
2017-02-16 14:02:23 +00:00
|
|
|
$this->canDo = ComponentbuilderHelper::getActions('joomla_component');
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch'))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// get list of uniqe fields
|
|
|
|
$uniqeFields = $this->getUniqeFields();
|
|
|
|
// remove move_copy from array
|
|
|
|
unset($values['move_copy']);
|
|
|
|
|
|
|
|
// make sure published is set
|
|
|
|
if (!isset($values['published']))
|
|
|
|
{
|
|
|
|
$values['published'] = 0;
|
|
|
|
}
|
|
|
|
elseif (isset($values['published']) && !$this->canDo->get('core.edit.state'))
|
|
|
|
{
|
|
|
|
$values['published'] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$newIds = array();
|
|
|
|
|
|
|
|
// Parent exists so let's proceed
|
|
|
|
while (!empty($pks))
|
|
|
|
{
|
|
|
|
// Pop the first ID off the stack
|
|
|
|
$pk = array_shift($pks);
|
|
|
|
|
|
|
|
$this->table->reset();
|
|
|
|
|
|
|
|
// only allow copy if user may edit this item.
|
|
|
|
|
|
|
|
if (!$this->user->authorise('core.edit', $contexts[$pk]))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Not fatal error
|
|
|
|
|
|
|
|
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check that the row actually exists
|
|
|
|
if (!$this->table->load($pk))
|
|
|
|
{
|
|
|
|
if ($error = $this->table->getError())
|
|
|
|
{
|
|
|
|
// Fatal error
|
|
|
|
$this->setError($error);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Not fatal error
|
|
|
|
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->table->name = $this->generateUniqe('name',$this->table->name);
|
|
|
|
|
|
|
|
// insert all set values
|
|
|
|
if (ComponentbuilderHelper::checkArray($values))
|
|
|
|
{
|
|
|
|
foreach ($values as $key => $value)
|
|
|
|
{
|
|
|
|
if (strlen($value) > 0 && isset($this->table->$key))
|
|
|
|
{
|
|
|
|
$this->table->$key = $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// update all uniqe fields
|
|
|
|
if (ComponentbuilderHelper::checkArray($uniqeFields))
|
|
|
|
{
|
|
|
|
foreach ($uniqeFields as $uniqeField)
|
|
|
|
{
|
|
|
|
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reset the ID because we are making a copy
|
|
|
|
$this->table->id = 0;
|
|
|
|
|
|
|
|
// TODO: Deal with ordering?
|
|
|
|
// $this->table->ordering = 1;
|
|
|
|
|
|
|
|
// Check the row.
|
|
|
|
if (!$this->table->check())
|
|
|
|
{
|
|
|
|
$this->setError($this->table->getError());
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($this->type))
|
|
|
|
{
|
|
|
|
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Store the row.
|
|
|
|
if (!$this->table->store())
|
|
|
|
{
|
|
|
|
$this->setError($this->table->getError());
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the new item ID
|
|
|
|
$newId = $this->table->get('id');
|
|
|
|
|
|
|
|
// Add the new ID to the array
|
|
|
|
$newIds[$pk] = $newId;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Clean the cache
|
|
|
|
$this->cleanCache();
|
|
|
|
|
|
|
|
return $newIds;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Batch move items to a new category
|
|
|
|
*
|
|
|
|
* @param integer $value The new category ID.
|
|
|
|
* @param array $pks An array of row IDs.
|
|
|
|
* @param array $contexts An array of item contexts.
|
|
|
|
*
|
|
|
|
* @return boolean True if successful, false otherwise and internal error is set.
|
|
|
|
*
|
|
|
|
* @since 12.2
|
|
|
|
*/
|
2016-02-26 12:46:15 +00:00
|
|
|
protected function batchMove($values, $pks, $contexts)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
if (empty($this->batchSet))
|
|
|
|
{
|
|
|
|
// Set some needed variables.
|
|
|
|
$this->user = JFactory::getUser();
|
|
|
|
$this->table = $this->getTable();
|
|
|
|
$this->tableClassName = get_class($this->table);
|
|
|
|
$this->contentType = new JUcmType;
|
|
|
|
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
2017-02-16 14:02:23 +00:00
|
|
|
$this->canDo = ComponentbuilderHelper::getActions('joomla_component');
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch'))
|
|
|
|
{
|
|
|
|
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// make sure published only updates if user has the permission.
|
|
|
|
if (isset($values['published']) && !$this->canDo->get('core.edit.state'))
|
|
|
|
{
|
|
|
|
unset($values['published']);
|
|
|
|
}
|
|
|
|
// remove move_copy from array
|
|
|
|
unset($values['move_copy']);
|
|
|
|
|
|
|
|
// Parent exists so we proceed
|
|
|
|
foreach ($pks as $pk)
|
|
|
|
{
|
|
|
|
if (!$this->user->authorise('core.edit', $contexts[$pk]))
|
|
|
|
{
|
|
|
|
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check that the row actually exists
|
|
|
|
if (!$this->table->load($pk))
|
|
|
|
{
|
|
|
|
if ($error = $this->table->getError())
|
|
|
|
{
|
|
|
|
// Fatal error
|
|
|
|
$this->setError($error);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Not fatal error
|
|
|
|
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// insert all set values.
|
|
|
|
if (ComponentbuilderHelper::checkArray($values))
|
|
|
|
{
|
|
|
|
foreach ($values as $key => $value)
|
|
|
|
{
|
|
|
|
// Do special action for access.
|
2017-02-02 11:54:07 +00:00
|
|
|
if ('access' === $key && strlen($value) > 0)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
$this->table->$key = $value;
|
|
|
|
}
|
|
|
|
elseif (strlen($value) > 0 && isset($this->table->$key))
|
|
|
|
{
|
|
|
|
$this->table->$key = $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Check the row.
|
|
|
|
if (!$this->table->check())
|
|
|
|
{
|
|
|
|
$this->setError($this->table->getError());
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($this->type))
|
|
|
|
{
|
|
|
|
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Store the row.
|
|
|
|
if (!$this->table->store())
|
|
|
|
{
|
|
|
|
$this->setError($this->table->getError());
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Clean the cache
|
|
|
|
$this->cleanCache();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to save the form data.
|
|
|
|
*
|
|
|
|
* @param array $data The form data.
|
|
|
|
*
|
|
|
|
* @return boolean True on success.
|
|
|
|
*
|
|
|
|
* @since 1.6
|
|
|
|
*/
|
|
|
|
public function save($data)
|
|
|
|
{
|
|
|
|
$input = JFactory::getApplication()->input;
|
|
|
|
$filter = JFilterInput::getInstance();
|
|
|
|
|
|
|
|
// set the metadata to the Item Data
|
|
|
|
if (isset($data['metadata']) && isset($data['metadata']['author']))
|
|
|
|
{
|
|
|
|
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
|
|
|
|
|
|
|
|
$metadata = new JRegistry;
|
|
|
|
$metadata->loadArray($data['metadata']);
|
|
|
|
$data['metadata'] = (string) $metadata;
|
|
|
|
}
|
|
|
|
|
2017-10-06 14:53:22 +00:00
|
|
|
// Set the sql string to base64 string.
|
|
|
|
if (isset($data['sql']))
|
2017-02-02 11:54:07 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$data['sql'] = base64_encode($data['sql']);
|
2017-02-02 11:54:07 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 14:53:22 +00:00
|
|
|
// Set the php_preflight_update string to base64 string.
|
|
|
|
if (isset($data['php_preflight_update']))
|
2016-11-25 02:56:16 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$data['php_preflight_update'] = base64_encode($data['php_preflight_update']);
|
2016-11-25 02:56:16 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 14:53:22 +00:00
|
|
|
// Set the php_postflight_update string to base64 string.
|
|
|
|
if (isset($data['php_postflight_update']))
|
2016-06-03 06:28:32 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$data['php_postflight_update'] = base64_encode($data['php_postflight_update']);
|
2016-06-03 06:28:32 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 14:53:22 +00:00
|
|
|
// Set the php_preflight_install string to base64 string.
|
|
|
|
if (isset($data['php_preflight_install']))
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$data['php_preflight_install'] = base64_encode($data['php_preflight_install']);
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 14:53:22 +00:00
|
|
|
// Set the php_postflight_install string to base64 string.
|
|
|
|
if (isset($data['php_postflight_install']))
|
2016-03-04 20:58:05 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$data['php_postflight_install'] = base64_encode($data['php_postflight_install']);
|
2017-03-18 11:16:07 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 14:53:22 +00:00
|
|
|
// Set the php_method_uninstall string to base64 string.
|
|
|
|
if (isset($data['php_method_uninstall']))
|
2017-03-18 11:16:07 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$data['php_method_uninstall'] = base64_encode($data['php_method_uninstall']);
|
2017-03-03 21:53:18 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 14:53:22 +00:00
|
|
|
// Set the readme string to base64 string.
|
|
|
|
if (isset($data['readme']))
|
2017-03-03 21:53:18 +00:00
|
|
|
{
|
2017-10-06 14:53:22 +00:00
|
|
|
$data['readme'] = base64_encode($data['readme']);
|
2016-03-04 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
2017-03-18 11:16:07 +00:00
|
|
|
// Set the php_helper_both string to base64 string.
|
|
|
|
if (isset($data['php_helper_both']))
|
|
|
|
{
|
|
|
|
$data['php_helper_both'] = base64_encode($data['php_helper_both']);
|
|
|
|
}
|
|
|
|
|
2016-12-30 10:47:19 +00:00
|
|
|
// Set the php_helper_admin string to base64 string.
|
|
|
|
if (isset($data['php_helper_admin']))
|
2016-03-04 20:58:05 +00:00
|
|
|
{
|
2016-12-30 10:47:19 +00:00
|
|
|
$data['php_helper_admin'] = base64_encode($data['php_helper_admin']);
|
2016-03-04 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
2016-12-30 10:47:19 +00:00
|
|
|
// Set the php_admin_event string to base64 string.
|
|
|
|
if (isset($data['php_admin_event']))
|
2016-03-04 20:58:05 +00:00
|
|
|
{
|
2016-12-30 10:47:19 +00:00
|
|
|
$data['php_admin_event'] = base64_encode($data['php_admin_event']);
|
2016-03-04 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
2016-12-30 10:47:19 +00:00
|
|
|
// Set the php_helper_site string to base64 string.
|
|
|
|
if (isset($data['php_helper_site']))
|
2016-06-03 06:28:32 +00:00
|
|
|
{
|
2016-12-30 10:47:19 +00:00
|
|
|
$data['php_helper_site'] = base64_encode($data['php_helper_site']);
|
2016-10-23 22:48:26 +00:00
|
|
|
}
|
|
|
|
|
2016-12-30 10:47:19 +00:00
|
|
|
// Set the php_site_event string to base64 string.
|
|
|
|
if (isset($data['php_site_event']))
|
2016-10-23 22:48:26 +00:00
|
|
|
{
|
2016-12-30 10:47:19 +00:00
|
|
|
$data['php_site_event'] = base64_encode($data['php_site_event']);
|
2016-10-23 22:48:26 +00:00
|
|
|
}
|
|
|
|
|
2017-10-06 14:53:22 +00:00
|
|
|
// Set the javascript string to base64 string.
|
|
|
|
if (isset($data['javascript']))
|
|
|
|
{
|
|
|
|
$data['javascript'] = base64_encode($data['javascript']);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set the css string to base64 string.
|
|
|
|
if (isset($data['css']))
|
|
|
|
{
|
|
|
|
$data['css'] = base64_encode($data['css']);
|
|
|
|
}
|
|
|
|
|
2016-12-30 10:47:19 +00:00
|
|
|
// Set the php_dashboard_methods string to base64 string.
|
|
|
|
if (isset($data['php_dashboard_methods']))
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2016-12-30 10:47:19 +00:00
|
|
|
$data['php_dashboard_methods'] = base64_encode($data['php_dashboard_methods']);
|
|
|
|
}
|
|
|
|
|
2017-03-18 11:16:07 +00:00
|
|
|
// Set the buildcompsql string to base64 string.
|
|
|
|
if (isset($data['buildcompsql']))
|
|
|
|
{
|
|
|
|
$data['buildcompsql'] = base64_encode($data['buildcompsql']);
|
|
|
|
}
|
|
|
|
|
2017-09-13 00:37:43 +00:00
|
|
|
// Get the basic encryption key.
|
2016-01-30 20:28:43 +00:00
|
|
|
$basickey = ComponentbuilderHelper::getCryptKey('basic');
|
2017-09-13 00:37:43 +00:00
|
|
|
// Get the encryption object
|
2016-01-30 20:28:43 +00:00
|
|
|
$basic = new FOFEncryptAes($basickey, 128);
|
|
|
|
|
2017-09-13 00:37:43 +00:00
|
|
|
// Encrypt data whmcs_key.
|
2016-01-30 20:28:43 +00:00
|
|
|
if (isset($data['whmcs_key']) && $basickey)
|
|
|
|
{
|
|
|
|
$data['whmcs_key'] = $basic->encryptString($data['whmcs_key']);
|
2016-03-04 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
2017-09-13 00:37:43 +00:00
|
|
|
// Encrypt data export_key.
|
2017-03-28 14:57:59 +00:00
|
|
|
if (isset($data['export_key']) && $basickey)
|
|
|
|
{
|
|
|
|
$data['export_key'] = $basic->encryptString($data['export_key']);
|
|
|
|
}
|
|
|
|
|
2016-12-30 10:47:19 +00:00
|
|
|
// we check if component should be build from sql file
|
|
|
|
ComponentbuilderHelper::dynamicBuilder($data, 1);
|
2016-01-30 20:28:43 +00:00
|
|
|
|
|
|
|
// Set the Params Items to data
|
|
|
|
if (isset($data['params']) && is_array($data['params']))
|
|
|
|
{
|
|
|
|
$params = new JRegistry;
|
|
|
|
$params->loadArray($data['params']);
|
|
|
|
$data['params'] = (string) $params;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Alter the uniqe field for save as copy
|
2017-02-01 13:17:04 +00:00
|
|
|
if ($input->get('task') === 'save2copy')
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
// Automatic handling of other uniqe fields
|
|
|
|
$uniqeFields = $this->getUniqeFields();
|
|
|
|
if (ComponentbuilderHelper::checkArray($uniqeFields))
|
|
|
|
{
|
|
|
|
foreach ($uniqeFields as $uniqeField)
|
|
|
|
{
|
|
|
|
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parent::save($data))
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to generate a uniqe value.
|
|
|
|
*
|
|
|
|
* @param string $field name.
|
|
|
|
* @param string $value data.
|
|
|
|
*
|
|
|
|
* @return string New value.
|
|
|
|
*
|
|
|
|
* @since 3.0
|
|
|
|
*/
|
|
|
|
protected function generateUniqe($field,$value)
|
|
|
|
{
|
|
|
|
|
|
|
|
// set field value uniqe
|
|
|
|
$table = $this->getTable();
|
|
|
|
|
|
|
|
while ($table->load(array($field => $value)))
|
|
|
|
{
|
|
|
|
$value = JString::increment($value);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to change the title & alias.
|
|
|
|
*
|
|
|
|
* @param string $title The title.
|
|
|
|
*
|
|
|
|
* @return array Contains the modified title and alias.
|
|
|
|
*
|
|
|
|
*/
|
2016-02-26 12:46:15 +00:00
|
|
|
protected function _generateNewTitle($title)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
// Alter the title
|
|
|
|
$table = $this->getTable();
|
|
|
|
|
|
|
|
while ($table->load(array('title' => $title)))
|
|
|
|
{
|
|
|
|
$title = JString::increment($title);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $title;
|
|
|
|
}
|
|
|
|
}
|