Added the basic code for controller and model for gh-53

This commit is contained in:
dev
2017-03-18 13:16:07 +02:00
parent 7534aed01d
commit b0ad2ddffc
29 changed files with 1452 additions and 1354 deletions

View File

@@ -151,7 +151,7 @@ class JFormFieldAdminviews extends JFormFieldList
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.system_name'),array('id','before_system_name')));
$query->select($db->quoteName(array('a.id','a.system_name'),array('id','adminview_system_name')));
$query->from($db->quoteName('#__componentbuilder_admin_view', 'a'));
$query->where($db->quoteName('a.published') . ' = 1');
$query->order('a.system_name ASC');
@@ -163,7 +163,7 @@ class JFormFieldAdminviews extends JFormFieldList
$options[] = JHtml::_('select.option', '', 'Select an option');
foreach($items as $item)
{
$options[] = JHtml::_('select.option', $item->id, $item->before_system_name);
$options[] = JHtml::_('select.option', $item->id, $item->adminview_system_name);
}
}
return $options;

View File

@@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 97 of this MVC
@build 3rd March, 2017
@version @update number 101 of this MVC
@build 18th March, 2017
@created 6th May, 2015
@package Component Builder
@subpackage joomla_component.js

File diff suppressed because it is too large Load Diff

View File

