Fixed #884 so we will have correct pagination in admin area J3. Imporved the import of powers JCB-pro.

This commit is contained in:
2022-05-16 06:25:03 +02:00
parent c5be4ff5fa
commit 1e0533ffa5
30 changed files with 855 additions and 554 deletions

View File

@ -167,10 +167,36 @@ class ComponentbuilderModelAjax extends JModelList
{
// Get the encryption object.
$db = 'COM_COMPONENTBUILDER_VJRZDESSMHBTRWFIFTYTWVZEROAESFLVVXJTMTHREEJTWOIXM';
$opener = new FOFEncryptAes(base64_decode(JText::sprintf($db, 'QzdmV', '9kQ')), 128);
$info = rtrim($opener->decryptString($info), "\0");
$password = base64_decode(JText::sprintf($db, 'QzdmV', '9kQ'));
// we first use the new encryption
// load phpseclib <https://phpseclib.com/docs/symmetric>
$opened = false;
if(ComponentbuilderHelper::crypt('AES', 'CBC') instanceof \phpseclib\Crypt\Rijndael)
{
// load the system password
ComponentbuilderHelper::crypt('AES', 'CBC')->setPassword($password, 'pbkdf2', 'sha256', 'VastDevelopmentMethod/salt');
// open the info block
$_info = ComponentbuilderHelper::crypt('AES', 'CBC')->decrypt(base64_decode($info));
// check if we had success
if ($_info !== false)
{
$opened = true;
}
}
// check if we had success
if (!$opened && class_exists('FOFEncryptAes'))
{
$opener = new FOFEncryptAes($password, 128);
$_info = $opener->decryptString($info);
// check if we had success
if ($_info !== false)
{
$opened = true;
$_info = rtrim($_info, "\0");
}
}
// check if we have json
if (ComponentbuilderHelper::checkJson($info))
if ($opened && ComponentbuilderHelper::checkJson($_info))
{
$info = json_decode($info, true);
return array('owner' => ComponentbuilderHelper::getPackageOwnerDetailsDisplay($info, true), 'packages' => ComponentbuilderHelper::getPackageComponentsDetailsDisplay($info));
@ -1065,7 +1091,7 @@ class ComponentbuilderModelAjax extends JModelList
array('table' => 'custom_admin_view', 'tables' => 'custom_admin_views', 'fields' => array('params' => 'custom_admin_view_headers:power_', 'system_name' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW'),
array('table' => 'joomla_component', 'tables' => 'joomla_components', 'fields' => array('params' => 'joomla_component_headers:power_', 'system_name' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT'),
array('table' => 'component_dashboard', 'tables' => 'components_dashboard', 'fields' => array('params' => 'component_dashboard_headers:power_', 'joomla_component' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_COMPONENT_DASHBOARD', 'linked_name' => 'system_name'),
array('table' => 'power', 'tables' => 'powers', 'fields' => array('extends' => 'INT', 'implements' => 'ARRAY', 'use_selection' => 'use', 'load_selection' => 'load', 'system_name' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_POWER')
array('table' => 'power', 'tables' => 'powers', 'fields' => array('extends' => 'GUID', 'implements' => 'ARRAY', 'use_selection' => 'use', 'load_selection' => 'load', 'system_name' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_POWER')
)
);
@ -1095,8 +1121,14 @@ class ComponentbuilderModelAjax extends JModelList
}
// make sure the ref is set
$this->ref = '&ref=' . $values['a_view'] . '&refid=' . $values['a_id'] . '&return=' . urlencode(base64_encode($return_url));
// specail treatment of powers
$guid = false;
if ('power' === $values['a_view'])
{
$guid = $values['a_guid'];
}
// get the linked to
if ($linked = $this->getLinkedTo($values['a_view'], $values['a_id']))
if ($linked = $this->getLinkedTo($values['a_view'], $values['a_id'], $guid))
{
// just return it for now a table
$table = '<div class="control-group"><table class="uk-table uk-table-hover uk-table-striped uk-table-condensed">';
@ -1119,13 +1151,14 @@ class ComponentbuilderModelAjax extends JModelList
/**
* Get Linked to Items
*
* @param string $view View that is being searched for
* @param int $id ID
* @param string $view View that is being searched for
* @param int $id ID
* @param string $guid GUID
*
* @return array Found items
*
*/
protected function getLinkedTo($view, $id)
protected function getLinkedTo($view, $id, $guid)
{
// reset bucket
$linked = array();
@ -1174,6 +1207,14 @@ class ComponentbuilderModelAjax extends JModelList
$found = true;
}
}
elseif ('GUID' === $target)
{
// check if GUID match
if ($this->linkedGuid($guid, $item->{$key}))
{
$found = true;
}
}
else
{
// check if we have a json
@ -1189,7 +1230,7 @@ class ComponentbuilderModelAjax extends JModelList
// check if ID match
foreach ($item->{$key} as $_id)
{
if ($_id == $id)
if ($_id == $id || $this->linkedGuid($guid, $_id))
{
$found = true;
}
@ -1208,7 +1249,7 @@ class ComponentbuilderModelAjax extends JModelList
{
if ($_size == 2)
{
if (isset($row[$_target[0]]) && isset($row[$_target[0]][$_target[1]]) && $row[$_target[0]][$_target[1]] == $id)
if (isset($row[$_target[0]]) && isset($row[$_target[0]][$_target[1]]) && ($row[$_target[0]][$_target[1]] == $id || $this->linkedGuid($guid, $row[$_target[0]][$_target[1]])))
{
$found = true;
}
@ -1217,7 +1258,7 @@ class ComponentbuilderModelAjax extends JModelList
{
foreach ($row[$_target[0]] as $_row)
{
if (!$found && isset($_row[$_target[2]]) && $_row[$_target[2]] == $id)
if (!$found && isset($_row[$_target[2]]) && ($_row[$_target[2]] == $id || $this->linkedGuid($guid, $_row[$_target[2]])))
{
$found = true;
}
@ -1238,7 +1279,7 @@ class ComponentbuilderModelAjax extends JModelList
{
foreach ($row as $key => $_ids)
{
if (!$found && strpos($key, $_target[1]) !== false && in_array($id, $_ids))
if (!$found && strpos($key, $_target[1]) !== false && (in_array($id, $_ids) || $this->linkedGuid($guid, $_ids)))
{
$found = true;
}
@ -1251,7 +1292,7 @@ class ComponentbuilderModelAjax extends JModelList
{
foreach ($item->{$key} as $row)
{
if (!$found && isset($row[$target]) && $row[$target] == $id)
if (!$found && isset($row[$target]) && ($row[$target] == $id || $this->linkedGuid($guid, $row[$target])))
{
$found = true;
}
@ -1275,7 +1316,7 @@ class ComponentbuilderModelAjax extends JModelList
{
foreach ($_fields as $_field)
{
if ($_field == $id)
if ($_field == $id || $this->linkedGuid($guid, $_field))
{
$found = true;
}
@ -1330,6 +1371,32 @@ class ComponentbuilderModelAjax extends JModelList
}
return false;
}
/**
* Check if we have a GUID match
*
* @param string|bool $guid The active power guid
* @param string|array $setGuid The linked power guid
*
* @return bool true if match is found
*
*/
protected function linkedGuid($guid, $setGuid): bool
{
// check if GUID is valid
if ($guid && ComponentbuilderHelper::validGUID($guid))
{
if (is_string($setGuid) && ComponentbuilderHelper::validGUID($setGuid) && $guid === $setGuid)
{
return true;
}
elseif (is_array($setGuid) && in_array($guid, $setGuid))
{
return true;
}
}
return false;
}
protected $viewid = array();
@ -1356,13 +1423,13 @@ class ComponentbuilderModelAjax extends JModelList
}
}
// set GUID if found (TODO we will later move over to GUID)
// if (($guid = ComponentbuilderHelper::get($vdm . '__guid')) !== false && method_exists('ComponentbuilderHelper', 'validGUID'))
//{
// if (ComponentbuilderHelper::validGUID($guid))
// {
// $this->viewid[$call]['a_guid'] = $guid;
// }
//}
if (($guid = ComponentbuilderHelper::get($vdm . '__guid')) !== false && method_exists('ComponentbuilderHelper', 'validGUID'))
{
if (ComponentbuilderHelper::validGUID($guid))
{
$this->viewid[$call]['a_guid'] = $guid;
}
}
// set return if found
if (($return = ComponentbuilderHelper::get($vdm . '__return')) !== false)
{
@ -1627,11 +1694,11 @@ class ComponentbuilderModelAjax extends JModelList
// set the key get value
$key_get_value = $values['a_id'];
// check if we have a GUID
if (isset($values['a_guid']))
{
$this->ref .= '&guid=' . (string) $values['a_guid'];
$key_get_value = $values['a_guid'];
}
//if (isset($values['a_guid']))
//{
//$this->ref .= '&guid=' . (string) $values['a_guid'];
//$key_get_value = $values['a_guid'];
//}
// load the results
$result = array();
// return field table
@ -2703,7 +2770,7 @@ class ComponentbuilderModelAjax extends JModelList
'name' => 'name'
),
// #__componentbuilder_power (v)
'class_method' => array(
'power' => array(
'search' => array('id', 'system_name', 'name', 'description', 'head', 'namespace', 'main_class_code'),
'views' => 'powers',
'not_base64' => array('description'),

View File

@ -202,13 +202,14 @@ class ComponentbuilderModelCompiler extends JModelList
return true;
}
public function builder($version, $id, $backup, $repo, $addPlaceholders, $debugLinenr, $minify)
public function builder($version, $id, $backup, $repo, $addPlaceholders, $addPowers, $debugLinenr, $minify)
{
$set['version'] = $version;
$set['component'] = $id;
$set['backup'] = $backup;
$set['repository'] = $repo;
$set['placeholders'] = $addPlaceholders;
$set['powers'] = $addPowers;
$set['debuglinenr'] = $debugLinenr;
$set['minify'] = $minify;
// run compiler

View File

@ -156,48 +156,6 @@
message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPANYNAME_MESSAGE"
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPANYNAME_HINT"
/>
<!-- Php_admin_event Field. Type: Editor. (joomla) -->
<field
type="editor"
name="php_admin_event"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_ADMIN_EVENT_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_ADMIN_EVENT_DESCRIPTION"
width="100%"
height="450px"
cols="15"
rows="30"
buttons="no"
syntax="php"
editor="codemirror|none"
filter="raw"
validate="code"
/>
<!-- Php_site_event Field. Type: Editor. (joomla) -->
<field
type="editor"
name="php_site_event"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_SITE_EVENT_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_SITE_EVENT_DESCRIPTION"
width="100%"
height="450px"
cols="15"
rows="30"
buttons="no"
syntax="php"
editor="codemirror|none"
filter="raw"
validate="code"
/>
<!-- Created Field. Type: Calendar. (joomla) -->
<field
type="calendar"
name="created"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CREATED_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CREATED_DESCRIPTION"
format="%Y-%m-%d %H:%M:%S"
filter="user_utc"
size="22"
/>
<!-- Php_helper_both Field. Type: Editor. (joomla) -->
<field
type="editor"
@ -214,39 +172,33 @@
filter="raw"
validate="code"
/>
<!-- Created Field. Type: Calendar. (joomla) -->
<field
type="calendar"
name="created"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CREATED_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CREATED_DESCRIPTION"
format="%Y-%m-%d %H:%M:%S"
filter="user_utc"
size="22"
/>
<!-- Crowdin_project_identifier Field. Type: Text. (joomla) -->
<field
type="text"
name="crowdin_project_identifier"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_PROJECT_IDENTIFIER_LABEL"
size="50"
maxlength="150"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_PROJECT_IDENTIFIER_DESCRIPTION"
class="text_area"
required="true"
filter="CMD"
message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_PROJECT_IDENTIFIER_MESSAGE"
autocomplete="off"
onchange="getTranslationToolDetails()"
/>
<!-- Note_readme Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_readme" label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_README_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_README_DESCRIPTION" heading="h4" class="note_readme" />
<!-- Debug_linenr Field. Type: Radio. (joomla) -->
<field
type="radio"
name="debug_linenr"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DEBUG_LINENR_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DEBUG_LINENR_DESCRIPTION"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_YES</option>
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO</option>
</field>
<!-- Php_preflight_install Field. Type: Editor. (joomla) -->
<field
type="editor"
name="php_preflight_install"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_INSTALL_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_INSTALL_DESCRIPTION"
width="100%"
height="450px"
cols="15"
rows="30"
buttons="no"
syntax="php"
editor="codemirror|none"
filter="raw"
validate="code"
/>
<!-- Php_method_uninstall Field. Type: Editor. (joomla) -->
<field
type="editor"
@ -263,8 +215,22 @@
filter="raw"
validate="code"
/>
<!-- Note_version_options_3 Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_version_options_3" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_VERSION_OPTIONS_3_DESCRIPTION" class="alert alert-info note_version_options_3" showon="mvc_versiondate:3" />
<!-- Php_preflight_install Field. Type: Editor. (joomla) -->
<field
type="editor"
name="php_preflight_install"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_INSTALL_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_INSTALL_DESCRIPTION"
width="100%"
height="450px"
cols="15"
rows="30"
buttons="no"
syntax="php"
editor="codemirror|none"
filter="raw"
validate="code"
/>
<!-- Css_admin Field. Type: Editor. (joomla) -->
<field
type="editor"
@ -281,6 +247,8 @@
filter="raw"
validate="code"
/>
<!-- Note_version_options_3 Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_version_options_3" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_VERSION_OPTIONS_3_DESCRIPTION" class="alert alert-info note_version_options_3" showon="mvc_versiondate:3" />
<!-- Note_version_options_2 Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_version_options_2" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_VERSION_OPTIONS_2_DESCRIPTION" class="alert alert-info note_version_options_2" showon="mvc_versiondate:2" />
<!-- Note_version_options_1 Field. Type: Note. A None Database Field. (joomla) -->
@ -336,8 +304,38 @@
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO</option>
</field>
<!-- Note_dynamic_dashboard Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_dynamic_dashboard" label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_DYNAMIC_DASHBOARD_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_DYNAMIC_DASHBOARD_DESCRIPTION" heading="h4" class="alert alert-info note_dynamic_dashboard" />
<!-- Php_admin_event Field. Type: Editor. (joomla) -->
<field
type="editor"
name="php_admin_event"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_ADMIN_EVENT_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_ADMIN_EVENT_DESCRIPTION"
width="100%"
height="450px"
cols="15"
rows="30"
buttons="no"
syntax="php"
editor="codemirror|none"
filter="raw"
validate="code"
/>
<!-- Php_site_event Field. Type: Editor. (joomla) -->
<field
type="editor"
name="php_site_event"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_SITE_EVENT_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_SITE_EVENT_DESCRIPTION"
width="100%"
height="450px"
cols="15"
rows="30"
buttons="no"
syntax="php"
editor="codemirror|none"
filter="raw"
validate="code"
/>
<!-- Description Field. Type: Textarea. (joomla) -->
<field
type="textarea"
@ -350,6 +348,24 @@
filter="HTML"
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_HINT"
/>
<!-- Note_dynamic_dashboard Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_dynamic_dashboard" label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_DYNAMIC_DASHBOARD_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_DYNAMIC_DASHBOARD_DESCRIPTION" heading="h4" class="alert alert-info note_dynamic_dashboard" />
<!-- Author Field. Type: Text. (joomla) -->
<field
type="text"
name="author"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_LABEL"
size="10"
maxlength="120"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="HTML"
message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_MESSAGE"
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_HINT"
/>
<!-- Php_postflight_install Field. Type: Editor. (joomla) -->
<field
type="editor"
@ -366,35 +382,6 @@
filter="raw"
validate="code"
/>
<!-- Author Field. Type: Text. (joomla) -->
<field
type="text"
name="author"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_LABEL"
size="10"
maxlength="120"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="HTML"
message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_MESSAGE"
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_HINT"
/>
<!-- Sql_uninstall Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="sql_uninstall"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_UNINSTALL_LABEL"
rows="30"
cols="15"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_UNINSTALL_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_UNINSTALL_HINT"
required="true"
/>
<!-- Email Field. Type: Text. (joomla) -->
<field
type="text"
@ -410,8 +397,19 @@
message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EMAIL_MESSAGE"
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EMAIL_HINT"
/>
<!-- Note_update_server_note_ftp Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_update_server_note_ftp" label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_UPDATE_SERVER_NOTE_FTP_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_UPDATE_SERVER_NOTE_FTP_DESCRIPTION" heading="h4" class="alert alert-success note_update_server_note_ftp" />
<!-- Sql_uninstall Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="sql_uninstall"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_UNINSTALL_LABEL"
rows="30"
cols="15"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_UNINSTALL_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_UNINSTALL_HINT"
required="true"
/>
<!-- Website Field. Type: Url. (joomla) -->
<field
type="url"
@ -428,8 +426,21 @@
message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_MESSAGE"
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_HINT"
/>
<!-- Note_buildcomp_dynamic_mysql Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_buildcomp_dynamic_mysql" label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BUILDCOMP_DYNAMIC_MYSQL_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BUILDCOMP_DYNAMIC_MYSQL_DESCRIPTION" heading="h4" class="alert alert-info note_buildcomp_dynamic_mysql" />
<!-- Debug_linenr Field. Type: Radio. (joomla) -->
<field
type="radio"
name="debug_linenr"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DEBUG_LINENR_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DEBUG_LINENR_DESCRIPTION"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_YES</option>
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO</option>
</field>
<!-- Add_license Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -445,21 +456,8 @@
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO</option>
</field>
<!-- Add_email_helper Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_email_helper"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_EMAIL_HELPER_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_EMAIL_HELPER_DESCRIPTION"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_YES</option>
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO</option>
</field>
<!-- Note_buildcomp_dynamic_mysql Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_buildcomp_dynamic_mysql" label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BUILDCOMP_DYNAMIC_MYSQL_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BUILDCOMP_DYNAMIC_MYSQL_DESCRIPTION" heading="h4" class="alert alert-info note_buildcomp_dynamic_mysql" />
<!-- License_type Field. Type: List. (joomla) -->
<field
type="list"
@ -481,6 +479,23 @@
<option value="4">
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CUSTOM_USED_IN_CUSTOM_CODE</option>
</field>
<!-- Add_email_helper Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_email_helper"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_EMAIL_HELPER_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_EMAIL_HELPER_DESCRIPTION"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_YES</option>
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO</option>
</field>
<!-- Note_whmcs_lisencing_note Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_whmcs_lisencing_note" label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_WHMCS_LISENCING_NOTE_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_WHMCS_LISENCING_NOTE_DESCRIPTION" heading="h4" class="alert alert-success note_whmcs_lisencing_note" />
<!-- Php_helper_admin Field. Type: Editor. (joomla) -->
<field
type="editor"
@ -497,24 +512,6 @@
filter="raw"
validate="code"
/>
<!-- Note_whmcs_lisencing_note Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_whmcs_lisencing_note" label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_WHMCS_LISENCING_NOTE_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_WHMCS_LISENCING_NOTE_DESCRIPTION" heading="h4" class="alert alert-success note_whmcs_lisencing_note" />
<!-- Php_helper_site Field. Type: Editor. (joomla) -->
<field
type="editor"
name="php_helper_site"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_SITE_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_SITE_DESCRIPTION"
width="100%"
height="550px"
cols="15"
rows="80"
buttons="no"
syntax="php"
editor="codemirror|none"
filter="raw"
validate="code"
/>
<!-- Whmcs_key Field. Type: Text. (joomla) -->
<field
type="text"
@ -528,18 +525,18 @@
message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_KEY_MESSAGE"
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_KEY_HINT"
/>
<!-- Javascript Field. Type: Editor. (joomla) -->
<!-- Php_helper_site Field. Type: Editor. (joomla) -->
<field
type="editor"
name="javascript"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JAVASCRIPT_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JAVASCRIPT_DESCRIPTION"
name="php_helper_site"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_SITE_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_SITE_DESCRIPTION"
width="100%"
height="450px"
height="550px"
cols="15"
rows="30"
rows="80"
buttons="no"
syntax="javascript"
syntax="php"
editor="codemirror|none"
filter="raw"
validate="code"
@ -559,18 +556,18 @@
message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_URL_MESSAGE"
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_URL_HINT"
/>
<!-- Css_site Field. Type: Editor. (joomla) -->
<!-- Javascript Field. Type: Editor. (joomla) -->
<field
type="editor"
name="css_site"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CSS_SITE_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CSS_SITE_DESCRIPTION"
name="javascript"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JAVASCRIPT_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JAVASCRIPT_DESCRIPTION"
width="100%"
height="450px"
cols="15"
rows="30"
buttons="no"
syntax="css"
syntax="javascript"
editor="codemirror|none"
filter="raw"
validate="code"
@ -590,8 +587,22 @@
message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_BUY_LINK_MESSAGE"
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_BUY_LINK_HINT"
/>
<!-- Note_botton_component_dashboard Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_botton_component_dashboard" label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BOTTON_COMPONENT_DASHBOARD_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BOTTON_COMPONENT_DASHBOARD_DESCRIPTION" heading="h4" class="alert alert-info note_botton_component_dashboard" />
<!-- Css_site Field. Type: Editor. (joomla) -->
<field
type="editor"
name="css_site"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CSS_SITE_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CSS_SITE_DESCRIPTION"
width="100%"
height="450px"
cols="15"
rows="30"
buttons="no"
syntax="css"
editor="codemirror|none"
filter="raw"
validate="code"
/>
<!-- License Field. Type: Textarea. (joomla) -->
<field
type="textarea"
@ -606,22 +617,8 @@
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_LICENSE_HINT"
required="true"
/>
<!-- Php_preflight_update Field. Type: Editor. (joomla) -->
<field
type="editor"
name="php_preflight_update"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_UPDATE_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_UPDATE_DESCRIPTION"
width="100%"
height="450px"
cols="15"
rows="30"
buttons="no"
syntax="php"
editor="codemirror|none"
filter="raw"
validate="code"
/>
<!-- Note_botton_component_dashboard Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_botton_component_dashboard" label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BOTTON_COMPONENT_DASHBOARD_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BOTTON_COMPONENT_DASHBOARD_DESCRIPTION" heading="h4" class="alert alert-info note_botton_component_dashboard" />
<!-- Bom Field. Type: Filelist. (joomla) -->
<field
type="filelist"
@ -634,12 +631,12 @@
hide_none="true"
hide_default="true"
/>
<!-- Php_postflight_update Field. Type: Editor. (joomla) -->
<!-- Php_preflight_update Field. Type: Editor. (joomla) -->
<field
type="editor"
name="php_postflight_update"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_UPDATE_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_UPDATE_DESCRIPTION"
name="php_preflight_update"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_UPDATE_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_UPDATE_DESCRIPTION"
width="100%"
height="450px"
cols="15"
@ -658,18 +655,21 @@
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMAGE_DESCRIPTION"
directory=""
/>
<!-- Sql Field. Type: Textarea. (joomla) -->
<!-- Php_postflight_update Field. Type: Editor. (joomla) -->
<field
type="textarea"
name="sql"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_LABEL"
rows="30"
type="editor"
name="php_postflight_update"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_UPDATE_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_UPDATE_DESCRIPTION"
width="100%"
height="450px"
cols="15"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_DESCRIPTION"
class="text_area span12"
rows="30"
buttons="no"
syntax="php"
editor="codemirror|none"
filter="raw"
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_HINT"
required="true"
validate="code"
/>
<!-- Copyright Field. Type: Textarea. (joomla) -->
<field
@ -685,6 +685,21 @@
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COPYRIGHT_HINT"
required="true"
/>
<!-- Sql Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="sql"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_LABEL"
rows="30"
cols="15"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_HINT"
required="true"
/>
<!-- Note_update_server_note_ftp Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_update_server_note_ftp" label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_UPDATE_SERVER_NOTE_FTP_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_UPDATE_SERVER_NOTE_FTP_DESCRIPTION" heading="h4" class="alert alert-success note_update_server_note_ftp" />
<!-- Addreadme Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -727,23 +742,6 @@
message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_URL_MESSAGE"
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_URL_HINT"
/>
<!-- Crowdin_project_identifier Field. Type: Text. (joomla) -->
<field
type="text"
name="crowdin_project_identifier"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_PROJECT_IDENTIFIER_LABEL"
size="50"
maxlength="150"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_PROJECT_IDENTIFIER_DESCRIPTION"
class="text_area"
required="true"
filter="CMD"
message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_PROJECT_IDENTIFIER_MESSAGE"
autocomplete="off"
onchange="getTranslationToolDetails()"
/>
<!-- Note_update_server_note_other Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_update_server_note_other" label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_UPDATE_SERVER_NOTE_OTHER_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_UPDATE_SERVER_NOTE_OTHER_DESCRIPTION" heading="h4" class="alert alert-success note_update_server_note_other" />
<!-- Component_version Field. Type: Text. (joomla) -->
<field
type="text"
@ -759,6 +757,23 @@
message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPONENT_VERSION_MESSAGE"
hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPONENT_VERSION_HINT"
/>
<!-- Note_update_server_note_other Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_update_server_note_other" label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_UPDATE_SERVER_NOTE_OTHER_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_UPDATE_SERVER_NOTE_OTHER_DESCRIPTION" heading="h4" class="alert alert-success note_update_server_note_other" />
<!-- Add_powers Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_powers"
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_POWERS_LABEL"
description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_POWERS_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_YES</option>
<option value="0">
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO</option>
</field>
<!-- Translation_tool Field. Type: List. (joomla) -->
<field
type="list"

View File

@ -84,6 +84,8 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
protected $dir = false;
protected $target = false;
protected $newID = array();
protected $packageInfo = null;
protected $noopmaker;
protected $updateAfter = array('field' => array(), 'adminview' => array());
protected $divergedDataMover = array();
protected $fieldTypes = array();
@ -151,7 +153,15 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
$session->clear('package');
$session->clear('dataType');
$session->clear('hasPackage');
// before we clear this, we add it locally
$packageInfo = $session->get('smart_package_info', null);
// now clear it
$session->clear('smart_package_info');
// convert to an array if found
if ($packageInfo && ComponentbuilderHelper::checkJson($packageInfo))
{
$this->packageInfo = json_decode($packageInfo, true);
}
break;
default:
@ -185,7 +195,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
$session->clear('backto_VDM_IMPORT');
if ($back)
{
$this->app->setUserState('com_componentbuilder.redirect_url', 'index.php?option=com_componentbuilder&view='.$back);
$this->app->setUserState('com_componentbuilder.redirect_url', 'index.php?option=com_componentbuilder&view=' . $back);
}
$session->clear('backto_VDM_IMPORT');
return false;
@ -335,18 +345,18 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// load the data
if ($info = @file_get_contents($infoFile))
{
// remove all line breaks
$info = str_replace("\n", '', $info);
// make sure we have base64
if ($info === base64_encode(base64_decode($info, true)))
// Get the password.
$db = 'COM_COMPONENTBUILDER_SZDEQZDMVSMHBTRWFIFTYTSQFLVVXJTMTHREEJTWOIXM';
$password = base64_decode(JText::sprintf($db, 'VjR', 'WV0aE9k'));
// unlock the info data
if (($info = $this->unlock($info, $password, true)) !== false && ComponentbuilderHelper::checkJson($info))
{
// Get the encryption object.
$db = 'COM_COMPONENTBUILDER_VJRZDESSMHBTRWFIFTYTWVZEROAENINEKQFLVVXJTMTHREEJTWOIXM';
$opener = new FOFEncryptAes(base64_decode(JText::sprintf($db, 'QzdmV')), 128);
$info = rtrim($opener->decryptString($info), "\0");
// we only continue if info could be opened
$session->set('smart_package_info', $info);
return true;
}
// do not have check sum validation
$this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTWOWE_COULD_NOT_OPEN_THE_PACKAGEHTWOTHIS_COULD_BE_DUE_TO_THE_FOFENCRYPTION_THAT_IS_NO_LONGER_SUPPORTED_IN_JOOMLA_PLEASE_EXPORT_YOUR_PACKAGES_WITH_JCB_VTHREEZEROELEVENPRO_OR_VTWOONETWOSEVENTEENPUBLIC_OR_HIGHER_TO_BE_ABLE_TO_IMPORT_IT_INTO_THIS_VERSION_OF_JCB'), 'error');
}
}
ComponentbuilderHelper::removeFolder($this->dir);
@ -656,24 +666,11 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
protected function extractData($data)
{
// remove all line breaks
$data = str_replace("\n", '', $data);
// make sure we have base64
if ($data === base64_encode(base64_decode($data, true)))
if (($data = $this->unlock($data, $this->sleutle)) !== false)
{
// open the data
if(ComponentbuilderHelper::checkString($this->sleutle) && strlen($this->sleutle) == 32)
{
// Get the encryption object.
$opener = new FOFEncryptAes($this->sleutle, 128);
$data = rtrim($opener->decryptString($data), "\0");
}
else
{
$data = base64_decode($data);
}
// final check if we have success
$data = @unserialize($data);
if ($data !== false)
if (ComponentbuilderHelper::checkArray($data))
{
// set the data global
$this->data = $data;
@ -1005,7 +1002,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
/**
* Method to unlock all files
* Method to unlock all files in all folders of this package
*
* @return void
*/
@ -1014,7 +1011,6 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// lock the data if set
if(ComponentbuilderHelper::checkString($this->sleutle) && strlen($this->sleutle) == 32)
{
$unlocker = new FOFEncryptAes($this->sleutle, 128);
// we must first store the current working directory
$joomla = getcwd();
// to avoid that it decrypt the db and info file again we must move per/folder
@ -1026,7 +1022,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// go to the package sub folder if found
if (JFolder::exists($subPath))
{
$this->unlock($subPath, $unlocker);
$this->unLockFile($subPath);
}
}
// change back to working dir
@ -1035,11 +1031,11 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
/**
* The Unlocker
* The unlocking files
*
* @return void
*/
protected function unlock(&$tmpPath, &$unlocker)
protected function unLockFile(&$tmpPath)
{
// we are changing the working directory to the tmp path (important)
chdir($tmpPath);
@ -1048,12 +1044,11 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// read in the file content
foreach ($files as $file)
{
// check that the string is base64
$data = str_replace("\n", '', file_get_contents($file));
if ($data === base64_encode(base64_decode($data, true)))
// open the file content
if (($data = $this->unlock(file_get_contents($file), $this->sleutle)) !== false)
{
// write the decrypted data back to file
if (!ComponentbuilderHelper::writeFile($file, rtrim($unlocker->decryptString($data), "\0")))
if (!ComponentbuilderHelper::writeFile($file, $data))
{
// in case file could not be unlocked
$this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FILE_BSB_COULD_NOT_BE_UNLOCKED', $file), 'error');
@ -1064,9 +1059,79 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
$this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FILE_BSB_WAS_SUCCESSFULLY_UNLOCKED', $file), 'success');
}
}
else
{
// in case file could not be unlocked
$this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_FILE_BSB_COULD_NOT_BE_UNLOCKED', $file), 'error');
}
}
}
/**
* unlock data
*
* @param string $data The data string
* @param string $password The key to unlock
* @param bool $force Should we force phpseclib decryption
*
* @return mixed the data, or false
*
* @since 3.0.11
**/
protected function unlock(string $data, string $password, bool $force = false)
{
// remove all line breaks
$data = str_replace("\n", '', $data);
// make sure we have base64
if ($data === base64_encode(base64_decode($data, true)))
{
// open the data
if(ComponentbuilderHelper::checkString($password) && strlen($password) == 32)
{
// check if we should use the phpseclib decryption
$phpseclip = (isset($this->packageInfo['phpseclib']) && $this->packageInfo['phpseclib']) ? true : $force;
// load phpseclib <https://phpseclib.com/docs/symmetric>
if($phpseclip && ComponentbuilderHelper::crypt('AES', 'CBC') instanceof \phpseclib\Crypt\Rijndael)
{
// load the system password
ComponentbuilderHelper::crypt('AES', 'CBC')->setPassword($password, 'pbkdf2', 'sha256', 'VastDevelopmentMethod/salt');
// open the data block
$data = ComponentbuilderHelper::crypt('AES', 'CBC')->decrypt(base64_decode($data));
// check if we had success
if ($data !== false)
{
return $data;
}
}
// check if we had success
if (class_exists('FOFEncryptAes'))
{
// Get the encryption object.
if (!$this->noopmaker instanceof FOFEncryptAes)
{
$this->noopmaker = new FOFEncryptAes($password, 128);
}
// open the data block
$data = $this->noopmaker->decryptString($data);
// check if we had success
if ($data !== false)
{
return $data;
}
else
{
$this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTWOWE_COULD_NOT_OPEN_THE_ENCRYPT_DATAHTWO_THIS_COULD_BE_DUE_TO_THE_FOFENCRYPTION_THAT_IS_NO_LONGER_SUPPORTED_IN_JOOMLABR_PLEASE_EXPORT_YOUR_PACKAGES_WITH_JCB_VTHREEZEROELEVENPRO_OR_VTWOONETWOSEVENTEENPUBLIC_OR_HIGHER_TO_BE_ABLE_TO_IMPORT_IT_INTO_THIS_VERSION_OF_JCB'), 'error');
}
}
}
else
{
return base64_decode($data);
}
}
return false;
}
/**
* Update some items after all
*
@ -1323,7 +1388,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
// get the power
$query = $this->_db->getQuery(true);
$query->select(array('a.id', 'a.extends', 'a.implements', 'a.use_selection', 'a.property_selection', 'a.method_selection'));
$query->select(array('a.id', 'a.property_selection', 'a.method_selection'));
$query->from($this->_db->quoteName('#__componentbuilder_power', 'a'));
$query->where($this->_db->quoteName('a.id') . ' = '. (int) $power);
// see if we get an item
@ -1332,14 +1397,9 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
if ($this->_db->getNumRows())
{
$item = $this->_db->loadObject();
// now update extends
$item = $this->setNewID($item, 'extends', 'power', 'power');
// now update implements
$item = $this->setNewID($item, 'implements', 'power', 'power');
// subform fields to target
$updaterT = array(
// subformfield => array( field => type_value )
'use_selection' => array('use' => 'power'),
'property_selection' => array('property' => 'class_property'),
'method_selection' => array('method' => 'class_method')
);
@ -1828,37 +1888,6 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
{
$item->system_name = $item->system_name.$this->postfix;
}
// param fields to target
if ($type === 'site_view')
{
$updaterP = array(
// param_field => field* => field_table
'site_view_headers' => array(
'power_site_view_model' => 'power',
'power_site_view' => 'power',
'power_site_view_controller' => 'power',
'power_site_views_model' => 'power',
'power_site_views' => 'power',
'power_site_views_controller' => 'power'
)
);
}
else
{
$updaterP = array(
// param_field => field* => field_table
'custom_admin_view_headers' => array(
'power_custom_admin_view_model' => 'power',
'power_custom_admin_view' => 'power',
'power_custom_admin_view_controller' => 'power',
'power_custom_admin_views_model' => 'power',
'power_custom_admin_views' => 'power',
'power_custom_admin_views_controller' => 'power'
)
);
}
// update the params ids
$this->updateParamIDs($item, $type, $updaterP);
break;
case 'admin_view':
// set the getters anchors
@ -1911,14 +1940,6 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// param fields to target
$updaterP = array(
// param_field => field* => field_table
'admin_view_headers' => array(
'power_admin_view_model' => 'power',
'power_admin_view' => 'power',
'power_admin_view_controller' => 'power',
'power_admin_views_model' => 'power',
'power_admin_views' => 'power',
'power_admin_views_controller' => 'power'
),
'fieldordering' => array(
'admin_ordering_fields.field' => 'field',
'linked_ordering_fields.field' => 'field'
@ -2073,18 +2094,6 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
);
// update the repeatable fields
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
// param fields to target
$updaterP = array(
// param_field => field* => field_table
'joomla_component_headers' => array(
'power_admin_component' => 'power',
'power_site_component' => 'power',
'power_admin_helper' => 'power',
'power_site_helper' => 'power'
)
);
// update the params ids
$this->updateParamIDs($item, $type, $updaterP);
// if we can't merge add postfix to name
if ($this->postfix)
{

View File

@ -60,7 +60,8 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
'copyright'
),
'above' => array(
'system_name'
'system_name',
'add_powers'
),
'under' => array(
'not_required'
@ -90,6 +91,27 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
'css_site'
)
),
'dynamic_integration' => array(
'left' => array(
'add_update_server',
'update_server_url',
'update_server_target',
'note_update_server_note_ftp',
'note_update_server_note_zip',
'note_update_server_note_other',
'update_server',
'add_sales_server',
'sales_server'
),
'right' => array(
'translation_tool',
'note_crowdin',
'crowdin_project_identifier',
'crowdin_project_api_key',
'crowdin_username',
'crowdin_account_api_key'
)
),
'readme' => array(
'left' => array(
'addreadme',
@ -130,27 +152,6 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
'assets_table_fix'
)
),
'dynamic_integration' => array(
'left' => array(
'add_update_server',
'update_server_url',
'update_server_target',
'note_update_server_note_ftp',
'note_update_server_note_zip',
'note_update_server_note_other',
'update_server',
'add_sales_server',
'sales_server'
),
'right' => array(
'translation_tool',
'note_crowdin',
'crowdin_project_identifier',
'crowdin_project_api_key',
'crowdin_username',
'crowdin_account_api_key'
)
),
'dynamic_build_beta' => array(
'fullwidth' => array(
'note_buildcomp_dynamic_mysql',
@ -341,6 +342,30 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$item->metadata = $registry->toArray();
}
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_method_uninstall))
{
// base64 Decode php_method_uninstall.
$item->php_method_uninstall = base64_decode($item->php_method_uninstall);
}
if (!empty($item->php_preflight_install))
{
// base64 Decode php_preflight_install.
$item->php_preflight_install = base64_decode($item->php_preflight_install);
}
if (!empty($item->css_admin))
{
// base64 Decode css_admin.
$item->css_admin = base64_decode($item->css_admin);
}
if (!empty($item->php_admin_event))
{
// base64 Decode php_admin_event.
@ -353,30 +378,6 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$item->php_site_event = base64_decode($item->php_site_event);
}
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_preflight_install))
{
// base64 Decode php_preflight_install.
$item->php_preflight_install = base64_decode($item->php_preflight_install);
}
if (!empty($item->php_method_uninstall))
{
// base64 Decode php_method_uninstall.
$item->php_method_uninstall = base64_decode($item->php_method_uninstall);
}
if (!empty($item->css_admin))
{
// base64 Decode css_admin.
$item->css_admin = base64_decode($item->css_admin);
}
if (!empty($item->php_postflight_install))
{
// base64 Decode php_postflight_install.
@ -1408,6 +1409,30 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$data['addcontributors'] = '';
}
// 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_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_install string to base64 string.
if (isset($data['php_preflight_install']))
{
$data['php_preflight_install'] = base64_encode($data['php_preflight_install']);
}
// Set the css_admin string to base64 string.
if (isset($data['css_admin']))
{
$data['css_admin'] = base64_encode($data['css_admin']);
}
// Set the php_admin_event string to base64 string.
if (isset($data['php_admin_event']))
{
@ -1420,30 +1445,6 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$data['php_site_event'] = base64_encode($data['php_site_event']);
}
// 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_preflight_install string to base64 string.
if (isset($data['php_preflight_install']))
{
$data['php_preflight_install'] = base64_encode($data['php_preflight_install']);
}
// 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 css_admin string to base64 string.
if (isset($data['css_admin']))
{
$data['css_admin'] = base64_encode($data['css_admin']);
}
// Set the php_postflight_install string to base64 string.
if (isset($data['php_postflight_install']))
{

View File

@ -104,6 +104,8 @@ class ComponentbuilderModelJoomla_components extends JModelList
$this->removeOldComponentValues($item);
// load to global object
$this->smartBox['joomla_component'][$item->id] = $item;
// set the powers linked to this joomla component
$this->setSmartIDs($this->getValues($item->params, 'power', 'joomla_component_headers', null), 'power', false);
// add to pks
$pks[] = $item->id;
}
@ -266,6 +268,8 @@ class ComponentbuilderModelJoomla_components extends JModelList
$this->setLanguageTranslation($item->id);
// load to global object
$this->smartBox['joomla_component'][$item->id] = $item;
// set the powers linked to this joomla component
$this->setSmartIDs($this->getValues($item->params, 'power', 'joomla_component_headers', null), 'power', false);
// add to pks
$pks[] = $item->id;
}
@ -402,7 +406,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
// add powers
if (isset($this->smartIDs['power']) && ComponentbuilderHelper::checkArray($this->smartIDs['power']))
{
$this->setData('power', array_values($this->smartIDs['power']), 'id');
$this->setData('power', array_values($this->smartIDs['power']), 'guid');
}
// set limiter
$limit = 0;
@ -697,8 +701,24 @@ class ComponentbuilderModelJoomla_components extends JModelList
$query->select(array('a.*'));
// From the componentbuilder_ANY table
$query->from($this->_db->quoteName('#__componentbuilder_'. $table, 'a'));
// set the where query
$query->where('a.'.$key.' IN (' . implode(',',$values) . ')');
// check if this is an array of integers
if ($this->is_numeric($values))
{
// set the where query
$query->where('a.'.$key.' IN (' . implode(',', $values) . ')');
}
else
{
// set the where query
$query->where('a.'.$key.' IN (' . implode(',', array_map( function ($var) {
// check if already quoted
if (preg_match('/^(["\']).*\1$/m', $var))
{
return $var;
}
return $this->_db->quote($var);
}, $values)) . ')');
}
// Implement View Level Access
if (!$this->user->authorise('core.options', 'com_componentbuilder'))
{
@ -806,19 +826,9 @@ class ComponentbuilderModelJoomla_components extends JModelList
if ('joomla_component' === $table)
{
// make sure old fields are not exported any more
unset($item->addconfig);
unset($item->addadmin_views);
unset($item->addcustom_admin_views);
unset($item->addsite_views);
unset($item->version_update);
unset($item->sql_tweak);
unset($item->addcustommenus);
unset($item->dashboard_tab);
unset($item->php_dashboard_methods);
unset($item->addfiles);
unset($item->addfolders);
// set the powers linked to this admin view
$this->setSmartIDs($this->getValues($item->params, 'power', 'joomla_component_headers', null), 'power');
$this->removeOldComponentValues($item);
// set the powers linked to this joomla component
$this->setSmartIDs($this->getValues($item->params, 'power', 'joomla_component_headers', null), 'power', false);
}
// actions to take before storing the item if table is admin_view
if ('admin_view' === $table)
@ -845,6 +855,12 @@ class ComponentbuilderModelJoomla_components extends JModelList
// build full path folders
$this->moveIt($this->getValues($item->addfoldersfullpath, 'subform', 'folderpath', null), 'folder', true);
}
// actions to take if table is component_dashboard
if ('component_dashboard' === $table)
{
// set the powers linked to this dashboard
$this->setSmartIDs($this->getValues($item->params, 'power', 'component_dashboard_headers', null), 'power', false);
}
// actions to take if table is component_config
if ('component_config' === $table)
{
@ -917,7 +933,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
// add fields & conditions
$this->setSmartIDs($item->id, 'admin_view');
// set the powers linked to this admin view
$this->setSmartIDs($this->getValues($item->params, 'power', 'admin_view_headers', null), 'power');
$this->setSmartIDs($this->getValues($item->params, 'power', 'admin_view_headers', null), 'power', false);
// do not move anything if clone
if ('clone' !== $this->activeType)
{
@ -1027,13 +1043,13 @@ class ComponentbuilderModelJoomla_components extends JModelList
if ('site_view' === $table)
{
// set the powers linked to this admin view
$this->setSmartIDs($this->getValues($item->params, 'power', 'site_view_headers', null), 'power');
$this->setSmartIDs($this->getValues($item->params, 'power', 'site_view_headers', null), 'power', false);
}
// actions to take if table is custom_admin_view
elseif ('custom_admin_view' === $table)
{
// set the powers linked to this admin view
$this->setSmartIDs($this->getValues($item->params, 'power', 'custom_admin_view_headers', null), 'power');
$this->setSmartIDs($this->getValues($item->params, 'power', 'custom_admin_view_headers', null), 'power', false);
}
}
// actions to take if table is template and layout
@ -1098,17 +1114,23 @@ class ComponentbuilderModelJoomla_components extends JModelList
// add joomla_plugin_group
$this->setSmartIDs((int) $item->joomla_plugin_group, 'joomla_plugin_group');
}
// actions to take if table is dynamic_get
if ('dynamic_get' === $table)
{
// add dynamic_get_headers
$this->setSmartIDs($this->getValues($item->params, 'power', 'dynamic_get_headers', null), 'power', false);
}
// actions to take if table is power
if ('power' === $table)
{
// add the extended class (powers)
$this->setData('power', $item->extends, 'id');
$this->setData('power', $item->extends, 'guid');
// add implements interfaces (powers)
$this->setData('power', $item->implements, 'id');
$this->setData('power', $item->implements, 'guid');
// add use classes (powers)
$this->setData('power', $this->getValues($item->use_selection, 'subform', 'use'), 'id');
$this->setData('power', $this->getValues($item->use_selection, 'subform', 'use'), 'guid');
// add load classes (powers)
$this->setData('power', $this->getValues($item->load_selection, 'subform', 'load'), 'id');
$this->setData('power', $this->getValues($item->load_selection, 'subform', 'load'), 'guid');
// add property_selection
$this->setData('class_property', $this->getValues($item->property_selection, 'subform', 'property'), 'id');
// add class_method
@ -1119,6 +1141,23 @@ class ComponentbuilderModelJoomla_components extends JModelList
}
}
/**
* Method to check if array has only numiric values
*
* @return bool
**/
protected function is_numeric($array)
{
foreach ($array as $value)
{
if (!is_numeric($value))
{
return false;
}
}
return true;
}
/**
* Method to do the smart cloning
*
@ -1202,8 +1241,21 @@ class ComponentbuilderModelJoomla_components extends JModelList
{
// lock the data
$this->key = md5(implode('', $this->key));
$locker = new FOFEncryptAes($this->key, 128);
$data = $locker->encryptString($data);
// April 20, 2022 we moved away from FOF for good... sorry that it took this long
// $locker = new FOFEncryptAes($this->key, 128);
// $data = $locker->encryptString($data);
// load phpseclib <https://phpseclib.com/docs/symmetric>
if(ComponentbuilderHelper::crypt('AES', 'CBC') instanceof \phpseclib\Crypt\Rijndael)
{
// set the password
ComponentbuilderHelper::crypt('AES', 'CBC')->setPassword($this->key, 'pbkdf2', 'sha256', 'VastDevelopmentMethod/salt');
// lock the data
$data = base64_encode(ComponentbuilderHelper::crypt('AES', 'CBC')->encrypt($data));
}
else
{
return false;
}
// Set the key owner information
$this->info['getKeyFrom'] = array();
$this->info['getKeyFrom']['company'] = $this->info['source']['company'];
@ -1227,12 +1279,16 @@ class ComponentbuilderModelJoomla_components extends JModelList
// if we have multi links add them also
// we started adding this at v2.7.7
$this->info['key'] = true;
// we started adding this at v3.0.11 and v2.12.17
$this->info['phpseclib'] = true;
}
else
{
// we started adding this at v2.7.7
$this->info['key'] = false;
// Set the owner information
// we started adding this at v3.0.11 and v2.12.17
$this->info['phpseclib'] = false;
// base 64 encode the data
$data = base64_encode($data);
}
// set the path
@ -1243,15 +1299,26 @@ class ComponentbuilderModelJoomla_components extends JModelList
return false;
}
// set info data
$db = 'COM_COMPONENTBUILDER_SZDEQZDMVSMHBTRWFIFTYTSQFLVVXJTMTHREEJTWOIXM';
$locker = new FOFEncryptAes(base64_decode(JText::sprintf($db, 'VjR', 'WV0aE9k')), 128);
$info = $locker->encryptString(json_encode($this->info));
// set the path
$infoPath = $this->packagePath . '/info.vdm';
// write the db data to file in package
if (!ComponentbuilderHelper::writeFile($infoPath, wordwrap($info, 128, "\n", true)))
if(ComponentbuilderHelper::crypt('AES', 'CBC') instanceof \phpseclib\Crypt\Rijndael)
{
return false;
// set system password
$db = 'COM_COMPONENTBUILDER_SZDEQZDMVSMHBTRWFIFTYTSQFLVVXJTMTHREEJTWOIXM';
$password = base64_decode(JText::sprintf($db, 'VjR', 'WV0aE9k'));
// set the password
ComponentbuilderHelper::crypt('AES', 'CBC')->setPassword($password, 'pbkdf2', 'sha256', 'VastDevelopmentMethod/salt');
// lock the data
$info = base64_encode(ComponentbuilderHelper::crypt('AES', 'CBC')->encrypt(json_encode($this->info)));
// set the path
$infoPath = $this->packagePath . '/info.vdm';
// write the info data to file in package
if (!ComponentbuilderHelper::writeFile($infoPath, wordwrap($info, 128, "\n", true)))
{
return false;
}
}
else
{
return false;
}
// lock all files
$this->lockFiles();
@ -1296,7 +1363,8 @@ class ComponentbuilderModelJoomla_components extends JModelList
// lock the data if set
if (ComponentbuilderHelper::checkString($this->key) && strlen($this->key) == 32)
{
$locker = new FOFEncryptAes($this->key, 128);
// set secure password
ComponentbuilderHelper::crypt('AES', 'CBC')->setPassword($this->key, 'pbkdf2', 'sha256', 'VastDevelopmentMethod/salt');
// we must first store the current working directory
$joomla = getcwd();
// to avoid that it encrypt the db and info file again we must move per/folder
@ -1309,7 +1377,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
// go to the package sub folder if found
if (JFolder::exists($subPath))
{
$this->lock($subPath, $locker);
$this->lock($subPath);
}
}
// change back to working dir
@ -1322,7 +1390,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
*
* @return void
*/
protected function lock(&$tmpPath, &$locker)
protected function lock(&$tmpPath)
{
// we are changing the working directory to the tmp path (important)
chdir($tmpPath);
@ -1332,7 +1400,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
foreach ($files as $file)
{
// write the encrypted string back to file
if (!ComponentbuilderHelper::writeFile($file, wordwrap($locker->encryptString(file_get_contents($file)), 128, "\n", true)))
if (!ComponentbuilderHelper::writeFile($file, wordwrap(base64_encode(ComponentbuilderHelper::crypt('AES', 'CBC')->encrypt(file_get_contents($file))), 128, "\n", true)))
{
// we should add error handler here in case file could not be locked
}
@ -2141,7 +2209,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
'name' => 'name'
),
// #__componentbuilder_power (v)
'class_method' => array(
'power' => array(
'search' => array('id', 'system_name', 'name', 'description', 'head', 'namespace', 'main_class_code'),
'views' => 'powers',
'not_base64' => array('description'),
@ -2576,31 +2644,31 @@ class ComponentbuilderModelJoomla_components extends JModelList
continue;
}
// decode php_helper_both
$item->php_helper_both = base64_decode($item->php_helper_both);
// decode php_method_uninstall
$item->php_method_uninstall = base64_decode($item->php_method_uninstall);
// decode php_preflight_install
$item->php_preflight_install = base64_decode($item->php_preflight_install);
// decode css_admin
$item->css_admin = base64_decode($item->css_admin);
// decode php_admin_event
$item->php_admin_event = base64_decode($item->php_admin_event);
// decode php_site_event
$item->php_site_event = base64_decode($item->php_site_event);
// decode php_helper_both
$item->php_helper_both = base64_decode($item->php_helper_both);
// decode php_preflight_install
$item->php_preflight_install = base64_decode($item->php_preflight_install);
// decode php_method_uninstall
$item->php_method_uninstall = base64_decode($item->php_method_uninstall);
// decode css_admin
$item->css_admin = base64_decode($item->css_admin);
// decode php_postflight_install
$item->php_postflight_install = base64_decode($item->php_postflight_install);
// decode sql_uninstall
$item->sql_uninstall = base64_decode($item->sql_uninstall);
// decode php_helper_admin
$item->php_helper_admin = base64_decode($item->php_helper_admin);
// decode php_helper_site
$item->php_helper_site = base64_decode($item->php_helper_site);
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_helper_site
$item->php_helper_site = base64_decode($item->php_helper_site);
// decode javascript
$item->javascript = base64_decode($item->javascript);
// decode css_site