Started with the first adaptation to implement the ssh protocol as mentioned in gh-230
This commit is contained in:
@ -43,7 +43,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList
|
||||
$icons = array();
|
||||
// view groups array
|
||||
$viewGroups = array(
|
||||
'main' => array('png.compiler', 'png.joomla_component.add', 'png.joomla_components', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.libraries', 'png.snippet.add', 'png.snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.ftps', 'png.help_document.add', 'png.help_documents')
|
||||
'main' => array('png.compiler', 'png.joomla_component.add', 'png.joomla_components', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.libraries', 'png.snippet.add', 'png.snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.servers', 'png.help_document.add', 'png.help_documents')
|
||||
);
|
||||
// view access array
|
||||
$viewAccess = array(
|
||||
@ -123,11 +123,11 @@ class ComponentbuilderModelComponentbuilder extends JModelList
|
||||
'languages.access' => 'language.access',
|
||||
'language.access' => 'language.access',
|
||||
'languages.submenu' => 'language.submenu',
|
||||
'ftp.create' => 'ftp.create',
|
||||
'ftps.access' => 'ftp.access',
|
||||
'ftp.access' => 'ftp.access',
|
||||
'ftps.submenu' => 'ftp.submenu',
|
||||
'ftps.dashboard_list' => 'ftp.dashboard_list',
|
||||
'server.create' => 'server.create',
|
||||
'servers.access' => 'server.access',
|
||||
'server.access' => 'server.access',
|
||||
'servers.submenu' => 'server.submenu',
|
||||
'servers.dashboard_list' => 'server.dashboard_list',
|
||||
'help_document.create' => 'help_document.create',
|
||||
'help_documents.access' => 'help_document.access',
|
||||
'help_document.access' => 'help_document.access',
|
||||
|
@ -13,7 +13,7 @@
|
||||
@version 2.6.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage ftps.php
|
||||
@subpackage servers.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@ -31,16 +31,16 @@ jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Ftps Form Field class for the Componentbuilder component
|
||||
* Servers Form Field class for the Componentbuilder component
|
||||
*/
|
||||
class JFormFieldFtps extends JFormFieldList
|
||||
class JFormFieldServers extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The ftps field type.
|
||||
* The servers field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'ftps';
|
||||
public $type = 'servers';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
@ -78,8 +78,8 @@ class JFormFieldFtps extends JFormFieldList
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create ftp
|
||||
if ($user->authorise('ftp.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
// only add if user allowed to create server
|
||||
if ($user->authorise('server.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
@ -88,11 +88,11 @@ class JFormFieldFtps extends JFormFieldList
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=ftp&layout=edit'.$ref.'" >
|
||||
href="index.php?option=com_componentbuilder&view=server&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit ftp
|
||||
if (($buttonName === 'ftp' || $buttonName === 'ftps') && $user->authorise('ftp.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
// only add if user allowed to edit server
|
||||
if (($buttonName === 'server' || $buttonName === 'servers') && $user->authorise('server.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
@ -119,7 +119,7 @@ class JFormFieldFtps extends JFormFieldList
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=ftps&task=ftp.edit&id='+value+'".$refJ."';
|
||||
var url = 'index.php?option=com_componentbuilder&view=servers&task=server.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
@ -129,7 +129,7 @@ class JFormFieldFtps extends JFormFieldList
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for ftp field.
|
||||
// check if button was created for server field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
@ -151,8 +151,8 @@ class JFormFieldFtps extends JFormFieldList
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.id','a.name'),array('id','update_server_ftp_name')));
|
||||
$query->from($db->quoteName('#__componentbuilder_ftp', 'a'));
|
||||
$query->select($db->quoteName(array('a.id','a.name','a.protocol'),array('id','update_server_name', 'protocol')));
|
||||
$query->from($db->quoteName('#__componentbuilder_server', 'a'));
|
||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
||||
$query->order('a.name ASC');
|
||||
$db->setQuery((string)$query);
|
||||
@ -163,7 +163,8 @@ class JFormFieldFtps extends JFormFieldList
|
||||
$options[] = JHtml::_('select.option', '', 'Select an option');
|
||||
foreach($items as $item)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $item->id, $item->update_server_ftp_name);
|
||||
$item->protocol = ($item->protocol == 2) ? JText::_('SSH') : JText::_('FTP');
|
||||
$options[] = JHtml::_('select.option', $item->id, $item->update_server_name.' ['.$item->protocol.']');
|
||||
}
|
||||
}
|
||||
return $options;
|
@ -1,25 +0,0 @@
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.6.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage ftp.js
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@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
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
@ -1,139 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addrulepath="/administrator/components/com_componentbuilder/models/rules"
|
||||
addfieldpath="/administrator/components/com_componentbuilder/models/fields"
|
||||
>
|
||||
<fieldset name="details">
|
||||
<!-- Default Fields.-->
|
||||
<!-- Id Field. Type: Text (joomla)-->
|
||||
<field name="id"
|
||||
type="text"
|
||||
class="readonly"
|
||||
label="JGLOBAL_FIELD_ID_LABEL"
|
||||
description="JGLOBAL_FIELD_ID_DESC"
|
||||
size="10"
|
||||
default="0" />
|
||||
<!-- Date Created Field. Type: Calendar (joomla)-->
|
||||
<field name="created"
|
||||
type="calendar"
|
||||
label="COM_COMPONENTBUILDER_FTP_CREATED_DATE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_FTP_CREATED_DATE_DESC"
|
||||
size="22"
|
||||
format="%Y-%m-%d %H:%M:%S"
|
||||
filter="user_utc" />
|
||||
<!-- User Created Field. Type: User (joomla)-->
|
||||
<field name="created_by"
|
||||
type="user"
|
||||
label="COM_COMPONENTBUILDER_FTP_CREATED_BY_LABEL"
|
||||
description="COM_COMPONENTBUILDER_FTP_CREATED_BY_DESC" />
|
||||
<!-- Published Field. Type: List (joomla)-->
|
||||
<field name="published"
|
||||
type="list"
|
||||
label="JSTATUS">
|
||||
<option value="1">JPUBLISHED</option>
|
||||
<option value="0">JUNPUBLISHED</option>
|
||||
<option value="2">JARCHIVED</option>
|
||||
<option value="-2">JTRASHED</option>
|
||||
</field>
|
||||
<!-- Date Modified Field. Type: Calendar (joomla)-->
|
||||
<field name="modified"
|
||||
type="calendar"
|
||||
class="readonly"
|
||||
label="COM_COMPONENTBUILDER_FTP_MODIFIED_DATE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_FTP_MODIFIED_DATE_DESC"
|
||||
size="22"
|
||||
readonly="true"
|
||||
format="%Y-%m-%d %H:%M:%S"
|
||||
filter="user_utc" />
|
||||
<!-- User Modified Field. Type: User (joomla)-->
|
||||
<field name="modified_by"
|
||||
type="user"
|
||||
label="COM_COMPONENTBUILDER_FTP_MODIFIED_BY_LABEL"
|
||||
description="COM_COMPONENTBUILDER_FTP_MODIFIED_BY_DESC"
|
||||
class="readonly"
|
||||
readonly="true"
|
||||
filter="unset" />
|
||||
<!-- Access Field. Type: Accesslevel (joomla)-->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
required="false" />
|
||||
<!-- Ordering Field. Type: Numbers (joomla)-->
|
||||
<field name="ordering"
|
||||
type="number"
|
||||
class="inputbox validate-ordering"
|
||||
label="COM_COMPONENTBUILDER_FTP_ORDERING_LABEL"
|
||||
description=""
|
||||
default="0"
|
||||
size="6"
|
||||
required="false" />
|
||||
<!-- Version Field. Type: Text (joomla)-->
|
||||
<field name="version"
|
||||
type="text"
|
||||
class="readonly"
|
||||
label="COM_COMPONENTBUILDER_FTP_VERSION_LABEL"
|
||||
description="COM_COMPONENTBUILDER_FTP_VERSION_DESC"
|
||||
size="6"
|
||||
readonly="true"
|
||||
filter="unset" />
|
||||
<!-- Dynamic Fields.-->
|
||||
<!-- Name Field. Type: Text. (joomla)-->
|
||||
<field type="text"
|
||||
name="name"
|
||||
label="COM_COMPONENTBUILDER_FTP_NAME_LABEL"
|
||||
size="40"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_FTP_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_FTP_NAME_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_FTP_NAME_HINT" />
|
||||
<!-- Note_ftp_signature Field. Type: Note. A None Database Field. (joomla)-->
|
||||
<field type="note"
|
||||
name="note_ftp_signature"
|
||||
label="COM_COMPONENTBUILDER_FTP_NOTE_FTP_SIGNATURE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_FTP_NOTE_FTP_SIGNATURE_DESCRIPTION"
|
||||
heading="h4"
|
||||
class="alert alert-success note_ftp_signature" />
|
||||
<!-- Signature Field. Type: Text. (joomla)-->
|
||||
<field type="text"
|
||||
name="signature"
|
||||
label="COM_COMPONENTBUILDER_FTP_SIGNATURE_LABEL"
|
||||
size="250"
|
||||
maxlength="250"
|
||||
description="COM_COMPONENTBUILDER_FTP_SIGNATURE_DESCRIPTION"
|
||||
class="text_area span12"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_FTP_SIGNATURE_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_FTP_SIGNATURE_HINT"
|
||||
autocomplete="off" />
|
||||
</fieldset>
|
||||
|
||||
<!-- Access Control Fields. -->
|
||||
<fieldset name="accesscontrol">
|
||||
<!-- Asset Id Field. Type: Hidden (joomla) -->
|
||||
<field
|
||||
name="asset_id"
|
||||
type="hidden"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Rules Field. Type: Rules (joomla) -->
|
||||
<field
|
||||
name="rules"
|
||||
type="rules"
|
||||
label="Permissions in relation to this ftp"
|
||||
translate_label="false"
|
||||
filter="rules"
|
||||
validate="rules"
|
||||
class="inputbox"
|
||||
component="com_componentbuilder"
|
||||
section="ftp"
|
||||
/>
|
||||
</fieldset>
|
||||
</form>
|
@ -23,289 +23,289 @@
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// Some Global Values
|
||||
jform_vvvvwatwaf_required = false;
|
||||
jform_vvvvwauwag_required = false;
|
||||
jform_vvvvwavwah_required = false;
|
||||
jform_vvvvwawwai_required = false;
|
||||
jform_vvvvwaxwaj_required = false;
|
||||
jform_vvvvwaywak_required = false;
|
||||
jform_vvvvwazwaq_required = false;
|
||||
jform_vvvvwbawar_required = false;
|
||||
jform_vvvvwbbwas_required = false;
|
||||
jform_vvvvwbcwat_required = false;
|
||||
jform_vvvvwbdwau_required = false;
|
||||
jform_vvvvwbewav_required = false;
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var location_vvvvwat = jQuery("#jform_location input[type='radio']:checked").val();
|
||||
vvvvwat(location_vvvvwat);
|
||||
var location_vvvvwaz = jQuery("#jform_location input[type='radio']:checked").val();
|
||||
vvvvwaz(location_vvvvwaz);
|
||||
|
||||
var location_vvvvwau = jQuery("#jform_location input[type='radio']:checked").val();
|
||||
vvvvwau(location_vvvvwau);
|
||||
var location_vvvvwba = jQuery("#jform_location input[type='radio']:checked").val();
|
||||
vvvvwba(location_vvvvwba);
|
||||
|
||||
var type_vvvvwav = jQuery("#jform_type").val();
|
||||
vvvvwav(type_vvvvwav);
|
||||
var type_vvvvwbb = jQuery("#jform_type").val();
|
||||
vvvvwbb(type_vvvvwbb);
|
||||
|
||||
var type_vvvvwaw = jQuery("#jform_type").val();
|
||||
vvvvwaw(type_vvvvwaw);
|
||||
var type_vvvvwbc = jQuery("#jform_type").val();
|
||||
vvvvwbc(type_vvvvwbc);
|
||||
|
||||
var type_vvvvwax = jQuery("#jform_type").val();
|
||||
vvvvwax(type_vvvvwax);
|
||||
var type_vvvvwbd = jQuery("#jform_type").val();
|
||||
vvvvwbd(type_vvvvwbd);
|
||||
|
||||
var target_vvvvway = jQuery("#jform_target input[type='radio']:checked").val();
|
||||
vvvvway(target_vvvvway);
|
||||
var target_vvvvwbe = jQuery("#jform_target input[type='radio']:checked").val();
|
||||
vvvvwbe(target_vvvvwbe);
|
||||
});
|
||||
|
||||
// the vvvvwat function
|
||||
function vvvvwat(location_vvvvwat)
|
||||
// the vvvvwaz function
|
||||
function vvvvwaz(location_vvvvwaz)
|
||||
{
|
||||
// set the function logic
|
||||
if (location_vvvvwat == 1)
|
||||
if (location_vvvvwaz == 1)
|
||||
{
|
||||
jQuery('#jform_admin_view').closest('.control-group').show();
|
||||
if (jform_vvvvwatwaf_required)
|
||||
if (jform_vvvvwazwaq_required)
|
||||
{
|
||||
updateFieldRequired('admin_view',0);
|
||||
jQuery('#jform_admin_view').prop('required','required');
|
||||
jQuery('#jform_admin_view').attr('aria-required',true);
|
||||
jQuery('#jform_admin_view').addClass('required');
|
||||
jform_vvvvwatwaf_required = false;
|
||||
jform_vvvvwazwaq_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_admin_view').closest('.control-group').hide();
|
||||
if (!jform_vvvvwatwaf_required)
|
||||
if (!jform_vvvvwazwaq_required)
|
||||
{
|
||||
updateFieldRequired('admin_view',1);
|
||||
jQuery('#jform_admin_view').removeAttr('required');
|
||||
jQuery('#jform_admin_view').removeAttr('aria-required');
|
||||
jQuery('#jform_admin_view').removeClass('required');
|
||||
jform_vvvvwatwaf_required = true;
|
||||
jform_vvvvwazwaq_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwau function
|
||||
function vvvvwau(location_vvvvwau)
|
||||
// the vvvvwba function
|
||||
function vvvvwba(location_vvvvwba)
|
||||
{
|
||||
// set the function logic
|
||||
if (location_vvvvwau == 2)
|
||||
if (location_vvvvwba == 2)
|
||||
{
|
||||
jQuery('#jform_site_view').closest('.control-group').show();
|
||||
if (jform_vvvvwauwag_required)
|
||||
if (jform_vvvvwbawar_required)
|
||||
{
|
||||
updateFieldRequired('site_view',0);
|
||||
jQuery('#jform_site_view').prop('required','required');
|
||||
jQuery('#jform_site_view').attr('aria-required',true);
|
||||
jQuery('#jform_site_view').addClass('required');
|
||||
jform_vvvvwauwag_required = false;
|
||||
jform_vvvvwbawar_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_site_view').closest('.control-group').hide();
|
||||
if (!jform_vvvvwauwag_required)
|
||||
if (!jform_vvvvwbawar_required)
|
||||
{
|
||||
updateFieldRequired('site_view',1);
|
||||
jQuery('#jform_site_view').removeAttr('required');
|
||||
jQuery('#jform_site_view').removeAttr('aria-required');
|
||||
jQuery('#jform_site_view').removeClass('required');
|
||||
jform_vvvvwauwag_required = true;
|
||||
jform_vvvvwbawar_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwav function
|
||||
function vvvvwav(type_vvvvwav)
|
||||
// the vvvvwbb function
|
||||
function vvvvwbb(type_vvvvwbb)
|
||||
{
|
||||
if (isSet(type_vvvvwav) && type_vvvvwav.constructor !== Array)
|
||||
if (isSet(type_vvvvwbb) && type_vvvvwbb.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwav = type_vvvvwav;
|
||||
var type_vvvvwav = [];
|
||||
type_vvvvwav.push(temp_vvvvwav);
|
||||
var temp_vvvvwbb = type_vvvvwbb;
|
||||
var type_vvvvwbb = [];
|
||||
type_vvvvwbb.push(temp_vvvvwbb);
|
||||
}
|
||||
else if (!isSet(type_vvvvwav))
|
||||
else if (!isSet(type_vvvvwbb))
|
||||
{
|
||||
var type_vvvvwav = [];
|
||||
var type_vvvvwbb = [];
|
||||
}
|
||||
var type = type_vvvvwav.some(type_vvvvwav_SomeFunc);
|
||||
var type = type_vvvvwbb.some(type_vvvvwbb_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (type)
|
||||
{
|
||||
jQuery('#jform_url').closest('.control-group').show();
|
||||
if (jform_vvvvwavwah_required)
|
||||
if (jform_vvvvwbbwas_required)
|
||||
{
|
||||
updateFieldRequired('url',0);
|
||||
jQuery('#jform_url').prop('required','required');
|
||||
jQuery('#jform_url').attr('aria-required',true);
|
||||
jQuery('#jform_url').addClass('required');
|
||||
jform_vvvvwavwah_required = false;
|
||||
jform_vvvvwbbwas_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_url').closest('.control-group').hide();
|
||||
if (!jform_vvvvwavwah_required)
|
||||
if (!jform_vvvvwbbwas_required)
|
||||
{
|
||||
updateFieldRequired('url',1);
|
||||
jQuery('#jform_url').removeAttr('required');
|
||||
jQuery('#jform_url').removeAttr('aria-required');
|
||||
jQuery('#jform_url').removeClass('required');
|
||||
jform_vvvvwavwah_required = true;
|
||||
jform_vvvvwbbwas_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwav Some function
|
||||
function type_vvvvwav_SomeFunc(type_vvvvwav)
|
||||
// the vvvvwbb Some function
|
||||
function type_vvvvwbb_SomeFunc(type_vvvvwbb)
|
||||
{
|
||||
// set the function logic
|
||||
if (type_vvvvwav == 3)
|
||||
if (type_vvvvwbb == 3)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwaw function
|
||||
function vvvvwaw(type_vvvvwaw)
|
||||
// the vvvvwbc function
|
||||
function vvvvwbc(type_vvvvwbc)
|
||||
{
|
||||
if (isSet(type_vvvvwaw) && type_vvvvwaw.constructor !== Array)
|
||||
if (isSet(type_vvvvwbc) && type_vvvvwbc.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwaw = type_vvvvwaw;
|
||||
var type_vvvvwaw = [];
|
||||
type_vvvvwaw.push(temp_vvvvwaw);
|
||||
var temp_vvvvwbc = type_vvvvwbc;
|
||||
var type_vvvvwbc = [];
|
||||
type_vvvvwbc.push(temp_vvvvwbc);
|
||||
}
|
||||
else if (!isSet(type_vvvvwaw))
|
||||
else if (!isSet(type_vvvvwbc))
|
||||
{
|
||||
var type_vvvvwaw = [];
|
||||
var type_vvvvwbc = [];
|
||||
}
|
||||
var type = type_vvvvwaw.some(type_vvvvwaw_SomeFunc);
|
||||
var type = type_vvvvwbc.some(type_vvvvwbc_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (type)
|
||||
{
|
||||
jQuery('#jform_article').closest('.control-group').show();
|
||||
if (jform_vvvvwawwai_required)
|
||||
if (jform_vvvvwbcwat_required)
|
||||
{
|
||||
updateFieldRequired('article',0);
|
||||
jQuery('#jform_article').prop('required','required');
|
||||
jQuery('#jform_article').attr('aria-required',true);
|
||||
jQuery('#jform_article').addClass('required');
|
||||
jform_vvvvwawwai_required = false;
|
||||
jform_vvvvwbcwat_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_article').closest('.control-group').hide();
|
||||
if (!jform_vvvvwawwai_required)
|
||||
if (!jform_vvvvwbcwat_required)
|
||||
{
|
||||
updateFieldRequired('article',1);
|
||||
jQuery('#jform_article').removeAttr('required');
|
||||
jQuery('#jform_article').removeAttr('aria-required');
|
||||
jQuery('#jform_article').removeClass('required');
|
||||
jform_vvvvwawwai_required = true;
|
||||
jform_vvvvwbcwat_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwaw Some function
|
||||
function type_vvvvwaw_SomeFunc(type_vvvvwaw)
|
||||
// the vvvvwbc Some function
|
||||
function type_vvvvwbc_SomeFunc(type_vvvvwbc)
|
||||
{
|
||||
// set the function logic
|
||||
if (type_vvvvwaw == 1)
|
||||
if (type_vvvvwbc == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwax function
|
||||
function vvvvwax(type_vvvvwax)
|
||||
// the vvvvwbd function
|
||||
function vvvvwbd(type_vvvvwbd)
|
||||
{
|
||||
if (isSet(type_vvvvwax) && type_vvvvwax.constructor !== Array)
|
||||
if (isSet(type_vvvvwbd) && type_vvvvwbd.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwax = type_vvvvwax;
|
||||
var type_vvvvwax = [];
|
||||
type_vvvvwax.push(temp_vvvvwax);
|
||||
var temp_vvvvwbd = type_vvvvwbd;
|
||||
var type_vvvvwbd = [];
|
||||
type_vvvvwbd.push(temp_vvvvwbd);
|
||||
}
|
||||
else if (!isSet(type_vvvvwax))
|
||||
else if (!isSet(type_vvvvwbd))
|
||||
{
|
||||
var type_vvvvwax = [];
|
||||
var type_vvvvwbd = [];
|
||||
}
|
||||
var type = type_vvvvwax.some(type_vvvvwax_SomeFunc);
|
||||
var type = type_vvvvwbd.some(type_vvvvwbd_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (type)
|
||||
{
|
||||
jQuery('#jform_content-lbl').closest('.control-group').show();
|
||||
if (jform_vvvvwaxwaj_required)
|
||||
if (jform_vvvvwbdwau_required)
|
||||
{
|
||||
updateFieldRequired('content',0);
|
||||
jQuery('#jform_content').prop('required','required');
|
||||
jQuery('#jform_content').attr('aria-required',true);
|
||||
jQuery('#jform_content').addClass('required');
|
||||
jform_vvvvwaxwaj_required = false;
|
||||
jform_vvvvwbdwau_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_content-lbl').closest('.control-group').hide();
|
||||
if (!jform_vvvvwaxwaj_required)
|
||||
if (!jform_vvvvwbdwau_required)
|
||||
{
|
||||
updateFieldRequired('content',1);
|
||||
jQuery('#jform_content').removeAttr('required');
|
||||
jQuery('#jform_content').removeAttr('aria-required');
|
||||
jQuery('#jform_content').removeClass('required');
|
||||
jform_vvvvwaxwaj_required = true;
|
||||
jform_vvvvwbdwau_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwax Some function
|
||||
function type_vvvvwax_SomeFunc(type_vvvvwax)
|
||||
// the vvvvwbd Some function
|
||||
function type_vvvvwbd_SomeFunc(type_vvvvwbd)
|
||||
{
|
||||
// set the function logic
|
||||
if (type_vvvvwax == 2)
|
||||
if (type_vvvvwbd == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvway function
|
||||
function vvvvway(target_vvvvway)
|
||||
// the vvvvwbe function
|
||||
function vvvvwbe(target_vvvvwbe)
|
||||
{
|
||||
// set the function logic
|
||||
if (target_vvvvway == 1)
|
||||
if (target_vvvvwbe == 1)
|
||||
{
|
||||
jQuery('#jform_groups').closest('.control-group').show();
|
||||
if (jform_vvvvwaywak_required)
|
||||
if (jform_vvvvwbewav_required)
|
||||
{
|
||||
updateFieldRequired('groups',0);
|
||||
jQuery('#jform_groups').prop('required','required');
|
||||
jQuery('#jform_groups').attr('aria-required',true);
|
||||
jQuery('#jform_groups').addClass('required');
|
||||
jform_vvvvwaywak_required = false;
|
||||
jform_vvvvwbewav_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_groups').closest('.control-group').hide();
|
||||
if (!jform_vvvvwaywak_required)
|
||||
if (!jform_vvvvwbewav_required)
|
||||
{
|
||||
updateFieldRequired('groups',1);
|
||||
jQuery('#jform_groups').removeAttr('required');
|
||||
jQuery('#jform_groups').removeAttr('aria-required');
|
||||
jQuery('#jform_groups').removeClass('required');
|
||||
jform_vvvvwaywak_required = true;
|
||||
jform_vvvvwbewav_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -491,11 +491,11 @@ function vvvvvwh(add_update_server_vvvvvwh)
|
||||
// set the function logic
|
||||
if (add_update_server_vvvvvwh == 1)
|
||||
{
|
||||
jQuery('#jform_update_server').closest('.control-group').show();
|
||||
jQuery('#jform_update_server_url').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_update_server').closest('.control-group').hide();
|
||||
jQuery('#jform_update_server_url').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
@ -505,11 +505,11 @@ function vvvvvwi(add_sales_server_vvvvvwi)
|
||||
// set the function logic
|
||||
if (add_sales_server_vvvvvwi == 1)
|
||||
{
|
||||
jQuery('#jform_sales_server_ftp').closest('.control-group').show();
|
||||
jQuery('#jform_sales_server').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_sales_server_ftp').closest('.control-group').hide();
|
||||
jQuery('#jform_sales_server').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
@ -692,12 +692,12 @@ function vvvvvwp(update_server_target_vvvvvwp,add_update_server_vvvvvwp)
|
||||
// set the function logic
|
||||
if (update_server_target_vvvvvwp == 1 && add_update_server_vvvvvwp == 1)
|
||||
{
|
||||
jQuery('#jform_update_server_ftp').closest('.control-group').show();
|
||||
jQuery('#jform_update_server').closest('.control-group').show();
|
||||
jQuery('.note_update_server_note_ftp').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_update_server_ftp').closest('.control-group').hide();
|
||||
jQuery('#jform_update_server').closest('.control-group').hide();
|
||||
jQuery('.note_update_server_note_ftp').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
@ -708,12 +708,12 @@ function vvvvvwq(add_update_server_vvvvvwq,update_server_target_vvvvvwq)
|
||||
// set the function logic
|
||||
if (add_update_server_vvvvvwq == 1 && update_server_target_vvvvvwq == 1)
|
||||
{
|
||||
jQuery('#jform_update_server_ftp').closest('.control-group').show();
|
||||
jQuery('#jform_update_server').closest('.control-group').show();
|
||||
jQuery('.note_update_server_note_ftp').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_update_server_ftp').closest('.control-group').hide();
|
||||
jQuery('#jform_update_server').closest('.control-group').hide();
|
||||
jQuery('.note_update_server_note_ftp').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
@ -247,11 +247,11 @@
|
||||
class="text_area span12"
|
||||
filter="HTML"
|
||||
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_HINT" />
|
||||
<!-- Update_server_ftp Field. Type: Ftps. (custom)-->
|
||||
<field type="ftps"
|
||||
name="update_server_ftp"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_FTP_LABEL"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_FTP_DESCRIPTION"
|
||||
<!-- Update_server Field. Type: Servers. (custom)-->
|
||||
<field type="servers"
|
||||
name="update_server"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_LABEL"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_DESCRIPTION"
|
||||
class="list_class"
|
||||
multiple="false"
|
||||
default="0"
|
||||
@ -342,7 +342,7 @@
|
||||
default="1"
|
||||
required="true">
|
||||
<!-- Option Set.-->
|
||||
<option value="1">COM_COMPONENTBUILDER_JOOMLA_COMPONENT_FTP</option>
|
||||
<option value="1">COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SERVER</option>
|
||||
<option value="2">COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ZIP</option>
|
||||
<option value="3">COM_COMPONENTBUILDER_JOOMLA_COMPONENT_OTHER</option>
|
||||
</field>
|
||||
@ -615,11 +615,11 @@
|
||||
<option value="1">COM_COMPONENTBUILDER_JOOMLA_COMPONENT_YES</option>
|
||||
<option value="0">COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO</option>
|
||||
</field>
|
||||
<!-- Sales_server_ftp Field. Type: Ftps. (custom)-->
|
||||
<field type="ftps"
|
||||
name="sales_server_ftp"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SALES_SERVER_FTP_LABEL"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SALES_SERVER_FTP_DESCRIPTION"
|
||||
<!-- Sales_server Field. Type: Servers. (custom)-->
|
||||
<field type="servers"
|
||||
name="sales_server"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SALES_SERVER_LABEL"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SALES_SERVER_DESCRIPTION"
|
||||
class="list_class"
|
||||
multiple="false"
|
||||
default="0"
|
||||
@ -1087,18 +1087,18 @@
|
||||
<option value="1">COM_COMPONENTBUILDER_JOOMLA_COMPONENT_YES</option>
|
||||
<option value="0">COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO</option>
|
||||
</field>
|
||||
<!-- Update_server Field. Type: Url. (joomla)-->
|
||||
<!-- Update_server_url Field. Type: Url. (joomla)-->
|
||||
<field type="url"
|
||||
name="update_server"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_LABEL"
|
||||
name="update_server_url"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_URL_LABEL"
|
||||
size="60"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_DESCRIPTION"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_URL_DESCRIPTION"
|
||||
class="text_area span12"
|
||||
filter="url"
|
||||
validated="url"
|
||||
message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_HINT" />
|
||||
message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_URL_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_URL_HINT" />
|
||||
<!-- Number Field. Type: Number. (joomla)-->
|
||||
<field type="number"
|
||||
name="number"
|
||||
|
560
admin/models/forms/server.js
Normal file
560
admin/models/forms/server.js
Normal file
@ -0,0 +1,560 @@
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.6.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage server.js
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@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
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// Some Global Values
|
||||
jform_vvvvwatwae_required = false;
|
||||
jform_vvvvwatwaf_required = false;
|
||||
jform_vvvvwatwag_required = false;
|
||||
jform_vvvvwatwah_required = false;
|
||||
jform_vvvvwatwai_required = false;
|
||||
jform_vvvvwauwaj_required = false;
|
||||
jform_vvvvwavwak_required = false;
|
||||
jform_vvvvwaxwal_required = false;
|
||||
jform_vvvvwaxwam_required = false;
|
||||
jform_vvvvwaywan_required = false;
|
||||
jform_vvvvwaywao_required = false;
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var protocol_vvvvwat = jQuery("#jform_protocol").val();
|
||||
vvvvwat(protocol_vvvvwat);
|
||||
|
||||
var protocol_vvvvwau = jQuery("#jform_protocol").val();
|
||||
vvvvwau(protocol_vvvvwau);
|
||||
|
||||
var protocol_vvvvwav = jQuery("#jform_protocol").val();
|
||||
var authentication_vvvvwav = jQuery("#jform_authentication input[type='radio']:checked").val();
|
||||
vvvvwav(protocol_vvvvwav,authentication_vvvvwav);
|
||||
|
||||
var protocol_vvvvwax = jQuery("#jform_protocol").val();
|
||||
var authentication_vvvvwax = jQuery("#jform_authentication input[type='radio']:checked").val();
|
||||
vvvvwax(protocol_vvvvwax,authentication_vvvvwax);
|
||||
|
||||
var authentication_vvvvway = jQuery("#jform_authentication input[type='radio']:checked").val();
|
||||
var protocol_vvvvway = jQuery("#jform_protocol").val();
|
||||
vvvvway(authentication_vvvvway,protocol_vvvvway);
|
||||
});
|
||||
|
||||
// the vvvvwat function
|
||||
function vvvvwat(protocol_vvvvwat)
|
||||
{
|
||||
if (isSet(protocol_vvvvwat) && protocol_vvvvwat.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwat = protocol_vvvvwat;
|
||||
var protocol_vvvvwat = [];
|
||||
protocol_vvvvwat.push(temp_vvvvwat);
|
||||
}
|
||||
else if (!isSet(protocol_vvvvwat))
|
||||
{
|
||||
var protocol_vvvvwat = [];
|
||||
}
|
||||
var protocol = protocol_vvvvwat.some(protocol_vvvvwat_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (protocol)
|
||||
{
|
||||
jQuery('#jform_authentication').closest('.control-group').show();
|
||||
if (jform_vvvvwatwae_required)
|
||||
{
|
||||
updateFieldRequired('authentication',0);
|
||||
jQuery('#jform_authentication').prop('required','required');
|
||||
jQuery('#jform_authentication').attr('aria-required',true);
|
||||
jQuery('#jform_authentication').addClass('required');
|
||||
jform_vvvvwatwae_required = false;
|
||||
}
|
||||
|
||||
jQuery('#jform_host').closest('.control-group').show();
|
||||
if (jform_vvvvwatwaf_required)
|
||||
{
|
||||
updateFieldRequired('host',0);
|
||||
jQuery('#jform_host').prop('required','required');
|
||||
jQuery('#jform_host').attr('aria-required',true);
|
||||
jQuery('#jform_host').addClass('required');
|
||||
jform_vvvvwatwaf_required = false;
|
||||
}
|
||||
|
||||
jQuery('#jform_port').closest('.control-group').show();
|
||||
if (jform_vvvvwatwag_required)
|
||||
{
|
||||
updateFieldRequired('port',0);
|
||||
jQuery('#jform_port').prop('required','required');
|
||||
jQuery('#jform_port').attr('aria-required',true);
|
||||
jQuery('#jform_port').addClass('required');
|
||||
jform_vvvvwatwag_required = false;
|
||||
}
|
||||
|
||||
jQuery('#jform_path').closest('.control-group').show();
|
||||
if (jform_vvvvwatwah_required)
|
||||
{
|
||||
updateFieldRequired('path',0);
|
||||
jQuery('#jform_path').prop('required','required');
|
||||
jQuery('#jform_path').attr('aria-required',true);
|
||||
jQuery('#jform_path').addClass('required');
|
||||
jform_vvvvwatwah_required = false;
|
||||
}
|
||||
|
||||
jQuery('.note_ssh_security').closest('.control-group').show();
|
||||
jQuery('#jform_username').closest('.control-group').show();
|
||||
if (jform_vvvvwatwai_required)
|
||||
{
|
||||
updateFieldRequired('username',0);
|
||||
jQuery('#jform_username').prop('required','required');
|
||||
jQuery('#jform_username').attr('aria-required',true);
|
||||
jQuery('#jform_username').addClass('required');
|
||||
jform_vvvvwatwai_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_authentication').closest('.control-group').hide();
|
||||
if (!jform_vvvvwatwae_required)
|
||||
{
|
||||
updateFieldRequired('authentication',1);
|
||||
jQuery('#jform_authentication').removeAttr('required');
|
||||
jQuery('#jform_authentication').removeAttr('aria-required');
|
||||
jQuery('#jform_authentication').removeClass('required');
|
||||
jform_vvvvwatwae_required = true;
|
||||
}
|
||||
jQuery('#jform_host').closest('.control-group').hide();
|
||||
if (!jform_vvvvwatwaf_required)
|
||||
{
|
||||
updateFieldRequired('host',1);
|
||||
jQuery('#jform_host').removeAttr('required');
|
||||
jQuery('#jform_host').removeAttr('aria-required');
|
||||
jQuery('#jform_host').removeClass('required');
|
||||
jform_vvvvwatwaf_required = true;
|
||||
}
|
||||
jQuery('#jform_port').closest('.control-group').hide();
|
||||
if (!jform_vvvvwatwag_required)
|
||||
{
|
||||
updateFieldRequired('port',1);
|
||||
jQuery('#jform_port').removeAttr('required');
|
||||
jQuery('#jform_port').removeAttr('aria-required');
|
||||
jQuery('#jform_port').removeClass('required');
|
||||
jform_vvvvwatwag_required = true;
|
||||
}
|
||||
jQuery('#jform_path').closest('.control-group').hide();
|
||||
if (!jform_vvvvwatwah_required)
|
||||
{
|
||||
updateFieldRequired('path',1);
|
||||
jQuery('#jform_path').removeAttr('required');
|
||||
jQuery('#jform_path').removeAttr('aria-required');
|
||||
jQuery('#jform_path').removeClass('required');
|
||||
jform_vvvvwatwah_required = true;
|
||||
}
|
||||
jQuery('.note_ssh_security').closest('.control-group').hide();
|
||||
jQuery('#jform_username').closest('.control-group').hide();
|
||||
if (!jform_vvvvwatwai_required)
|
||||
{
|
||||
updateFieldRequired('username',1);
|
||||
jQuery('#jform_username').removeAttr('required');
|
||||
jQuery('#jform_username').removeAttr('aria-required');
|
||||
jQuery('#jform_username').removeClass('required');
|
||||
jform_vvvvwatwai_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwat Some function
|
||||
function protocol_vvvvwat_SomeFunc(protocol_vvvvwat)
|
||||
{
|
||||
// set the function logic
|
||||
if (protocol_vvvvwat == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwau function
|
||||
function vvvvwau(protocol_vvvvwau)
|
||||
{
|
||||
if (isSet(protocol_vvvvwau) && protocol_vvvvwau.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwau = protocol_vvvvwau;
|
||||
var protocol_vvvvwau = [];
|
||||
protocol_vvvvwau.push(temp_vvvvwau);
|
||||
}
|
||||
else if (!isSet(protocol_vvvvwau))
|
||||
{
|
||||
var protocol_vvvvwau = [];
|
||||
}
|
||||
var protocol = protocol_vvvvwau.some(protocol_vvvvwau_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (protocol)
|
||||
{
|
||||
jQuery('.note_ftp_signature').closest('.control-group').show();
|
||||
jQuery('#jform_signature').closest('.control-group').show();
|
||||
if (jform_vvvvwauwaj_required)
|
||||
{
|
||||
updateFieldRequired('signature',0);
|
||||
jQuery('#jform_signature').prop('required','required');
|
||||
jQuery('#jform_signature').attr('aria-required',true);
|
||||
jQuery('#jform_signature').addClass('required');
|
||||
jform_vvvvwauwaj_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('.note_ftp_signature').closest('.control-group').hide();
|
||||
jQuery('#jform_signature').closest('.control-group').hide();
|
||||
if (!jform_vvvvwauwaj_required)
|
||||
{
|
||||
updateFieldRequired('signature',1);
|
||||
jQuery('#jform_signature').removeAttr('required');
|
||||
jQuery('#jform_signature').removeAttr('aria-required');
|
||||
jQuery('#jform_signature').removeClass('required');
|
||||
jform_vvvvwauwaj_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwau Some function
|
||||
function protocol_vvvvwau_SomeFunc(protocol_vvvvwau)
|
||||
{
|
||||
// set the function logic
|
||||
if (protocol_vvvvwau == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwav function
|
||||
function vvvvwav(protocol_vvvvwav,authentication_vvvvwav)
|
||||
{
|
||||
if (isSet(protocol_vvvvwav) && protocol_vvvvwav.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwav = protocol_vvvvwav;
|
||||
var protocol_vvvvwav = [];
|
||||
protocol_vvvvwav.push(temp_vvvvwav);
|
||||
}
|
||||
else if (!isSet(protocol_vvvvwav))
|
||||
{
|
||||
var protocol_vvvvwav = [];
|
||||
}
|
||||
var protocol = protocol_vvvvwav.some(protocol_vvvvwav_SomeFunc);
|
||||
|
||||
if (isSet(authentication_vvvvwav) && authentication_vvvvwav.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwav = authentication_vvvvwav;
|
||||
var authentication_vvvvwav = [];
|
||||
authentication_vvvvwav.push(temp_vvvvwav);
|
||||
}
|
||||
else if (!isSet(authentication_vvvvwav))
|
||||
{
|
||||
var authentication_vvvvwav = [];
|
||||
}
|
||||
var authentication = authentication_vvvvwav.some(authentication_vvvvwav_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (protocol && authentication)
|
||||
{
|
||||
jQuery('#jform_password').closest('.control-group').show();
|
||||
if (jform_vvvvwavwak_required)
|
||||
{
|
||||
updateFieldRequired('password',0);
|
||||
jQuery('#jform_password').prop('required','required');
|
||||
jQuery('#jform_password').attr('aria-required',true);
|
||||
jQuery('#jform_password').addClass('required');
|
||||
jform_vvvvwavwak_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_password').closest('.control-group').hide();
|
||||
if (!jform_vvvvwavwak_required)
|
||||
{
|
||||
updateFieldRequired('password',1);
|
||||
jQuery('#jform_password').removeAttr('required');
|
||||
jQuery('#jform_password').removeAttr('aria-required');
|
||||
jQuery('#jform_password').removeClass('required');
|
||||
jform_vvvvwavwak_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwav Some function
|
||||
function protocol_vvvvwav_SomeFunc(protocol_vvvvwav)
|
||||
{
|
||||
// set the function logic
|
||||
if (protocol_vvvvwav == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwav Some function
|
||||
function authentication_vvvvwav_SomeFunc(authentication_vvvvwav)
|
||||
{
|
||||
// set the function logic
|
||||
if (authentication_vvvvwav == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwax function
|
||||
function vvvvwax(protocol_vvvvwax,authentication_vvvvwax)
|
||||
{
|
||||
if (isSet(protocol_vvvvwax) && protocol_vvvvwax.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwax = protocol_vvvvwax;
|
||||
var protocol_vvvvwax = [];
|
||||
protocol_vvvvwax.push(temp_vvvvwax);
|
||||
}
|
||||
else if (!isSet(protocol_vvvvwax))
|
||||
{
|
||||
var protocol_vvvvwax = [];
|
||||
}
|
||||
var protocol = protocol_vvvvwax.some(protocol_vvvvwax_SomeFunc);
|
||||
|
||||
if (isSet(authentication_vvvvwax) && authentication_vvvvwax.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwax = authentication_vvvvwax;
|
||||
var authentication_vvvvwax = [];
|
||||
authentication_vvvvwax.push(temp_vvvvwax);
|
||||
}
|
||||
else if (!isSet(authentication_vvvvwax))
|
||||
{
|
||||
var authentication_vvvvwax = [];
|
||||
}
|
||||
var authentication = authentication_vvvvwax.some(authentication_vvvvwax_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (protocol && authentication)
|
||||
{
|
||||
jQuery('#jform_private').closest('.control-group').show();
|
||||
if (jform_vvvvwaxwal_required)
|
||||
{
|
||||
updateFieldRequired('private',0);
|
||||
jQuery('#jform_private').prop('required','required');
|
||||
jQuery('#jform_private').attr('aria-required',true);
|
||||
jQuery('#jform_private').addClass('required');
|
||||
jform_vvvvwaxwal_required = false;
|
||||
}
|
||||
|
||||
jQuery('#jform_public').closest('.control-group').show();
|
||||
if (jform_vvvvwaxwam_required)
|
||||
{
|
||||
updateFieldRequired('public',0);
|
||||
jQuery('#jform_public').prop('required','required');
|
||||
jQuery('#jform_public').attr('aria-required',true);
|
||||
jQuery('#jform_public').addClass('required');
|
||||
jform_vvvvwaxwam_required = false;
|
||||
}
|
||||
|
||||
jQuery('#jform_secret').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_private').closest('.control-group').hide();
|
||||
if (!jform_vvvvwaxwal_required)
|
||||
{
|
||||
updateFieldRequired('private',1);
|
||||
jQuery('#jform_private').removeAttr('required');
|
||||
jQuery('#jform_private').removeAttr('aria-required');
|
||||
jQuery('#jform_private').removeClass('required');
|
||||
jform_vvvvwaxwal_required = true;
|
||||
}
|
||||
jQuery('#jform_public').closest('.control-group').hide();
|
||||
if (!jform_vvvvwaxwam_required)
|
||||
{
|
||||
updateFieldRequired('public',1);
|
||||
jQuery('#jform_public').removeAttr('required');
|
||||
jQuery('#jform_public').removeAttr('aria-required');
|
||||
jQuery('#jform_public').removeClass('required');
|
||||
jform_vvvvwaxwam_required = true;
|
||||
}
|
||||
jQuery('#jform_secret').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwax Some function
|
||||
function protocol_vvvvwax_SomeFunc(protocol_vvvvwax)
|
||||
{
|
||||
// set the function logic
|
||||
if (protocol_vvvvwax == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwax Some function
|
||||
function authentication_vvvvwax_SomeFunc(authentication_vvvvwax)
|
||||
{
|
||||
// set the function logic
|
||||
if (authentication_vvvvwax == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvway function
|
||||
function vvvvway(authentication_vvvvway,protocol_vvvvway)
|
||||
{
|
||||
if (isSet(authentication_vvvvway) && authentication_vvvvway.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvway = authentication_vvvvway;
|
||||
var authentication_vvvvway = [];
|
||||
authentication_vvvvway.push(temp_vvvvway);
|
||||
}
|
||||
else if (!isSet(authentication_vvvvway))
|
||||
{
|
||||
var authentication_vvvvway = [];
|
||||
}
|
||||
var authentication = authentication_vvvvway.some(authentication_vvvvway_SomeFunc);
|
||||
|
||||
if (isSet(protocol_vvvvway) && protocol_vvvvway.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvway = protocol_vvvvway;
|
||||
var protocol_vvvvway = [];
|
||||
protocol_vvvvway.push(temp_vvvvway);
|
||||
}
|
||||
else if (!isSet(protocol_vvvvway))
|
||||
{
|
||||
var protocol_vvvvway = [];
|
||||
}
|
||||
var protocol = protocol_vvvvway.some(protocol_vvvvway_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (authentication && protocol)
|
||||
{
|
||||
jQuery('#jform_private').closest('.control-group').show();
|
||||
if (jform_vvvvwaywan_required)
|
||||
{
|
||||
updateFieldRequired('private',0);
|
||||
jQuery('#jform_private').prop('required','required');
|
||||
jQuery('#jform_private').attr('aria-required',true);
|
||||
jQuery('#jform_private').addClass('required');
|
||||
jform_vvvvwaywan_required = false;
|
||||
}
|
||||
|
||||
jQuery('#jform_public').closest('.control-group').show();
|
||||
if (jform_vvvvwaywao_required)
|
||||
{
|
||||
updateFieldRequired('public',0);
|
||||
jQuery('#jform_public').prop('required','required');
|
||||
jQuery('#jform_public').attr('aria-required',true);
|
||||
jQuery('#jform_public').addClass('required');
|
||||
jform_vvvvwaywao_required = false;
|
||||
}
|
||||
|
||||
jQuery('#jform_secret').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_private').closest('.control-group').hide();
|
||||
if (!jform_vvvvwaywan_required)
|
||||
{
|
||||
updateFieldRequired('private',1);
|
||||
jQuery('#jform_private').removeAttr('required');
|
||||
jQuery('#jform_private').removeAttr('aria-required');
|
||||
jQuery('#jform_private').removeClass('required');
|
||||
jform_vvvvwaywan_required = true;
|
||||
}
|
||||
jQuery('#jform_public').closest('.control-group').hide();
|
||||
if (!jform_vvvvwaywao_required)
|
||||
{
|
||||
updateFieldRequired('public',1);
|
||||
jQuery('#jform_public').removeAttr('required');
|
||||
jQuery('#jform_public').removeAttr('aria-required');
|
||||
jQuery('#jform_public').removeClass('required');
|
||||
jform_vvvvwaywao_required = true;
|
||||
}
|
||||
jQuery('#jform_secret').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvway Some function
|
||||
function authentication_vvvvway_SomeFunc(authentication_vvvvway)
|
||||
{
|
||||
// set the function logic
|
||||
if (authentication_vvvvway == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvway Some function
|
||||
function protocol_vvvvway_SomeFunc(protocol_vvvvway)
|
||||
{
|
||||
// set the function logic
|
||||
if (protocol_vvvvway == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// update required fields
|
||||
function updateFieldRequired(name,status)
|
||||
{
|
||||
var not_required = jQuery('#jform_not_required').val();
|
||||
|
||||
if(status == 1)
|
||||
{
|
||||
if (isSet(not_required) && not_required != 0)
|
||||
{
|
||||
not_required = not_required+','+name;
|
||||
}
|
||||
else
|
||||
{
|
||||
not_required = ','+name;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isSet(not_required) && not_required != 0)
|
||||
{
|
||||
not_required = not_required.replace(','+name,'');
|
||||
}
|
||||
}
|
||||
|
||||
jQuery('#jform_not_required').val(not_required);
|
||||
}
|
||||
|
||||
// the isSet function
|
||||
function isSet(val)
|
||||
{
|
||||
if ((val != undefined) && (val != null) && 0 !== val.length){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
274
admin/models/forms/server.xml
Normal file
274
admin/models/forms/server.xml
Normal file
@ -0,0 +1,274 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addrulepath="/administrator/components/com_componentbuilder/models/rules"
|
||||
addfieldpath="/administrator/components/com_componentbuilder/models/fields"
|
||||
>
|
||||
<fieldset name="details">
|
||||
<!-- Default Fields.-->
|
||||
<!-- Id Field. Type: Text (joomla)-->
|
||||
<field name="id"
|
||||
type="text"
|
||||
class="readonly"
|
||||
label="JGLOBAL_FIELD_ID_LABEL"
|
||||
description="JGLOBAL_FIELD_ID_DESC"
|
||||
size="10"
|
||||
default="0" />
|
||||
<!-- Date Created Field. Type: Calendar (joomla)-->
|
||||
<field name="created"
|
||||
type="calendar"
|
||||
label="COM_COMPONENTBUILDER_SERVER_CREATED_DATE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_SERVER_CREATED_DATE_DESC"
|
||||
size="22"
|
||||
format="%Y-%m-%d %H:%M:%S"
|
||||
filter="user_utc" />
|
||||
<!-- User Created Field. Type: User (joomla)-->
|
||||
<field name="created_by"
|
||||
type="user"
|
||||
label="COM_COMPONENTBUILDER_SERVER_CREATED_BY_LABEL"
|
||||
description="COM_COMPONENTBUILDER_SERVER_CREATED_BY_DESC" />
|
||||
<!-- Published Field. Type: List (joomla)-->
|
||||
<field name="published"
|
||||
type="list"
|
||||
label="JSTATUS">
|
||||
<option value="1">JPUBLISHED</option>
|
||||
<option value="0">JUNPUBLISHED</option>
|
||||
<option value="2">JARCHIVED</option>
|
||||
<option value="-2">JTRASHED</option>
|
||||
</field>
|
||||
<!-- Date Modified Field. Type: Calendar (joomla)-->
|
||||
<field name="modified"
|
||||
type="calendar"
|
||||
class="readonly"
|
||||
label="COM_COMPONENTBUILDER_SERVER_MODIFIED_DATE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_SERVER_MODIFIED_DATE_DESC"
|
||||
size="22"
|
||||
readonly="true"
|
||||
format="%Y-%m-%d %H:%M:%S"
|
||||
filter="user_utc" />
|
||||
<!-- User Modified Field. Type: User (joomla)-->
|
||||
<field name="modified_by"
|
||||
type="user"
|
||||
label="COM_COMPONENTBUILDER_SERVER_MODIFIED_BY_LABEL"
|
||||
description="COM_COMPONENTBUILDER_SERVER_MODIFIED_BY_DESC"
|
||||
class="readonly"
|
||||
readonly="true"
|
||||
filter="unset" />
|
||||
<!-- Access Field. Type: Accesslevel (joomla)-->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
required="false" />
|
||||
<!-- Ordering Field. Type: Numbers (joomla)-->
|
||||
<field name="ordering"
|
||||
type="number"
|
||||
class="inputbox validate-ordering"
|
||||
label="COM_COMPONENTBUILDER_SERVER_ORDERING_LABEL"
|
||||
description=""
|
||||
default="0"
|
||||
size="6"
|
||||
required="false" />
|
||||
<!-- Version Field. Type: Text (joomla)-->
|
||||
<field name="version"
|
||||
type="text"
|
||||
class="readonly"
|
||||
label="COM_COMPONENTBUILDER_SERVER_VERSION_LABEL"
|
||||
description="COM_COMPONENTBUILDER_SERVER_VERSION_DESC"
|
||||
size="6"
|
||||
readonly="true"
|
||||
filter="unset" />
|
||||
<!-- Dynamic Fields.-->
|
||||
<!-- Name Field. Type: Text. (joomla)-->
|
||||
<field type="text"
|
||||
name="name"
|
||||
label="COM_COMPONENTBUILDER_SERVER_NAME_LABEL"
|
||||
size="40"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_SERVER_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_SERVER_NAME_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_SERVER_NAME_HINT" />
|
||||
<!-- Protocol Field. Type: List. (joomla)-->
|
||||
<field type="list"
|
||||
name="protocol"
|
||||
label="COM_COMPONENTBUILDER_SERVER_PROTOCOL_LABEL"
|
||||
description="COM_COMPONENTBUILDER_SERVER_PROTOCOL_DESCRIPTION"
|
||||
class="list_class"
|
||||
multiple="false"
|
||||
filter="INT"
|
||||
required="true">
|
||||
<!-- Option Set.-->
|
||||
<option value="">COM_COMPONENTBUILDER_SERVER_SELECT_AN_OPTION</option>
|
||||
<option value="1">COM_COMPONENTBUILDER_SERVER_FTP</option>
|
||||
<option value="2">COM_COMPONENTBUILDER_SERVER_SSH</option>
|
||||
</field>
|
||||
<!-- Note_ftp_signature Field. Type: Note. A None Database Field. (joomla)-->
|
||||
<field type="note"
|
||||
name="note_ftp_signature"
|
||||
label="COM_COMPONENTBUILDER_SERVER_NOTE_FTP_SIGNATURE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_SERVER_NOTE_FTP_SIGNATURE_DESCRIPTION"
|
||||
heading="h4"
|
||||
class="alert alert-success note_ftp_signature" />
|
||||
<!-- Path Field. Type: Text. (joomla)-->
|
||||
<field type="text"
|
||||
name="path"
|
||||
label="COM_COMPONENTBUILDER_SERVER_PATH_LABEL"
|
||||
size="40"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_SERVER_PATH_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="PATH"
|
||||
message="COM_COMPONENTBUILDER_SERVER_PATH_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_SERVER_PATH_HINT" />
|
||||
<!-- Port Field. Type: Text. (joomla)-->
|
||||
<field type="text"
|
||||
name="port"
|
||||
label="COM_COMPONENTBUILDER_SERVER_PORT_LABEL"
|
||||
size="10"
|
||||
maxlength="50"
|
||||
description="COM_COMPONENTBUILDER_SERVER_PORT_DESCRIPTION"
|
||||
class="text_area"
|
||||
required="true"
|
||||
filter="INT"
|
||||
message="COM_COMPONENTBUILDER_SERVER_PORT_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_SERVER_PORT_HINT"
|
||||
onchange="if(!jQuery(this).val().match(/^\d+$/)){jQuery(this).val('')};" />
|
||||
<!-- Authentication Field. Type: Radio. (joomla)-->
|
||||
<field type="radio"
|
||||
name="authentication"
|
||||
label="COM_COMPONENTBUILDER_SERVER_AUTHENTICATION_LABEL"
|
||||
description="COM_COMPONENTBUILDER_SERVER_AUTHENTICATION_DESCRIPTION"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="1"
|
||||
required="true">
|
||||
<!-- Option Set.-->
|
||||
<option value="1">COM_COMPONENTBUILDER_SERVER_PASSWORD</option>
|
||||
<option value="2">COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY</option>
|
||||
</field>
|
||||
<!-- Note_ssh_security Field. Type: Note. A None Database Field. (joomla)-->
|
||||
<field type="note"
|
||||
name="note_ssh_security"
|
||||
label="COM_COMPONENTBUILDER_SERVER_NOTE_SSH_SECURITY_LABEL"
|
||||
description="COM_COMPONENTBUILDER_SERVER_NOTE_SSH_SECURITY_DESCRIPTION"
|
||||
heading="h4"
|
||||
class="alert alert-info note_ssh_security" />
|
||||
<!-- Password Field. Type: Password. (joomla)-->
|
||||
<field type="password"
|
||||
name="password"
|
||||
label="COM_COMPONENTBUILDER_SERVER_PASSWORD_LABEL"
|
||||
size="60"
|
||||
description="COM_COMPONENTBUILDER_SERVER_PASSWORD_DESCRIPTION"
|
||||
message="Error! Please add the password here."
|
||||
class="text_area"
|
||||
required="true"
|
||||
filter="raw" />
|
||||
<!-- Secret Field. Type: Password. (joomla)-->
|
||||
<field type="password"
|
||||
name="secret"
|
||||
label="COM_COMPONENTBUILDER_SERVER_SECRET_LABEL"
|
||||
size="60"
|
||||
description="COM_COMPONENTBUILDER_SERVER_SECRET_DESCRIPTION"
|
||||
message="Error! Please add the passphrase here."
|
||||
class="text_area"
|
||||
filter="raw" />
|
||||
<!-- Host Field. Type: Text. (joomla)-->
|
||||
<field type="text"
|
||||
name="host"
|
||||
label="COM_COMPONENTBUILDER_SERVER_HOST_LABEL"
|
||||
size="40"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_SERVER_HOST_DESCRIPTION"
|
||||
class="text_area"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_SERVER_HOST_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_SERVER_HOST_HINT" />
|
||||
<!-- Signature Field. Type: Text. (joomla)-->
|
||||
<field type="text"
|
||||
name="signature"
|
||||
label="COM_COMPONENTBUILDER_SERVER_SIGNATURE_LABEL"
|
||||
size="250"
|
||||
maxlength="250"
|
||||
description="COM_COMPONENTBUILDER_SERVER_SIGNATURE_DESCRIPTION"
|
||||
class="text_area span12"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_SERVER_SIGNATURE_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_SERVER_SIGNATURE_HINT"
|
||||
autocomplete="off" />
|
||||
<!-- Username Field. Type: Text. (joomla)-->
|
||||
<field type="text"
|
||||
name="username"
|
||||
label="COM_COMPONENTBUILDER_SERVER_USERNAME_LABEL"
|
||||
size="60"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_SERVER_USERNAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_SERVER_USERNAME_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_SERVER_USERNAME_HINT" />
|
||||
<!-- Not_required Field. Type: Hidden. (joomla)-->
|
||||
<field type="hidden"
|
||||
name="not_required"
|
||||
default="[]" />
|
||||
<!-- Private Field. Type: Text. (joomla)-->
|
||||
<field type="text"
|
||||
name="private"
|
||||
label="COM_COMPONENTBUILDER_SERVER_PRIVATE_LABEL"
|
||||
size="50"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_SERVER_PRIVATE_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="PATH"
|
||||
message="COM_COMPONENTBUILDER_SERVER_PRIVATE_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_SERVER_PRIVATE_HINT" />
|
||||
<!-- Public Field. Type: Text. (joomla)-->
|
||||
<field type="text"
|
||||
name="public"
|
||||
label="COM_COMPONENTBUILDER_SERVER_PUBLIC_LABEL"
|
||||
size="50"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_SERVER_PUBLIC_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="true"
|
||||
filter="PATH"
|
||||
message="COM_COMPONENTBUILDER_SERVER_PUBLIC_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_SERVER_PUBLIC_HINT" />
|
||||
</fieldset>
|
||||
|
||||
<!-- Access Control Fields. -->
|
||||
<fieldset name="accesscontrol">
|
||||
<!-- Asset Id Field. Type: Hidden (joomla) -->
|
||||
<field
|
||||
name="asset_id"
|
||||
type="hidden"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Rules Field. Type: Rules (joomla) -->
|
||||
<field
|
||||
name="rules"
|
||||
type="rules"
|
||||
label="Permissions in relation to this server"
|
||||
translate_label="false"
|
||||
filter="rules"
|
||||
validate="rules"
|
||||
class="inputbox"
|
||||
component="com_componentbuilder"
|
||||
section="server"
|
||||
/>
|
||||
</fieldset>
|
||||
</form>
|
@ -13,7 +13,7 @@
|
||||
@version 2.6.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage ftp.php
|
||||
@subpackage server.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@ -32,9 +32,9 @@ use Joomla\Registry\Registry;
|
||||
jimport('joomla.application.component.modeladmin');
|
||||
|
||||
/**
|
||||
* Componentbuilder Ftp Model
|
||||
* Componentbuilder Server Model
|
||||
*/
|
||||
class ComponentbuilderModelFtp extends JModelAdmin
|
||||
class ComponentbuilderModelServer extends JModelAdmin
|
||||
{
|
||||
/**
|
||||
* @var string The prefix to use with controller messages.
|
||||
@ -48,7 +48,7 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
* @var string
|
||||
* @since 3.2
|
||||
*/
|
||||
public $typeAlias = 'com_componentbuilder.ftp';
|
||||
public $typeAlias = 'com_componentbuilder.server';
|
||||
|
||||
/**
|
||||
* Returns a Table object, always creating it
|
||||
@ -61,7 +61,7 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getTable($type = 'ftp', $prefix = 'ComponentbuilderTable', $config = array())
|
||||
public function getTable($type = 'server', $prefix = 'ComponentbuilderTable', $config = array())
|
||||
{
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
@ -100,19 +100,67 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
// Get the encryption object.
|
||||
$basic = new FOFEncryptAes($basickey, 128);
|
||||
|
||||
if (!empty($item->path) && $basickey && !is_numeric($item->path) && $item->path === base64_encode(base64_decode($item->path, true)))
|
||||
{
|
||||
// basic decrypt data path.
|
||||
$item->path = rtrim($basic->decryptString($item->path), "\0");
|
||||
}
|
||||
|
||||
if (!empty($item->port) && $basickey && !is_numeric($item->port) && $item->port === base64_encode(base64_decode($item->port, true)))
|
||||
{
|
||||
// basic decrypt data port.
|
||||
$item->port = rtrim($basic->decryptString($item->port), "\0");
|
||||
}
|
||||
|
||||
if (!empty($item->password) && $basickey && !is_numeric($item->password) && $item->password === base64_encode(base64_decode($item->password, true)))
|
||||
{
|
||||
// basic decrypt data password.
|
||||
$item->password = rtrim($basic->decryptString($item->password), "\0");
|
||||
}
|
||||
|
||||
if (!empty($item->secret) && $basickey && !is_numeric($item->secret) && $item->secret === base64_encode(base64_decode($item->secret, true)))
|
||||
{
|
||||
// basic decrypt data secret.
|
||||
$item->secret = rtrim($basic->decryptString($item->secret), "\0");
|
||||
}
|
||||
|
||||
if (!empty($item->host) && $basickey && !is_numeric($item->host) && $item->host === base64_encode(base64_decode($item->host, true)))
|
||||
{
|
||||
// basic decrypt data host.
|
||||
$item->host = rtrim($basic->decryptString($item->host), "\0");
|
||||
}
|
||||
|
||||
if (!empty($item->signature) && $basickey && !is_numeric($item->signature) && $item->signature === base64_encode(base64_decode($item->signature, true)))
|
||||
{
|
||||
// basic decrypt data signature.
|
||||
$item->signature = rtrim($basic->decryptString($item->signature), "\0");
|
||||
}
|
||||
|
||||
if (!empty($item->username) && $basickey && !is_numeric($item->username) && $item->username === base64_encode(base64_decode($item->username, true)))
|
||||
{
|
||||
// basic decrypt data username.
|
||||
$item->username = rtrim($basic->decryptString($item->username), "\0");
|
||||
}
|
||||
|
||||
if (!empty($item->private) && $basickey && !is_numeric($item->private) && $item->private === base64_encode(base64_decode($item->private, true)))
|
||||
{
|
||||
// basic decrypt data private.
|
||||
$item->private = rtrim($basic->decryptString($item->private), "\0");
|
||||
}
|
||||
|
||||
if (!empty($item->public) && $basickey && !is_numeric($item->public) && $item->public === base64_encode(base64_decode($item->public, true)))
|
||||
{
|
||||
// basic decrypt data public.
|
||||
$item->public = rtrim($basic->decryptString($item->public), "\0");
|
||||
}
|
||||
|
||||
if (!empty($item->id))
|
||||
{
|
||||
$item->tags = new JHelperTags;
|
||||
$item->tags->getTagIds($item->id, 'com_componentbuilder.ftp');
|
||||
$item->tags->getTagIds($item->id, 'com_componentbuilder.server');
|
||||
}
|
||||
}
|
||||
$this->sales_server_ftpupdate_server_ftp_vvvx = $item->id;
|
||||
$this->sales_serverupdate_servervvvx = $item->id;
|
||||
|
||||
return $item;
|
||||
}
|
||||
@ -122,7 +170,7 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getWaelinked_components()
|
||||
public function getWaplinked_components()
|
||||
{
|
||||
// Get the user object.
|
||||
$user = JFactory::getUser();
|
||||
@ -136,19 +184,19 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
// From the componentbuilder_joomla_component table
|
||||
$query->from($db->quoteName('#__componentbuilder_joomla_component', 'a'));
|
||||
|
||||
// Filter by sales_server_ftpupdate_server_ftp_vvvx global.
|
||||
$sales_server_ftpupdate_server_ftp_vvvx = $this->sales_server_ftpupdate_server_ftp_vvvx;
|
||||
if (is_numeric($sales_server_ftpupdate_server_ftp_vvvx ))
|
||||
// Filter by sales_serverupdate_servervvvx global.
|
||||
$sales_serverupdate_servervvvx = $this->sales_serverupdate_servervvvx;
|
||||
if (is_numeric($sales_serverupdate_servervvvx ))
|
||||
{
|
||||
$query->where('a.sales_server_ftp = ' . (int) $sales_server_ftpupdate_server_ftp_vvvx . ' OR a.update_server_ftp = ' . (int) $sales_server_ftpupdate_server_ftp_vvvx, ' OR');
|
||||
$query->where('a.sales_server = ' . (int) $sales_serverupdate_servervvvx . ' OR a.update_server = ' . (int) $sales_serverupdate_servervvvx, ' OR');
|
||||
}
|
||||
elseif (is_string($sales_server_ftpupdate_server_ftp_vvvx))
|
||||
elseif (is_string($sales_serverupdate_servervvvx))
|
||||
{
|
||||
$query->where('a.sales_server_ftp = ' . $db->quote($sales_server_ftpupdate_server_ftp_vvvx) . ' OR a.update_server_ftp = ' . $db->quote($sales_server_ftpupdate_server_ftp_vvvx), ' OR');
|
||||
$query->where('a.sales_server = ' . $db->quote($sales_serverupdate_servervvvx) . ' OR a.update_server = ' . $db->quote($sales_serverupdate_servervvvx), ' OR');
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where('a.update_server_ftp = -5');
|
||||
$query->where('a.update_server = -5');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
@ -211,7 +259,7 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
public function getForm($data = array(), $loadData = true)
|
||||
{
|
||||
// Get the form.
|
||||
$form = $this->loadForm('com_componentbuilder.ftp', 'ftp', array('control' => 'jform', 'load_data' => $loadData));
|
||||
$form = $this->loadForm('com_componentbuilder.server', 'server', array('control' => 'jform', 'load_data' => $loadData));
|
||||
|
||||
if (empty($form))
|
||||
{
|
||||
@ -235,8 +283,8 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
|
||||
// Check for existing item.
|
||||
// Modify the form based on Edit State access controls.
|
||||
if ($id != 0 && (!$user->authorise('ftp.edit.state', 'com_componentbuilder.ftp.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('ftp.edit.state', 'com_componentbuilder')))
|
||||
if ($id != 0 && (!$user->authorise('server.edit.state', 'com_componentbuilder.server.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('server.edit.state', 'com_componentbuilder')))
|
||||
{
|
||||
// Disable fields for display.
|
||||
$form->setFieldAttribute('ordering', 'disabled', 'true');
|
||||
@ -252,8 +300,8 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
$form->setValue('created_by', null, $user->id);
|
||||
}
|
||||
// Modify the form based on Edit Creaded By access controls.
|
||||
if ($id != 0 && (!$user->authorise('ftp.edit.created_by', 'com_componentbuilder.ftp.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('ftp.edit.created_by', 'com_componentbuilder')))
|
||||
if ($id != 0 && (!$user->authorise('server.edit.created_by', 'com_componentbuilder.server.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('server.edit.created_by', 'com_componentbuilder')))
|
||||
{
|
||||
// Disable fields for display.
|
||||
$form->setFieldAttribute('created_by', 'disabled', 'true');
|
||||
@ -263,46 +311,14 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
$form->setFieldAttribute('created_by', 'filter', 'unset');
|
||||
}
|
||||
// Modify the form based on Edit Creaded Date access controls.
|
||||
if ($id != 0 && (!$user->authorise('ftp.edit.created', 'com_componentbuilder.ftp.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('ftp.edit.created', 'com_componentbuilder')))
|
||||
if ($id != 0 && (!$user->authorise('server.edit.created', 'com_componentbuilder.server.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('server.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 Name access controls.
|
||||
if ($id != 0 && (!$user->authorise('ftp.edit.name', 'com_componentbuilder.ftp.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('ftp.edit.name', 'com_componentbuilder')))
|
||||
{
|
||||
// Disable fields for display.
|
||||
$form->setFieldAttribute('name', 'disabled', 'true');
|
||||
// Disable fields for display.
|
||||
$form->setFieldAttribute('name', 'readonly', 'true');
|
||||
if (!$form->getValue('name'))
|
||||
{
|
||||
// Disable fields while saving.
|
||||
$form->setFieldAttribute('name', 'filter', 'unset');
|
||||
// Disable fields while saving.
|
||||
$form->setFieldAttribute('name', 'required', 'false');
|
||||
}
|
||||
}
|
||||
// Modify the form based on Edit Signature access controls.
|
||||
if ($id != 0 && (!$user->authorise('ftp.edit.signature', 'com_componentbuilder.ftp.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('ftp.edit.signature', 'com_componentbuilder')))
|
||||
{
|
||||
// Disable fields for display.
|
||||
$form->setFieldAttribute('signature', 'disabled', 'true');
|
||||
// Disable fields for display.
|
||||
$form->setFieldAttribute('signature', 'readonly', 'true');
|
||||
if (!$form->getValue('signature'))
|
||||
{
|
||||
// Disable fields while saving.
|
||||
$form->setFieldAttribute('signature', 'filter', 'unset');
|
||||
// Disable fields while saving.
|
||||
$form->setFieldAttribute('signature', 'required', 'false');
|
||||
}
|
||||
}
|
||||
// Only load these values if no id is found
|
||||
if (0 == $id)
|
||||
{
|
||||
@ -327,7 +343,7 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
*/
|
||||
public function getScript()
|
||||
{
|
||||
return 'administrator/components/com_componentbuilder/models/forms/ftp.js';
|
||||
return 'administrator/components/com_componentbuilder/models/forms/server.js';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -350,7 +366,7 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
|
||||
$user = JFactory::getUser();
|
||||
// The record has been set. Check the record permissions.
|
||||
return $user->authorise('ftp.delete', 'com_componentbuilder.ftp.' . (int) $record->id);
|
||||
return $user->authorise('server.delete', 'com_componentbuilder.server.' . (int) $record->id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -372,14 +388,14 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
if ($recordId)
|
||||
{
|
||||
// The record has been set. Check the record permissions.
|
||||
$permission = $user->authorise('ftp.edit.state', 'com_componentbuilder.ftp.' . (int) $recordId);
|
||||
$permission = $user->authorise('server.edit.state', 'com_componentbuilder.server.' . (int) $recordId);
|
||||
if (!$permission && !is_null($permission))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return $user->authorise('ftp.edit.state', 'com_componentbuilder');
|
||||
return $user->authorise('server.edit.state', 'com_componentbuilder');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -396,7 +412,7 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
// Check specific edit permission then general edit permission.
|
||||
$user = JFactory::getUser();
|
||||
|
||||
return $user->authorise('ftp.edit', 'com_componentbuilder.ftp.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('ftp.edit', 'com_componentbuilder');
|
||||
return $user->authorise('server.edit', 'com_componentbuilder.server.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('server.edit', 'com_componentbuilder');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -437,7 +453,7 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('MAX(ordering)')
|
||||
->from($db->quoteName('#__componentbuilder_ftp'));
|
||||
->from($db->quoteName('#__componentbuilder_server'));
|
||||
$db->setQuery($query);
|
||||
$max = $db->loadResult();
|
||||
|
||||
@ -467,7 +483,7 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.ftp.data', array());
|
||||
$data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.server.data', array());
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
@ -475,6 +491,42 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -565,7 +617,7 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('ftp');
|
||||
$this->canDo = ComponentbuilderHelper::getActions('server');
|
||||
$this->batchSet = true;
|
||||
|
||||
if (!$this->canDo->get('core.batch'))
|
||||
@ -645,10 +697,10 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('ftp');
|
||||
$this->canDo = ComponentbuilderHelper::getActions('server');
|
||||
}
|
||||
|
||||
if (!$this->canDo->get('ftp.create') && !$this->canDo->get('ftp.batch'))
|
||||
if (!$this->canDo->get('server.create') && !$this->canDo->get('server.batch'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -663,7 +715,7 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
{
|
||||
$values['published'] = 0;
|
||||
}
|
||||
elseif (isset($values['published']) && !$this->canDo->get('ftp.edit.state'))
|
||||
elseif (isset($values['published']) && !$this->canDo->get('server.edit.state'))
|
||||
{
|
||||
$values['published'] = 0;
|
||||
}
|
||||
@ -680,7 +732,7 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
|
||||
// only allow copy if user may edit this item.
|
||||
|
||||
if (!$this->user->authorise('ftp.edit', $contexts[$pk]))
|
||||
if (!$this->user->authorise('server.edit', $contexts[$pk]))
|
||||
|
||||
{
|
||||
|
||||
@ -794,17 +846,17 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('ftp');
|
||||
$this->canDo = ComponentbuilderHelper::getActions('server');
|
||||
}
|
||||
|
||||
if (!$this->canDo->get('ftp.edit') && !$this->canDo->get('ftp.batch'))
|
||||
if (!$this->canDo->get('server.edit') && !$this->canDo->get('server.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('ftp.edit.state'))
|
||||
if (isset($values['published']) && !$this->canDo->get('server.edit.state'))
|
||||
{
|
||||
unset($values['published']);
|
||||
}
|
||||
@ -814,7 +866,7 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
// Parent exists so we proceed
|
||||
foreach ($pks as $pk)
|
||||
{
|
||||
if (!$this->user->authorise('ftp.edit', $contexts[$pk]))
|
||||
if (!$this->user->authorise('server.edit', $contexts[$pk]))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
|
||||
|
||||
@ -914,10 +966,58 @@ class ComponentbuilderModelFtp extends JModelAdmin
|
||||
// Get the encryption object
|
||||
$basic = new FOFEncryptAes($basickey, 128);
|
||||
|
||||
// Encrypt data path.
|
||||
if (isset($data['path']) && $basickey)
|
||||
{
|
||||
$data['path'] = $basic->encryptString($data['path']);
|
||||
}
|
||||
|
||||
// Encrypt data port.
|
||||
if (isset($data['port']) && $basickey)
|
||||
{
|
||||
$data['port'] = $basic->encryptString($data['port']);
|
||||
}
|
||||
|
||||
// Encrypt data password.
|
||||
if (isset($data['password']) && $basickey)
|
||||
{
|
||||
$data['password'] = $basic->encryptString($data['password']);
|
||||
}
|
||||
|
||||
// Encrypt data secret.
|
||||
if (isset($data['secret']) && $basickey)
|
||||
{
|
||||
$data['secret'] = $basic->encryptString($data['secret']);
|
||||
}
|
||||
|
||||
// Encrypt data host.
|
||||
if (isset($data['host']) && $basickey)
|
||||
{
|
||||
$data['host'] = $basic->encryptString($data['host']);
|
||||
}
|
||||
|
||||
// Encrypt data signature.
|
||||
if (isset($data['signature']) && $basickey)
|
||||
{
|
||||
$data['signature'] = $basic->encryptString($data['signature']);
|
||||
}
|
||||
|
||||
// Encrypt data username.
|
||||
if (isset($data['username']) && $basickey)
|
||||
{
|
||||
$data['username'] = $basic->encryptString($data['username']);
|
||||
}
|
||||
|
||||
// Encrypt data private.
|
||||
if (isset($data['private']) && $basickey)
|
||||
{
|
||||
$data['private'] = $basic->encryptString($data['private']);
|
||||
}
|
||||
|
||||
// Encrypt data public.
|
||||
if (isset($data['public']) && $basickey)
|
||||
{
|
||||
$data['public'] = $basic->encryptString($data['public']);
|
||||
}
|
||||
|
||||
// Set the Params Items to data
|
@ -13,7 +13,7 @@
|
||||
@version 2.6.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage ftps.php
|
||||
@subpackage servers.php
|
||||
@author Llewellyn van der Merwe <http://joomlacomponentbuilder.com>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@ -30,9 +30,9 @@ defined('_JEXEC') or die('Restricted access');
|
||||
jimport('joomla.application.component.modellist');
|
||||
|
||||
/**
|
||||
* Ftps Model
|
||||
* Servers Model
|
||||
*/
|
||||
class ComponentbuilderModelFtps extends JModelList
|
||||
class ComponentbuilderModelServers extends JModelList
|
||||
{
|
||||
public function __construct($config = array())
|
||||
{
|
||||
@ -44,7 +44,8 @@ class ComponentbuilderModelFtps extends JModelList
|
||||
'a.ordering','ordering',
|
||||
'a.created_by','created_by',
|
||||
'a.modified_by','modified_by',
|
||||
'a.name','name'
|
||||
'a.name','name',
|
||||
'a.protocol','protocol'
|
||||
);
|
||||
}
|
||||
|
||||
@ -66,7 +67,10 @@ class ComponentbuilderModelFtps extends JModelList
|
||||
$this->context .= '.' . $layout;
|
||||
}
|
||||
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
|
||||
$this->setState('filter.name', $name);
|
||||
$this->setState('filter.name', $name);
|
||||
|
||||
$protocol = $this->getUserStateFromRequest($this->context . '.filter.protocol', 'filter_protocol');
|
||||
$this->setState('filter.protocol', $protocol);
|
||||
|
||||
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
|
||||
$this->setState('filter.sorting', $sorting);
|
||||
@ -110,7 +114,7 @@ class ComponentbuilderModelFtps extends JModelList
|
||||
$user = JFactory::getUser();
|
||||
foreach ($items as $nr => &$item)
|
||||
{
|
||||
$access = ($user->authorise('ftp.access', 'com_componentbuilder.ftp.' . (int) $item->id) && $user->authorise('ftp.access', 'com_componentbuilder'));
|
||||
$access = ($user->authorise('server.access', 'com_componentbuilder.server.' . (int) $item->id) && $user->authorise('server.access', 'com_componentbuilder'));
|
||||
if (!$access)
|
||||
{
|
||||
unset($items[$nr]);
|
||||
@ -118,10 +122,45 @@ class ComponentbuilderModelFtps extends JModelList
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set selection value to a translatable value
|
||||
if (ComponentbuilderHelper::checkArray($items))
|
||||
{
|
||||
foreach ($items as $nr => &$item)
|
||||
{
|
||||
// convert protocol
|
||||
$item->protocol = $this->selectionTranslation($item->protocol, 'protocol');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to convert selection values to translatable string.
|
||||
*
|
||||
* @return translatable string
|
||||
*/
|
||||
public function selectionTranslation($value,$name)
|
||||
{
|
||||
// Array of protocol language strings
|
||||
if ($name === 'protocol')
|
||||
{
|
||||
$protocolArray = array(
|
||||
0 => 'COM_COMPONENTBUILDER_SERVER_SELECT_AN_OPTION',
|
||||
1 => 'COM_COMPONENTBUILDER_SERVER_FTP',
|
||||
2 => 'COM_COMPONENTBUILDER_SERVER_SSH'
|
||||
);
|
||||
// Now check if value is found in this array
|
||||
if (isset($protocolArray[$value]) && ComponentbuilderHelper::checkString($protocolArray[$value]))
|
||||
{
|
||||
return $protocolArray[$value];
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -141,7 +180,7 @@ class ComponentbuilderModelFtps extends JModelList
|
||||
$query->select('a.*');
|
||||
|
||||
// From the componentbuilder_item table
|
||||
$query->from($db->quoteName('#__componentbuilder_ftp', 'a'));
|
||||
$query->from($db->quoteName('#__componentbuilder_server', 'a'));
|
||||
|
||||
// Filter by published state
|
||||
$published = $this->getState('filter.published');
|
||||
@ -179,7 +218,7 @@ class ComponentbuilderModelFtps extends JModelList
|
||||
else
|
||||
{
|
||||
$search = $db->quote('%' . $db->escape($search) . '%');
|
||||
$query->where('(a.name LIKE '.$search.')');
|
||||
$query->where('(a.name LIKE '.$search.' OR a.protocol LIKE '.$search.')');
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,6 +227,11 @@ class ComponentbuilderModelFtps extends JModelList
|
||||
{
|
||||
$query->where('a.name = ' . $db->quote($db->escape($name)));
|
||||
}
|
||||
// Filter by Protocol.
|
||||
if ($protocol = $this->getState('filter.protocol'))
|
||||
{
|
||||
$query->where('a.protocol = ' . $db->quote($db->escape($protocol)));
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
$orderCol = $this->state->get('list.ordering', 'a.id');
|
||||
@ -221,8 +265,8 @@ class ComponentbuilderModelFtps extends JModelList
|
||||
// Select some fields
|
||||
$query->select('a.*');
|
||||
|
||||
// From the componentbuilder_ftp table
|
||||
$query->from($db->quoteName('#__componentbuilder_ftp', 'a'));
|
||||
// From the componentbuilder_server table
|
||||
$query->from($db->quoteName('#__componentbuilder_server', 'a'));
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
@ -253,18 +297,58 @@ class ComponentbuilderModelFtps extends JModelList
|
||||
$user = JFactory::getUser();
|
||||
foreach ($items as $nr => &$item)
|
||||
{
|
||||
$access = ($user->authorise('ftp.access', 'com_componentbuilder.ftp.' . (int) $item->id) && $user->authorise('ftp.access', 'com_componentbuilder'));
|
||||
$access = ($user->authorise('server.access', 'com_componentbuilder.server.' . (int) $item->id) && $user->authorise('server.access', 'com_componentbuilder'));
|
||||
if (!$access)
|
||||
{
|
||||
unset($items[$nr]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($basickey && !is_numeric($item->path) && $item->path === base64_encode(base64_decode($item->path, true)))
|
||||
{
|
||||
// decrypt path
|
||||
$item->path = $basic->decryptString($item->path);
|
||||
}
|
||||
if ($basickey && !is_numeric($item->port) && $item->port === base64_encode(base64_decode($item->port, true)))
|
||||
{
|
||||
// decrypt port
|
||||
$item->port = $basic->decryptString($item->port);
|
||||
}
|
||||
if ($basickey && !is_numeric($item->password) && $item->password === base64_encode(base64_decode($item->password, true)))
|
||||
{
|
||||
// decrypt password
|
||||
$item->password = $basic->decryptString($item->password);
|
||||
}
|
||||
if ($basickey && !is_numeric($item->secret) && $item->secret === base64_encode(base64_decode($item->secret, true)))
|
||||
{
|
||||
// decrypt secret
|
||||
$item->secret = $basic->decryptString($item->secret);
|
||||
}
|
||||
if ($basickey && !is_numeric($item->host) && $item->host === base64_encode(base64_decode($item->host, true)))
|
||||
{
|
||||
// decrypt host
|
||||
$item->host = $basic->decryptString($item->host);
|
||||
}
|
||||
if ($basickey && !is_numeric($item->signature) && $item->signature === base64_encode(base64_decode($item->signature, true)))
|
||||
{
|
||||
// decrypt signature
|
||||
$item->signature = $basic->decryptString($item->signature);
|
||||
}
|
||||
if ($basickey && !is_numeric($item->username) && $item->username === base64_encode(base64_decode($item->username, true)))
|
||||
{
|
||||
// decrypt username
|
||||
$item->username = $basic->decryptString($item->username);
|
||||
}
|
||||
if ($basickey && !is_numeric($item->private) && $item->private === base64_encode(base64_decode($item->private, true)))
|
||||
{
|
||||
// decrypt private
|
||||
$item->private = $basic->decryptString($item->private);
|
||||
}
|
||||
if ($basickey && !is_numeric($item->public) && $item->public === base64_encode(base64_decode($item->public, true)))
|
||||
{
|
||||
// decrypt public
|
||||
$item->public = $basic->decryptString($item->public);
|
||||
}
|
||||
// unset the values we don't want exported.
|
||||
unset($item->asset_id);
|
||||
unset($item->checked_out);
|
||||
@ -293,7 +377,7 @@ class ComponentbuilderModelFtps extends JModelList
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// get the columns
|
||||
$columns = $db->getTableColumns("#__componentbuilder_ftp");
|
||||
$columns = $db->getTableColumns("#__componentbuilder_server");
|
||||
if (ComponentbuilderHelper::checkArray($columns))
|
||||
{
|
||||
// remove the headers you don't import/export.
|
||||
@ -325,7 +409,8 @@ class ComponentbuilderModelFtps extends JModelList
|
||||
$id .= ':' . $this->getState('filter.ordering');
|
||||
$id .= ':' . $this->getState('filter.created_by');
|
||||
$id .= ':' . $this->getState('filter.modified_by');
|
||||
$id .= ':' . $this->getState('filter.name');
|
||||
$id .= ':' . $this->getState('filter.name');
|
||||
$id .= ':' . $this->getState('filter.protocol');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
@ -349,7 +434,7 @@ class ComponentbuilderModelFtps extends JModelList
|
||||
// reset query
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('*');
|
||||
$query->from($db->quoteName('#__componentbuilder_ftp'));
|
||||
$query->from($db->quoteName('#__componentbuilder_server'));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
@ -372,7 +457,7 @@ class ComponentbuilderModelFtps extends JModelList
|
||||
);
|
||||
|
||||
// Check table
|
||||
$query->update($db->quoteName('#__componentbuilder_ftp'))->set($fields)->where($conditions);
|
||||
$query->update($db->quoteName('#__componentbuilder_server'))->set($fields)->where($conditions);
|
||||
|
||||
$db->setQuery($query);
|
||||
|
Reference in New Issue
Block a user