Resolved gh-360 by adding the blob data type as an option for data types. Resolved gh-362 by adding the nested subform compatibility to subforms in JCB. Resolved gh-365 by improving the customscript validation search of save of custom code area. Added email validation to the email helper script.

This commit is contained in:
Llewellyn van der Merwe 2019-01-14 17:32:23 +02:00
parent b7a5cb7285
commit 4e2c51c303
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
14 changed files with 310 additions and 33 deletions

View File

@ -144,11 +144,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 29th December, 2018 + *Last Build*: 14th January, 2019
+ *Version*: 2.9.8 + *Version*: 2.9.8
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **195665** + *Line count*: **195803**
+ *Field count*: **1087** + *Field count*: **1087**
+ *File count*: **1275** + *File count*: **1275**
+ *Folder count*: **201** + *Folder count*: **201**

View File

@ -144,11 +144,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 29th December, 2018 + *Last Build*: 14th January, 2019
+ *Version*: 2.9.8 + *Version*: 2.9.8
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **195665** + *Line count*: **195803**
+ *Field count*: **1087** + *Field count*: **1087**
+ *File count*: **1275** + *File count*: **1275**
+ *Folder count*: **201** + *Folder count*: **201**

View File

@ -19,6 +19,13 @@ defined('_JEXEC') or die('Restricted access');
*/ */
abstract class ###Component###Email abstract class ###Component###Email
{ {
/**
* The active recipient
*
* @var activeRecipient (array)
*/
public static $active = array();
/** /**
* Configuraiton object * Configuraiton object
* *
@ -54,6 +61,44 @@ abstract class ###Component###Email
return self::$config; return self::$config;
} }
/**
* Returns the global mailer object, only creating it if it doesn't already exist.
*
*/
public static function getMailerInstance()
{
if (!self::$mailer)
{
self::$mailer = self::createMailer();
}
return self::$mailer;
}
/**
* Check that a string looks like an email address.
* @param string $address The email address to check
* @param string|callable $patternselect A selector for the validation pattern to use :
* * `auto` Pick best pattern automatically;
* * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14;
* * `pcre` Use old PCRE implementation;
* * `php` Use PHP built-in FILTER_VALIDATE_EMAIL;
* * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements.
* * `noregex` Don't use a regex: super fast, really dumb.
* Alternatively you may pass in a callable to inject your own validator, for example:
* PHPMailer::validateAddress('user@example.com', function($address) {
* return (strpos($address, '@') !== false);
* });
* You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator.
* @return boolean
* @static
* @access public
*/
public static function validateAddress($address, $patternselect = null)
{
return self::getMailerInstance()->validateAddress($address, $patternselect);
}
/** /**
* Get a mailer object. * Get a mailer object.
* *
@ -282,13 +327,70 @@ abstract class ###Component###Email
if (method_exists('###Component###Helper','storeMessage')) if (method_exists('###Component###Helper','storeMessage'))
{ {
// store the massage if the method is set // if we have active recipient details
###Component###Helper::storeMessage($sendmail, $recipient, $subject, $body, $textonly, $mode, 'email'); if (isset(self::$active[$recipient]))
{
// store the massage if the method is set
###Component###Helper::storeMessage($sendmail, self::$active[$recipient], $subject, $body, $textonly, $mode, 'email');
// clear memory
unset(self::$active[$recipient]);
}
else
{
// store the massage if the method is set
###Component###Helper::storeMessage($sendmail, $recipient, $subject, $body, $textonly, $mode, 'email');
}
} }
return $sendmail; return $sendmail;
} }
/**
* Set html text (in a row) and subject (as title) to a email table.
* do not use <p> instead use <br />
* in your html that you pass to this method
* since it is a table row it does not
* work well with paragraphs
*
* @return string on success
*
*/
public static function setBasicBody($html, $subject)
{
$body = array();
$body[] = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
$body[] = "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
$body[] = "<head>";
$body[] = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
$body[] = "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>";
$body[] = "<title>" . $subject . "</title>";
$body[] = "<style type=\"text/css\">";
$body[] = "#outlook a {padding:0;}";
$body[] = ".ExternalClass {width:100%;}";
$body[] = ".ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} ";
$body[] = "p {margin: 0; padding: 0; font-size: 0px; line-height: 0px;} ";
$body[] = "table td {border-collapse: collapse;}";
$body[] = "table {border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }";
$body[] = "img {display: block; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic;}";
$body[] = "a img {border: none;}";
$body[] = "a {text-decoration: none; color: #000001;}";
$body[] = "a.phone {text-decoration: none; color: #000001 !important; pointer-events: auto; cursor: default;}";
$body[] = "span {font-size: 13px; line-height: 17px; font-family: monospace; color: #000001;}";
$body[] = "</style>";
$body[] = "<!--[if gte mso 9]>";
$body[] = "<style>";
$body[] = "/* Target Outlook 2007 and 2010 */";
$body[] = "</style>";
$body[] = "<![endif]-->";
$body[] = "</head>";
$body[] = "<body style=\"width:100%; margin:0; padding:0; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;\">";
$body[] = $html;
$body[] = "</body>";
$body[] = "</html>";
return implode("\n", $body);
}
/** /**
* Set html text (in a row) and subject (as title) to a email table. * Set html text (in a row) and subject (as title) to a email table.
* do not use <p> instead use <br /> * do not use <p> instead use <br />

View File

@ -1427,18 +1427,18 @@ class Fields extends Structure
elseif ($typeName === 'subform') elseif ($typeName === 'subform')
{ {
// now add to the field set // now add to the field set
$field .= PHP_EOL . $this->_t(2) . "<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla) -->"; $field .= PHP_EOL . $this->_t(2) . $taber . "<!--" . $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (joomla) -->";
$field .= PHP_EOL . $this->_t(2) . "<field"; $field .= PHP_EOL . $this->_t(2) . $taber . "<field";
$fieldsSet = array(); $fieldsSet = array();
foreach ($fieldAttributes as $property => $value) foreach ($fieldAttributes as $property => $value)
{ {
if ($property != 'fields') if ($property != 'fields')
{ {
$field .= PHP_EOL . $this->_t(3) . $property . '="' . $value . '"'; $field .= PHP_EOL . $this->_t(3) . $taber . $property . '="' . $value . '"';
} }
} }
$field .= ">"; $field .= ">";
$field .= PHP_EOL . $this->_t(3) . '<form hidden="true" name="list_' . $fieldAttributes['name'] . '_modal" repeat="true">'; $field .= PHP_EOL . $this->_t(3) . $taber . '<form hidden="true" name="list_' . $fieldAttributes['name'] . '_modal" repeat="true">';
if (strpos($fieldAttributes['fields'], ',') !== false) if (strpos($fieldAttributes['fields'], ',') !== false)
{ {
// mulitpal fields // mulitpal fields
@ -1475,7 +1475,7 @@ class Fields extends Structure
$r_multiple = false; $r_multiple = false;
$r_langLabel = ''; $r_langLabel = '';
// add the tabs needed // add the tabs needed
$r_taber = $this->_t(2); $r_taber = $this->_t(2) . $taber;
// get field values // get field values
$r_fieldValues = $this->setFieldAttributes($fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, $view_name_list, $view_name_single, $placeholders, true); $r_fieldValues = $this->setFieldAttributes($fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, $view_name_list, $view_name_single, $placeholders, true);
// check if values were set // check if values were set
@ -1493,6 +1493,24 @@ class Fields extends Structure
// now add to the field set // now add to the field set
$field .= $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray, null, $r_taber); $field .= $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray, null, $r_taber);
} }
elseif ($r_typeName === 'subform')
{
// set nested depth
if (isset($fieldAttributes['nested_depth']))
{
$r_fieldValues['nested_depth'] = ++$fieldAttributes['nested_depth'];
}
else
{
$r_fieldValues['nested_depth'] = 1;
}
// only continue if nest is bellow 20 (this should be a safe limit)
if ($r_fieldValues['nested_depth'] <= 20)
{
// now add to the field set
$field .= $this->setField('special', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray, null, $r_taber);
}
}
elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom'])) elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom']))
{ {
// add to custom // add to custom
@ -1518,8 +1536,8 @@ class Fields extends Structure
} }
} }
} }
$field .= PHP_EOL . $this->_t(3) . "</form>"; $field .= PHP_EOL . $this->_t(3) . $taber . "</form>";
$field .= PHP_EOL . $this->_t(2) . "</field>"; $field .= PHP_EOL . $this->_t(2) . $taber . "</field>";
} }
} }
elseif ($setType === 'custom') elseif ($setType === 'custom')
@ -1862,6 +1880,25 @@ class Fields extends Structure
// now add to the field set // now add to the field set
ComponentbuilderHelper::xmlAppend($form, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray)); ComponentbuilderHelper::xmlAppend($form, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray));
} }
elseif ($r_typeName === 'subform')
{
// set nested depth
if (isset($fieldAttributes['nested_depth']))
{
$r_fieldValues['nested_depth'] = ++$fieldAttributes['nested_depth'];
}
else
{
$r_fieldValues['nested_depth'] = 1;
}
// only continue if nest is bellow 20 (this should be a safe limit)
if ($r_fieldValues['nested_depth'] <= 20)
{
// now add to the field set
ComponentbuilderHelper::xmlAppend($form, $this->setField('special', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray));
}
}
elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom'])) elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom']))
{ {
// add to custom // add to custom

View File

@ -614,7 +614,7 @@ class Interpretation extends Fields
} }
// give notice of this issue // give notice of this issue
$this->app->enqueueMessage(JText::_('<hr /><h3>WHMCS Error</h3>'), 'Error'); $this->app->enqueueMessage(JText::_('<hr /><h3>WHMCS Error</h3>'), 'Error');
$this->app->enqueueMessage(JText::sprintf('The <b>WHMCS class</b> could not be added to this component. You will need to enable the add-on in the Joomla Component area (Add WHMCS)->Yes.', $this->libraries[$id]->name), 'Error'); $this->app->enqueueMessage(JText::sprintf('The <b>WHMCS class</b> could not be added to this component. You will need to enable the add-on in the Joomla Component area (Add WHMCS)->Yes. If you have done this, then please check that you have your own <b>Basic Encryption<b/> set in the global settings of JCB. Then open and save this component again, making sure that your WHMCS settings are still correct.', $this->libraries[$id]->name), 'Error');
return "//" . $this->setLine(__LINE__) . " The WHMCS class could not be added to this component." . PHP_EOL . "//" . $this->setLine(__LINE__) . " Please note that you will need to enable the add-on in the Joomla Component area (Add WHMCS)->Yes."; return "//" . $this->setLine(__LINE__) . " The WHMCS class could not be added to this component." . PHP_EOL . "//" . $this->setLine(__LINE__) . " Please note that you will need to enable the add-on in the Joomla Component area (Add WHMCS)->Yes.";
} }

View File

@ -1354,9 +1354,15 @@ abstract class ComponentbuilderHelper
{ {
$it = new RecursiveDirectoryIterator($dir); $it = new RecursiveDirectoryIterator($dir);
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); $it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
// remove ending /
$dir = rtrim($dir, '/');
// now loop the files & folders
foreach ($it as $file) foreach ($it as $file)
{ {
if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue; if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue;
// set file dir
$file_dir = $file->getPathname();
// check if this is a dir or a file
if ($file->isDir()) if ($file->isDir())
{ {
$keeper = false; $keeper = false;
@ -1364,7 +1370,7 @@ abstract class ComponentbuilderHelper
{ {
foreach ($ignore as $keep) foreach ($ignore as $keep)
{ {
if (strpos($file->getPathname(), $dir.'/'.$keep) !== false) if (strpos($file_dir, $dir.'/'.$keep) !== false)
{ {
$keeper = true; $keeper = true;
} }
@ -1374,7 +1380,7 @@ abstract class ComponentbuilderHelper
{ {
continue; continue;
} }
JFolder::delete($file->getPathname()); JFolder::delete($file_dir);
} }
else else
{ {
@ -1383,7 +1389,7 @@ abstract class ComponentbuilderHelper
{ {
foreach ($ignore as $keep) foreach ($ignore as $keep)
{ {
if (strpos($file->getPathname(), $dir.'/'.$keep) !== false) if (strpos($file_dir, $dir.'/'.$keep) !== false)
{ {
$keeper = true; $keeper = true;
} }
@ -1393,9 +1399,10 @@ abstract class ComponentbuilderHelper
{ {
continue; continue;
} }
JFile::delete($file->getPathname()); JFile::delete($file_dir);
} }
} }
// delete the root folder if not ignore found
if (!self::checkArray($ignore)) if (!self::checkArray($ignore))
{ {
return JFolder::delete($dir); return JFolder::delete($dir);

View File

@ -14,6 +14,13 @@
*/ */
abstract class ComponentbuilderEmail abstract class ComponentbuilderEmail
{ {
/**
* The active recipient
*
* @var activeRecipient (array)
*/
public static $active = array();
/** /**
* Configuraiton object * Configuraiton object
* *
@ -49,6 +56,44 @@ abstract class ComponentbuilderEmail
return self::$config; return self::$config;
} }
/**
* Returns the global mailer object, only creating it if it doesn't already exist.
*
*/
public static function getMailerInstance()
{
if (!self::$mailer)
{
self::$mailer = self::createMailer();
}
return self::$mailer;
}
/**
* Check that a string looks like an email address.
* @param string $address The email address to check
* @param string|callable $patternselect A selector for the validation pattern to use :
* * `auto` Pick best pattern automatically;
* * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14;
* * `pcre` Use old PCRE implementation;
* * `php` Use PHP built-in FILTER_VALIDATE_EMAIL;
* * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements.
* * `noregex` Don't use a regex: super fast, really dumb.
* Alternatively you may pass in a callable to inject your own validator, for example:
* PHPMailer::validateAddress('user@example.com', function($address) {
* return (strpos($address, '@') !== false);
* });
* You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator.
* @return boolean
* @static
* @access public
*/
public static function validateAddress($address, $patternselect = null)
{
return self::getMailerInstance()->validateAddress($address, $patternselect);
}
/** /**
* Get a mailer object. * Get a mailer object.
* *
@ -277,13 +322,70 @@ abstract class ComponentbuilderEmail
if (method_exists('ComponentbuilderHelper','storeMessage')) if (method_exists('ComponentbuilderHelper','storeMessage'))
{ {
// store the massage if the method is set // if we have active recipient details
ComponentbuilderHelper::storeMessage($sendmail, $recipient, $subject, $body, $textonly, $mode, 'email'); if (isset(self::$active[$recipient]))
{
// store the massage if the method is set
ComponentbuilderHelper::storeMessage($sendmail, self::$active[$recipient], $subject, $body, $textonly, $mode, 'email');
// clear memory
unset(self::$active[$recipient]);
}
else
{
// store the massage if the method is set
ComponentbuilderHelper::storeMessage($sendmail, $recipient, $subject, $body, $textonly, $mode, 'email');
}
} }
return $sendmail; return $sendmail;
} }
/**
* Set html text (in a row) and subject (as title) to a email table.
* do not use <p> instead use <br />
* in your html that you pass to this method
* since it is a table row it does not
* work well with paragraphs
*
* @return string on success
*
*/
public static function setBasicBody($html, $subject)
{
$body = array();
$body[] = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
$body[] = "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
$body[] = "<head>";
$body[] = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
$body[] = "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>";
$body[] = "<title>" . $subject . "</title>";
$body[] = "<style type=\"text/css\">";
$body[] = "#outlook a {padding:0;}";
$body[] = ".ExternalClass {width:100%;}";
$body[] = ".ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} ";
$body[] = "p {margin: 0; padding: 0; font-size: 0px; line-height: 0px;} ";
$body[] = "table td {border-collapse: collapse;}";
$body[] = "table {border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }";
$body[] = "img {display: block; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic;}";
$body[] = "a img {border: none;}";
$body[] = "a {text-decoration: none; color: #000001;}";
$body[] = "a.phone {text-decoration: none; color: #000001 !important; pointer-events: auto; cursor: default;}";
$body[] = "span {font-size: 13px; line-height: 17px; font-family: monospace; color: #000001;}";
$body[] = "</style>";
$body[] = "<!--[if gte mso 9]>";
$body[] = "<style>";
$body[] = "/* Target Outlook 2007 and 2010 */";
$body[] = "</style>";
$body[] = "<![endif]-->";
$body[] = "</head>";
$body[] = "<body style=\"width:100%; margin:0; padding:0; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;\">";
$body[] = $html;
$body[] = "</body>";
$body[] = "</html>";
return implode("\n", $body);
}
/** /**
* Set html text (in a row) and subject (as title) to a email table. * Set html text (in a row) and subject (as title) to a email table.
* do not use <p> instead use <br /> * do not use <p> instead use <br />

View File

@ -4324,6 +4324,7 @@ COM_COMPONENTBUILDER_FIELD_ADD_JAVASCRIPT_VIEW_FOOTER_LABEL="Add JavaScript (vie
COM_COMPONENTBUILDER_FIELD_BASESIXTY_FOUR="base64" COM_COMPONENTBUILDER_FIELD_BASESIXTY_FOUR="base64"
COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY="Basic Encryption (local-DB-key)" COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY="Basic Encryption (local-DB-key)"
COM_COMPONENTBUILDER_FIELD_BIGINT="BIGINT" COM_COMPONENTBUILDER_FIELD_BIGINT="BIGINT"
COM_COMPONENTBUILDER_FIELD_BLOB="BLOB"
COM_COMPONENTBUILDER_FIELD_BSB_NOT_FOUND_IN_LOCAL_DATABASE_TABLE_S_SO_IMPORTED_OF_ITS_VALUES_FAILED_PLEASE_UPDATE_YOUR_JCB_INSTALL_AND_TRY_AGAIN="Field <b>%s</b> not found in local database table (%s) so imported of its values failed, please update your JCB install and try again." COM_COMPONENTBUILDER_FIELD_BSB_NOT_FOUND_IN_LOCAL_DATABASE_TABLE_S_SO_IMPORTED_OF_ITS_VALUES_FAILED_PLEASE_UPDATE_YOUR_JCB_INSTALL_AND_TRY_AGAIN="Field <b>%s</b> not found in local database table (%s) so imported of its values failed, please update your JCB install and try again."
COM_COMPONENTBUILDER_FIELD_CATID_DESCRIPTION="select one of the following categories" COM_COMPONENTBUILDER_FIELD_CATID_DESCRIPTION="select one of the following categories"
COM_COMPONENTBUILDER_FIELD_CATID_LABEL="Category" COM_COMPONENTBUILDER_FIELD_CATID_LABEL="Category"
@ -4386,7 +4387,9 @@ COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEW_FOOTER_DESCRIPTION="Add JavaScript fo
COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEW_FOOTER_LABEL="Javascript (edit view footer)" COM_COMPONENTBUILDER_FIELD_JAVASCRIPT_VIEW_FOOTER_LABEL="Javascript (edit view footer)"
COM_COMPONENTBUILDER_FIELD_JSON="JSON" COM_COMPONENTBUILDER_FIELD_JSON="JSON"
COM_COMPONENTBUILDER_FIELD_KEY="KEY" COM_COMPONENTBUILDER_FIELD_KEY="KEY"
COM_COMPONENTBUILDER_FIELD_LONGBLOB="LONGBLOB"
COM_COMPONENTBUILDER_FIELD_LONGTEXT="LONGTEXT" COM_COMPONENTBUILDER_FIELD_LONGTEXT="LONGTEXT"
COM_COMPONENTBUILDER_FIELD_MEDIUMBLOB="MEDIUMBLOB"
COM_COMPONENTBUILDER_FIELD_MEDIUMTEXT="MEDIUMTEXT" COM_COMPONENTBUILDER_FIELD_MEDIUMTEXT="MEDIUMTEXT"
COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY="Medium Encryption (local-file-key)" COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY="Medium Encryption (local-file-key)"
COM_COMPONENTBUILDER_FIELD_MODIFIED_BY_DESC="The last user that modified this Field." COM_COMPONENTBUILDER_FIELD_MODIFIED_BY_DESC="The last user that modified this Field."
@ -4526,6 +4529,7 @@ COM_COMPONENTBUILDER_FIELD_STORE_LABEL="Store Method"
COM_COMPONENTBUILDER_FIELD_TEN="10" COM_COMPONENTBUILDER_FIELD_TEN="10"
COM_COMPONENTBUILDER_FIELD_TEXT="TEXT" COM_COMPONENTBUILDER_FIELD_TEXT="TEXT"
COM_COMPONENTBUILDER_FIELD_TIME="TIME" COM_COMPONENTBUILDER_FIELD_TIME="TIME"
COM_COMPONENTBUILDER_FIELD_TINYBLOB="TINYBLOB"
COM_COMPONENTBUILDER_FIELD_TINYINT="TINYINT" COM_COMPONENTBUILDER_FIELD_TINYINT="TINYINT"
COM_COMPONENTBUILDER_FIELD_TWO_HUNDRED_AND_FIFTY_FIVE="255" COM_COMPONENTBUILDER_FIELD_TWO_HUNDRED_AND_FIFTY_FIVE="255"
COM_COMPONENTBUILDER_FIELD_TWO_THOUSAND_AND_FORTY_EIGHT="2048" COM_COMPONENTBUILDER_FIELD_TWO_THOUSAND_AND_FORTY_EIGHT="2048"

View File

@ -826,29 +826,31 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
} }
// few checks with the new option of using custom code in custom code // few checks with the new option of using custom code in custom code
if (isset($data['code']) && ($placholders = ComponentbuilderHelper::getAllBetween($data['code'], '[CUSTOM' . 'CODE=', ']')) if (isset($data['code']) && ($placeholders = ComponentbuilderHelper::getAllBetween($data['code'], '[CUSTOM' . 'CODE=', ']'))
&& ComponentbuilderHelper::checkArray($placholders)) && ComponentbuilderHelper::checkArray($placeholders))
{ {
// make sure custom code as Hash (automation) target does not have other custom code placeholders // make sure custom code as Hash (automation) target does not have other custom code placeholders
if (isset($data['target']) && 1 == $data['target']) if (isset($data['target']) && 1 == $data['target'])
{ {
foreach ($placholders as $placholder) foreach ($placeholders as $placeholder)
{ {
$data['code'] = str_replace('[CUSTOM' . 'CODE=' . $placholder . ']', '', $data['code']); $data['code'] = str_replace('[CUSTOM' . 'CODE=' . $placeholder . ']', '', $data['code']);
} }
// set title // set title
$title = (count($placholders) == 1) ? JText::_('COM_COMPONENTBUILDER_PLACEHOLDER_REMOVED') : JText::_('COM_COMPONENTBUILDER_PLACEHOLDERS_REMOVED'); $title = (count($placeholders) == 1) ? JText::_('COM_COMPONENTBUILDER_PLACEHOLDER_REMOVED') : JText::_('COM_COMPONENTBUILDER_PLACEHOLDERS_REMOVED');
// show message that we have had to remove the custom placeholders // show message that we have had to remove the custom placeholders
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_HTHREESHTHREEPCUSTOM_CODE_CAN_ONLY_BE_USED_IN_OTHER_CUSTOM_CODE_IF_SET_AS_BJCB_MANUALB_YOU_CAN_NOT_ADD_THEM_TO_EMHASH_AUTOMATIONEM_CODE_AT_THIS_POINTP', $title), 'Warning'); JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_HTHREESHTHREEPCUSTOM_CODE_CAN_ONLY_BE_USED_IN_OTHER_CUSTOM_CODE_IF_SET_AS_BJCB_MANUALB_YOU_CAN_NOT_ADD_THEM_TO_EMHASH_AUTOMATIONEM_CODE_AT_THIS_POINTP', $title), 'Warning');
} }
// make sure that the same custom code is not added to itself // make sure that the same custom code is not added to itself
else else
{ {
foreach ($placholders as $placholder) foreach ($placeholders as $placeholder)
{ {
if (strpos($placholder, $data['function_name']) !== false) // strip the placeholder down to just the function name
$_placeholder = (array) explode('+', $placeholder);
if ($_placeholder[0] === $data['function_name'])
{ {
$data['code'] = str_replace('[CUSTOM' . 'CODE=' . $placholder . ']', '', $data['code']); $data['code'] = str_replace('[CUSTOM' . 'CODE=' . $placeholder . ']', '', $data['code']);
// show message that we have had to remove the custom placeholders // show message that we have had to remove the custom placeholders
JFactory::getApplication()->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTHREEPLACEHOLDER_REMOVEDHTHREEPBTHISB_CUSTOM_CODE_CAN_ONLY_BE_USED_IN_BOTHERB_CUSTOM_CODE_NOT_IN_IT_SELF_SINCE_THAT_WILL_CAUSE_A_INFINITE_LOOP_IN_THE_COMPILERP'), 'Warning'); JFactory::getApplication()->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTHREEPLACEHOLDER_REMOVEDHTHREEPBTHISB_CUSTOM_CODE_CAN_ONLY_BE_USED_IN_BOTHERB_CUSTOM_CODE_NOT_IN_IT_SELF_SINCE_THAT_WILL_CAUSE_A_INFINITE_LOOP_IN_THE_COMPILERP'), 'Warning');
// stop the loop :) // stop the loop :)

View File

@ -171,6 +171,10 @@ class ComponentbuilderModelFields extends JModelList
'TEXT' => 'COM_COMPONENTBUILDER_FIELD_TEXT', 'TEXT' => 'COM_COMPONENTBUILDER_FIELD_TEXT',
'MEDIUMTEXT' => 'COM_COMPONENTBUILDER_FIELD_MEDIUMTEXT', 'MEDIUMTEXT' => 'COM_COMPONENTBUILDER_FIELD_MEDIUMTEXT',
'LONGTEXT' => 'COM_COMPONENTBUILDER_FIELD_LONGTEXT', 'LONGTEXT' => 'COM_COMPONENTBUILDER_FIELD_LONGTEXT',
'BLOB' => 'COM_COMPONENTBUILDER_FIELD_BLOB',
'TINYBLOB' => 'COM_COMPONENTBUILDER_FIELD_TINYBLOB',
'MEDIUMBLOB' => 'COM_COMPONENTBUILDER_FIELD_MEDIUMBLOB',
'LONGBLOB' => 'COM_COMPONENTBUILDER_FIELD_LONGBLOB',
'DATETIME' => 'COM_COMPONENTBUILDER_FIELD_DATETIME', 'DATETIME' => 'COM_COMPONENTBUILDER_FIELD_DATETIME',
'DATE' => 'COM_COMPONENTBUILDER_FIELD_DATE', 'DATE' => 'COM_COMPONENTBUILDER_FIELD_DATE',
'TIME' => 'COM_COMPONENTBUILDER_FIELD_TIME', 'TIME' => 'COM_COMPONENTBUILDER_FIELD_TIME',

View File

@ -239,6 +239,10 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
'TEXT' => 'COM_COMPONENTBUILDER_FIELD_TEXT', 'TEXT' => 'COM_COMPONENTBUILDER_FIELD_TEXT',
'MEDIUMTEXT' => 'COM_COMPONENTBUILDER_FIELD_MEDIUMTEXT', 'MEDIUMTEXT' => 'COM_COMPONENTBUILDER_FIELD_MEDIUMTEXT',
'LONGTEXT' => 'COM_COMPONENTBUILDER_FIELD_LONGTEXT', 'LONGTEXT' => 'COM_COMPONENTBUILDER_FIELD_LONGTEXT',
'BLOB' => 'COM_COMPONENTBUILDER_FIELD_BLOB',
'TINYBLOB' => 'COM_COMPONENTBUILDER_FIELD_TINYBLOB',
'MEDIUMBLOB' => 'COM_COMPONENTBUILDER_FIELD_MEDIUMBLOB',
'LONGBLOB' => 'COM_COMPONENTBUILDER_FIELD_LONGBLOB',
'DATETIME' => 'COM_COMPONENTBUILDER_FIELD_DATETIME', 'DATETIME' => 'COM_COMPONENTBUILDER_FIELD_DATETIME',
'DATE' => 'COM_COMPONENTBUILDER_FIELD_DATE', 'DATE' => 'COM_COMPONENTBUILDER_FIELD_DATE',
'TIME' => 'COM_COMPONENTBUILDER_FIELD_TIME', 'TIME' => 'COM_COMPONENTBUILDER_FIELD_TIME',

View File

@ -136,6 +136,14 @@
COM_COMPONENTBUILDER_FIELD_MEDIUMTEXT</option> COM_COMPONENTBUILDER_FIELD_MEDIUMTEXT</option>
<option value="LONGTEXT"> <option value="LONGTEXT">
COM_COMPONENTBUILDER_FIELD_LONGTEXT</option> COM_COMPONENTBUILDER_FIELD_LONGTEXT</option>
<option value="BLOB">
COM_COMPONENTBUILDER_FIELD_BLOB</option>
<option value="TINYBLOB">
COM_COMPONENTBUILDER_FIELD_TINYBLOB</option>
<option value="MEDIUMBLOB">
COM_COMPONENTBUILDER_FIELD_MEDIUMBLOB</option>
<option value="LONGBLOB">
COM_COMPONENTBUILDER_FIELD_LONGBLOB</option>
<option value="DATETIME"> <option value="DATETIME">
COM_COMPONENTBUILDER_FIELD_DATETIME</option> COM_COMPONENTBUILDER_FIELD_DATETIME</option>
<option value="DATE"> <option value="DATE">

View File

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

View File

@ -1354,9 +1354,15 @@ abstract class ComponentbuilderHelper
{ {
$it = new RecursiveDirectoryIterator($dir); $it = new RecursiveDirectoryIterator($dir);
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); $it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
// remove ending /
$dir = rtrim($dir, '/');
// now loop the files & folders
foreach ($it as $file) foreach ($it as $file)
{ {
if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue; if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue;
// set file dir
$file_dir = $file->getPathname();
// check if this is a dir or a file
if ($file->isDir()) if ($file->isDir())
{ {
$keeper = false; $keeper = false;
@ -1364,7 +1370,7 @@ abstract class ComponentbuilderHelper
{ {
foreach ($ignore as $keep) foreach ($ignore as $keep)
{ {
if (strpos($file->getPathname(), $dir.'/'.$keep) !== false) if (strpos($file_dir, $dir.'/'.$keep) !== false)
{ {
$keeper = true; $keeper = true;
} }
@ -1374,7 +1380,7 @@ abstract class ComponentbuilderHelper
{ {
continue; continue;
} }
JFolder::delete($file->getPathname()); JFolder::delete($file_dir);
} }
else else
{ {
@ -1383,7 +1389,7 @@ abstract class ComponentbuilderHelper
{ {
foreach ($ignore as $keep) foreach ($ignore as $keep)
{ {
if (strpos($file->getPathname(), $dir.'/'.$keep) !== false) if (strpos($file_dir, $dir.'/'.$keep) !== false)
{ {
$keeper = true; $keeper = true;
} }
@ -1393,9 +1399,10 @@ abstract class ComponentbuilderHelper
{ {
continue; continue;
} }
JFile::delete($file->getPathname()); JFile::delete($file_dir);
} }
} }
// delete the root folder if not ignore found
if (!self::checkArray($ignore)) if (!self::checkArray($ignore))
{ {
return JFolder::delete($dir); return JFolder::delete($dir);