fixed greateUser logic to use the admin and site creation modes in correct way. Fixed language import issue that cause header mismatching. Added the option to add header values to the custom-custom fields.

This commit is contained in:
Llewellyn van der Merwe 2020-07-11 02:51:45 +02:00
parent a394638aff
commit 25afc31e7f
Signed by: Llewellyn
GPG Key ID: EFC0C720A240551C
8 changed files with 63 additions and 27 deletions

View File

@ -144,11 +144,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 7th July, 2020
+ *Last Build*: 11th July, 2020
+ *Version*: 2.11.2
+ *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **282473**
+ *Line count*: **282509**
+ *Field count*: **1522**
+ *File count*: **1785**
+ *Folder count*: **295**

View File

@ -144,11 +144,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 7th July, 2020
+ *Last Build*: 11th July, 2020
+ *Version*: 2.11.2
+ *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **282473**
+ *Line count*: **282509**
+ *Field count*: **1522**
+ *File count*: **1785**
+ *Folder count*: **295**

View File

@ -1876,20 +1876,22 @@ class Interpretation extends Fields
. "\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);";
$method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
. " Load the correct user model.";
$method[] = $this->_t(2) . "if (\$mode == 1)";
$method[] = $this->_t(2) . "{";
$method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
. " Load the backend-user model";
$method[] = $this->_t(3)
. "\$model = self::getModel('user', JPATH_ADMINISTRATOR . '/components/com_users', 'Users');";
$method[] = $this->_t(2) . "}";
$method[] = $this->_t(2) . "else";
$method[] = $this->_t(2) . "if (\$mode == 1) //" . $this->setLine(__LINE__)
. " 1 = Site Registrations";
$method[] = $this->_t(2) . "{";
$method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
. " Load the user site-registration model";
$method[] = $this->_t(3)
. "\$model = self::getModel('registration', JPATH_ROOT. '/components/com_users', 'Users');";
$method[] = $this->_t(2) . "}";
$method[] = $this->_t(2) . "else //" . $this->setLine(__LINE__)
. " 0 = Admin Registration";
$method[] = $this->_t(2) . "{";
$method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
. " Load the backend-user model";
$method[] = $this->_t(3)
. "\$model = self::getModel('user', JPATH_ADMINISTRATOR . '/components/com_users', 'Users');";
$method[] = $this->_t(2) . "}";
$method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
. " Check if we have params/config";
$method[] = $this->_t(2) . "if (self::checkArray(\$params))";
@ -1921,16 +1923,14 @@ class Interpretation extends Fields
$method[] = $this->_t(3) . "'block' => 0 );";
$method[] = $this->_t(2) . "//" . $this->setLine(__LINE__)
. " Added details based on mode";
$method[] = $this->_t(2) . "if (\$mode == 1)";
$method[] = $this->_t(2) . "if (\$mode == 1) //". $this->setLine(__LINE__)
. " 1 = Site-registration mode";
$method[] = $this->_t(2) . "{";
$method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
. " Site-registration mode";
$method[] = $this->_t(3) . "\$data['email1'] = \$credentials['email'];";
$method[] = $this->_t(2) . "}";
$method[] = $this->_t(2) . "else";
$method[] = $this->_t(2) . "else //" . $this->setLine(__LINE__)
. " 0 = Admin-registration mode";
$method[] = $this->_t(2) . "{";
$method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
. " Admin-registration mode";
$method[] = $this->_t(3) . "\$data['email'] = \$credentials['email'];";
$method[] = $this->_t(3) . "\$data['registerDate'] = JFactory::getDate()->toSql();";
$method[] = $this->_t(2) . "}";
@ -1943,7 +1943,7 @@ class Interpretation extends Fields
$method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
. " Set random password when empty password was submitted,";
$method[] = $this->_t(3) . "//" . $this->setLine(__LINE__)
. " and we are using the site-registration mode";
. " when using the 1 = site-registration mode";
$method[] = $this->_t(3) . "\$credentials['password'] = self::randomkey(8);";
$method[] = $this->_t(3) . "\$credentials['password2'] = \$credentials['password'];";
$method[] = $this->_t(2) . "}";

View File

