diff --git a/README.md b/README.md index 191c05c05..76c3fa154 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,7 @@ 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*: 29th October, 2020 ++ *Last Build*: 6th November, 2020 + *Version*: 2.11.7 + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt diff --git a/admin/README.txt b/admin/README.txt index 191c05c05..76c3fa154 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -144,7 +144,7 @@ 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*: 29th October, 2020 ++ *Last Build*: 6th November, 2020 + *Version*: 2.11.7 + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index d5b22de90..3da1fbf5d 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -1178,11 +1178,11 @@ class Interpretation extends Fields $updateXML[] = ''; // UPDATE_SERVER_XML $name = substr( - $this->componentData->update_server_url, - strrpos($this->componentData->update_server_url, '/') - + 1 - ); - $name = explode('.xml', $name)[0]; + $this->componentData->update_server_url, + strrpos($this->componentData->update_server_url, '/') + + 1 + ); + $name = explode('.xml', $name)[0]; $target = array('admin' => $name); $this->buildDynamique($target, 'update_server'); $this->fileContentDynamic[$name][$this->hhh @@ -1685,7 +1685,8 @@ class Interpretation extends Fields $exel[] = $this->_t(2) . "));"; $exel[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Add some data"; - $exel[] = $this->_t(2) . "if ((\$size = self::checkArray(\$rows)) !== false)"; + $exel[] = $this->_t(2) + . "if ((\$size = self::checkArray(\$rows)) !== false)"; $exel[] = $this->_t(2) . "{"; $exel[] = $this->_t(3) . "\$i = 1;"; $exel[] = PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) @@ -1702,7 +1703,8 @@ class Interpretation extends Fields $exel[] = $this->_t(3) . "}"; $exel[] = PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Set active sheet and get it."; - $exel[] = $this->_t(3) . "\$active_sheet = \$spreadsheet->setActiveSheetIndex(0);"; + $exel[] = $this->_t(3) + . "\$active_sheet = \$spreadsheet->setActiveSheetIndex(0);"; $exel[] = $this->_t(3) . "foreach (\$rows as \$array)"; $exel[] = $this->_t(3) . "{"; $exel[] = $this->_t(4) . "\$a = 'A';"; @@ -1712,7 +1714,7 @@ class Interpretation extends Fields . "\$active_sheet->setCellValue(\$a.\$i, \$value);"; $exel[] = $this->_t(5) . "if (\$xls_mode != 3)"; $exel[] = $this->_t(5) . "{"; - $exel[] = $this->_t(6) . "if (\$i == 1)"; + $exel[] = $this->_t(6) . "if (\$i == 1)"; $exel[] = $this->_t(6) . "{"; $exel[] = $this->_t(7) . "\$active_sheet->getColumnDimension(\$a)->setAutoSize(true);"; @@ -1878,30 +1880,37 @@ class Interpretation extends Fields $method[] = PHP_EOL . PHP_EOL . $this->_t(1) . "/**"; $method[] = $this->_t(1) . " * Greate user and update given table"; $method[] = $this->_t(1) . " *"; - $method[] = $this->_t(1) . " * @param array \$credentials Array('name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string)"; + $method[] = $this->_t(1) + . " * @param array \$credentials Array('name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string)"; $method[] = $this->_t(1) . " * @param int \$autologin"; - $method[] = $this->_t(1) . " * @param array \$params Array('useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int)"; - $method[] = $this->_t(1) . " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser"; + $method[] = $this->_t(1) + . " * @param array \$params Array('useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int)"; + $method[] = $this->_t(1) + . " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser"; $method[] = $this->_t(1) . " *"; - $method[] = $this->_t(1) . " * @return int|Error User ID on success, or an error."; + $method[] = $this->_t(1) + . " * @return int|Error User ID on success, or an error."; $method[] = $this->_t(1) . " */"; $method[] = $this->_t(1) . "public static function createUser(\$credentials, \$autologin = 0,"; $method[] = $this->_t(2) . "\$params = array("; - $method[] = $this->_t(3) . "'useractivation' => 0, 'sendpassword' => 1"; + $method[] = $this->_t(3) + . "'useractivation' => 0, 'sendpassword' => 1"; $method[] = $this->_t(2) . "), \$mode = 1"; $method[] = $this->_t(1) . ")"; $method[] = $this->_t(1) . "{"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Override mode"; - $method[] = $this->_t(2) . "if (\$mode == 2 && method_exists(__CLASS__, 'registerUser'))"; + $method[] = $this->_t(2) + . "if (\$mode == 2 && method_exists(__CLASS__, 'registerUser'))"; $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Update params"; $method[] = $this->_t(3) . "\$params['autologin'] = \$autologin;"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Now Register User"; - $method[] = $this->_t(3) . "return self::registerUser(\$credentials, \$params);"; + $method[] = $this->_t(3) + . "return self::registerUser(\$credentials, \$params);"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "elseif (\$mode == 2)"; $method[] = $this->_t(2) . "{"; @@ -1921,7 +1930,9 @@ 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) //" . $this->setLine(__LINE__) + $method[] = $this->_t(2) . "if (\$mode == 1) //" . $this->setLine( + __LINE__ + ) . " 1 = Site Registrations"; $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) @@ -1942,14 +1953,14 @@ class Interpretation extends Fields $method[] = $this->_t(2) . "if (self::checkArray(\$params))"; $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) - . " Make changes to user config"; + . " Make changes to user config"; $method[] = $this->_t(3) . "foreach (\$params as \$param => \$set)"; $method[] = $this->_t(3) . "{"; $method[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " If you know of a better path, let me know"; $method[] = $this->_t(4) - ."\$params[\$param] = self::setParams(\$extension, \$param, \$set);"; + . "\$params[\$param] = self::setParams(\$extension, \$param, \$set);"; $method[] = $this->_t(3) . "}"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -1963,25 +1974,31 @@ class Interpretation extends Fields $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Lineup new user data array"; $method[] = $this->_t(2) . "\$data = array("; - $method[] = $this->_t(3) . "'username' => \$credentials['username'],"; + $method[] = $this->_t(3) + . "'username' => \$credentials['username'],"; $method[] = $this->_t(3) . "'name' => \$credentials['name'],"; $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) //". $this->setLine(__LINE__) + $method[] = $this->_t(2) . "if (\$mode == 1) //" . $this->setLine( + __LINE__ + ) . " 1 = Site-registration mode"; $method[] = $this->_t(2) . "{"; - $method[] = $this->_t(3) . "\$data['email1'] = \$credentials['email'];"; + $method[] = $this->_t(3) + . "\$data['email1'] = \$credentials['email'];"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "else //" . $this->setLine(__LINE__) . " 0 = Admin-registration mode"; $method[] = $this->_t(2) . "{"; - $method[] = $this->_t(3) . "\$data['email'] = \$credentials['email'];"; - $method[] = $this->_t(3) . "\$data['registerDate'] = JFactory::getDate()->toSql();"; + $method[] = $this->_t(3) + . "\$data['email'] = \$credentials['email'];"; + $method[] = $this->_t(3) + . "\$data['registerDate'] = JFactory::getDate()->toSql();"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) - . " Check if password was set"; + . " Check if password was set"; $method[] = $this->_t(2) . "if (\$mode == 1 && (!isset(\$credentials['password']) || !isset(\$credentials['password2']) || !self::checkString(\$credentials['password']) || !self::checkString(\$credentials['password2'])))"; $method[] = $this->_t(2) . "{"; @@ -1989,8 +2006,10 @@ class Interpretation extends Fields . " Set random password when empty password was submitted,"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " 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(3) + . "\$credentials['password'] = self::randomkey(8);"; + $method[] = $this->_t(3) + . "\$credentials['password2'] = \$credentials['password'];"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -1998,17 +2017,22 @@ class Interpretation extends Fields $method[] = $this->_t(2) . "if (isset(\$credentials['password']) && isset(\$credentials['password2']) && self::checkString(\$credentials['password']) && self::checkString(\$credentials['password2']))"; $method[] = $this->_t(2) . "{"; - $method[] = $this->_t(3) . "if (\$mode == 1) //". $this->setLine(__LINE__) + $method[] = $this->_t(3) . "if (\$mode == 1) //" . $this->setLine( + __LINE__ + ) . " 1 = Site-registration mode"; $method[] = $this->_t(3) . "{"; - $method[] = $this->_t(4) . "\$data['password1'] = \$credentials['password'];"; + $method[] = $this->_t(4) + . "\$data['password1'] = \$credentials['password'];"; $method[] = $this->_t(3) . "}"; $method[] = $this->_t(3) . "else //" . $this->setLine(__LINE__) . " 0 = Admin-registration mode"; $method[] = $this->_t(3) . "{"; - $method[] = $this->_t(4) . "\$data['password'] = \$credentials['password'];"; + $method[] = $this->_t(4) + . "\$data['password'] = \$credentials['password'];"; $method[] = $this->_t(3) . "}"; - $method[] = $this->_t(3) . "\$data['password2'] = \$credentials['password2'];"; + $method[] = $this->_t(3) + . "\$data['password2'] = \$credentials['password2'];"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Load the group/s value if set, only for Admin Registration (\$mode == 0)"; @@ -2020,7 +2044,9 @@ class Interpretation extends Fields $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Create the new user"; - $method[] = $this->_t(2) . "if (\$mode == 1) //". $this->setLine(__LINE__) + $method[] = $this->_t(2) . "if (\$mode == 1) //" . $this->setLine( + __LINE__ + ) . " 1 = Site-registration mode"; $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "\$userId = \$model->register(\$data);"; @@ -2029,7 +2055,8 @@ class Interpretation extends Fields . " 0 = Admin-registration mode"; $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "\$model->save(\$data);"; - $method[] = $this->_t(3) . "\$userId = \$model->getState('user.id', 0);"; + $method[] = $this->_t(3) + . "\$userId = \$model->getState('user.id', 0);"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -2044,7 +2071,7 @@ class Interpretation extends Fields $method[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " If you know of a better path, let me know"; $method[] = $this->_t(4) - ."self::setParams(\$extension, \$param, \$set);"; + . "self::setParams(\$extension, \$param, \$set);"; $method[] = $this->_t(3) . "}"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -2053,12 +2080,14 @@ class Interpretation extends Fields $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Auto Login if Needed"; - $method[] = $this->_t(3) . "if (\$autologin && isset(\$credentials['password']))"; + $method[] = $this->_t(3) + . "if (\$autologin && isset(\$credentials['password']))"; $method[] = $this->_t(3) . "{"; $method[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " Try to login"; $method[] = $this->_t(4) . "try{"; - $method[] = $this->_t(5) . "JFactory::getApplication()->login(\$credentials);"; + $method[] = $this->_t(5) + . "JFactory::getApplication()->login(\$credentials);"; $method[] = $this->_t(4) . "} catch (Exception \$exception){"; $method[] = $this->_t(5) . "//" . $this->setLine(__LINE__) . " Do noting for now, may want to set redirect."; @@ -5078,19 +5107,21 @@ class Interpretation extends Fields as $order_field ) { - if ($order_first && ($order_field_name = $this->getFieldDatabaseName( + if ($order_first + && ($order_field_name = $this->getFieldDatabaseName( $viewName_list, $order_field['field'] )) !== false) { // just the first field is based on state $order_first = false; - $script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine( + $script .= PHP_EOL . $this->_t(2) . "//" + . $this->setLine( __LINE__ ) . " Add the list ordering clause."; - $script .= PHP_EOL . $this->_t(2) + $script .= PHP_EOL . $this->_t(2) . "\$this->listOrder = \$this->escape(\$this->state->get('list.ordering', '" . $order_field_name . "'));"; - $script .= PHP_EOL . $this->_t(2) + $script .= PHP_EOL . $this->_t(2) . "\$this->listDirn = \$this->escape(\$this->state->get('list.direction', '" . $order_field['direction'] . "'));"; } @@ -5107,6 +5138,7 @@ class Interpretation extends Fields $script .= PHP_EOL . $this->_t(2) . "\$this->listDirn = \$this->escape(\$this->state->get('list.direction', 'asc'));"; } + return $script; } @@ -5670,7 +5702,8 @@ class Interpretation extends Fields . "JToolBarHelper::custom('" . $viewName . "." . $custom_button['method'] . "', '" . $custom_button['icomoon'] . " custom-button-" - . strtolower($custom_button['method']) . "', '', '" . $keyLang + . strtolower($custom_button['method']) . "', '', '" + . $keyLang . "', false);"; $buttons[] = $this->_t(1) . $tab . $this->_t(1) . "}"; } @@ -5705,7 +5738,8 @@ class Interpretation extends Fields . "JToolBarHelper::custom('" . $viewsName . "." . $custom_button['method'] . "', '" . $custom_button['icomoon'] . " custom-button-" - . strtolower($custom_button['method']) . "', '', '" + . strtolower($custom_button['method']) + . "', '', '" . $keyLang . "', false);"; $this->onlyFunctionButton[$viewsName][] = $this->_t( 1 @@ -5726,7 +5760,8 @@ class Interpretation extends Fields . "JToolBarHelper::custom('" . $viewsName . "." . $custom_button['method'] . "', '" . $custom_button['icomoon'] . " custom-button-" - . strtolower($custom_button['method']) . "', '', '" + . strtolower($custom_button['method']) + . "', '', '" . $keyLang . "', '" . $validateSelection . "');"; $buttons[] = $this->_t(1) . $tab . $this->_t(1) @@ -5812,9 +5847,11 @@ class Interpretation extends Fields if (ComponentbuilderHelper::checkArray($buttons)) { // just to check if the submission script is manually added - if (!isset($view['settings']->php_document) || - strpos(implode(' ', $view['settings']->php_document), - '/submitbutton.js') === false) + if (!isset($view['settings']->php_document) + || strpos( + implode(' ', $view['settings']->php_document), + '/submitbutton.js' + ) === false) { // set the custom get form method JAVASCRIPT_FOR_BUTTONS $this->fileContentDynamic[$view['settings']->code][$this->hhh @@ -6956,7 +6993,8 @@ class Interpretation extends Fields // add pagination start if (!$has_pagination_start) { - $body[] = $this->placeholders[$this->bbb . 'PAGINATIONSTART' . $this->ddd]; + $body[] = $this->placeholders[$this->bbb . 'PAGINATIONSTART' + . $this->ddd]; } if (!$has_limitbox && !$has_pagescounter) @@ -6977,14 +7015,28 @@ class Interpretation extends Fields // add pagination end if (!$has_pagination_end) { - $body[] = $this->placeholders[$this->bbb . 'PAGINATIONEND' . $this->ddd]; + $body[] = $this->placeholders[$this->bbb . 'PAGINATIONEND' + . $this->ddd]; } // lets clear the placeholders just in case - unset($this->placeholders[$this->bbb . 'LIMITBOX' . $this->ddd]); - unset($this->placeholders[$this->bbb . 'PAGESCOUNTER' . $this->ddd]); - unset($this->placeholders[$this->bbb . 'PAGESLINKS' . $this->ddd]); - unset($this->placeholders[$this->bbb . 'PAGINATIONSTART' . $this->ddd]); - unset($this->placeholders[$this->bbb . 'PAGINATIONEND' . $this->ddd]); + unset( + $this->placeholders[$this->bbb . 'LIMITBOX' . $this->ddd] + ); + unset( + $this->placeholders[$this->bbb . 'PAGESCOUNTER' + . $this->ddd] + ); + unset( + $this->placeholders[$this->bbb . 'PAGESLINKS' . $this->ddd] + ); + unset( + $this->placeholders[$this->bbb . 'PAGINATIONSTART' + . $this->ddd] + ); + unset( + $this->placeholders[$this->bbb . 'PAGINATIONEND' + . $this->ddd] + ); // insure the form is added (only if no form exist) if (strpos($view['settings']->default, '