@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 97 of this MVC
@build 3rd March, 2017
@version @update number 101 of this MVC
@build 18th March, 2017
@created 6th May, 2015
@package Component Builder
@subpackage joomla_component.php
@@ -95,46 +95,16 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$item->metadata = $registry->toArray();
}
if (!empty($item->readme))
{
// base64 Decode readme.
$item->readme = base64_decode($item->readme);
}
if (!empty($item->php_postflight_update))
{
// base64 Decode php_postflight_update.
$item->php_postflight_update = base64_decode($item->php_postflight_update);
}
if (!empty($item->buildcompsql))
{
// base64 Decode buildcompsql.
$item->buildcompsql = base64_decode($item->buildcompsql);
}
if (!empty($item->php_preflight_update))
{
// base64 Decode php_preflight_update.
$item->php_preflight_update = base64_decode($item->php_preflight_update);
}
if (!empty($item->php_helper_both))
{
// base64 Decode php_helper_both.
$item->php_helper_both = base64_decode($item->php_helper_both);
}
if (!empty($item->php_postflight_install))
{
// base64 Decode php_postflight_install.
$item->php_postflight_install = base64_decode($item->php_postflight_install);
}
if (!empty($item->php_method_uninstall))
if (!empty($item->readme))
{
// base64 Decode php_method_uninstall.
$item->php_method_uninstall = base64_decode($item->php_method_uninstall);
// base64 Decode readme.
$item->readme = base64_decode($item->readme);
}
if (!empty($item->php_preflight_install))
@@ -143,12 +113,42 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$item->php_preflight_install = base64_decode($item->php_preflight_install);
}
if (!empty($item->css))
{
// base64 Decode css.
$item->css = base64_decode($item->css);
}
if (!empty($item->php_method_uninstall))
{
// base64 Decode php_method_uninstall.
$item->php_method_uninstall = base64_decode($item->php_method_uninstall);
}
if (!empty($item->php_preflight_update))
{
// base64 Decode php_preflight_update.
$item->php_preflight_update = base64_decode($item->php_preflight_update);
}
if (!empty($item->php_postflight_update))
{
// base64 Decode php_postflight_update.
$item->php_postflight_update = base64_decode($item->php_postflight_update);
}
if (!empty($item->sql))
{
// base64 Decode sql.
$item->sql = base64_decode($item->sql);
}
if (!empty($item->php_helper_both))
{
// base64 Decode php_helper_both.
$item->php_helper_both = base64_decode($item->php_helper_both);
}
if (!empty($item->php_helper_admin))
{
// base64 Decode php_helper_admin.
@@ -173,18 +173,18 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$item->php_site_event = base64_decode($item->php_site_event);
}
if (!empty($item->css))
{
// base64 Decode css.
$item->css = base64_decode($item->css);
}
if (!empty($item->php_dashboard_methods))
{
// base64 Decode php_dashboard_methods.
$item->php_dashboard_methods = base64_decode($item->php_dashboard_methods);
}
if (!empty($item->buildcompsql))
{
// base64 Decode buildcompsql.
$item->buildcompsql = base64_decode($item->buildcompsql);
}
// Get the basic encription.
$basickey = ComponentbuilderHelper::getCryptKey('basic');
// Get the encription object.
@@ -196,16 +196,16 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$item->update_server_ftp = rtrim($basic->decryptString($item->update_server_ftp), "\0");
}
if (!empty($item->sales_server_ftp) && $basickey && !is_numeric($item->sales_server_ftp) && $item->sales_server_ftp === base64_encode(base64_decode($item->sales_server_ftp, true)))
{
// basic decript data sales_server_ftp.
$item->sales_server_ftp = rtrim($basic->decryptString($item->sales_server_ftp), "\0");
}
if (!empty($item->whmcs_key) && $basickey && !is_numeric($item->whmcs_key) && $item->whmcs_key === base64_encode(base64_decode($item->whmcs_key, true)))
{
// basic decript data whmcs_key.
$item->whmcs_key = rtrim($basic->decryptString($item->whmcs_key), "\0");
}
if (!empty($item->sales_server_ftp) && $basickey && !is_numeric($item->sales_server_ftp) && $item->sales_server_ftp === base64_encode(base64_decode($item->sales_server_ftp, true)))
{
// basic decript data sales_server_ftp.
$item->sales_server_ftp = rtrim($basic->decryptString($item->sales_server_ftp), "\0");
}
if (!empty($item->id))
@@ -1252,46 +1252,16 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$data['metadata'] = (string) $metadata;
}
// Set the readme string to base64 string.
if (isset($data['readme']))
{
$data['readme'] = base64_encode($data['readme']);
}
// Set the php_postflight_update string to base64 string.
if (isset($data['php_postflight_update']))
{
$data['php_postflight_update'] = base64_encode($data['php_postflight_update']);
}
// Set the buildcompsql string to base64 string.
if (isset($data['buildcompsql']))
{
$data['buildcompsql'] = base64_encode($data['buildcompsql']);
}
// Set the php_preflight_update string to base64 string.
if (isset($data['php_preflight_update']))
{
$data['php_preflight_update'] = base64_encode($data['php_preflight_update']);
}
// 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']);
}
// Set the php_postflight_install string to base64 string.
if (isset($data['php_postflight_install']))
{
$data['php_postflight_install'] = base64_encode($data['php_postflight_install']);
}
// Set the php_method_uninstall string to base64 string.
if (isset($data['php_method_uninstall']))
// Set the readme string to base64 string.
if (isset($data['readme']))
{
$data['php_method_uninstall'] = base64_encode($data['php_method_uninstall']);
$data['readme'] = base64_encode($data['readme']);
}
// Set the php_preflight_install string to base64 string.
@@ -1300,12 +1270,42 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$data['php_preflight_install'] = base64_encode($data['php_preflight_install']);
}
// Set the css string to base64 string.
if (isset($data['css']))
{
$data['css'] = base64_encode($data['css']);
}
// Set the php_method_uninstall string to base64 string.
if (isset($data['php_method_uninstall']))
{
$data['php_method_uninstall'] = base64_encode($data['php_method_uninstall']);
}
// Set the php_preflight_update string to base64 string.
if (isset($data['php_preflight_update']))
{
$data['php_preflight_update'] = base64_encode($data['php_preflight_update']);
}
// Set the php_postflight_update string to base64 string.
if (isset($data['php_postflight_update']))
{
$data['php_postflight_update'] = base64_encode($data['php_postflight_update']);
}
// Set the sql string to base64 string.
if (isset($data['sql']))
{
$data['sql'] = base64_encode($data['sql']);
}
// 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']);
}
// Set the php_helper_admin string to base64 string.
if (isset($data['php_helper_admin']))
{
@@ -1330,18 +1330,18 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$data['php_site_event'] = base64_encode($data['php_site_event']);
}
// Set the css string to base64 string.
if (isset($data['css']))
{
$data['css'] = base64_encode($data['css']);
}
// Set the php_dashboard_methods string to base64 string.
if (isset($data['php_dashboard_methods']))
{
$data['php_dashboard_methods'] = base64_encode($data['php_dashboard_methods']);
}
// Set the buildcompsql string to base64 string.
if (isset($data['buildcompsql']))
{
$data['buildcompsql'] = base64_encode($data['buildcompsql']);
}
// Get the basic encription key.
$basickey = ComponentbuilderHelper::getCryptKey('basic');
// Get the encription object
@@ -1353,18 +1353,18 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$data['update_server_ftp'] = $basic->encryptString($data['update_server_ftp']);
}
// Encript data sales_server_ftp.
if (isset($data['sales_server_ftp']) && $basickey)
{
$data['sales_server_ftp'] = $basic->encryptString($data['sales_server_ftp']);
}
// Encript data whmcs_key.
if (isset($data['whmcs_key']) && $basickey)
{
$data['whmcs_key'] = $basic->encryptString($data['whmcs_key']);
}
// Encript data sales_server_ftp.
if (isset($data['sales_server_ftp']) && $basickey)
{
$data['sales_server_ftp'] = $basic->encryptString($data['sales_server_ftp']);
}
// we check if component should be build from sql file
ComponentbuilderHelper::dynamicBuilder($data, 1);