@ -57,7 +57,7 @@ abstract class ComponentbuilderHelper
/**
* Array of php fields Allowed (16)
**/
public static $phpFieldArray = array('', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'x');
public static $phpFieldArray = array('', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'x', 'HEADER');
/**
* The global params
@ -2965,7 +2965,15 @@ abstract class ComponentbuilderHelper
$script['setdata'][] = self::_t(3) . "\$jinput = JFactory::getApplication()->input;";
$script['setdata'][] = self::_t(3) . "foreach(\$target_headers as \$header)";
$script['setdata'][] = self::_t(3) . "{";
$script['setdata'][] = self::_t(4) . "\$data['target_headers'][\$header] = \$jinput->getString(\$header, null);";
$script['setdata'][] = self::_t(4) . "if ((\$column = \$jinput->getString(\$header, false)) !== false ||";
$script['setdata'][] = self::_t(5) . "(\$column = \$jinput->getString(strtolower(\$header), false)) !== false)";
$script['setdata'][] = self::_t(4) . "{";
$script['setdata'][] = self::_t(5) . "\$data['target_headers'][\$header] = \$column;";
$script['setdata'][] = self::_t(4) . "}";
$script['setdata'][] = self::_t(4) . "else";
$script['setdata'][] = self::_t(4) . "{";
$script['setdata'][] = self::_t(5) . "\$data['target_headers'][\$header] = null;";
$script['setdata'][] = self::_t(4) . "}";
$script['setdata'][] = self::_t(3) . "}";
$script['setdata'][] = self::_t(3) . "// set the data";
$script['setdata'][] = self::_t(3) . "if(isset(\$package['dir']))";

View File

@ -426,7 +426,15 @@ class ComponentbuilderModelImport extends JModelLegacy
$jinput = JFactory::getApplication()->input;
foreach($target_headers as $header)
{
$data['target_headers'][$header] = $jinput->getString($header, null);
if (($column = $jinput->getString($header, false)) !== false ||
($column = $jinput->getString(strtolower($header), false)) !== false)
{
$data['target_headers'][$header] = $column;
}
else
{
$data['target_headers'][$header] = null;
}
}
// set the data
if(isset($package['dir']))

View File

@ -424,7 +424,15 @@ class ComponentbuilderModelImport_language_translations extends JModelLegacy
$jinput = JFactory::getApplication()->input;
foreach($target_headers as $header)
{
$data['target_headers'][$header] = $jinput->getString(strtolower($header), null);
if (($column = $jinput->getString($header, false)) !== false ||
($column = $jinput->getString(strtolower($header), false)) !== false)
{
$data['target_headers'][$header] = $column;
}
else
{
$data['target_headers'][$header] = null;
}
}
// set the data
if(isset($package['dir']))
@ -463,10 +471,14 @@ class ComponentbuilderModelImport_language_translations extends JModelLegacy
{
$source_key = $data['target_headers']['Source'];
}
else
elseif (isset($data['target_headers']['English']))
{
$source_key = $data['target_headers']['English'];
}
else
{
$source_key = null;
}
// get the first array set
$firstSet = reset($data['array']);
// check if first array is a header array and remove if true

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>7th July, 2020</creationDate>
<creationDate>11th July, 2020</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>

View File

@ -54,7 +54,7 @@ abstract class ComponentbuilderHelper
/**
* Array of php fields Allowed (16)
**/
public static $phpFieldArray = array('', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'x');
public static $phpFieldArray = array('', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'x', 'HEADER');
/**
* The global params
@ -2962,7 +2962,15 @@ abstract class ComponentbuilderHelper
$script['setdata'][] = self::_t(3) . "\$jinput = JFactory::getApplication()->input;";
$script['setdata'][] = self::_t(3) . "foreach(\$target_headers as \$header)";
$script['setdata'][] = self::_t(3) . "{";
$script['setdata'][] = self::_t(4) . "\$data['target_headers'][\$header] = \$jinput->getString(\$header, null);";
$script['setdata'][] = self::_t(4) . "if ((\$column = \$jinput->getString(\$header, false)) !== false ||";
$script['setdata'][] = self::_t(5) . "(\$column = \$jinput->getString(strtolower(\$header), false)) !== false)";
$script['setdata'][] = self::_t(4) . "{";
$script['setdata'][] = self::_t(5) . "\$data['target_headers'][\$header] = \$column;";
$script['setdata'][] = self::_t(4) . "}";
$script['setdata'][] = self::_t(4) . "else";
$script['setdata'][] = self::_t(4) . "{";
$script['setdata'][] = self::_t(5) . "\$data['target_headers'][\$header] = null;";
$script['setdata'][] = self::_t(4) . "}";
$script['setdata'][] = self::_t(3) . "}";
$script['setdata'][] = self::_t(3) . "// set the data";
$script['setdata'][] = self::_t(3) . "if(isset(\$package['dir']))";