View File

@@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 97 of this MVC
@build 3rd March, 2017
@version @update number 101 of this MVC
@build 18th March, 2017
@created 6th May, 2015
@package Component Builder
@subpackage joomla_components.php
@@ -54,6 +54,66 @@ class ComponentbuilderModelJoomla_components extends JModelList
}
parent::__construct($config);
}
/**
* Method to get list export data.
*
* @return mixed An array of data items on success, false on failure.
*/
public function getSmartExport($pks)
{
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Get the user object.
$user = JFactory::getUser();
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Select some fields
$query->select($db->quoteName('a.*'));
// From the componentbuilder_joomla_componet table
$query->from($db->quoteName('#__componentbuilder_joomla_component', 'a'));
$query->where('a.id IN (' . implode(',',$pks) . ')');
// 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.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))
{
foreach ($items as $nr => &$item)
{
$access = ($user->authorise('joomla_component.access', 'com_componentbuilder.joomla_component.' . (int) $item->id) && $user->authorise('joomla_component.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
continue;
}
}
}
return $items;
}
}
return false;
}
/**
@@ -264,46 +324,46 @@ class ComponentbuilderModelJoomla_components extends JModelList
// decrypt update_server_ftp
$item->update_server_ftp = $basic->decryptString($item->update_server_ftp);
}
if ($basickey && !is_numeric($item->sales_server_ftp) && $item->sales_server_ftp === base64_encode(base64_decode($item->sales_server_ftp, true)))
{
// decrypt sales_server_ftp
$item->sales_server_ftp = $basic->decryptString($item->sales_server_ftp);
}
// decode readme
$item->readme = base64_decode($item->readme);
// decode php_postflight_update
$item->php_postflight_update = base64_decode($item->php_postflight_update);
// decode buildcompsql
$item->buildcompsql = base64_decode($item->buildcompsql);
// decode php_preflight_update
$item->php_preflight_update = base64_decode($item->php_preflight_update);
// decode php_helper_both
$item->php_helper_both = base64_decode($item->php_helper_both);
// decode php_postflight_install
$item->php_postflight_install = base64_decode($item->php_postflight_install);
// decode php_method_uninstall
$item->php_method_uninstall = base64_decode($item->php_method_uninstall);
// decode readme
$item->readme = base64_decode($item->readme);
// decode php_preflight_install
$item->php_preflight_install = base64_decode($item->php_preflight_install);
// decode sql
$item->sql = base64_decode($item->sql);
// decode php_helper_admin
$item->php_helper_admin = base64_decode($item->php_helper_admin);
// decode php_admin_event
$item->php_admin_event = base64_decode($item->php_admin_event);
// decode css
$item->css = base64_decode($item->css);
// decode php_method_uninstall
$item->php_method_uninstall = base64_decode($item->php_method_uninstall);
if ($basickey && !is_numeric($item->whmcs_key) && $item->whmcs_key === base64_encode(base64_decode($item->whmcs_key, true)))
{
// decrypt whmcs_key
$item->whmcs_key = $basic->decryptString($item->whmcs_key);
}
// decode php_preflight_update
$item->php_preflight_update = base64_decode($item->php_preflight_update);
// decode php_postflight_update
$item->php_postflight_update = base64_decode($item->php_postflight_update);
// decode sql
$item->sql = base64_decode($item->sql);
if ($basickey && !is_numeric($item->sales_server_ftp) && $item->sales_server_ftp === base64_encode(base64_decode($item->sales_server_ftp, true)))
{
// decrypt sales_server_ftp
$item->sales_server_ftp = $basic->decryptString($item->sales_server_ftp);
}
// decode php_helper_both
$item->php_helper_both = base64_decode($item->php_helper_both);
// decode php_helper_admin
$item->php_helper_admin = base64_decode($item->php_helper_admin);
// decode php_admin_event
$item->php_admin_event = base64_decode($item->php_admin_event);
// decode php_helper_site
$item->php_helper_site = base64_decode($item->php_helper_site);
// decode php_site_event
$item->php_site_event = base64_decode($item->php_site_event);
// decode css
$item->css = base64_decode($item->css);
// decode php_dashboard_methods
$item->php_dashboard_methods = base64_decode($item->php_dashboard_methods);
// decode buildcompsql
$item->buildcompsql = base64_decode($item->buildcompsql);
// unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);