diff --git a/README.md b/README.md index 9994258e8..e0b645a15 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.6.17) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.6.18) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -126,14 +126,14 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 -+ *Last Build*: 27th February, 2018 -+ *Version*: 2.6.17 ++ *Last Build*: 19th March, 2018 ++ *Version*: 2.6.18 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **183098** -+ *Field count*: **1641** -+ *File count*: **1169** -+ *Folder count*: **188** ++ *Line count*: **186136** ++ *Field count*: **994** ++ *File count*: **1171** ++ *Folder count*: **189** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) diff --git a/admin/README.txt b/admin/README.txt index 9994258e8..e0b645a15 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.6.17) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.6.18) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -126,14 +126,14 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 -+ *Last Build*: 27th February, 2018 -+ *Version*: 2.6.17 ++ *Last Build*: 19th March, 2018 ++ *Version*: 2.6.18 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **183098** -+ *Field count*: **1641** -+ *File count*: **1169** -+ *Folder count*: **188** ++ *Line count*: **186136** ++ *Field count*: **994** ++ *File count*: **1171** ++ *Folder count*: **189** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) diff --git a/admin/access.xml b/admin/access.xml index e81f9fc5a..b9769fd7d 100644 --- a/admin/access.xml +++ b/admin/access.xml @@ -473,9 +473,9 @@ + -
diff --git a/admin/assets/css/dynamic_get.css b/admin/assets/css/dynamic_get.css index ea37532e5..f4cbb8a06 100644 --- a/admin/assets/css/dynamic_get.css +++ b/admin/assets/css/dynamic_get.css @@ -24,6 +24,7 @@ /* CSS Document */ + .fieldMedium { width: 80px !important; } diff --git a/admin/assets/css/joomla_component.css b/admin/assets/css/joomla_component.css index d1060adb5..0017fd394 100644 --- a/admin/assets/css/joomla_component.css +++ b/admin/assets/css/joomla_component.css @@ -24,4 +24,7 @@ /* CSS Document */ - + +#jform_dashboard_chzn { +width: 100% !important; +} diff --git a/admin/assets/images/icons/getsnippets.png b/admin/assets/images/icons/getsnippets.png new file mode 100644 index 000000000..cbe68e80e Binary files /dev/null and b/admin/assets/images/icons/getsnippets.png differ diff --git a/admin/compiler/joomla_3/DASHJModelList.php b/admin/compiler/joomla_3/DASHJModelList.php index e5d5053d2..65f0b06c4 100644 --- a/admin/compiler/joomla_3/DASHJModelList.php +++ b/admin/compiler/joomla_3/DASHJModelList.php @@ -48,6 +48,7 @@ class ###Component###Model###Component### extends JModelList $viewGroups = array( 'main' => array(###DASHBOARDICONS###) );###DASHBOARDICONACCESS### + // loop over the $views foreach($viewGroups as $group => $views) { $i = 0; @@ -56,47 +57,62 @@ class ###Component###Model###Component### extends JModelList foreach($views as $view) { $add = false; - if (strpos($view,'.') !== false) + // external views (links) + if (strpos($view,'||') !== false) { - $dwd = explode('.', $view); - if (count($dwd) == 3) + $dwd = explode('||', $view); + if (count($dwd) == 3) + { + list($type, $name, $url) = $dwd; + $viewName = $name; + $alt = $name; + $url = $url; + $image = $name.'.'.$type; + $name = 'COM_###COMPONENT###_DASHBOARD_'.###Component###Helper::safeString($name,'U'); + } + } + // internal views + elseif (strpos($view,'.') !== false) + { + $dwd = explode('.', $view); + if (count($dwd) == 3) + { + list($type, $name, $action) = $dwd; + } + elseif (count($dwd) == 2) + { + list($type, $name) = $dwd; + $action = false; + } + if ($action) + { + $viewName = $name; + switch($action) { - list($type, $name, $action) = $dwd; - } - elseif (count($dwd) == 2) - { - list($type, $name) = $dwd; - $action = false; - } - if ($action) - { - $viewName = $name; - switch($action) - { - case 'add': - $url ='index.php?option=com_###component###&view='.$name.'&layout=edit'; - $image = $name.'_'.$action.'.'.$type; - $alt = $name.' '.$action; - $name = 'COM_###COMPONENT###_DASHBOARD_'.###Component###Helper::safeString($name,'U').'_ADD'; - $add = true; - break; - default: - $url = 'index.php?option=com_categories&view=categories&extension=com_###component###.'.$name; - $image = $name.'_'.$action.'.'.$type; - $alt = $name.' '.$action; - $name = 'COM_###COMPONENT###_DASHBOARD_'.###Component###Helper::safeString($name,'U').'_'.###Component###Helper::safeString($action,'U'); - break; - } - } - else - { - $viewName = $name; - $alt = $name; - $url = 'index.php?option=com_###component###&view='.$name; - $image = $name.'.'.$type; - $name = 'COM_###COMPONENT###_DASHBOARD_'.###Component###Helper::safeString($name,'U'); - $hover = false; + case 'add': + $url = 'index.php?option=com_###component###&view='.$name.'&layout=edit'; + $image = $name.'_'.$action.'.'.$type; + $alt = $name.' '.$action; + $name = 'COM_###COMPONENT###_DASHBOARD_'.###Component###Helper::safeString($name,'U').'_ADD'; + $add = true; + break; + default: + $url = 'index.php?option=com_categories&view=categories&extension=com_###component###.'.$name; + $image = $name.'_'.$action.'.'.$type; + $alt = $name.' '.$action; + $name = 'COM_###COMPONENT###_DASHBOARD_'.###Component###Helper::safeString($name,'U').'_'.###Component###Helper::safeString($action,'U'); + break; } + } + else + { + $viewName = $name; + $alt = $name; + $url = 'index.php?option=com_###component###&view='.$name; + $image = $name.'.'.$type; + $name = 'COM_###COMPONENT###_DASHBOARD_'.###Component###Helper::safeString($name,'U'); + $hover = false; + } } else { @@ -149,7 +165,7 @@ class ###Component###Model###Component### extends JModelList // check access if($user->authorise($accessAdd, 'com_###component###') && $user->authorise($accessTo, 'com_###component###') && $dashboard_add) { - $icons[$group][$i] = new StdClass; + $icons[$group][$i] = new StdClass; $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; @@ -161,7 +177,7 @@ class ###Component###Model###Component### extends JModelList // check access if($user->authorise($accessTo, 'com_###component###') && $dashboard_list) { - $icons[$group][$i] = new StdClass; + $icons[$group][$i] = new StdClass; $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; @@ -173,7 +189,7 @@ class ###Component###Model###Component### extends JModelList // check access if($user->authorise($accessAdd, 'com_###component###') && $dashboard_add) { - $icons[$group][$i] = new StdClass; + $icons[$group][$i] = new StdClass; $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; @@ -182,7 +198,7 @@ class ###Component###Model###Component### extends JModelList } else { - $icons[$group][$i] = new StdClass; + $icons[$group][$i] = new StdClass; $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; @@ -191,7 +207,7 @@ class ###Component###Model###Component### extends JModelList } else { - $icons[$group][$i] = new StdClass; + $icons[$group][$i] = new StdClass; $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; diff --git a/admin/compiler/joomla_3/Helper.php b/admin/compiler/joomla_3/Helper.php index ac0351cad..fae8c8cb8 100644 --- a/admin/compiler/joomla_3/Helper.php +++ b/admin/compiler/joomla_3/Helper.php @@ -42,12 +42,12 @@ abstract class ###Component###Helper $manifestUrl = JPATH_ADMINISTRATOR."/components/com_###component###/###component###.xml"; return simplexml_load_file($manifestUrl); } - + /** * Joomla version object **/ protected static $JVersion; - + /** * set/get Joomla version **/ @@ -503,7 +503,7 @@ abstract class ###Component###Helper } return $model; } - + /** * Add to asset Table */ @@ -565,7 +565,7 @@ abstract class ###Component###Helper } return false; } - + /** * Gets the default asset Rules for a component/view. */ @@ -641,7 +641,14 @@ abstract class ###Component###Helper return $button->input; } - + + /** + * Check if have an json string + * + * @input string The json string to check + * + * @returns bool true on success + **/ public static function checkJson($string) { if (self::checkString($string)) @@ -652,15 +659,29 @@ abstract class ###Component###Helper return false; } + /** + * Check if have an object with a length + * + * @input object The object to check + * + * @returns bool true on success + **/ public static function checkObject($object) { - if (isset($object) && is_object($object) && count($object) > 0) + if (isset($object) && is_object($object)) { - return true; + return count((array)$object) > 0; } return false; } + /** + * Check if have an array with a length + * + * @input array The array to check + * + * @returns bool true on success + **/ public static function checkArray($array, $removeEmptyString = false) { if (isset($array) && is_array($array) && count($array) > 0) @@ -682,6 +703,13 @@ abstract class ###Component###Helper return false; } + /** + * Check if have a string with a length + * + * @input string The string to check + * + * @returns bool true on success + **/ public static function checkString($string) { if (isset($string) && is_string($string) && strlen($string) > 0) @@ -690,7 +718,7 @@ abstract class ###Component###Helper } return false; } - + /** * Check if we are connected * Thanks https://stackoverflow.com/a/4860432/1429677 @@ -716,6 +744,13 @@ abstract class ###Component###Helper return $is_conn; } + /** + * Merge an array of array's + * + * @input array The arrays you would like to merge + * + * @returns array on success + **/ public static function mergeArrays($arrays) { if(self::checkArray($arrays)) @@ -739,6 +774,13 @@ abstract class ###Component###Helper return self::shorten($string, $length, $addTip); } + /** + * Shorten a string + * + * @input string The you would like to shorten + * + * @returns string on success + **/ public static function shorten($string, $length = 40, $addTip = true) { if (self::checkString($string)) @@ -773,6 +815,13 @@ abstract class ###Component###Helper return $string; } + /** + * Making strings safe (various ways) + * + * @input string The you would like to make safe + * + * @returns string on success + **/ public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true) { if ($replaceNumbers === true) @@ -900,7 +949,7 @@ abstract class ###Component###Helper // return the string with no numbers remaining. return $string; } - + /** * Convert an integer into an English word string * Thanks to Tom Nicholson diff --git a/admin/compiler/joomla_3/Helper_site.php b/admin/compiler/joomla_3/Helper_site.php index 0ba4442b0..3dc3ae053 100644 --- a/admin/compiler/joomla_3/Helper_site.php +++ b/admin/compiler/joomla_3/Helper_site.php @@ -65,7 +65,7 @@ abstract class ###Component###Helper } return $value; } - + /** * Load the Component xml manifest. **/ @@ -74,12 +74,12 @@ abstract class ###Component###Helper $manifestUrl = JPATH_ADMINISTRATOR."/components/com_###component###/###component###.xml"; return simplexml_load_file($manifestUrl); } - + /** * Joomla version object **/ protected static $JVersion; - + /** * set/get Joomla version **/ @@ -174,7 +174,7 @@ abstract class ###Component###Helper } return $model; } - + /** * Add to asset Table */ @@ -238,7 +238,7 @@ abstract class ###Component###Helper } return false; } - + /** * Gets the default asset Rules for a component/view. */ @@ -441,7 +441,7 @@ abstract class ###Component###Helper } return $id; } - + /** * Get the actions permissions **/ @@ -633,7 +633,14 @@ abstract class ###Component###Helper } return $result; } - + + /** + * Check if have an json string + * + * @input string The json string to check + * + * @returns bool true on success + **/ public static function checkJson($string) { if (self::checkString($string)) @@ -644,15 +651,29 @@ abstract class ###Component###Helper return false; } + /** + * Check if have an object with a length + * + * @input object The object to check + * + * @returns bool true on success + **/ public static function checkObject($object) { - if (isset($object) && is_object($object) && count($object) > 0) + if (isset($object) && is_object($object)) { - return true; + return count((array)$object) > 0; } return false; } + /** + * Check if have an array with a length + * + * @input array The array to check + * + * @returns bool true on success + **/ public static function checkArray($array, $removeEmptyString = false) { if (isset($array) && is_array($array) && count($array) > 0) @@ -674,6 +695,13 @@ abstract class ###Component###Helper return false; } + /** + * Check if have a string with a length + * + * @input string The string to check + * + * @returns bool true on success + **/ public static function checkString($string) { if (isset($string) && is_string($string) && strlen($string) > 0) @@ -682,7 +710,7 @@ abstract class ###Component###Helper } return false; } - + /** * Check if we are connected * Thanks https://stackoverflow.com/a/4860432/1429677 @@ -708,6 +736,13 @@ abstract class ###Component###Helper return $is_conn; } + /** + * Merge an array of array's + * + * @input array The arrays you would like to merge + * + * @returns array on success + **/ public static function mergeArrays($arrays) { if(self::checkArray($arrays)) @@ -731,6 +766,13 @@ abstract class ###Component###Helper return self::shorten($string, $length, $addTip); } + /** + * Shorten a string + * + * @input string The you would like to shorten + * + * @returns string on success + **/ public static function shorten($string, $length = 40, $addTip = true) { if (self::checkString($string)) @@ -765,6 +807,13 @@ abstract class ###Component###Helper return $string; } + /** + * Making strings safe (various ways) + * + * @input string The you would like to make safe + * + * @returns string on success + **/ public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true) { if ($replaceNumbers === true) @@ -892,7 +941,7 @@ abstract class ###Component###Helper // return the string with no numbers remaining. return $string; } - + /** * Convert an integer into an English word string * Thanks to Tom Nicholson diff --git a/admin/compiler/joomla_3/JControllerLegacy.php b/admin/compiler/joomla_3/JControllerLegacy.php index a94d8357b..d6d5bf94f 100644 --- a/admin/compiler/joomla_3/JControllerLegacy.php +++ b/admin/compiler/joomla_3/JControllerLegacy.php @@ -37,6 +37,23 @@ jimport('joomla.application.component.controller'); */ class ###Component###Controller extends JControllerLegacy { + /** + * Constructor. + * + * @param array $config An optional associative array of configuration settings. + * Recognized key values include 'name', 'default_task', 'model_path', and + * 'view_path' (this list is not meant to be comprehensive). + * + * @since 3.0 + */ + public function __construct($config = array()) + { + // set the default view + $config['default_view'] = '###DASHBOARDVIEW###'; + + parent::__construct($config); + } + /** * display task * @@ -45,7 +62,7 @@ class ###Component###Controller extends JControllerLegacy function display($cachable = false, $urlparams = false) { // set default view if not set - $view = $this->input->getCmd('view', '###Component###'); + $view = $this->input->getCmd('view', '###DASHBOARDVIEW###'); $data = $this->getViewRelation($view); $layout = $this->input->get('layout', null, 'WORD'); $id = $this->input->getInt('id'); @@ -88,18 +105,22 @@ class ###Component###Controller extends JControllerLegacy protected function getViewRelation($view) { + // check the we have a value if (###Component###Helper::checkString($view)) { + // the view relationships $views = array(###VIEWARRAY### ); // check if this is a list view - if (in_array($view,$views)) + if (in_array($view, $views)) { + // this is a list view return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view); } // check if it is an edit view - elseif (array_key_exists($view,$views)) + elseif (array_key_exists($view, $views)) { + // this is a edit view return array('edit' => true, 'view' => $view, 'views' => $views[$view]); } } diff --git a/admin/compiler/joomla_3/JControllerLegacySITE.php b/admin/compiler/joomla_3/JControllerLegacySITE.php index effb2a5a9..7d9a3f208 100644 --- a/admin/compiler/joomla_3/JControllerLegacySITE.php +++ b/admin/compiler/joomla_3/JControllerLegacySITE.php @@ -38,18 +38,30 @@ jimport('joomla.application.component.controller'); class ###Component###Controller extends JControllerLegacy { /** - * display task + * Method to display a view. + * + * @param boolean $cachable If true, the view output will be cached. + * @param boolean $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}. + * + * @return JController This object to support chaining. * - * @return void */ function display($cachable = false, $urlparams = false) { // set default view if not set $view = $this->input->getCmd('view', '###SITE_DEFAULT_VIEW###'); + $this->input->set('view', $view); $isEdit = $this->checkEditView($view); $layout = $this->input->get('layout', null, 'WORD'); $id = $this->input->getInt('id'); - $cachable = true; + // $cachable = true; (TODO) working on a fix [gh-238](https://github.com/vdm-io/Joomla-Component-Builder/issues/238) + + // insure that the view is not cashable if edit view or if user is logged in + $user = JFactory::getUser(); + if ($user->get('id') || $isEdit) + { + $cachable = false; + } // Check for edit form. if($isEdit) @@ -81,8 +93,33 @@ class ###Component###Controller extends JControllerLegacy return false; } } + + // we may need to make this more dynamic in the future. (TODO) + $safeurlparams = array( + 'catid' => 'INT', + 'id' => 'INT', + 'cid' => 'ARRAY', + 'year' => 'INT', + 'month' => 'INT', + 'limit' => 'UINT', + 'limitstart' => 'UINT', + 'showall' => 'INT', + 'return' => 'BASE64', + 'filter' => 'STRING', + 'filter_order' => 'CMD', + 'filter_order_Dir' => 'CMD', + 'filter-search' => 'STRING', + 'print' => 'BOOLEAN', + 'lang' => 'CMD', + 'Itemid' => 'INT'); - return parent::display($cachable, $urlparams); + // should these not merge? + if (###Component###Helper::checkArray($urlparams)) + { + $safeurlparams = ###Component###Helper::mergeArrays(array($urlparams, $safeurlparams)); + } + + return parent::display($cachable, $safeurlparams); } protected function checkEditView($view) diff --git a/admin/compiler/joomla_3/component.xml b/admin/compiler/joomla_3/component.xml index f2a5d84e3..e1503f55e 100644 --- a/admin/compiler/joomla_3/component.xml +++ b/admin/compiler/joomla_3/component.xml @@ -71,7 +71,7 @@ access.xml config.xml - controller.php###ENCRYPT_FILE### + controller.php###WHMCS_ENCRYPT_FILE### index.html ###component###.php###EXSTRA_ADMIN_FILES### assets diff --git a/admin/compiler/joomla_3/script.php b/admin/compiler/joomla_3/script.php index f26fa5b3b..e1525f537 100644 --- a/admin/compiler/joomla_3/script.php +++ b/admin/compiler/joomla_3/script.php @@ -111,6 +111,8 @@ class com_###component###InstallerScript */ function postflight($type, $parent) { + // get application + $app = JFactory::getApplication();###MOVEFOLDERSSCRIPT### // set the default component settings if ($type == 'install') {###POSTINSTALLSCRIPT### @@ -119,5 +121,5 @@ class com_###component###InstallerScript if ($type == 'update') {###POSTUPDATESCRIPT### } - } + }###MOVEFOLDERSMETHOD### } diff --git a/admin/compiler/joomla_3/settings.json b/admin/compiler/joomla_3/settings.json index f9fcc2cf3..a56267742 100644 --- a/admin/compiler/joomla_3/settings.json +++ b/admin/compiler/joomla_3/settings.json @@ -216,10 +216,10 @@ }, "dynamic": { "admin": { - "vdm.php": { + "whmcs.php": { "path": "c0mp0n3nt/admin", "rename": false, - "type": "encrypt" + "type": "whmcs" }, "Helper_email.php": { "path": "c0mp0n3nt/admin/helpers", diff --git a/admin/compiler/joomla_3/vdm.php b/admin/compiler/joomla_3/whmcs.php similarity index 97% rename from admin/compiler/joomla_3/vdm.php rename to admin/compiler/joomla_3/whmcs.php index 3c541e902..ca0e36ddd 100644 --- a/admin/compiler/joomla_3/vdm.php +++ b/admin/compiler/joomla_3/whmcs.php @@ -29,4 +29,4 @@ defined('_JEXEC') or die('Restricted access'); // No direct access to this file defined('_JEXEC') or die('Restricted access'); -###VDM_ENCRYPTION_BODY### +###WHMCS_ENCRYPTION_BODY### diff --git a/admin/config.xml b/admin/config.xml index 4a12248d7..0f2763316 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -47,78 +47,113 @@ /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - + + + + + + + + + + + + + +
input->getCmd('view', 'Componentbuilder'); + $view = $this->input->getCmd('view', 'componentbuilder'); $data = $this->getViewRelation($view); $layout = $this->input->get('layout', null, 'WORD'); $id = $this->input->getInt('id'); @@ -85,8 +102,10 @@ class ComponentbuilderController extends JControllerLegacy protected function getViewRelation($view) { + // check the we have a value if (ComponentbuilderHelper::checkString($view)) { + // the view relationships $views = array( 'joomla_component' => 'joomla_components', 'admin_view' => 'admin_views', @@ -120,13 +139,15 @@ class ComponentbuilderController extends JControllerLegacy 'library_files_folders_urls' => 'libraries_files_folders_urls' ); // check if this is a list view - if (in_array($view,$views)) + if (in_array($view, $views)) { + // this is a list view return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view); } // check if it is an edit view - elseif (array_key_exists($view,$views)) + elseif (array_key_exists($view, $views)) { + // this is a edit view return array('edit' => true, 'view' => $view, 'views' => $views[$view]); } } diff --git a/admin/helpers/compiler.php b/admin/helpers/compiler.php index 6254b8058..ba5b314ba 100644 --- a/admin/helpers/compiler.php +++ b/admin/helpers/compiler.php @@ -183,7 +183,9 @@ class Compiler extends Infusion // the correct string $externalCodeString = ($externalCount == 1) ? JText::_('code/string') : JText::_('code/strings'); // the notice + $this->app->enqueueMessage(JText::_('

External Code Notice

'), 'Notice'); $this->app->enqueueMessage(JText::sprintf('There has been %s - %s added to this component as EXTERNALCODE. To avoid shipping your component with malicious %s always make sure that the correct code/string values were used.', $externalCount, $externalCodeString, $externalCodeString), 'Notice'); + $this->app->enqueueMessage('
', 'Notice'); } // end the timer here $this->time_end = microtime(true); @@ -699,4 +701,5 @@ class Compiler extends Infusion // any help to improve this is welcome... } + } diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index 35de9b301..c234f44ae 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -11,7 +11,7 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version 2.6.0 + @version 2.6.x @created 30th April, 2015 @package Component Builder @subpackage compiler.php @@ -247,10 +247,10 @@ class Get * @var array */ public $langStringTargets = array( - 'Joomla'.'.JText._(', - 'JText:'.':script(', - 'JText:'.':_(', - 'JText:'.':sprintf(' + 'Joomla' . '.JText._(', + 'JText:' . ':script(', + 'JText:' . ':_(', + 'JText:' . ':sprintf(' ); /** @@ -428,6 +428,37 @@ class Get */ private $_fieldData = array(); + /** + * The field builder type + * + * 1 = StringManipulation + * 2 = SimpleXMLElement + * + * @var int + */ + public $fieldBuilderType; + + /** + * Set unique Names + * + * @var array + */ + public $uniqueNames = array(); + + /** + * Set unique Names + * + * @var array + */ + protected $uniqueFieldNames = array(); + + /** + * Category other name bucket + * + * @var array + */ + public $catOtherName = array(); + /** * The linked admin view tabs * @@ -471,11 +502,18 @@ class Get public $layoutData = array(); /** - * The Advanced Encryption Switch + * The Encryption Types + * + * @var array + */ + public $cryptionTypes = array('basic', 'medium', 'whmcs'); + + /** + * The WHMCS Encryption Switch * * @var boolean */ - public $advancedEncryption = false; + public $whmcsEncryption = false; /** * The Basic Encryption Switch @@ -484,6 +522,13 @@ class Get */ public $basicEncryption = false; + /** + * The Medium Encryption Switch + * + * @var boolean + */ + public $mediumEncryption = false; + /** * The Custom field Switch per view * @@ -575,6 +620,16 @@ class Get $this->tidy = extension_loaded('Tidy'); // Set the params $this->params = JComponentHelper::getParams('com_componentbuilder'); + // set the field type builder + $this->fieldBuilderType = $this->params->get('compiler_field_builder_type', 2); + // check the field builder type logic + if (!$this->tidy && $this->fieldBuilderType == 2) + { + // we do not have the tidy extention set fall back to StringManipulation + $this->fieldBuilderType = 1; + // load the sugestion to use string manipulation + $this->app->enqueueMessage(JText::_('Since you do not have Tidy extentsion setup on your system, we could not use the SimpleXMLElement class. We instead used string manipulation to build all your fields, this is a faster method, you must inspect the xml files in your component package to see if you are satisfied with the result.
You can make this method your default by opening the global options of JCB and under the Global tab set the Field Builder Type to string manipulation.
'), 'Notice'); + } // load the compiler path $this->compilerPath = $this->params->get('compiler_folder_path', JPATH_COMPONENT_ADMINISTRATOR . '/compiler'); // set the component ID @@ -777,22 +832,22 @@ class Get foreach ($addArrayF as $addTarget => $targetHere) { // set the add target data - $component->{'add'.$addTarget} = (isset($component->{'add'.$addTarget}) && ComponentbuilderHelper::checkJson($component->{'add'.$addTarget})) ? json_decode($component->{'add'.$addTarget}, true) : null; - if (ComponentbuilderHelper::checkArray($component->{'add'.$addTarget})) + $component->{'add' . $addTarget} = (isset($component->{'add' . $addTarget}) && ComponentbuilderHelper::checkJson($component->{'add' . $addTarget})) ? json_decode($component->{'add' . $addTarget}, true) : null; + if (ComponentbuilderHelper::checkArray($component->{'add' . $addTarget})) { if (isset($component->{$targetHere}) && ComponentbuilderHelper::checkArray($component->{$targetHere})) { - foreach($component->{'add'.$addTarget} as $taget) + foreach ($component->{'add' . $addTarget} as $taget) { $component->{$targetHere}[] = $taget; } } else { - $component->{$targetHere} = array_values($component->{'add'.$addTarget}); + $component->{$targetHere} = array_values($component->{'add' . $addTarget}); } } - unset($component->{'add'.$addTarget}); + unset($component->{'add' . $addTarget}); } // set the uikit switch @@ -938,13 +993,32 @@ class Get $component->addconfig = (isset($component->addconfig) && ComponentbuilderHelper::checkJson($component->addconfig)) ? json_decode($component->addconfig, true) : null; if (ComponentbuilderHelper::checkArray($component->addconfig)) { - $component->config = array_map(function($array) + $component->config = array_map(function($field) { - $array['alias'] = 0; - $array['title'] = 0; - $array['settings'] = $this->getFieldData($array['field']); - return $array; + // set hash + static $hash = 1; + // load hash + $field['hash'] = md5($field['field'] . $hash); + // increment hash + $hash++; + $field['alias'] = 0; + $field['title'] = 0; + // load the settings + $field['settings'] = $this->getFieldData($field['field']); + // set real field name + $field['base_name'] = $this->getFieldName($field); + // set unigue name keeper + $this->setUniqueNameCounter($this->getFieldName($field), 'configs'); + // return field + return $field; }, array_values($component->addconfig)); + + // do some house cleaning (for fields) + foreach ($component->config as $field) + { + // so first we lock the field name in + $this->getFieldName($field, 'configs'); + } // unset original value unset($component->addconfig); } @@ -1012,15 +1086,15 @@ class Get foreach ($addGlobalCss as $area) { // add_css if found - if (isset($component->{'add_css_'.$area}) && $component->{'add_css_'.$area} == 1 && isset($component->{'css_'.$area}) && ComponentbuilderHelper::checkString($component->{'css_'.$area})) + if (isset($component->{'add_css_' . $area}) && $component->{'add_css_' . $area} == 1 && isset($component->{'css_' . $area}) && ComponentbuilderHelper::checkString($component->{'css_' . $area})) { - $this->customScriptBuilder['component_css_'.$area] = base64_decode($component->{'css_'.$area}); + $this->customScriptBuilder['component_css_' . $area] = base64_decode($component->{'css_' . $area}); } else { - $this->customScriptBuilder['component_css_'.$area] = ''; + $this->customScriptBuilder['component_css_' . $area] = ''; } - unset($component->{'css_'.$area}); + unset($component->{'css_' . $area}); } // set the lang target $this->lang = 'admin'; @@ -1121,10 +1195,10 @@ class Get { $component->readme = ''; } + // set lang now $nowLang = $this->lang; $this->lang = 'admin'; - // dashboard methods $component->dashboard_tab = (isset($component->dashboard_tab) && ComponentbuilderHelper::checkJson($component->dashboard_tab)) ? json_decode($component->dashboard_tab, true) : null; if (ComponentbuilderHelper::checkArray($component->dashboard_tab)) @@ -1153,13 +1227,13 @@ class Get $this->lang = $nowLang; // add the update/sales server FTP details if that is the expected protocol - $serverArray = array('update_server','sales_server'); - foreach($serverArray as $server) + $serverArray = array('update_server', 'sales_server'); + foreach ($serverArray as $server) { - if ($component->{'add_'.$server} == 1 && is_numeric($component->{$server}) && $component->{$server} > 0) + if ($component->{'add_' . $server} == 1 && is_numeric($component->{$server}) && $component->{$server} > 0) { // get the server protocol - $component->{$server.'_protocol'} = ComponentbuilderHelper::getVar('server', (int) $component->{$server}, 'id', 'protocol'); + $component->{$server . '_protocol'} = ComponentbuilderHelper::getVar('server', (int) $component->{$server}, 'id', 'protocol'); } else { @@ -1167,9 +1241,9 @@ class Get // only change this for sales server (update server can be added loacaly to the zip file) if ('sales_server' === $server) { - $component->{'add_'.$server} = 0; + $component->{'add_' . $server} = 0; } - $component->{$server.'_protocol'} = 0; + $component->{$server . '_protocol'} = 0; } } // set the ignore folders for repo if found @@ -1343,11 +1417,24 @@ class Get if (ComponentbuilderHelper::checkArray($view->addfields)) { // load the field data - $view->fields = array_map(function($array) use($name_single, $name_list) + $view->fields = array_map(function($field) use($name_single, $name_list) { - $array['settings'] = $this->getFieldData($array['field'], $name_single, $name_list); - return $array; + // set hash + static $hash = 1; + // load hash + $field['hash'] = md5($field['field'] . $hash); + // increment hash + $hash++; + // set the settings + $field['settings'] = $this->getFieldData($field['field'], $name_single, $name_list); + // set real field name + $field['base_name'] = $this->getFieldName($field); + // set unigue name keeper + $this->setUniqueNameCounter($field['base_name'], $name_list); + // return field + return $field; }, array_values($view->addfields)); + // sort the fields acording to order usort($view->fields, function($a, $b) { @@ -1369,6 +1456,62 @@ class Get } return 0; }); + + // do some house cleaning (for fields) + foreach ($view->fields as $field) + { + // so first we lock the field name in + $field_name = $this->getFieldName($field, $name_list); + // check if the field changed since the last compilation + if (ComponentbuilderHelper::checkObject($field['settings']->history)) + { + // check if the datatype changed + if (isset($field['settings']->history->datatype)) + { + $this->setUpdateSQL($field['settings']->history->datatype, $field['settings']->datatype, 'field.datatype', $name_single . '.' . $field_name); + } + // check if the datatype lenght changed + if (isset($field['settings']->history->datalenght) && isset($field['settings']->history->datalenght_other)) + { + $this->setUpdateSQL($field['settings']->history->datalenght . $field['settings']->history->datalenght_other, $field['settings']->datalenght . $field['settings']->datalenght_other, 'field.lenght', $name_single . '.' . $field_name); + } + // check if the name changed + if (isset($field['settings']->history->xml) && ComponentbuilderHelper::checkJson($field['settings']->history->xml)) + { + // only run if this is not an alias or a tag + if ((!isset($field['alias']) || !$field['alias']) && 'tag' !== $field['settings']->type_name) + { + // build temp field bucket + $tmpfield = array(); + $tmpfield['settings'] = new stdClass(); + // convert the xml json string to normal string + $tmpfield['settings']->xml = $this->setDynamicValues(json_decode($field['settings']->history->xml)); + // add properties from current field as it is generic + $tmpfield['settings']->properties = $field['settings']->properties; + // add the old name + $tmpfield['settings']->name = $field['settings']->history->name; + // add the field type from current field since it is generic + $tmpfield['settings']->type_name = $field['settings']->type_name; + // get the old name + $old_field_name = $this->getFieldName($tmpfield); + + // only run this if not a multi field + if (!isset($this->uniqueNames[$name_list]['names'][$field_name])) + { + // this only works when the field is not multiple of the same field + $this->setUpdateSQL($old_field_name, $field_name, 'field.name', $name_single . '.' . $field_name); + } + elseif ($old_field_name !== $field_name) + { + // give a notice atleast that the multi fields could have changed and no DB update was done + $this->app->enqueueMessage(JText::sprintf('You have a field called %s that has been added multiple times to the %s view, the name of that field has changed to %s. Normaly we would automaticly add the update SQL to your component, but with multiple fields this does not work automaticly since it could be that noting changed and it just seems like it did. Therefore you will have to do this manualy if it actualy did change!', $field_name, $name_single, $old_field_name), 'Notice'); + } + // remove tmp + unset($tmpfield); + } + } + } + } } } unset($view->addfields); @@ -1404,16 +1547,10 @@ class Get $required = ($required == true) ? 'yes' : 'no'; $filter = ComponentbuilderHelper::getBetween($fieldValues['settings']->xml, 'filter="', '"'); $filter = ComponentbuilderHelper::checkString($filter) ? $filter : 'none'; - // get name - $name = ComponentbuilderHelper::getBetween($fieldValues['settings']->xml, 'name="', '"'); - $name = ComponentbuilderHelper::checkString($name) ? $name : $fieldValues['settings']->name; - // get type - $type = ComponentbuilderHelper::getBetween($fieldValues['settings']->xml, 'type="', '"'); - $type = ComponentbuilderHelper::checkString($type) ? $type : $fieldValues['settings']->type_name; // set the field name $conditionValue['target_field'][$fieldKey] = array( - 'name' => ComponentbuilderHelper::safeString($name), - 'type' => ComponentbuilderHelper::safeString($type), + 'name' => $this->getFieldName($fieldValues, $name_list), + 'type' => $this->getFieldType($fieldValues), 'required' => $required, 'filter' => $filter ); @@ -1430,15 +1567,11 @@ class Get { if ((int) $fieldValue['field'] == (int) $conditionValue['match_field']) { - // get name - $name = ComponentbuilderHelper::getBetween($fieldValue['settings']->xml, 'name="', '"'); - $name = ComponentbuilderHelper::checkString($name) ? $name : $fieldValue['settings']->name; - // get type - $type = ComponentbuilderHelper::getBetween($fieldValue['settings']->xml, 'type="', '"'); - $type = ComponentbuilderHelper::checkString($type) ? $type : $fieldValue['settings']->type_name; + // set the type + $type = $this->getFieldType($fieldValue); // set the field details - $conditionValue['match_name'] = ComponentbuilderHelper::safeString($name); - $conditionValue['match_type'] = ComponentbuilderHelper::safeString($type); + $conditionValue['match_name'] = $this->getFieldName($fieldValue, $name_list); + $conditionValue['match_type'] = $type; $conditionValue['match_xml'] = $fieldValue['settings']->xml; // if custom field load field being extended if (!ComponentbuilderHelper::typeField($type)) @@ -1486,7 +1619,7 @@ class Get } $this->customScriptBuilder[$scripter_target][$name_single] = ''; } - $this->customScriptBuilder[$scripter_target][$name_single] .= $view->$scripter; + $this->customScriptBuilder[$scripter_target][$name_single] .= PHP_EOL . $view->$scripter; if (strpos($view->$scripter, "token") !== false || strpos($view->$scripter, "task=ajax") !== false) { if (!$this->customScriptBuilder['token'][$name_single]) @@ -1507,7 +1640,7 @@ class Get { $this->customScriptBuilder[$scripter][$name_single] = ''; } - $this->customScriptBuilder[$scripter][$name_single] .= base64_decode($view->$scripter); + $this->customScriptBuilder[$scripter][$name_single] .= PHP_EOL . base64_decode($view->$scripter); unset($view->$scripter); } } @@ -1956,16 +2089,21 @@ class Get { $field->properties = array_values($field->properties); } - // check if we have advanced encryption - if (4 == $field->store && (!isset($this->advancedEncryption) || !$this->advancedEncryption)) + // check if we have WHMCS encryption + if (4 == $field->store && (!isset($this->whmcsEncryption) || !$this->whmcsEncryption)) { - $this->advancedEncryption = true; + $this->whmcsEncryption = true; } // check if we have basic encryption elseif (3 == $field->store && (!isset($this->basicEncryption) || !$this->basicEncryption)) { $this->basicEncryption = true; } + // check if we have better encryption + elseif (5 == $field->store && (!isset($this->mediumEncryption) || !$this->mediumEncryption)) + { + $this->mediumEncryption = true; + } // get the last used version $field->history = $this->getHistoryWatch('field', $id); @@ -2057,7 +2195,7 @@ class Get $this->_fieldData[$id]->javascript_views_footer = $this->setDynamicValues(base64_decode($this->_fieldData[$id]->javascript_views_footer)); $this->_fieldData[$id]->javascript_views_footer_decoded = true; } - $this->customScriptBuilder['views_footer'][$name_list] .= $this->_fieldData[$id]->javascript_views_footer; + $this->customScriptBuilder['views_footer'][$name_list] .= PHP_EOL . $this->_fieldData[$id]->javascript_views_footer; if (strpos($this->_fieldData[$id]->javascript_views_footer, "token") !== false || strpos($this->_fieldData[$id]->javascript_views_footer, "task=ajax") !== false) { @@ -2089,7 +2227,7 @@ class Get $this->setCustomCodeData($this->_fieldData[$id]->css_views); $this->_fieldData[$id]->css_views_decoded = true; } - $this->customScriptBuilder['css_views'][$name_list] .= $this->_fieldData[$id]->css_views; + $this->customScriptBuilder['css_views'][$name_list] .= PHP_EOL . $this->_fieldData[$id]->css_views; } // add this only once to view. @@ -2104,6 +2242,213 @@ class Get return false; } + /** + * Get the field's actual type + * + * @param object $field The field object + * + * @return string Success returns field type + * + */ + public function getFieldType(&$field) + { + // set the type name + $type_name = ComponentbuilderHelper::safeString($field['settings']->type_name); + // check that we have the poperties + if (ComponentbuilderHelper::checkArray($field['settings']->properties)) + { + foreach ($field['settings']->properties as $property) + { + if ($property['name'] === 'type') + { + if ($type_name === 'custom' || $type_name === 'customuser') + { + $type = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'type="', '"')); + } + // use field core type + elseif (ComponentbuilderHelper::checkString($type_name)) + { + $type = $type_name; + } + // make sure none adjustable fields are set (should be same as above) + elseif (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']) && $property['adjustable'] == 0) + { + $type = $property['example']; + } + // fall back on the xml settings (not ideal) + else + { + $type = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xml, 'type="', '"')); + } + + // check if the value is set + if (ComponentbuilderHelper::checkString($type)) + { + // add the value + return $type; + } + // exit foreach loop + break; + } + } + } + // fall back to text + return 'text'; + } + + /** + * Get the field's actual name + * + * @param object $field The field object + * @param string $listViewName The list view name + * + * @return string Success returns field name + * + */ + public function getFieldName(&$field, $listViewName = null) + { + // return the unique name if already set + if (ComponentbuilderHelper::checkString($listViewName) && isset($field['hash']) && isset($this->uniqueFieldNames[$listViewName . $field['hash']])) + { + return $this->uniqueFieldNames[$listViewName . $field['hash']]; + } + // set the type name + $type_name = ComponentbuilderHelper::safeString($field['settings']->type_name); + // set the name of the field + $name = ComponentbuilderHelper::safeString($field['settings']->name); + // check that we have the poperties + if (ComponentbuilderHelper::checkArray($field['settings']->properties)) + { + foreach ($field['settings']->properties as $property) + { + if ($property['name'] === 'name') + { + // if category then name must be catid (only one per view) + if ($type_name === 'category') + { + // quick check if this is a category linked to view page + $requeSt_id = ComponentbuilderHelper::getBetween($field['settings']->xml, 'name="', '"'); + if (strpos($requeSt_id, '_request_id') !== false || strpos($requeSt_id, '_request_catid') !== false) + { + // keep it then, don't change + $name = $requeSt_id; + } + else + { + $name = 'catid'; + } + // if list view name is set + if (ComponentbuilderHelper::checkString($listViewName)) + { + // check if we should use another Text Name as this views name + $otherName = ComponentbuilderHelper::getBetween($field['settings']->xml, 'othername="', '"'); + $otherViews = ComponentbuilderHelper::getBetween($field['settings']->xml, 'views="', '"'); + $otherView = ComponentbuilderHelper::getBetween($field['settings']->xml, 'view="', '"'); + if (ComponentbuilderHelper::checkString($otherName) && ComponentbuilderHelper::checkString($otherViews) && ComponentbuilderHelper::checkString($otherView)) + { + $this->catOtherName[$listViewName] = array( + 'name' => ComponentbuilderHelper::safeString($otherName), + 'views' => ComponentbuilderHelper::safeString($otherViews), + 'view' => ComponentbuilderHelper::safeString($otherView) + ); + } + } + } + // if tag is set then enable all tag options for this view (only one per view) + elseif ($type_name === 'tag') + { + $name = 'tags'; + } + // if the field is set as alias it must be called alias + elseif (isset($field['alias']) && $field['alias']) + { + $name = 'alias'; + } + else + { + // get value from xml + $xml = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'name="', '"')); + // check if a value was found + if (ComponentbuilderHelper::checkString($xml)) + { + $name = $xml; + } + } + // exit foreach loop + break; + } + } + } + // return the value unique + if (ComponentbuilderHelper::checkString($listViewName) && isset($field['hash'])) + { + $this->uniqueFieldNames[$listViewName . $field['hash']] = $this->uniqueName($name, $listViewName); + // now return the unique name + return $this->uniqueFieldNames[$listViewName . $field['hash']]; + } + // fall back to global + return $name; + } + + /** + * Count how many times the same field is used per view + * + * @param string $name The name of the field + * @param string $view The name of the view + * + * @return void + * + */ + protected function setUniqueNameCounter($name, $view) + { + if (!isset($this->uniqueNames[$view])) + { + $this->uniqueNames[$view] = array(); + $this->uniqueNames[$view]['counter'] = array(); + $this->uniqueNames[$view]['names'] = array(); + } + if (!isset($this->uniqueNames[$view]['counter'][$name])) + { + $this->uniqueNames[$view]['counter'][$name] = 1; + return; + } + // count how many times the field is used + $this->uniqueNames[$view]['counter'][$name] ++; + return; + } + + /** + * Naming each field with an unique name + * + * @param string $name The name of the field + * @param string $view The name of the view + * + * @return string the name + * + */ + protected function uniqueName($name, $view) + { + // only increment if the field name is used multiple times + if (isset($this->uniqueNames[$view]['counter'][$name]) && $this->uniqueNames[$view]['counter'][$name] > 1) + { + $counter = 1; + // set the unique name + $uniqueName = ComponentbuilderHelper::safeString($name . '_' . $counter); + while (isset($this->uniqueNames[$view]['names'][$uniqueName])) + { + // increment the number + $counter++; + // try again + $uniqueName = ComponentbuilderHelper::safeString($name . '_' . $counter); + } + // set the new name number + $this->uniqueNames[$view]['names'][$uniqueName] = $counter; + // return the unique name + return $uniqueName; + } + return $name; + } + /** * Set get Data * @@ -2139,55 +2484,38 @@ class Get { $result->php_calculation = $this->setDynamicValues(base64_decode($result->php_calculation)); } - // add php custom scripting (php_before_getitem) - if ($result->add_php_before_getitem == 1 && ComponentbuilderHelper::checkString($result->php_before_getitem)) + // The array of the php scripts that should be added to the script builder + $phpSripts = array('php_before_getitem', 'php_after_getitem', 'php_before_getitems', 'php_after_getitems', 'php_getlistquery'); + // load the php scripts + foreach ($phpSripts as $script) { - if (!isset($this->customScriptBuilder[$this->target . '_php_before_getitem'][$view_code])) + // add php script to the script builder + if (isset($result->{'add_' . $script}) && $result->{'add_' . $script} == 1 && isset($result->{$script}) && ComponentbuilderHelper::checkString($result->{$script})) { - $this->customScriptBuilder[$this->target . '_php_before_getitem'][$view_code] = ''; + // move all main gets out to the customscript builder + if ($result->gettype <= 2) + { + if (!isset($this->customScriptBuilder[$this->target . '_' . $script][$view_code])) + { + $this->customScriptBuilder[$this->target . '_' . $script][$view_code] = ''; + } + $this->customScriptBuilder[$this->target . '_' . $script][$view_code] .= $this->setDynamicValues(PHP_EOL . PHP_EOL . base64_decode($result->{$script})); + // remove from local item + unset($result->{$script}); + unset($result->{'add_' . $script}); + } + else + { + // only for custom gets + $result->{$script} = $this->setDynamicValues(PHP_EOL . base64_decode($result->{$script})); + } } - $this->customScriptBuilder[$this->target . '_php_before_getitem'][$view_code] .= $this->setDynamicValues(PHP_EOL . PHP_EOL . base64_decode($result->php_before_getitem)); - unset($result->php_before_getitem); - } - // add php custom scripting (php_after_getitem) - if ($result->add_php_after_getitem == 1 && ComponentbuilderHelper::checkString($result->php_after_getitem)) - { - if (!isset($this->customScriptBuilder[$this->target . '_php_after_getitem'][$view_code])) + else { - $this->customScriptBuilder[$this->target . '_php_after_getitem'][$view_code] = ''; + // remove from local item + unset($result->{$script}); + unset($result->{'add_' . $script}); } - $this->customScriptBuilder[$this->target . '_php_after_getitem'][$view_code] .= $this->setDynamicValues(PHP_EOL . PHP_EOL . base64_decode($result->php_after_getitem)); - unset($result->php_after_getitem); - } - // add php custom scripting (php_before_getitems) - if ($result->add_php_before_getitems == 1 && ComponentbuilderHelper::checkString($result->php_before_getitems)) - { - if (!isset($this->customScriptBuilder[$this->target . '_php_before_getitems'][$view_code])) - { - $this->customScriptBuilder[$this->target . '_php_before_getitems'][$view_code] = ''; - } - $this->customScriptBuilder[$this->target . '_php_before_getitems'][$view_code] .= $this->setDynamicValues(PHP_EOL . PHP_EOL . base64_decode($result->php_before_getitems)); - unset($result->php_before_getitems); - } - // add php custom scripting (php_after_getitems) - if ($result->add_php_after_getitems == 1 && ComponentbuilderHelper::checkString($result->php_after_getitems)) - { - if (!isset($this->customScriptBuilder[$this->target . '_php_after_getitems'][$view_code])) - { - $this->customScriptBuilder[$this->target . '_php_after_getitems'][$view_code] = ''; - } - $this->customScriptBuilder[$this->target . '_php_after_getitems'][$view_code] .= $this->setDynamicValues(PHP_EOL . PHP_EOL . base64_decode($result->php_after_getitems)); - unset($result->php_after_getitems); - } - // add php custom scripting (php_getlistquery) - if ($result->add_php_getlistquery == 1 && ComponentbuilderHelper::checkString($result->php_getlistquery)) - { - if (!isset($this->customScriptBuilder[$this->target . '_php_getlistquery'][$view_code])) - { - $this->customScriptBuilder[$this->target . '_php_getlistquery'][$view_code] = ''; - } - $this->customScriptBuilder[$this->target . '_php_getlistquery'][$view_code] .= $this->setDynamicValues(PHP_EOL . base64_decode($result->php_getlistquery)); - unset($result->php_getlistquery); } // set the getmethod code name $result->key = ComponentbuilderHelper::safeString($view_code . ' ' . $result->name . ' ' . $result->id); @@ -3091,22 +3419,22 @@ class Get foreach ($addArray as $addTarget => $targetHere) { // set the add target data - $library->{'add'.$addTarget} = (isset($library->{'add'.$addTarget}) && ComponentbuilderHelper::checkJson($library->{'add'.$addTarget})) ? json_decode($library->{'add'.$addTarget}, true) : null; - if (ComponentbuilderHelper::checkArray($library->{'add'.$addTarget})) + $library->{'add' . $addTarget} = (isset($library->{'add' . $addTarget}) && ComponentbuilderHelper::checkJson($library->{'add' . $addTarget})) ? json_decode($library->{'add' . $addTarget}, true) : null; + if (ComponentbuilderHelper::checkArray($library->{'add' . $addTarget})) { if (isset($library->{$targetHere}) && ComponentbuilderHelper::checkArray($library->{$targetHere})) { - foreach($library->{'add'.$addTarget} as $taget) + foreach ($library->{'add' . $addTarget} as $taget) { $library->{$targetHere}[] = $taget; } } else { - $library->{$targetHere} = array_values($library->{'add'.$addTarget}); + $library->{$targetHere} = array_values($library->{'add' . $addTarget}); } } - unset($library->{'add'.$addTarget}); + unset($library->{'add' . $addTarget}); } // add config fields only if needed if ($library->how > 1) @@ -3188,10 +3516,10 @@ class Get // insure string is not broken $content = str_replace('COM_###COMPONENT###', $this->langPrefix, $content); // first get the Joomla.JText._() - if (in_array('Joomla'.'.JText._(', $langStringTargets)) + if (in_array('Joomla' . '.JText._(', $langStringTargets)) { - $jsTEXT[] = ComponentbuilderHelper::getAllBetween($content, "Joomla".".JText._('", "'"); - $jsTEXT[] = ComponentbuilderHelper::getAllBetween($content, 'Joomla.'.'JText._("', '"'); + $jsTEXT[] = ComponentbuilderHelper::getAllBetween($content, "Joomla" . ".JText._('", "'"); + $jsTEXT[] = ComponentbuilderHelper::getAllBetween($content, 'Joomla.' . 'JText._("', '"'); // combine into one array $jsTEXT = ComponentbuilderHelper::mergeArrays($jsTEXT); // we need to add a check to insure these JavaScript lang matchup @@ -3203,10 +3531,10 @@ class Get } } // now get the JText: :script() - if (in_array('JText:'.':script(', $langStringTargets)) + if (in_array('JText:' . ':script(', $langStringTargets)) { - $scTEXT[] = ComponentbuilderHelper::getAllBetween($content, "JText:".":script('", "'"); - $scTEXT[] = ComponentbuilderHelper::getAllBetween($content, 'JText:'.':script("', '"'); + $scTEXT[] = ComponentbuilderHelper::getAllBetween($content, "JText:" . ":script('", "'"); + $scTEXT[] = ComponentbuilderHelper::getAllBetween($content, 'JText:' . ':script("', '"'); // combine into one array $scTEXT = ComponentbuilderHelper::mergeArrays($scTEXT); // we need to add a check to insure these JavaScript lang matchup @@ -3221,7 +3549,7 @@ class Get foreach ($langStringTargets as $langStringTarget) { // need some special treatment here - if ($langStringTarget === 'Joomla'.'.JText._(' || $langStringTarget === 'JText:'.':script(') + if ($langStringTarget === 'Joomla' . '.JText._(' || $langStringTarget === 'JText:' . ':script(') { continue; } @@ -3679,7 +4007,7 @@ class Get } return $string; } - + /** * Set the external code string & load it in to string * @@ -3691,29 +4019,43 @@ class Get public function setExternalCodeString($string) { // check if content has custom code place holder - if (strpos($string, '[EXTERNA'.'LCODE=') !== false) + if (strpos($string, '[EXTERNA' . 'LCODE=') !== false) { // target content $bucket = array(); - $found = ComponentbuilderHelper::getAllBetween($string, '[EXTERNA'.'LCODE=', ']'); + $found = ComponentbuilderHelper::getAllBetween($string, '[EXTERNA' . 'LCODE=', ']'); if (ComponentbuilderHelper::checkArray($found)) { // build local bucket foreach ($found as $target) { - // check if the target is valid URL or path - if ((!filter_var($target, FILTER_VALIDATE_URL) === false && ComponentbuilderHelper::urlExists($target)) - || (JPath::clean($target) === $target && JFile::exists($target))) + // check if user has permission to use EXTERNAL code (we may add a custom access switch - use ADMIN for now) + if ($this->user->authorise('core.admin', 'com_componentbuilder')) { - $this->getExternalCodeString($target, $bucket); + // check if the target is valid URL or path + if ((!filter_var($target, FILTER_VALIDATE_URL) === false && ComponentbuilderHelper::urlExists($target)) || (JPath::clean($target) === $target && JFile::exists($target))) + { + $this->getExternalCodeString($target, $bucket); + } + // give notice that target is not a valid url/path + else + { + // set key + $key = '[EXTERNA' . 'LCODE=' . $target . ']'; + // set the notice + $this->app->enqueueMessage(JText::_('

External Code Warning

'), 'Warning'); + $this->app->enqueueMessage(JText::sprintf('The %s is not a valid url/path!', $key), 'Warning'); + $this->app->enqueueMessage('
', 'Warning'); + // remove the placeholder + $bucket[$key] = ''; + } } - // give notice that target is not a valid url/path else { // set key - $key = '[EXTERNA'.'LCODE='.$target.']'; + $key = '[EXTERNA' . 'LCODE=' . $target . ']'; // set the notice - $this->app->enqueueMessage(JText::sprintf('The %s is not a valid url/path!', $key), 'Warning'); + $this->app->enqueueMessage(JText::sprintf('%s, you do not have permission to use EXTERNALCODE feature (so it was removed from the compilation), please contact you system administrator for more info!
(admin access required)', $this->user->get('name')), 'Error'); // remove the placeholder $bucket[$key] = ''; } @@ -3727,7 +4069,7 @@ class Get } return $string; } - + /** * Get the External Code/String * @@ -3740,7 +4082,7 @@ class Get protected function getExternalCodeString($target, &$bucket) { // set key - $key = '[EXTERNA'.'LCODE=' . $target . ']'; + $key = '[EXTERNA' . 'LCODE=' . $target . ']'; // set URL key $targetKey = trim($target); // check if we already fetched this @@ -3765,7 +4107,9 @@ class Get // update local hash $this->db->updateObject('#__componentbuilder_external_code', $object, 'target'); // give notice of the change + $this->app->enqueueMessage(JText::_('

External Code Warning

'), 'Warning'); $this->app->enqueueMessage(JText::sprintf('The code/string from %s has been changed since the last compilation, please investigate to insure the changes are safe!', $key), 'Warning'); + $this->app->enqueueMessage('
', 'Warning'); } } else @@ -3777,13 +4121,17 @@ class Get // insert local hash $this->db->insertObject('#__componentbuilder_external_code', $object); // give notice the first time this is added + $this->app->enqueueMessage(JText::_('

External Code Notice

'), 'Notice'); $this->app->enqueueMessage(JText::sprintf('The code/string from %s has been added for the first time, please investigate to insure the correct code/string was used!', $key), 'Notice'); + $this->app->enqueueMessage('
', 'Notice'); } } else { // set notice that we could not get a valid string from the target + $this->app->enqueueMessage(JText::_('

External Code Warning

'), 'Warning'); $this->app->enqueueMessage(JText::sprintf('The %s returned an invalid string!', $key), 'Warning'); + $this->app->enqueueMessage('
', 'Warning'); } } // add to local bucket @@ -3792,7 +4140,7 @@ class Get $bucket[$key] = $this->externalCodeString[$targetKey]; } } - + /** * We start set the custom code data & can load it in to string * @@ -4151,12 +4499,12 @@ class Get // add the new lang placeholder to the db $this->newLangStrings[$counterInsert] = array(); $this->newLangStrings[$counterInsert][] = $this->db->quote(json_encode(array($this->componentID))); // 'components' - $this->newLangStrings[$counterInsert][] = $this->db->quote($string); // 'entranslation' - $this->newLangStrings[$counterInsert][] = $this->db->quote(1); // 'published' - $this->newLangStrings[$counterInsert][] = $this->db->quote($today); // 'created' + $this->newLangStrings[$counterInsert][] = $this->db->quote($string); // 'entranslation' + $this->newLangStrings[$counterInsert][] = $this->db->quote(1); // 'published' + $this->newLangStrings[$counterInsert][] = $this->db->quote($today); // 'created' $this->newLangStrings[$counterInsert][] = $this->db->quote((int) $this->user->id); // 'created_by' - $this->newLangStrings[$counterInsert][] = $this->db->quote(1); // 'version' - $this->newLangStrings[$counterInsert][] = $this->db->quote(1); // 'access' + $this->newLangStrings[$counterInsert][] = $this->db->quote(1); // 'version' + $this->newLangStrings[$counterInsert][] = $this->db->quote(1); // 'access' $counterInsert++; @@ -4690,7 +5038,7 @@ class Get if ($_type == 2) { // load the last value - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(0); // 'hashendtarget' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(0); // 'hashendtarget' } } // the record already exist so we must update instead @@ -4805,14 +5153,14 @@ class Get $this->newCustomCode[$pointer[$targetKey]] = array(); $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote($path); // 'path' $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote((int) $_type); // 'type' - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(1); // 'target' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(1); // 'target' $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote($commentType); // 'comment_type' $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote((int) $this->componentID); // 'component' - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(1); // 'published' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(1); // 'published' $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote($today); // 'created' $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote((int) $this->user->id); // 'created_by' - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(1); // 'version' - $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(1); // 'access' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(1); // 'version' + $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote(1); // 'access' $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote($hashtarget); // 'hashtarget' $this->newCustomCode[$pointer[$targetKey]][] = $this->db->quote((int) $lineNumber); // 'fromline' } @@ -5079,6 +5427,13 @@ class Get */ public function setPlaceholders(&$data, &$placeholder, $action = 1) { + // make sure the placeholders is an array + if (!ComponentbuilderHelper::checkArray($placeholder)) + { + // This is an error, (TODO) actualy we need to add a kind of log here to know that this happened + return $data; + } + // continue with the work of replacement if (1 == $action) // <-- just replace (default) { return str_replace(array_keys($placeholder), array_values($placeholder), $data); diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php index 690f5ea7e..0f68c5299 100644 --- a/admin/helpers/compiler/b_Structure.php +++ b/admin/helpers/compiler/b_Structure.php @@ -306,6 +306,13 @@ class Structure extends Get */ public $addCheckin = false; + /** + * The Move Folders Switch + * + * @var boolean + */ + public $setMoveFolders = false; + /** * The array of last modified dates * @@ -313,6 +320,13 @@ class Structure extends Get */ protected $lastModifiedDate = array(); + /** + * The default view switch + * + * @var bool/string + */ + public $dynamicDashboard = false; + /** * Constructor */ @@ -342,6 +356,8 @@ class Structure extends Get $this->setLibaries(); // set the Joomla Version Data $this->joomlaVersionData = $this->setJoomlaVersionData(); + // set the dashboard + $this->setDynamicDashboard(); // set the new folders if (!$this->setFolders()) { @@ -517,6 +533,84 @@ class Structure extends Get } } + /** + * set the dynamic dashboard if set + * + * @return void + * + */ + private function setDynamicDashboard() + { + // only add the dynamic dashboard if all checks out + if (isset($this->componentData->dashboard_type) && 2 == $this->componentData->dashboard_type && isset($this->componentData->dashboard) && ComponentbuilderHelper::checkString($this->componentData->dashboard) && strpos($this->componentData->dashboard, '_') !== false) + { + // set the default view + $getter = explode('_', $this->componentData->dashboard); + if (count($getter) == 2 && is_numeric($getter[1])) + { + // the pointers + $t = ComponentbuilderHelper::safeString($getter[0], 'U'); + $id = (int) $getter[1]; + // the dynamic stuff + $targets = array('A' => 'admin_views', 'C' => 'custom_admin_views'); + $names = array('A' => 'admin view', 'C' => 'custom admin view'); + $types = array('A' => 'adminview', 'C' => 'customadminview'); + $keys = array('A' => 'name_list', 'C' => 'code'); + // check the target values + if (isset($targets[$t]) && $id > 0) + { + // set the type name + $type_names = ComponentbuilderHelper::safeString($targets[$t], 'w'); + // set the dynamic dash + if (isset($this->componentData->{$targets[$t]}) && ComponentbuilderHelper::checkArray($this->componentData->{$targets[$t]})) + { + // search the target views + $dashboard = (array) array_filter($this->componentData->{$targets[$t]}, function($view) use($id, $t, $types) + { + if (isset($view[$types[$t]]) && $id == $view[$types[$t]]) + { + return true; + } + return false; + }); + // check if view was found (this should be true) + if (count($dashboard) && isset($dashboard[0]['settings']) && isset($dashboard[0]['settings']->{$keys[$t]})) + { + $this->dynamicDashboard = ComponentbuilderHelper::safeString($dashboard[0]['settings']->{$keys[$t]}); + } + else + { + // set massage that something is wrong + $this->app->enqueueMessage(JText::sprintf('The %s (%s) is not available in your component! Please insure to only used %s, for a dynamic dashboard, that are still linked to your component.', $names[$t], $this->componentData->dashboard, $type_names), 'Error'); + } + } + else + { + // set massage that something is wrong + $this->app->enqueueMessage(JText::sprintf('The %s (%s) is not available in your component! Please insure to only used %s, for a dynamic dashboard, that are still linked to your component.', $names[$t], $this->componentData->dashboard, $type_names), 'Error'); + } + } + else + { + // the target value is wrong + $this->app->enqueueMessage(JText::sprintf('The %s value for the dynamic dashboard is invalid.', $this->componentData->dashboard), 'Error'); + } + } + else + { + // the target value is wrong + $this->app->enqueueMessage(JText::sprintf('The %s value for the dynamic dashboard is invalid.', $this->componentData->dashboard), 'Error'); + } + // if default was changed to dynamic dashboard the remove default tab and methods + if (ComponentbuilderHelper::checkString($this->dynamicDashboard)) + { + // dynamic dashboard is used + $this->componentData->dashboard_tab = ''; + $this->componentData->php_dashboard_methods = ''; + } + } + } + /** * Write data to file * @@ -682,6 +776,8 @@ class Structure extends Get { $README = true; } + // set the standard folders + $stdFolders = array('site', 'admin', 'media'); // start moving foreach ($this->joomlaVersionData->move->static as $ftem => $details) { @@ -717,41 +813,59 @@ class Structure extends Get $zipPath = str_replace('c0mp0n3nt/', '', $details->path); $path = str_replace('c0mp0n3nt/', $this->componentPath . '/', $details->path); // set the template folder path - $templatePath = (isset($details->custom) && $details->custom) ? (($details->custom !== 'full') ? $this->templatePathCustom.'/':'') : $this->templatePath.'/'; - // now mov the file + $templatePath = (isset($details->custom) && $details->custom) ? (($details->custom !== 'full') ? $this->templatePathCustom . '/' : '') : $this->templatePath . '/'; + // set the final paths + $currentFullPath = str_replace('//', '/', $templatePath . '/' . $item); + $packageFullPath = str_replace('//', '/', $path . '/' . $new); + $zipFullPath = str_replace('//', '/', $zipPath . '/' . $new); + // now move the file if ($details->type === 'file') { - if (!JFile::exists($templatePath . $item)) + if (!JFile::exists($currentFullPath)) { - $this->app->enqueueMessage(JText::sprintf('The file path: %s does not exist, and was not added!', $templatePath . $item), 'Error'); + $this->app->enqueueMessage(JText::sprintf('The file path: %s does not exist, and was not added!', $currentFullPath), 'Error'); } else { // move the file to its place - JFile::copy($templatePath . $item, $path . '/' . $new); + JFile::copy($currentFullPath, $packageFullPath); // count the file created $this->fileCount++; // store the new files if (!in_array($ftem, $this->notNew)) { - $this->newFiles['static'][] = array('path' => $path . '/' . $new, 'name' => $new, 'zip' => $zipPath . '/' . $new); + $this->newFiles['static'][] = array('path' => $packageFullPath, 'name' => $new, 'zip' => $zipFullPath); } } } elseif ($details->type === 'folder') { - if (!JFolder::exists($templatePath . $item)) + if (!JFolder::exists($currentFullPath)) { - $this->app->enqueueMessage(JText::sprintf('The folder path: %s does not exist, and was not added!', $templatePath . $item), 'Error'); + $this->app->enqueueMessage(JText::sprintf('The folder path: %s does not exist, and was not added!', $currentFullPath), 'Error'); } else { // move the folder to its place - JFolder::copy($templatePath . $item, $path . '/' . $new); + JFolder::copy($currentFullPath, $packageFullPath); // count the folder created $this->folderCount++; } } + // check if we should add the dynamic folder moving script to the installer script + if (!$this->setMoveFolders) + { + $checker = explode('/', $zipFullPath); + // TODO <-- this may not be the best way, will keep an eye on this. + // We basicly only want to check if a folder is added that is not in the stdFolders array + if (isset($checker[0]) && ComponentbuilderHelper::checkString($checker[0]) && !in_array($checker[0], $stdFolders)) + { + // add the setDynamicF0ld3rs() method to the install scipt.php file + $this->setMoveFolders = true; + // set message that this was done (will still add a tutorial link later) + $this->app->enqueueMessage(JText::sprintf('

Dynamic folder/s were detected.
A method (setDynamicF0ld3rs) was added to the install script.php of this package to insure that the folder/s are copied into the correct place when this componet is installed!

'), 'Notice'); + } + } } return true; } @@ -770,9 +884,12 @@ class Structure extends Get $front = false; if ((isset($this->joomlaVersionData->move->dynamic) && ComponentbuilderHelper::checkObject($this->joomlaVersionData->move->dynamic)) && (isset($this->componentData->admin_views) && ComponentbuilderHelper::checkArray($this->componentData->admin_views))) { - // setup dashboard - $target = array('admin' => $this->componentData->name_code); - $this->buildDynamique($target, 'dashboard'); + if (!ComponentbuilderHelper::checkString($this->dynamicDashboard)) + { + // setup dashboard + $target = array('admin' => $this->componentData->name_code); + $this->buildDynamique($target, 'dashboard'); + } // now the rest of the views foreach ($this->componentData->admin_views as $nr => $view) { @@ -1125,9 +1242,11 @@ class Structure extends Get $custom['path'] = trim($custom['path'], '/'); } // set full path if this is a full path folder - if(!isset($custom['folder']) && isset($custom['folderpath'])) + if (!isset($custom['folder']) && isset($custom['folderpath'])) { - $custom['folder'] = '/'.trim($custom['folderpath'], '/'); + $custom['folder'] = '/' . trim($custom['folderpath'], '/'); + // update the dynamic path + $custom['folder'] = $this->updateDynamicPath($custom['folder']); // remove the file path unset($custom['folderpath']); // triget fullpath @@ -1234,9 +1353,11 @@ class Structure extends Get { $customPath = 'custom'; // set full path if this is a full path file - if(!isset($custom['file']) && isset($custom['filepath'])) + if (!isset($custom['file']) && isset($custom['filepath'])) { - $custom['file'] = '/'.trim($custom['filepath'], '/'); + $custom['file'] = '/' . trim($custom['filepath'], '/'); + // update the dynamic path + $custom['file'] = $this->updateDynamicPath($custom['file']); // remove the file path unset($custom['filepath']); // triget fullpath @@ -1312,6 +1433,19 @@ class Structure extends Get } } + /** + * Update paths with real value + * + * @param string $path The full path + * + * @return string The updated path + * + */ + protected function updateDynamicPath($path) + { + return $this->setPlaceholders($path, ComponentbuilderHelper::$constantPaths); + } + /** * Remove folders with files * @@ -1325,4 +1459,5 @@ class Structure extends Get { return ComponentbuilderHelper::removeFolder($dir, $ignore); } + } diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index 72e7e09b2..ba18df700 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -75,13 +75,6 @@ class Fields extends Structure */ public $siteFieldData = array(); - /** - * Category other name bucket - * - * @var array - */ - public $catOtherName = array(); - /** * list of fields that are not being escaped * @@ -272,11 +265,18 @@ class Fields extends Structure public $basicEncryptionBuilder = array(); /** - * Advnaced Encryption Builder + * WHMCS Encryption Builder * * @var array */ - public $advancedEncryptionBuilder = array(); + public $whmcsEncryptionBuilder = array(); + + /** + * Medium Encryption Builder + * + * @var array + */ + public $mediumEncryptionBuilder = array(); /** * Get Items Method List String Fix Builder @@ -334,13 +334,6 @@ class Fields extends Structure */ public $fieldsNames = array(); - /** - * Set unique Names - * - * @var array - */ - public $uniqueNames = array(); - /** * Default Fields * @@ -382,15 +375,15 @@ class Fields extends Structure /** * set the Field set of a view * - * @param array $view The view data - * @param string $component The component name - * @param string $viewName The single view name - * @param string $listViewName The list view name + * @param array $view The view data + * @param string $component The component name + * @param string $view_name_single The single view name + * @param string $view_name_list The list view name * * @return string The fields set in xml * */ - public function setFieldSet($view, $component, $viewName, $listViewName) + public function setFieldSet($view, $component, $view_name_single, $view_name_list) { // setup the fieldset of this view if (isset($view['settings']->fields) && ComponentbuilderHelper::checkArray($view['settings']->fields)) @@ -398,19 +391,12 @@ class Fields extends Structure // add metadata to the view if (isset($view['metadata']) && $view['metadata']) { - $this->metadataBuilder[$viewName] = $viewName; + $this->metadataBuilder[$view_name_single] = $view_name_single; } // add access to the view if (isset($view['access']) && $view['access']) { - $this->accessBuilder[$viewName] = $viewName; - } - // set the read only - $readOnlyXML = array(); - if ($view['settings']->type == 2) - { - $readOnlyXML['readonly'] = true; - $readOnlyXML['disabled'] = true; + $this->accessBuilder[$view_name_single] = $view_name_single; } // main lang prefix $langView = $this->langPrefix . '_' . $this->placeholders['###VIEW###']; @@ -418,8 +404,6 @@ class Fields extends Structure // set default lang $this->langContent[$this->lang][$langView] = $view['settings']->name_single; $this->langContent[$this->lang][$langViews] = $view['settings']->name_list; - // set the single name - $viewSingleName = ComponentbuilderHelper::safeString($view['settings']->name_single, 'W'); // set global item strings $this->langContent[$this->lang][$langViews . '_N_ITEMS_ARCHIVED'] = "%s " . $view['settings']->name_list . " archived."; $this->langContent[$this->lang][$langViews . '_N_ITEMS_ARCHIVED_1'] = "%s " . $view['settings']->name_single . " archived."; @@ -454,304 +438,598 @@ class Fields extends Structure $this->langContent[$this->lang][$langView . '_VERSION_LABEL'] = "Revision"; $this->langContent[$this->lang][$langView . '_VERSION_DESC'] = "A count of the number of times this " . $view['settings']->name_single . " has been revised."; $this->langContent[$this->lang][$langView . '_SAVE_WARNING'] = "Alias already existed so a number was added at the end. You can re-edit the " . $view['settings']->name_single . " to customise the alias."; - - // check if the same field is added multiple times - foreach ($view['settings']->fields as $field) + // check what type of field builder to use + if ($this->fieldBuilderType == 1) { - $name = ComponentbuilderHelper::safeString($field['settings']->name); - $this->setUniqueNameKeeper($field, $view['settings']->type, $name, $viewName); + // build field set using string manipulation + return $this->stringFieldSet($view, $component, $view_name_single, $view_name_list, $langView, $langViews); } - // start adding dynamc fields - $dynamicFieldsXML = array(); - $spacerCounter = 'a'; - // set the custom table key - $dbkey = 'g'; - // TODO we should add the global and local view switch if field for front end - foreach ($view['settings']->fields as $field) + else { - $dynamicFieldsXML[] = $this->setDynamicField($field, $view, $view['settings']->type, $langView, $viewName, $listViewName, $spacerCounter, $this->placeholders, $dbkey, true); + // build field set with simpleXMLElement class + return $this->simpleXMLFieldSet($view, $component, $view_name_single, $view_name_list, $langView, $langViews); } - // set the default fields - $XML = new simpleXMLElement(''); - $fieldSetXML = $XML->addChild('fieldset'); - $fieldSetXML->addAttribute('name', 'details'); - $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Default Fields."); - $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Id Field. Type: Text (joomla)"); - // if id is not set - if (!isset($this->fieldsNames[$viewName]['id'])) - { - $attributes = array( - 'name' => 'id', - 'type' => 'text', - 'class' => 'readonly', - 'label' => 'JGLOBAL_FIELD_ID_LABEL', - 'description' => 'JGLOBAL_FIELD_ID_DESC', - 'size' => 10, - 'default' => 0 - ); - $fieldXML = $fieldSetXML->addChild('field'); - $this->xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - } - // if created is not set - if (!isset($this->fieldsNames[$viewName]['created'])) - { - $attributes = array( - 'name' => 'created', - 'type' => 'calendar', - 'label' => $langView . '_CREATED_DATE_LABEL', - 'description' => $langView . '_CREATED_DATE_DESC', - 'size' => 22, - 'format' => '%Y-%m-%d %H:%M:%S', - 'filter' => 'user_utc' - ); - $attributes = array_merge($attributes, $readOnlyXML); - $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Created Field. Type: Calendar (joomla)"); - $fieldXML = $fieldSetXML->addChild('field'); - $this->xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - } - // if created_by is not set - if (!isset($this->fieldsNames[$viewName]['created_by'])) - { - $attributes = array( - 'name' => 'created_by', - 'type' => 'user', - 'label' => $langView . '_CREATED_BY_LABEL', - 'description' => $langView . '_CREATED_BY_DESC', - ); - $attributes = array_merge($attributes, $readOnlyXML); - $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Created Field. Type: User (joomla)"); - $fieldXML = $fieldSetXML->addChild('field'); - $this->xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - } - // if published is not set - if (!isset($this->fieldsNames[$viewName]['published'])) - { - $attributes = array( - 'name' => 'published', - 'type' => 'list', - 'label' => 'JSTATUS' - ); - $attributes = array_merge($attributes, $readOnlyXML); - $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Published Field. Type: List (joomla)"); - $fieldXML = $fieldSetXML->addChild('field'); - $this->xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - foreach (array('JPUBLISHED' => 1, 'JUNPUBLISHED' => 0, 'JARCHIVED' => 2, 'JTRASHED' => -2) as $text => $value) - { - $optionXML = $fieldXML->addChild('option'); - $optionXML->addAttribute('value', $value); - $optionXML[] = $text; - } - } - // if modified is not set - if (!isset($this->fieldsNames[$viewName]['modified'])) - { - $attributes = array( - 'name' => 'modified', - 'type' => 'calendar', - 'class' => 'readonly', - 'label' => $langView . '_MODIFIED_DATE_LABEL', - 'description' => $langView . '_MODIFIED_DATE_DESC', - 'size' => 22, - 'readonly' => "true", - 'format' => '%Y-%m-%d %H:%M:%S', - 'filter' => 'user_utc' - ); - $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Modified Field. Type: Calendar (joomla)"); - $fieldXML = $fieldSetXML->addChild('field'); - $this->xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - } - // if modified_by is not set - if (!isset($this->fieldsNames[$viewName]['modified_by'])) - { - $attributes = array( - 'name' => 'modified_by', - 'type' => 'user', - 'label' => $langView . '_MODIFIED_BY_LABEL', - 'description' => $langView . '_MODIFIED_BY_DESC', - 'class' => 'readonly', - 'readonly' => 'true', - 'filter' => 'unset' - ); - $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Modified Field. Type: User (joomla)"); - $fieldXML = $fieldSetXML->addChild('field'); - $this->xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - } - // check if view has access - if (isset($this->accessBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName]) && !isset($this->fieldsNames[$viewName]['access'])) - { - $attributes = array( - 'name' => 'access', - 'type' => 'accesslevel', - 'label' => 'JFIELD_ACCESS_LABEL', - 'description' => 'JFIELD_ACCESS_DESC', - 'default' => 1, - 'required' => "false" - ); - $attributes = array_merge($attributes, $readOnlyXML); - $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Access Field. Type: Accesslevel (joomla)"); - $fieldXML = $fieldSetXML->addChild('field'); - $this->xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - } - // if ordering is not set - if (!isset($this->fieldsNames[$viewName]['ordering'])) - { - $attributes = array( - 'name' => 'ordering', - 'type' => 'number', - 'class' => 'inputbox validate-ordering', - 'label' => $langView . '_ORDERING_LABEL', - 'description' => '', - 'default' => 0, - 'size' => 6, - 'required' => "false" - ); - $attributes = array_merge($attributes, $readOnlyXML); - $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Ordering Field. Type: Numbers (joomla)"); - $fieldXML = $fieldSetXML->addChild('field'); - $this->xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - } - // if version is not set - if (!isset($this->fieldsNames[$viewName]['version'])) - { - $attributes = array( - 'name' => 'version', - 'type' => 'text', - 'class' => 'readonly', - 'label' => $langView . '_VERSION_LABEL', - 'description' => $langView . '_VERSION_DESC', - 'size' => 6, - 'readonly' => "true", - 'filter' => 'unset' - ); - $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Version Field. Type: Text (joomla)"); - $fieldXML = $fieldSetXML->addChild('field'); - $this->xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - } - // check if metadata is added to this view - if (isset($this->metadataBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$viewName])) - { - // metakey - $attributes = array( - 'name' => 'metakey', - 'type' => 'textarea', - 'label' => 'JFIELD_META_KEYWORDS_LABEL', - 'description' => 'JFIELD_META_KEYWORDS_DESC', - 'rows' => 3, - 'cols' => 30 - ); - $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metakey Field. Type: Textarea (joomla)"); - $fieldXML = $fieldSetXML->addChild('field'); - $this->xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - // metadesc - $attributes['name'] = 'metadesc'; - $attributes['label'] = 'JFIELD_META_DESCRIPTION_LABEL'; - $attributes['description'] = 'JFIELD_META_DESCRIPTION_DESC'; - $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metadesc Field. Type: Textarea (joomla)"); - $fieldXML = $fieldSetXML->addChild('field'); - $this->xmlAddAttributes($fieldXML, $attributes); - // count the static field created - $this->fieldCount++; - } - // load the dynamic fields now - if (count($dynamicFieldsXML)) - { - $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Dynamic Fields."); - foreach ($dynamicFieldsXML as $dynamicfield) - { - $this->xmlAppend($fieldSetXML, $dynamicfield); - } - } - // check if metadata is added to this view - if (isset($this->metadataBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$viewName])) - { - $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metadata Fields"); - $fieldsXML = $fieldSetXML->addChild('fields'); - $fieldsXML->addAttribute('name', 'metadata'); - $fieldsXML->addAttribute('label', 'JGLOBAL_FIELDSET_METADATA_OPTIONS'); - $fieldsFieldSetXML = $fieldsXML->addChild('fieldset'); - $fieldsFieldSetXML->addAttribute('name', 'vdmmetadata'); - $fieldsFieldSetXML->addAttribute('label', 'JGLOBAL_FIELDSET_METADATA_OPTIONS'); - // robots - $this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Robots Field. Type: List (joomla)"); - $robots = $fieldsFieldSetXML->addChild('field'); - $attributes = array( - 'name' => 'robots', - 'type' => 'list', - 'label' => 'JFIELD_METADATA_ROBOTS_LABEL', - 'description' => 'JFIELD_METADATA_ROBOTS_DESC' - ); - $this->xmlAddAttributes($robots, $attributes); - // count the static field created - $this->fieldCount++; - $options = array( - 'JGLOBAL_USE_GLOBAL' => '', - 'JGLOBAL_INDEX_FOLLOW' => 'index, follow', - 'JGLOBAL_NOINDEX_FOLLOW' => 'noindex, follow', - 'JGLOBAL_INDEX_NOFOLLOW' => 'index, nofollow', - 'JGLOBAL_NOINDEX_NOFOLLOW' => 'noindex, nofollow', - ); - foreach ($options as $text => $value) - { - $option = $robots->addChild('option'); - $option->addAttribute('value', $value); - $option[] = $text; - } - // author - $this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Author Field. Type: Text (joomla)"); - $author = $fieldsFieldSetXML->addChild('field'); - $attributes = array( - 'name' => 'author', - 'type' => 'text', - 'label' => 'JAUTHOR', - 'description' => 'JFIELD_METADATA_AUTHOR_DESC', - 'size' => 20 - ); - $this->xmlAddAttributes($author, $attributes); - // count the static field created - $this->fieldCount++; - // rights - $this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Rights Field. Type: Textarea (joomla)"); - $rights = $fieldsFieldSetXML->addChild('field'); - $attributes = array( - 'name' => 'rights', - 'type' => 'textarea', - 'label' => 'JFIELD_META_RIGHTS_LABEL', - 'description' => 'JFIELD_META_RIGHTS_DESC', - 'required' => 'false', - 'filter' => 'string', - 'cols' => 30, - 'rows' => 2 - ); - $this->xmlAddAttributes($rights, $attributes); - // count the static field created - $this->fieldCount++; - } - // return the set - return $this->xmlPrettyPrint($XML, 'fieldset'); } return ''; } + /** + * build field set using string manipulation + * + * @param array $view The view data + * @param string $component The component name + * @param string $view_name_single The single view name + * @param string $view_name_list The list view name + * @param string $langView The language string of the view + * @param string $langViews The language string of the views + * + * @return string The fields set in xml + * + */ + protected function stringFieldSet($view, $component, $view_name_single, $view_name_list, $langView, $langViews) + { + // set the read only + $readOnly = false; + if ($view['settings']->type == 2) + { + $readOnly = "\t\t\t" . 'readonly="true"' . PHP_EOL . "\t\t\t" . 'disabled="true"'; + } + // start adding dynamc fields + $dynamicFields = ''; + // set the custom table key + $dbkey = 'g'; + // TODO we should add the global and local view switch if field for front end + foreach ($view['settings']->fields as $field) + { + $dynamicFields .= $this->setDynamicField($field, $view, $view['settings']->type, $langView, $view_name_single, $view_name_list, $this->placeholders, $dbkey, true); + } + // set the default fields + $fieldSet = array(); + $fieldSet[] = '
'; + $fieldSet[] = "\t\t"; + $fieldSet[] = "\t\t"; + // if id is not set + if (!isset($this->fieldsNames[$view_name_single]['id'])) + { + $fieldSet[] = "\t\tfieldCount++; + } + // if created is not set + if (!isset($this->fieldsNames[$view_name_single]['created'])) + { + $fieldSet[] = "\t\t"; + $fieldSet[] = "\t\tfieldCount++; + } + // if created_by is not set + if (!isset($this->fieldsNames[$view_name_single]['created_by'])) + { + $fieldSet[] = "\t\t"; + $fieldSet[] = "\t\tfieldCount++; + } + // if published is not set + if (!isset($this->fieldsNames[$view_name_single]['published'])) + { + $fieldSet[] = "\t\t"; + $fieldSet[] = "\t\t'; + $fieldSet[] = "\t\t\t"; + $fieldSet[] = "\t\t\t"; + $fieldSet[] = "\t\t\t"; + $fieldSet[] = "\t\t\t"; + $fieldSet[] = "\t\t"; + // count the static field created + $this->fieldCount++; + } + // if modified is not set + if (!isset($this->fieldsNames[$view_name_single]['modified'])) + { + $fieldSet[] = "\t\t"; + $fieldSet[] = "\t\t" . ''; + // count the static field created + $this->fieldCount++; + } + // if modified_by is not set + if (!isset($this->fieldsNames[$view_name_single]['modified_by'])) + { + $fieldSet[] = "\t\t"; + $fieldSet[] = "\t\t" . 'fieldCount++; + } + // check if view has access + if (isset($this->accessBuilder[$view_name_single]) && ComponentbuilderHelper::checkString($this->accessBuilder[$view_name_single]) && !isset($this->fieldsNames[$view_name_single]['access'])) + { + $fieldSet[] = "\t\t"; + $fieldSet[] = "\t\t" . 'fieldCount++; + } + // if ordering is not set + if (!isset($this->fieldsNames[$view_name_single]['ordering'])) + { + $fieldSet[] = "\t\t"; + $fieldSet[] = "\t\tfieldCount++; + } + // if version is not set + if (!isset($this->fieldsNames[$view_name_single]['version'])) + { + $fieldSet[] = "\t\t"; + $fieldSet[] = "\t\tfieldCount++; + } + // check if metadata is added to this view + if (isset($this->metadataBuilder[$view_name_single]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$view_name_single])) + { + // metakey + $fieldSet[] = "\t\t"; + $fieldSet[] = "\t\tfieldCount++; + // metadesc + $fieldSet[] = "\t\t"; + $fieldSet[] = "\t\tfieldCount++; + } + // load the dynamic fields now + if (ComponentbuilderHelper::checkString($dynamicFields)) + { + $fieldSet[] = "\t\t" . $dynamicFields; + } + // close fieldset + $fieldSet[] = "\t
"; + // check if metadata is added to this view + if (isset($this->metadataBuilder[$view_name_single]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$view_name_single])) + { + $fieldSet[] = PHP_EOL . "\t"; + $fieldSet[] = "\t'; + $fieldSet[] = "\t\t" . '
'; + // robots + $fieldSet[] = "\t\t\t"; + $fieldSet[] = "\t\t\t" . ''; + $fieldSet[] = "\t\t\t\t" . ''; + $fieldSet[] = "\t\t\t\t" . ''; + $fieldSet[] = "\t\t\t\t" . ''; + $fieldSet[] = "\t\t\t\t" . ''; + $fieldSet[] = "\t\t\t\t" . ''; + $fieldSet[] = "\t\t\t" . ''; + // count the static field created + $this->fieldCount++; + // author + $fieldSet[] = "\t\t\t"; + $fieldSet[] = "\t\t\t" . 'fieldCount++; + // rights + $fieldSet[] = "\t\t\t"; + $fieldSet[] = "\t\t\t" . 'fieldCount++; + $fieldSet[] = "\t\t
"; + $fieldSet[] = "\t"; + } + // retunr the set + return implode(PHP_EOL, $fieldSet); + } + + /** + * build field set with simpleXMLElement class + * + * @param array $view The view data + * @param string $component The component name + * @param string $view_name_single The single view name + * @param string $view_name_list The list view name + * @param string $langView The language string of the view + * @param string $langViews The language string of the views + * + * @return string The fields set in xml + * + */ + protected function simpleXMLFieldSet($view, $component, $view_name_single, $view_name_list, $langView, $langViews) + { + // set the read only + $readOnlyXML = array(); + if ($view['settings']->type == 2) + { + $readOnlyXML['readonly'] = true; + $readOnlyXML['disabled'] = true; + } + // start adding dynamc fields + $dynamicFieldsXML = array(); + // set the custom table key + $dbkey = 'g'; + // TODO we should add the global and local view switch if field for front end + foreach ($view['settings']->fields as $field) + { + $dynamicFieldsXML[] = $this->setDynamicField($field, $view, $view['settings']->type, $langView, $view_name_single, $view_name_list, $this->placeholders, $dbkey, true); + } + // set the default fields + $XML = new simpleXMLElement('
'); + $fieldSetXML = $XML->addChild('fieldset'); + $fieldSetXML->addAttribute('name', 'details'); + $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Default Fields."); + $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Id Field. Type: Text (joomla)"); + // if id is not set + if (!isset($this->fieldsNames[$view_name_single]['id'])) + { + $attributes = array( + 'name' => 'id', + 'type' => 'text', + 'class' => 'readonly', + 'label' => 'JGLOBAL_FIELD_ID_LABEL', + 'description' => 'JGLOBAL_FIELD_ID_DESC', + 'size' => 10, + 'default' => 0 + ); + $fieldXML = $fieldSetXML->addChild('field'); + $this->xmlAddAttributes($fieldXML, $attributes); + // count the static field created + $this->fieldCount++; + } + // if created is not set + if (!isset($this->fieldsNames[$view_name_single]['created'])) + { + $attributes = array( + 'name' => 'created', + 'type' => 'calendar', + 'label' => $langView . '_CREATED_DATE_LABEL', + 'description' => $langView . '_CREATED_DATE_DESC', + 'size' => 22, + 'format' => '%Y-%m-%d %H:%M:%S', + 'filter' => 'user_utc' + ); + $attributes = array_merge($attributes, $readOnlyXML); + $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Created Field. Type: Calendar (joomla)"); + $fieldXML = $fieldSetXML->addChild('field'); + $this->xmlAddAttributes($fieldXML, $attributes); + // count the static field created + $this->fieldCount++; + } + // if created_by is not set + if (!isset($this->fieldsNames[$view_name_single]['created_by'])) + { + $attributes = array( + 'name' => 'created_by', + 'type' => 'user', + 'label' => $langView . '_CREATED_BY_LABEL', + 'description' => $langView . '_CREATED_BY_DESC', + ); + $attributes = array_merge($attributes, $readOnlyXML); + $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Created Field. Type: User (joomla)"); + $fieldXML = $fieldSetXML->addChild('field'); + $this->xmlAddAttributes($fieldXML, $attributes); + // count the static field created + $this->fieldCount++; + } + // if published is not set + if (!isset($this->fieldsNames[$view_name_single]['published'])) + { + $attributes = array( + 'name' => 'published', + 'type' => 'list', + 'label' => 'JSTATUS' + ); + $attributes = array_merge($attributes, $readOnlyXML); + $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Published Field. Type: List (joomla)"); + $fieldXML = $fieldSetXML->addChild('field'); + $this->xmlAddAttributes($fieldXML, $attributes); + // count the static field created + $this->fieldCount++; + foreach (array('JPUBLISHED' => 1, 'JUNPUBLISHED' => 0, 'JARCHIVED' => 2, 'JTRASHED' => -2) as $text => $value) + { + $optionXML = $fieldXML->addChild('option'); + $optionXML->addAttribute('value', $value); + $optionXML[] = $text; + } + } + // if modified is not set + if (!isset($this->fieldsNames[$view_name_single]['modified'])) + { + $attributes = array( + 'name' => 'modified', + 'type' => 'calendar', + 'class' => 'readonly', + 'label' => $langView . '_MODIFIED_DATE_LABEL', + 'description' => $langView . '_MODIFIED_DATE_DESC', + 'size' => 22, + 'readonly' => "true", + 'format' => '%Y-%m-%d %H:%M:%S', + 'filter' => 'user_utc' + ); + $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Modified Field. Type: Calendar (joomla)"); + $fieldXML = $fieldSetXML->addChild('field'); + $this->xmlAddAttributes($fieldXML, $attributes); + // count the static field created + $this->fieldCount++; + } + // if modified_by is not set + if (!isset($this->fieldsNames[$view_name_single]['modified_by'])) + { + $attributes = array( + 'name' => 'modified_by', + 'type' => 'user', + 'label' => $langView . '_MODIFIED_BY_LABEL', + 'description' => $langView . '_MODIFIED_BY_DESC', + 'class' => 'readonly', + 'readonly' => 'true', + 'filter' => 'unset' + ); + $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Modified Field. Type: User (joomla)"); + $fieldXML = $fieldSetXML->addChild('field'); + $this->xmlAddAttributes($fieldXML, $attributes); + // count the static field created + $this->fieldCount++; + } + // check if view has access + if (isset($this->accessBuilder[$view_name_single]) && ComponentbuilderHelper::checkString($this->accessBuilder[$view_name_single]) && !isset($this->fieldsNames[$view_name_single]['access'])) + { + $attributes = array( + 'name' => 'access', + 'type' => 'accesslevel', + 'label' => 'JFIELD_ACCESS_LABEL', + 'description' => 'JFIELD_ACCESS_DESC', + 'default' => 1, + 'required' => "false" + ); + $attributes = array_merge($attributes, $readOnlyXML); + $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Access Field. Type: Accesslevel (joomla)"); + $fieldXML = $fieldSetXML->addChild('field'); + $this->xmlAddAttributes($fieldXML, $attributes); + // count the static field created + $this->fieldCount++; + } + // if ordering is not set + if (!isset($this->fieldsNames[$view_name_single]['ordering'])) + { + $attributes = array( + 'name' => 'ordering', + 'type' => 'number', + 'class' => 'inputbox validate-ordering', + 'label' => $langView . '_ORDERING_LABEL', + 'description' => '', + 'default' => 0, + 'size' => 6, + 'required' => "false" + ); + $attributes = array_merge($attributes, $readOnlyXML); + $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Ordering Field. Type: Numbers (joomla)"); + $fieldXML = $fieldSetXML->addChild('field'); + $this->xmlAddAttributes($fieldXML, $attributes); + // count the static field created + $this->fieldCount++; + } + // if version is not set + if (!isset($this->fieldsNames[$view_name_single]['version'])) + { + $attributes = array( + 'name' => 'version', + 'type' => 'text', + 'class' => 'readonly', + 'label' => $langView . '_VERSION_LABEL', + 'description' => $langView . '_VERSION_DESC', + 'size' => 6, + 'readonly' => "true", + 'filter' => 'unset' + ); + $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Version Field. Type: Text (joomla)"); + $fieldXML = $fieldSetXML->addChild('field'); + $this->xmlAddAttributes($fieldXML, $attributes); + // count the static field created + $this->fieldCount++; + } + // check if metadata is added to this view + if (isset($this->metadataBuilder[$view_name_single]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$view_name_single])) + { + // metakey + $attributes = array( + 'name' => 'metakey', + 'type' => 'textarea', + 'label' => 'JFIELD_META_KEYWORDS_LABEL', + 'description' => 'JFIELD_META_KEYWORDS_DESC', + 'rows' => 3, + 'cols' => 30 + ); + $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metakey Field. Type: Textarea (joomla)"); + $fieldXML = $fieldSetXML->addChild('field'); + $this->xmlAddAttributes($fieldXML, $attributes); + // count the static field created + $this->fieldCount++; + // metadesc + $attributes['name'] = 'metadesc'; + $attributes['label'] = 'JFIELD_META_DESCRIPTION_LABEL'; + $attributes['description'] = 'JFIELD_META_DESCRIPTION_DESC'; + $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metadesc Field. Type: Textarea (joomla)"); + $fieldXML = $fieldSetXML->addChild('field'); + $this->xmlAddAttributes($fieldXML, $attributes); + // count the static field created + $this->fieldCount++; + } + // load the dynamic fields now + if (count($dynamicFieldsXML)) + { + $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Dynamic Fields."); + foreach ($dynamicFieldsXML as $dynamicfield) + { + $this->xmlAppend($fieldSetXML, $dynamicfield); + } + } + // check if metadata is added to this view + if (isset($this->metadataBuilder[$view_name_single]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$view_name_single])) + { + $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metadata Fields"); + $fieldsXML = $fieldSetXML->addChild('fields'); + $fieldsXML->addAttribute('name', 'metadata'); + $fieldsXML->addAttribute('label', 'JGLOBAL_FIELDSET_METADATA_OPTIONS'); + $fieldsFieldSetXML = $fieldsXML->addChild('fieldset'); + $fieldsFieldSetXML->addAttribute('name', 'vdmmetadata'); + $fieldsFieldSetXML->addAttribute('label', 'JGLOBAL_FIELDSET_METADATA_OPTIONS'); + // robots + $this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Robots Field. Type: List (joomla)"); + $robots = $fieldsFieldSetXML->addChild('field'); + $attributes = array( + 'name' => 'robots', + 'type' => 'list', + 'label' => 'JFIELD_METADATA_ROBOTS_LABEL', + 'description' => 'JFIELD_METADATA_ROBOTS_DESC' + ); + $this->xmlAddAttributes($robots, $attributes); + // count the static field created + $this->fieldCount++; + $options = array( + 'JGLOBAL_USE_GLOBAL' => '', + 'JGLOBAL_INDEX_FOLLOW' => 'index, follow', + 'JGLOBAL_NOINDEX_FOLLOW' => 'noindex, follow', + 'JGLOBAL_INDEX_NOFOLLOW' => 'index, nofollow', + 'JGLOBAL_NOINDEX_NOFOLLOW' => 'noindex, nofollow', + ); + foreach ($options as $text => $value) + { + $option = $robots->addChild('option'); + $option->addAttribute('value', $value); + $option[] = $text; + } + // author + $this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Author Field. Type: Text (joomla)"); + $author = $fieldsFieldSetXML->addChild('field'); + $attributes = array( + 'name' => 'author', + 'type' => 'text', + 'label' => 'JAUTHOR', + 'description' => 'JFIELD_METADATA_AUTHOR_DESC', + 'size' => 20 + ); + $this->xmlAddAttributes($author, $attributes); + // count the static field created + $this->fieldCount++; + // rights + $this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Rights Field. Type: Textarea (joomla)"); + $rights = $fieldsFieldSetXML->addChild('field'); + $attributes = array( + 'name' => 'rights', + 'type' => 'textarea', + 'label' => 'JFIELD_META_RIGHTS_LABEL', + 'description' => 'JFIELD_META_RIGHTS_DESC', + 'required' => 'false', + 'filter' => 'string', + 'cols' => 30, + 'rows' => 2 + ); + $this->xmlAddAttributes($rights, $attributes); + // count the static field created + $this->fieldCount++; + } + // return the set + return $this->xmlPrettyPrint($XML, 'fieldset'); + } + /** * set Field Names * @@ -768,49 +1046,60 @@ class Fields extends Structure /** * set Dynamic field * - * @param array $field The field data - * @param array $view The view data - * @param int $viewType The view type - * @param string $langView The language string of the view - * @param string $viewName The singel view name - * @param string $listViewName The list view name - * @param string $spacerCounter The space counter value - * @param array $placeholders The place holder and replace values - * @param string $dbkey The the custom table key - * @param boolean $build The switch to set the build option + * @param array $field The field data + * @param array $view The view data + * @param int $viewType The view type + * @param string $langView The language string of the view + * @param string $view_name_single The single view name + * @param string $view_name_list The list view name + * @param array $placeholders The place holder and replace values + * @param string $dbkey The the custom table key + * @param boolean $build The switch to set the build option * * @return SimpleXMLElement The complete field in xml * */ - public function setDynamicField(&$field, &$view, &$viewType, &$langView, &$viewName, &$listViewName, &$spacerCounter, &$placeholders, &$dbkey, $build) + public function setDynamicField(&$field, &$view, &$viewType, &$langView, &$view_name_single, &$view_name_list, &$placeholders, &$dbkey, $build) { + // set default return + if ($this->fieldBuilderType == 1) + { + // string manipulation + $dynamicField = ''; + } + else + { + // simpleXMLElement class + $dynamicField = false; + } + // make sure we have settings if (isset($field['settings']) && ComponentbuilderHelper::checkObject($field['settings'])) { // reset some values - $name = ComponentbuilderHelper::safeString($field['settings']->name); - $typeName = ComponentbuilderHelper::safeString($field['settings']->type_name); + $name = $this->getFieldName($field, $view_name_list); + $typeName = $this->getFieldType($field); $multiple = false; $langLabel = ''; $fieldSet = ''; $fieldAttributes = array(); // set field attributes - $fieldAttributes = $this->setFieldAttributes($field, $viewType, $name, $typeName, $multiple, $langLabel, $langView, $spacerCounter, $listViewName, $viewName, $placeholders); + $fieldAttributes = $this->setFieldAttributes($field, $viewType, $name, $typeName, $multiple, $langLabel, $langView, $view_name_list, $view_name_single, $placeholders); // check if values were set if (ComponentbuilderHelper::checkArray($fieldAttributes)) { // set the array of field names - $this->setFieldsNames($viewName, $fieldAttributes['name']); + $this->setFieldsNames($view_name_single, $fieldAttributes['name']); if ($this->defaultField($typeName, 'option')) { //reset options array $optionArray = array(); // now add to the field set - $xmlElement = $this->setField('option', $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray); + $dynamicField = $this->setField('option', $fieldAttributes, $name, $typeName, $langView, $view_name_single, $view_name_list, $placeholders, $optionArray); if ($build) { // set builders - $this->setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple, false, $optionArray); + $this->setBuilders($langLabel, $langView, $view_name_single, $view_name_list, $name, $view, $field, $typeName, $multiple, false, $optionArray); } } elseif ($this->defaultField($typeName, 'plain')) @@ -818,10 +1107,10 @@ class Fields extends Structure if ($build) { // set builders - $this->setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple); + $this->setBuilders($langLabel, $langView, $view_name_single, $view_name_list, $name, $view, $field, $typeName, $multiple); } // now add to the field set - $xmlElement = $this->setField('plain', $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray); + $dynamicField = $this->setField('plain', $fieldAttributes, $name, $typeName, $langView, $view_name_single, $view_name_list, $placeholders, $optionArray); } elseif ($this->defaultField($typeName, 'spacer')) { @@ -838,15 +1127,10 @@ class Fields extends Structure // set to publishing tab $tabName = 'publishing'; } - $this->setLayoutBuilder($viewName, $tabName, $name, $field); + $this->setLayoutBuilder($view_name_single, $tabName, $name, $field); } // now add to the field set - $xmlElement = $this->setField('spacer', $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray); - // increment spacer counter - if ($typeName === 'spacer') - { - $spacerCounter++; - } + $dynamicField = $this->setField('spacer', $fieldAttributes, $name, $typeName, $langView, $view_name_single, $view_name_list, $placeholders, $optionArray); } elseif ($this->defaultField($typeName, 'special')) { @@ -856,10 +1140,10 @@ class Fields extends Structure if ($build) { // set builders - $this->setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple, false); + $this->setBuilders($langLabel, $langView, $view_name_single, $view_name_list, $name, $view, $field, $typeName, $multiple, false); } // now add to the field set - $xmlElement = $this->setField('special', $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray); + $dynamicField = $this->setField('special', $fieldAttributes, $name, $typeName, $langView, $view_name_single, $view_name_list, $placeholders, $optionArray); } } elseif (ComponentbuilderHelper::checkArray($fieldAttributes['custom'])) @@ -874,35 +1158,413 @@ class Fields extends Structure if ($build) { // set builders - $this->setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple, $custom); + $this->setBuilders($langLabel, $langView, $view_name_single, $view_name_list, $name, $view, $field, $typeName, $multiple, $custom); } // now add to the field set - $xmlElement = $this->setField('custom', $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray, $custom); + $dynamicField = $this->setField('custom', $fieldAttributes, $name, $typeName, $langView, $view_name_single, $view_name_list, $placeholders, $optionArray, $custom); } } - return $xmlElement; } - return false; + return $dynamicField; } /** * set a field * - * @param string $setType The set of fields type - * @param array $fieldAttributes The field values - * @param string $name The field name - * @param string $typeName The field type - * @param string $langView The language string of the view - * @param string $viewName The single view name - * @param string $listViewName The list view name - * @param array $placeholders The place holder and replace values - * @param string $optionArray The option bucket array used to set the field options if needed. - * @param array $custom Used when field is from config + * @param string $setType The set of fields type + * @param array $fieldAttributes The field values + * @param string $name The field name + * @param string $typeName The field type + * @param string $langView The language string of the view + * @param string $view_name_single The single view name + * @param string $view_name_list The list view name + * @param array $placeholders The place holder and replace values + * @param string $optionArray The option bucket array used to set the field options if needed. + * @param array $custom Used when field is from config + * @param string $taber The tabs to add in layout (only in string manipulation) * * @return SimpleXMLElement The field in xml * */ - private function setField($setType, &$fieldAttributes, &$name, &$typeName, &$langView, &$viewName, &$listViewName, $placeholders, &$optionArray, $custom = null) + private function setField($setType, &$fieldAttributes, &$name, &$typeName, &$langView, &$view_name_single, &$view_name_list, $placeholders, &$optionArray, $custom = null, $taber = '') + { + // count the dynamic fields created + $this->fieldCount++; + // check what type of field builder to use + if ($this->fieldBuilderType == 1) + { + // build field set using string manipulation + return $this->stringSetField($setType, $fieldAttributes, $name, $typeName, $langView, $view_name_single, $view_name_list, $placeholders, $optionArray, $custom, $taber); + } + else + { + // build field set with simpleXMLElement class + return $this->simpleXMLSetField($setType, $fieldAttributes, $name, $typeName, $langView, $view_name_single, $view_name_list, $placeholders, $optionArray, $custom); + } + } + + /** + * set a field using string manipulation + * + * @param string $setType The set of fields type + * @param array $fieldAttributes The field values + * @param string $name The field name + * @param string $typeName The field type + * @param string $langView The language string of the view + * @param string $view_name_single The single view name + * @param string $view_name_list The list view name + * @param array $placeholders The place holder and replace values + * @param string $optionArray The option bucket array used to set the field options if needed. + * @param array $custom Used when field is from config + * @param string $taber The tabs to add in layout + * + * @return SimpleXMLElement The field in xml + * + */ + protected function stringSetField($setType, &$fieldAttributes, &$name, &$typeName, &$langView, &$view_name_single, &$view_name_list, $placeholders, &$optionArray, $custom = null, $taber = '') + { + $field = ''; + if ($setType === 'option') + { + // now add to the field set + $field .= PHP_EOL . "\t" . $taber . "\t"; + $field .= PHP_EOL . "\t" . $taber . "\t $value) + { + if ($property != 'option') + { + $field .= PHP_EOL . "\t\t" . $taber . "\t" . $property . '="' . $value . '"'; + } + elseif ($property === 'option') + { + $optionSet = ''; + if (strpos($value, ',') !== false) + { + // mulitpal options + $options = explode(',', $value); + foreach ($options as $option) + { + if (strpos($option, '|') !== false) + { + // has other value then text + list($v, $t) = explode('|', $option); + $langValue = $langView . '_' . ComponentbuilderHelper::safeString($t, 'U'); + // add to lang array + $this->langContent[$this->lang][$langValue] = $t; + // no add to option set + $optionSet .= PHP_EOL . "\t" . $taber . "\t\t" . ''; + $optionArray[$v] = $langValue; + } + else + { + // text is also the value + $langValue = $langView . '_' . ComponentbuilderHelper::safeString($option, 'U'); + // add to lang array + $this->langContent[$this->lang][$langValue] = $option; + // no add to option set + $optionSet .= PHP_EOL . "\t\t" . $taber . "\t" . ''; + $optionArray[$option] = $langValue; + } + } + } + else + { + // one option + if (strpos($value, '|') !== false) + { + // has other value then text + list($v, $t) = explode('|', $value); + $langValue = $langView . '_' . ComponentbuilderHelper::safeString($t, 'U'); + // add to lang array + $this->langContent[$this->lang][$langValue] = $t; + // no add to option set + $optionSet .= PHP_EOL . "\t\t" . $taber . "\t" . ''; + $optionArray[$v] = $langValue; + } + else + { + // text is also the value + $langValue = $langView . '_' . ComponentbuilderHelper::safeString($value, 'U'); + // add to lang array + $this->langContent[$this->lang][$langValue] = $value; + // no add to option set + $optionSet .= PHP_EOL . "\t\t" . $taber . "\t" . ''; + $optionArray[$value] = $langValue; + } + } + } + } + if (ComponentbuilderHelper::checkString($optionSet)) + { + $field .= '>'; + $field .= PHP_EOL . "\t\t\t" . $taber . ""; + $field .= $optionSet; + $field .= PHP_EOL . "\t\t" . $taber . ""; + } + elseif ($typeName === 'sql') + { + $optionArray = false; + $field .= PHP_EOL . "\t\t" . $taber . "/>"; + } + else + { + $optionArray = false; + $field .= PHP_EOL . "\t\t\t" . $taber . ""; + $field .= PHP_EOL . "\t\t" . $taber . "/>"; + } + } + elseif ($setType === 'plain') + { + // now add to the field set + $field .= PHP_EOL . "\t\t" . $taber . ""; + $field .= PHP_EOL . "\t\t" . $taber . " $value) + { + if ($property != 'option') + { + $field .= PHP_EOL . "\t\t" . $taber . "\t" . $property . '="' . $value . '"'; + } + } + $field .= PHP_EOL . "\t\t" . $taber . "/>"; + } + elseif ($setType === 'spacer') + { + // now add to the field set + $field .= PHP_EOL . "\t\t"; + $field .= PHP_EOL . "\t\t $value) + { + if ($property != 'option') + { + $field .= " " . $property . '="' . $value . '"'; + } + } + $field .= " />"; + } + elseif ($setType === 'special') + { + // set the repeatable field + if ($typeName === 'repeatable') + { + // now add to the field set + $field .= PHP_EOL . "\t\t"; + $field .= PHP_EOL . "\t\t $value) + { + if ($property != 'fields') + { + $field .= PHP_EOL . "\t\t\t" . $property . '="' . $value . '"'; + } + } + $field .= ">"; + $field .= PHP_EOL . "\t\t\t" . ''; + $field .= PHP_EOL . "\t\t\t\t" . '"; + $field .= PHP_EOL . "\t\t\t"; + $field .= PHP_EOL . "\t\t"; + } + // set the subform fields (it is a repeatable without the modal) + elseif ($typeName === 'subform') + { + // now add to the field set + $field .= PHP_EOL . "\t\t"; + $field .= PHP_EOL . "\t\t $value) + { + if ($property != 'fields') + { + $field .= PHP_EOL . "\t\t\t" . $property . '="' . $value . '"'; + } + } + $field .= ">"; + $field .= PHP_EOL . "\t\t\t" . '"; + $field .= PHP_EOL . "\t\t"; + } + } + elseif ($setType === 'custom') + { + // now add to the field set + $field .= PHP_EOL . "\t\t" . $taber . ""; + $field .= PHP_EOL . "\t\t" . $taber . " $value) + { + if ($property != 'option') + { + $field .= PHP_EOL . "\t\t" . $taber . "\t" . $property . '="' . $value . '"'; + } + } + $field .= PHP_EOL . "\t\t" . $taber . "/>"; + // incase the field is in the config and has not been set + if ('config' === $view_name_single && 'configs' === $view_name_list) + { + // set lang (just incase) + $listLangName = $langView . '_' . ComponentbuilderHelper::safeString($name, 'U'); + // set the custom array + $data = array('type' => $typeName, 'code' => $name, 'lang' => $listLangName, 'custom' => $custom); + // set the custom field file + $this->setCustomFieldTypeFile($data, $view_name_list, $view_name_single); + } + } + // return field + return $field; + } + + /** + * set a field with simpleXMLElement class + * + * @param string $setType The set of fields type + * @param array $fieldAttributes The field values + * @param string $name The field name + * @param string $typeName The field type + * @param string $langView The language string of the view + * @param string $view_name_single The single view name + * @param string $view_name_list The list view name + * @param array $placeholders The place holder and replace values + * @param string $optionArray The option bucket array used to set the field options if needed. + * @param array $custom Used when field is from config + * + * @return SimpleXMLElement The field in xml + * + */ + protected function simpleXMLSetField($setType, &$fieldAttributes, &$name, &$typeName, &$langView, &$view_name_single, &$view_name_list, $placeholders, &$optionArray, $custom = null) { $field = new stdClass(); if ($setType === 'option') @@ -1054,15 +1716,15 @@ class Fields extends Structure { // get the field data $fieldData = array(); - $fieldData['settings'] = $this->getFieldData($fieldId, $viewName); + $fieldData['settings'] = $this->getFieldData($fieldId, $view_name_single); if (ComponentbuilderHelper::checkObject($fieldData['settings'])) { - $r_name = ComponentbuilderHelper::safeString($fieldData['settings']->name); - $r_typeName = ComponentbuilderHelper::safeString($fieldData['settings']->type_name); + $r_name = $this->getFieldName($fieldData); + $r_typeName = $this->getFieldType($fieldData); $r_multiple = false; $r_langLabel = ''; // get field values - $r_fieldValues = $this->setFieldAttributes($fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, $spacerCounter, $listViewName, $viewName, $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 if (ComponentbuilderHelper::checkArray($r_fieldValues)) { @@ -1071,12 +1733,12 @@ class Fields extends Structure if ($this->defaultField($r_typeName, 'option')) { // now add to the field set - $this->xmlAppend($fieldSetXML, $this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray)); + $this->xmlAppend($fieldSetXML, $this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray)); } elseif ($this->defaultField($r_typeName, 'plain')) { // now add to the field set - $this->xmlAppend($fieldSetXML, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray)); + $this->xmlAppend($fieldSetXML, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray)); } elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom'])) { @@ -1084,7 +1746,7 @@ class Fields extends Structure $custom = $r_fieldValues['custom']; unset($r_fieldValues['custom']); // now add to the field set - $this->xmlAppend($fieldSetXML, $this->setField('custom', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray)); + $this->xmlAppend($fieldSetXML, $this->setField('custom', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray)); // set lang (just incase) $r_listLangName = $langView . '_' . ComponentbuilderHelper::safeString($r_name, 'U'); // add to lang array @@ -1097,7 +1759,7 @@ class Fields extends Structure // set the custom array $data = array('type' => $r_typeName, 'code' => $r_name, 'lang' => $r_listLangName, 'custom' => $custom); // set the custom field file - $this->setCustomFieldTypeFile($data, $listViewName, $viewName); + $this->setCustomFieldTypeFile($data, $view_name_list, $view_name_single); } } } @@ -1151,15 +1813,15 @@ class Fields extends Structure { // get the field data $fieldData = array(); - $fieldData['settings'] = $this->getFieldData($fieldId, $viewName); + $fieldData['settings'] = $this->getFieldData($fieldId, $view_name_single); if (ComponentbuilderHelper::checkObject($fieldData['settings'])) { - $r_name = ComponentbuilderHelper::safeString($fieldData['settings']->name); - $r_typeName = ComponentbuilderHelper::safeString($fieldData['settings']->type_name); + $r_name = $this->getFieldName($fieldData); + $r_typeName = $this->getFieldType($fieldData); $r_multiple = false; $r_langLabel = ''; // get field values - $r_fieldValues = $this->setFieldAttributes($fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, $spacerCounter, $listViewName, $viewName, $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 if (ComponentbuilderHelper::checkArray($r_fieldValues)) { @@ -1168,12 +1830,12 @@ class Fields extends Structure if ($this->defaultField($r_typeName, 'option')) { // now add to the field set - $this->xmlAppend($form, $this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray)); + $this->xmlAppend($form, $this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray)); } elseif ($this->defaultField($r_typeName, 'plain')) { // now add to the field set - $this->xmlAppend($form, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray)); + $this->xmlAppend($form, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray)); } elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom'])) { @@ -1181,7 +1843,7 @@ class Fields extends Structure $custom = $r_fieldValues['custom']; unset($r_fieldValues['custom']); // now add to the field set - $this->xmlAppend($form, $this->setField('custom', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray)); + $this->xmlAppend($form, $this->setField('custom', $r_fieldValues, $r_name, $r_typeName, $langView, $view_name_single, $view_name_list, $placeholders, $r_optionArray)); // set lang (just incase) $r_listLangName = $langView . '_' . ComponentbuilderHelper::safeString($r_name, 'U'); // add to lang array @@ -1194,7 +1856,7 @@ class Fields extends Structure // set the custom array $data = array('type' => $r_typeName, 'code' => $r_name, 'lang' => $r_listLangName, 'custom' => $custom); // set the custom field file - $this->setCustomFieldTypeFile($data, $listViewName, $viewName); + $this->setCustomFieldTypeFile($data, $view_name_list, $view_name_single); } } } @@ -1216,14 +1878,14 @@ class Fields extends Structure } } // incase the field is in the config and has not been set - if ('config' === $viewName && 'configs' === $listViewName) + if ('config' === $view_name_single && 'configs' === $view_name_list) { // set lang (just incase) $listLangName = $langView . '_' . ComponentbuilderHelper::safeString($name, 'U'); // set the custom array $data = array('type' => $typeName, 'code' => $name, 'lang' => $listLangName, 'custom' => $custom); // set the custom field file - $this->setCustomFieldTypeFile($data, $listViewName, $viewName); + $this->setCustomFieldTypeFile($data, $view_name_list, $view_name_single); } } return $field; @@ -1232,87 +1894,99 @@ class Fields extends Structure /** * set the layout builder * - * @param string $viewName The single edit view code name - * @param string $tabName The tab code name - * @param string $name The field code name - * @param array $field The field details + * @param string $view_name_single The single edit view code name + * @param string $tabName The tab code name + * @param string $name The field code name + * @param array $field The field details * * @return void * */ - public function setLayoutBuilder(&$viewName, &$tabName, &$name, &$field) + public function setLayoutBuilder(&$view_name_single, &$tabName, &$name, &$field) { // first fix the zero order // to insure it lands before all the other fields // as zero is expected to behave if ($field['order_edit'] == 0) { - if (!isset($this->zeroOrderFix[$viewName])) + if (!isset($this->zeroOrderFix[$view_name_single])) { - $this->zeroOrderFix[$viewName] = array(); + $this->zeroOrderFix[$view_name_single] = array(); } - if (!isset($this->zeroOrderFix[$viewName][(int) $field['tab']])) + if (!isset($this->zeroOrderFix[$view_name_single][(int) $field['tab']])) { - $this->zeroOrderFix[$viewName][(int) $field['tab']] = -999; + $this->zeroOrderFix[$view_name_single][(int) $field['tab']] = -999; } else { - $this->zeroOrderFix[$viewName][(int) $field['tab']] ++; + $this->zeroOrderFix[$view_name_single][(int) $field['tab']] ++; } - $field['order_edit'] = $this->zeroOrderFix[$viewName][(int) $field['tab']]; + $field['order_edit'] = $this->zeroOrderFix[$view_name_single][(int) $field['tab']]; } // now build the layout if (ComponentbuilderHelper::checkString($tabName) && $tabName != 'publishing') { - $this->tabCounter[$viewName][(int) $field['tab']] = $tabName; - if (isset($this->layoutBuilder[$viewName][$tabName][(int) $field['alignment']][(int) $field['order_edit']])) + $this->tabCounter[$view_name_single][(int) $field['tab']] = $tabName; + if (isset($this->layoutBuilder[$view_name_single][$tabName][(int) $field['alignment']][(int) $field['order_edit']])) { - $size = count($this->layoutBuilder[$viewName][$tabName][(int) $field['alignment']][(int) $field['order_edit']]) + 1; - $this->layoutBuilder[$viewName][$tabName][(int) $field['alignment']][$size] = $name; + $size = (int) count((array) $this->layoutBuilder[$view_name_single][$tabName][(int) $field['alignment']]) + 1; + while (isset($this->layoutBuilder[$view_name_single][$tabName][(int) $field['alignment']][$size])) + { + $size++; + } + $this->layoutBuilder[$view_name_single][$tabName][(int) $field['alignment']][$size] = $name; } else { - $this->layoutBuilder[$viewName][$tabName][(int) $field['alignment']][(int) $field['order_edit']] = $name; + $this->layoutBuilder[$view_name_single][$tabName][(int) $field['alignment']][(int) $field['order_edit']] = $name; } // check if publishing fields were over written if (in_array($name, $this->defaultFields)) { // just to eliminate - $this->movedPublishingFields[$viewName][$name] = $name; + $this->movedPublishingFields[$view_name_single][$name] = $name; } } elseif ($tabName === 'publishing' || $tabName === 'Publishing') { if (!in_array($name, $this->defaultFields)) { - if (isset($this->newPublishingFields[$viewName][(int) $field['alignment']][(int) $field['order_edit']])) + if (isset($this->newPublishingFields[$view_name_single][(int) $field['alignment']][(int) $field['order_edit']])) { - $size = count($this->newPublishingFields[$viewName][(int) $field['alignment']][(int) $field['order_edit']]) + 1; - $this->newPublishingFields[$viewName][(int) $field['alignment']][$size] = $name; + $size = (int) count((array) $this->newPublishingFields[$view_name_single][(int) $field['alignment']]) + 1; + while (isset($this->newPublishingFields[$view_name_single][(int) $field['alignment']][$size])) + { + $size++; + } + $this->newPublishingFields[$view_name_single][(int) $field['alignment']][$size] = $name; } else { - $this->newPublishingFields[$viewName][(int) $field['alignment']][(int) $field['order_edit']] = $name; + $this->newPublishingFields[$view_name_single][(int) $field['alignment']][(int) $field['order_edit']] = $name; } } } else { - $this->tabCounter[$viewName][1] = 'Details'; - if (isset($this->layoutBuilder[$viewName]['Details'][(int) $field['alignment']][(int) $field['order_edit']])) + $this->tabCounter[$view_name_single][1] = 'Details'; + if (isset($this->layoutBuilder[$view_name_single]['Details'][(int) $field['alignment']][(int) $field['order_edit']])) { - $size = count($this->layoutBuilder[$viewName]['Details'][(int) $field['alignment']][(int) $field['order_edit']]) + 1; - $this->layoutBuilder[$viewName]['Details'][(int) $field['alignment']][$size] = $name; + $size = (int) count((array) $this->layoutBuilder[$view_name_single]['Details'][(int) $field['alignment']]) + 1; + while (isset($this->layoutBuilder[$view_name_single]['Details'][(int) $field['alignment']][$size])) + { + $size++; + } + $this->layoutBuilder[$view_name_single]['Details'][(int) $field['alignment']][$size] = $name; } else { - $this->layoutBuilder[$viewName]['Details'][(int) $field['alignment']][(int) $field['order_edit']] = $name; + $this->layoutBuilder[$view_name_single]['Details'][(int) $field['alignment']][(int) $field['order_edit']] = $name; } // check if publishing fields were over written if (in_array($name, $this->defaultFields)) { // just to eliminate - $this->movedPublishingFields[$viewName][$name] = $name; + $this->movedPublishingFields[$view_name_single][$name] = $name; } } } @@ -1330,7 +2004,7 @@ class Fields extends Structure */ public function buildSiteFieldData($view, $field, $set, $type) { - $decode = array('json', 'base64', 'basic_encryption', 'advance_encryption'); + $decode = array('json', 'base64', 'basic_encryption', 'whmcs_encryption', 'medium_encryption'); $textareas = array('textarea', 'editor'); if (isset($this->siteFields[$view][$field]) && ComponentbuilderHelper::checkArray($this->siteFields[$view][$field])) { @@ -1358,23 +2032,22 @@ class Fields extends Structure /** * set field attributes * - * @param array $field The field data - * @param int $viewType The view type - * @param string $name The field name - * @param string $typeName The field type - * @param boolean $multiple The switch to set multiple selection option - * @param string $langLabel The language string for field label - * @param string $langView The language string of the view - * @param string $spacerCounter The space counter value - * @param string $listViewName The list view name - * @param string $viewName The singel view name - * @param array $placeholders The place holder and replace values - * @param boolean $repeatable The repeatable field switch + * @param array $field The field data + * @param int $viewType The view type + * @param string $name The field name + * @param string $typeName The field type + * @param boolean $multiple The switch to set multiple selection option + * @param string $langLabel The language string for field label + * @param string $langView The language string of the view + * @param string $view_name_list The list view name + * @param string $view_name_single The singel view name + * @param array $placeholders The place holder and replace values + * @param boolean $repeatable The repeatable field switch * * @return array The field attributes * */ - private function setFieldAttributes(&$field, &$viewType, &$name, &$typeName, &$multiple, &$langLabel, $langView, &$spacerCounter, $listViewName, $viewName, $placeholders, $repeatable = false) + private function setFieldAttributes(&$field, &$viewType, &$name, &$typeName, &$multiple, &$langLabel, $langView, $view_name_list, $view_name_single, $placeholders, $repeatable = false) { // reset array $fieldAttributes = array(); @@ -1395,38 +2068,8 @@ class Fields extends Structure $langValue = ''; if ($property['name'] === 'type') { - if ($typeName === 'custom' || $typeName === 'customuser') - { - $xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'type="', '"')); - } - // use field core type only if not found - elseif (ComponentbuilderHelper::checkString($typeName)) - { - $xmlValue = $typeName; - } - // make sure none adjustable fields are set - elseif (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']) && $property['adjustable'] == 0) - { - $xmlValue = $property['example']; - } - // fall back on the xml settings - else - { - $xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'type="', '"')); - } - - // check if the value is set - if (ComponentbuilderHelper::checkString($xmlValue)) - { - // add the value - $typeName = $xmlValue; - } - else - { - // fall back to text - $xmlValue = 'text'; - $typeName = $xmlValue; - } + // get type name + $xmlValue = $typeName; // add to custom if it is custom if ($setCustom) @@ -1437,67 +2080,8 @@ class Fields extends Structure } elseif ($property['name'] === 'name') { - // if category then name must be catid (only one per view) - if ($typeName === 'category') - { - // quick check if this is a category linked to view page - $requeSt_id = ComponentbuilderHelper::getBetween($field['settings']->xml, 'name="', '"'); - if (strpos($requeSt_id, '_request_id') !== false || strpos($requeSt_id, '_request_catid') !== false) - { - // keep it then, don't change - $xmlValue = $requeSt_id; - } - else - { - $xmlValue = 'catid'; - } - // check if we should use another Text Name as this views name - $otherName = ComponentbuilderHelper::getBetween($field['settings']->xml, 'othername="', '"'); - $otherViews = ComponentbuilderHelper::getBetween($field['settings']->xml, 'views="', '"'); - $otherView = ComponentbuilderHelper::getBetween($field['settings']->xml, 'view="', '"'); - if (ComponentbuilderHelper::checkString($otherName) && ComponentbuilderHelper::checkString($otherViews) && ComponentbuilderHelper::checkString($otherView)) - { - $this->catOtherName[$listViewName] = array( - 'name' => ComponentbuilderHelper::safeString($otherName), - 'views' => ComponentbuilderHelper::safeString($otherViews), - 'view' => ComponentbuilderHelper::safeString($otherView) - ); - } - } - // if tag is set then enable all tag options for this view (only one per view) - elseif ($typeName === 'tag') - { - $xmlValue = 'tags'; - } - // if the field is set as alias it must be called alias - elseif (isset($field['alias']) && $field['alias']) - { - $xmlValue = 'alias'; - } - elseif ($typeName === 'spacer') - { - // make sure the name is unique - $xmlValue = $name . '_' . $spacerCounter; - } - else - { - $xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'name="', '"')); - } - - // use field core name only if not found in xml - if (!ComponentbuilderHelper::checkString($xmlValue)) - { - // make sure the XML name is uniqe, so we can add one field multiple times - $name = $this->uniqueName($name, $viewName); - $xmlValue = $name; - } - // set the name if found - else - { - // make sure the XML name is uniqe, so we can add one field multiple times - $xmlValue = $this->uniqueName($xmlValue, $viewName); - $name = $this->setPlaceholders($xmlValue, $placeholders); - } + // get the actual field name + $xmlValue = $this->setPlaceholders($name, $placeholders); } elseif ($property['name'] === 'extension' || $property['name'] === 'directory' || $property['name'] === 'formsource') { @@ -1616,9 +2200,9 @@ class Fields extends Structure // update label if field use multiple times if ($property['name'] === 'label') { - if (isset($fieldAttributes['name']) && isset($this->uniqueNames[$viewName]['names'][$fieldAttributes['name']])) + if (isset($fieldAttributes['name']) && isset($this->uniqueNames[$view_name_list]['names'][$fieldAttributes['name']])) { - $xmlValue .= ' (' . ComponentbuilderHelper::safeString($this->uniqueNames[$viewName]['names'][$fieldAttributes['name']]) . ')'; + $xmlValue .= ' (' . ComponentbuilderHelper::safeString($this->uniqueNames[$view_name_list]['names'][$fieldAttributes['name']]) . ')'; } } // replace placeholders @@ -1692,13 +2276,13 @@ class Fields extends Structure $listclass = ComponentbuilderHelper::getBetween($field['settings']->xml, 'listclass="', '"'); if (ComponentbuilderHelper::checkString($listclass)) { - $this->listFieldClass[$listViewName][$fieldAttributes['name']] = $listclass; + $this->listFieldClass[$view_name_list][$fieldAttributes['name']] = $listclass; } // check if we find reason to remove this field from being escaped $escaped = ComponentbuilderHelper::getBetween($field['settings']->xml, 'escape="', '"'); if (ComponentbuilderHelper::checkString($escaped)) { - $this->doNotEscape[$listViewName][] = $fieldAttributes['name']; + $this->doNotEscape[$view_name_list][] = $fieldAttributes['name']; } // check if we have display switch for dynamic placment $display = ComponentbuilderHelper::getBetween($field['settings']->xml, 'display="', '"'); @@ -1711,147 +2295,30 @@ class Fields extends Structure return $fieldAttributes; } - /** - * Keep track of the field names, to see if it used multiple times - * - * @param array $field The field data - * @param string $typeName The field type - * @param string $name The field name - * @param string $viewName The singel view name - * - * @return void - * - */ - protected function setUniqueNameKeeper(&$field, &$typeName, &$name, $viewName) - { - // setup a default field - if (ComponentbuilderHelper::checkArray($field['settings']->properties)) - { - foreach ($field['settings']->properties as $property) - { - // reset - $xmlValue = ''; - if ($property['name'] === 'name') - { - // if category then name must be catid (only one per view) - if ($typeName === 'category') - { - // only one allowed - return; - } - // if tag is set then enable all tag options for this view (only one per view) - elseif ($typeName === 'tag') - { - // only one allowed - return; - } - // if the field is set as alias it must be called alias - elseif (isset($field['alias']) && $field['alias']) - { - // only one allowed - return; - } - elseif ($typeName === 'spacer') - { - // not needed here - return; - } - else - { - $xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'name="', '"')); - } - - // use field core name only if not found in xml - if (!ComponentbuilderHelper::checkString($xmlValue)) - { - $xmlValue = $name; - } - // make sure the XML name is uniqe, so we can add one field multiple times - return $this->setUniqueNameCounter($xmlValue, $viewName); - } - } - } - } - - /** - * Count how many times the same field is used per view - * - * @param string $name The name of the field - * @param string $view The name of the view - * - * @return void - * - */ - protected function setUniqueNameCounter($name, $view) - { - if (!isset($this->uniqueNames[$view])) - { - $this->uniqueNames[$view] = array(); - $this->uniqueNames[$view]['counter'] = array(); - $this->uniqueNames[$view]['names'] = array(); - } - if (!isset($this->uniqueNames[$view]['counter'][$name])) - { - $this->uniqueNames[$view]['counter'][$name] = 1; - return; - } - // count how many times the field is used - $this->uniqueNames[$view]['counter'][$name] ++; - return; - } - - /** - * Naming each field with an unique name - * - * @param string $name The name of the field - * @param string $view The name of the view - * - * @return string the name - * - */ - protected function uniqueName($name, $view) - { - // only increment if the field name is used multiple times - if (isset($this->uniqueNames[$view]['counter'][$name]) && $this->uniqueNames[$view]['counter'][$name] > 1) - { - $counter = $this->uniqueNames[$view]['counter'][$name]; - $uniqueName = ComponentbuilderHelper::safeString($name . '_' . $counter); - while (isset($this->uniqueNames[$view]['names'][$uniqueName])) - { - $counter--; - $uniqueName = ComponentbuilderHelper::safeString($name . '_' . $counter); - } - // set the new name - $this->uniqueNames[$view]['names'][$uniqueName] = $counter; - return $uniqueName; - } - return $name; - } - /** * set Builders * - * @param string $langLabel The language string for field label - * @param string $langView The language string of the view - * @param string $viewName The singel view name - * @param string $listViewName The list view name - * @param string $name The field name - * @param array $view The view data - * @param array $field The field data - * @param string $typeName The field type - * @param boolean $multiple The switch to set multiple selection option - * @param boolean $custom The custom field switch - * @param boolean $options The options switch + * @param string $langLabel The language string for field label + * @param string $langView The language string of the view + * @param string $view_name_single The singel view name + * @param string $view_name_list The list view name + * @param string $name The field name + * @param array $view The view data + * @param array $field The field data + * @param string $typeName The field type + * @param boolean $multiple The switch to set multiple selection option + * @param boolean $custom The custom field switch + * @param boolean $options The options switch * * @return void * */ - public function setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple, $custom = false, $options = false) + public function setBuilders($langLabel, $langView, $view_name_single, $view_name_list, $name, $view, $field, $typeName, $multiple, $custom = false, $options = false) { if ($typeName === 'tag') { // set tags for this view but don't load to DB - $this->tagsBuilder[$viewName] = $viewName; + $this->tagsBuilder[$view_name_single] = $view_name_single; } else { @@ -1874,58 +2341,58 @@ class Fields extends Structure // don't use these as index or uniqe keys $textKeys = array('TEXT', 'TINYTEXT', 'MEDIUMTEXT', 'LONGTEXT', 'BLOB', 'TINYBLOB', 'MEDIUMBLOB', 'LONGBLOB'); // build the query values - $this->queryBuilder[$viewName][$name]['type'] = $field['settings']->datatype; + $this->queryBuilder[$view_name_single][$name]['type'] = $field['settings']->datatype; if (!in_array($field['settings']->datatype, $textKeys)) { - $this->queryBuilder[$viewName][$name]['lenght'] = $field['settings']->datalenght; - $this->queryBuilder[$viewName][$name]['lenght_other'] = $field['settings']->datalenght_other; - $this->queryBuilder[$viewName][$name]['default'] = $field['settings']->datadefault; - $this->queryBuilder[$viewName][$name]['other'] = $field['settings']->datadefault_other; + $this->queryBuilder[$view_name_single][$name]['lenght'] = $field['settings']->datalenght; + $this->queryBuilder[$view_name_single][$name]['lenght_other'] = $field['settings']->datalenght_other; + $this->queryBuilder[$view_name_single][$name]['default'] = $field['settings']->datadefault; + $this->queryBuilder[$view_name_single][$name]['other'] = $field['settings']->datadefault_other; } else { - $this->queryBuilder[$viewName][$name]['default'] = 'EMPTY'; + $this->queryBuilder[$view_name_single][$name]['default'] = 'EMPTY'; } // to identify the field - $this->queryBuilder[$viewName][$name]['ID'] = $field['settings']->id; - $this->queryBuilder[$viewName][$name]['null_switch'] = $field['settings']->null_switch; + $this->queryBuilder[$view_name_single][$name]['ID'] = $field['settings']->id; + $this->queryBuilder[$view_name_single][$name]['null_switch'] = $field['settings']->null_switch; // set index types if ($field['settings']->indexes == 1 && !in_array($field['settings']->datatype, $textKeys)) { // build unique keys of this view for db - $this->dbUniqueKeys[$viewName][] = $name; + $this->dbUniqueKeys[$view_name_single][] = $name; } elseif (($field['settings']->indexes == 2 || (isset($field['alias']) && $field['alias']) || (isset($field['title']) && $field['title']) || $typeName === 'category') && !in_array($field['settings']->datatype, $textKeys)) { // build keys of this view for db - $this->dbKeys[$viewName][] = $name; + $this->dbKeys[$view_name_single][] = $name; } } // add history to this view if (isset($view['history']) && $view['history']) { - $this->historyBuilder[$viewName] = $viewName; + $this->historyBuilder[$view_name_single] = $view_name_single; } // set Alias (only one title per view) if (isset($field['alias']) && $field['alias']) { - $this->aliasBuilder[$viewName] = $name; + $this->aliasBuilder[$view_name_single] = $name; } // set Titles (only one title per view) if (isset($field['title']) && $field['title']) { - $this->titleBuilder[$viewName] = $name; + $this->titleBuilder[$view_name_single] = $name; } // category name fix if ($typeName === 'category') { - if (isset($this->catOtherName[$listViewName]) && ComponentbuilderHelper::checkArray($this->catOtherName[$listViewName])) + if (isset($this->catOtherName[$view_name_list]) && ComponentbuilderHelper::checkArray($this->catOtherName[$view_name_list])) { - $tempName = $this->catOtherName[$listViewName]['name']; + $tempName = $this->catOtherName[$view_name_list]['name']; } else { - $tempName = $viewName . ' category'; + $tempName = $view_name_single . ' category'; } // set lang $listLangName = $langView . '_' . ComponentbuilderHelper::safeString($tempName, 'U'); @@ -1948,7 +2415,7 @@ class Fields extends Structure if ((isset($field['list']) && $field['list'] == 1) && $typeName != 'repeatable' && $typeName != 'subform') { // load to list builder - $this->listBuilder[$listViewName][] = array( + $this->listBuilder[$view_name_list][] = array( 'type' => $typeName, 'code' => $name, 'lang' => $listLangName, @@ -1960,64 +2427,64 @@ class Fields extends Structure 'multiple' => $multiple, 'options' => $options); - $this->customBuilderList[$listViewName][] = $name; + $this->customBuilderList[$view_name_list][] = $name; } // set the hidden field of this view if ($typeName === 'hidden') { - if (!isset($this->hiddenFieldsBuilder[$viewName])) + if (!isset($this->hiddenFieldsBuilder[$view_name_single])) { - $this->hiddenFieldsBuilder[$viewName] = ''; + $this->hiddenFieldsBuilder[$view_name_single] = ''; } - $this->hiddenFieldsBuilder[$viewName] .= ',"' . $name . '"'; + $this->hiddenFieldsBuilder[$view_name_single] .= ',"' . $name . '"'; } // set all int fields of this view if ($field['settings']->datatype === 'INT' || $field['settings']->datatype === 'TINYINT' || $field['settings']->datatype === 'BIGINT') { - if (!isset($this->intFieldsBuilder[$viewName])) + if (!isset($this->intFieldsBuilder[$view_name_single])) { - $this->intFieldsBuilder[$viewName] = ''; + $this->intFieldsBuilder[$view_name_single] = ''; } - $this->intFieldsBuilder[$viewName] .= ',"' . $name . '"'; + $this->intFieldsBuilder[$view_name_single] .= ',"' . $name . '"'; } // set all dynamic field of this view if ($typeName != 'category' && $typeName != 'repeatable' && $typeName != 'subform' && !in_array($name, $this->defaultFields)) { - if (!isset($this->dynamicfieldsBuilder[$viewName])) + if (!isset($this->dynamicfieldsBuilder[$view_name_single])) { - $this->dynamicfieldsBuilder[$viewName] = ''; + $this->dynamicfieldsBuilder[$view_name_single] = ''; } - if (isset($this->dynamicfieldsBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->dynamicfieldsBuilder[$viewName])) + if (isset($this->dynamicfieldsBuilder[$view_name_single]) && ComponentbuilderHelper::checkString($this->dynamicfieldsBuilder[$view_name_single])) { - $this->dynamicfieldsBuilder[$viewName] .= ',"' . $name . '":"' . $name . '"'; + $this->dynamicfieldsBuilder[$view_name_single] .= ',"' . $name . '":"' . $name . '"'; } else { - $this->dynamicfieldsBuilder[$viewName] .= '"' . $name . '":"' . $name . '"'; + $this->dynamicfieldsBuilder[$view_name_single] .= '"' . $name . '":"' . $name . '"'; } } // TODO we may need to add a switch instead (since now it uses the first editor field) // set the main(biggest) text field of this view if ($typeName === 'editor') { - if (!isset($this->maintextBuilder[$viewName]) || !ComponentbuilderHelper::checkString($this->maintextBuilder[$viewName])) + if (!isset($this->maintextBuilder[$view_name_single]) || !ComponentbuilderHelper::checkString($this->maintextBuilder[$view_name_single])) { - $this->maintextBuilder[$viewName] = $name; + $this->maintextBuilder[$view_name_single] = $name; } } // set the custom builder if (ComponentbuilderHelper::checkArray($custom) && $typeName != 'category' && $typeName != 'repeatable' && $typeName != 'subform') { - $this->customBuilder[$listViewName][] = array('type' => $typeName, 'code' => $name, 'lang' => $listLangName, 'custom' => $custom, 'method' => $field['settings']->store); + $this->customBuilder[$view_name_list][] = array('type' => $typeName, 'code' => $name, 'lang' => $listLangName, 'custom' => $custom, 'method' => $field['settings']->store); // set the custom fields needed in content type data - if (!isset($this->customFieldLinksBuilder[$viewName])) + if (!isset($this->customFieldLinksBuilder[$view_name_single])) { - $this->customFieldLinksBuilder[$viewName] = ''; + $this->customFieldLinksBuilder[$view_name_single] = ''; } // only load this if table is set if (isset($custom['table']) && ComponentbuilderHelper::checkString($custom['table'])) { - $this->customFieldLinksBuilder[$viewName] .= ',{"sourceColumn": "' . $name . '","targetTable": "' . $custom['table'] . '","targetColumn": "' . $custom['id'] . '","displayColumn": "' . $custom['text'] . '"}'; + $this->customFieldLinksBuilder[$view_name_single] .= ',{"sourceColumn": "' . $name . '","targetTable": "' . $custom['table'] . '","targetColumn": "' . $custom['id'] . '","displayColumn": "' . $custom['text'] . '"}'; } // build script switch for user if ($custom['extends'] === 'user') @@ -2032,24 +2499,24 @@ class Fields extends Structure // setup gategory for this view if ($typeName === 'category') { - if (isset($this->catOtherName[$listViewName]) && ComponentbuilderHelper::checkArray($this->catOtherName[$listViewName])) + if (isset($this->catOtherName[$view_name_list]) && ComponentbuilderHelper::checkArray($this->catOtherName[$view_name_list])) { - $otherViews = $this->catOtherName[$listViewName]['views']; - $otherView = $this->catOtherName[$listViewName]['view']; + $otherViews = $this->catOtherName[$view_name_list]['views']; + $otherView = $this->catOtherName[$view_name_list]['view']; } else { - $otherViews = $listViewName; - $otherView = $viewName; + $otherViews = $view_name_list; + $otherView = $view_name_single; } - $this->categoryBuilder[$listViewName] = array('code' => $name, 'name' => $listLangName); + $this->categoryBuilder[$view_name_list] = array('code' => $name, 'name' => $listLangName); // also set code name for title alias fix - $this->catCodeBuilder[$viewName] = array('code' => $name, 'views' => $otherViews, 'view' => $otherView); + $this->catCodeBuilder[$view_name_single] = array('code' => $name, 'views' => $otherViews, 'view' => $otherView); } // setup checkbox for this view if ($typeName === 'checkbox' || (ComponentbuilderHelper::checkArray($custom) && isset($custom['extends']) && $custom['extends'] === 'checkboxes')) { - $this->checkboxBuilder[$viewName][] = $name; + $this->checkboxBuilder[$view_name_single][] = $name; } // setup checkboxes and other json items for this view if (($typeName === 'subform' || $typeName === 'checkboxes' || $multiple || $field['settings']->store != 0) && $typeName != 'tag') @@ -2058,39 +2525,45 @@ class Fields extends Structure { case 1: // JSON_STRING_ENCODE - $this->jsonStringBuilder[$viewName][] = $name; + $this->jsonStringBuilder[$view_name_single][] = $name; // Site settings of each field if needed - $this->buildSiteFieldData($viewName, $name, 'json', $typeName); + $this->buildSiteFieldData($view_name_single, $name, 'json', $typeName); break; case 2: // BASE_SIXTY_FOUR - $this->base64Builder[$viewName][] = $name; + $this->base64Builder[$view_name_single][] = $name; // Site settings of each field if needed - $this->buildSiteFieldData($viewName, $name, 'base64', $typeName); + $this->buildSiteFieldData($view_name_single, $name, 'base64', $typeName); break; case 3: // BASIC_ENCRYPTION_LOCALKEY - $this->basicEncryptionBuilder[$viewName][] = $name; + $this->basicEncryptionBuilder[$view_name_single][] = $name; // Site settings of each field if needed - $this->buildSiteFieldData($viewName, $name, 'basic_encryption', $typeName); + $this->buildSiteFieldData($view_name_single, $name, 'basic_encryption', $typeName); break; case 4: - // ADVANCE_ENCRYPTION_VDMKEY - $this->advancedEncryptionBuilder[$viewName][] = $name; + // WHMCS_ENCRYPTION_VDMKEY + $this->whmcsEncryptionBuilder[$view_name_single][] = $name; // Site settings of each field if needed - $this->buildSiteFieldData($viewName, $name, 'advance_encryption', $typeName); + $this->buildSiteFieldData($view_name_single, $name, 'whmcs_encryption', $typeName); + break; + case 5: + // MEDIUM_ENCRYPTION_LOCALFILE + $this->mediumEncryptionBuilder[$view_name_single][] = $name; + // Site settings of each field if needed + $this->buildSiteFieldData($view_name_single, $name, 'medium_encryption', $typeName); break; default: // JSON_ARRAY_ENCODE - $this->jsonItemBuilder[$viewName][] = $name; + $this->jsonItemBuilder[$view_name_single][] = $name; // Site settings of each field if needed - $this->buildSiteFieldData($viewName, $name, 'json', $typeName); + $this->buildSiteFieldData($view_name_single, $name, 'json', $typeName); break; } // just a heads-up for usergroups set to multiple if ($typeName === 'usergroup') { - $this->buildSiteFieldData($viewName, $name, 'json', $typeName); + $this->buildSiteFieldData($view_name_single, $name, 'json', $typeName); } // load the json list display fix @@ -2098,47 +2571,47 @@ class Fields extends Structure { if (ComponentbuilderHelper::checkArray($options)) { - $this->getItemsMethodListStringFixBuilder[$viewName][] = array('name' => $name, 'type' => $typeName, 'translation' => true, 'custom' => $custom, 'method' => $field['settings']->store); + $this->getItemsMethodListStringFixBuilder[$view_name_single][] = array('name' => $name, 'type' => $typeName, 'translation' => true, 'custom' => $custom, 'method' => $field['settings']->store); } else { - $this->getItemsMethodListStringFixBuilder[$viewName][] = array('name' => $name, 'type' => $typeName, 'translation' => false, 'custom' => $custom, 'method' => $field['settings']->store); + $this->getItemsMethodListStringFixBuilder[$view_name_single][] = array('name' => $name, 'type' => $typeName, 'translation' => false, 'custom' => $custom, 'method' => $field['settings']->store); } } // if subform the values must revert to array if ('subform' === $typeName) { - $this->jsonItemBuilderArray[$viewName][] = $name; + $this->jsonItemBuilderArray[$view_name_single][] = $name; } } // build the data for the export & import methods $typeName === 'repeatable' || if (($typeName === 'checkboxes' || $multiple || $field['settings']->store != 0) && !ComponentbuilderHelper::checkArray($options)) { - $this->getItemsMethodEximportStringFixBuilder[$viewName][] = array('name' => $name, 'type' => $typeName, 'translation' => false, 'custom' => $custom, 'method' => $field['settings']->store); + $this->getItemsMethodEximportStringFixBuilder[$view_name_single][] = array('name' => $name, 'type' => $typeName, 'translation' => false, 'custom' => $custom, 'method' => $field['settings']->store); } // check if field should be added to uikit - $this->buildSiteFieldData($viewName, $name, 'uikit', $typeName); + $this->buildSiteFieldData($view_name_single, $name, 'uikit', $typeName); // load the selection translation fix if (ComponentbuilderHelper::checkArray($options) && (isset($field['list']) && $field['list'] == 1) && $typeName != 'repeatable' && $typeName != 'subform') { - $this->selectionTranslationFixBuilder[$listViewName][$name] = $options; + $this->selectionTranslationFixBuilder[$view_name_list][$name] = $options; } // build the sort values if ((isset($field['sort']) && $field['sort'] == 1) && (isset($field['list']) && $field['list'] == 1) && (!$multiple && $typeName != 'checkbox' && $typeName != 'checkboxes' && $typeName != 'repeatable' && $typeName != 'subform')) { - $this->sortBuilder[$listViewName][] = array('type' => $typeName, 'code' => $name, 'lang' => $listLangName, 'custom' => $custom, 'options' => $options); + $this->sortBuilder[$view_name_list][] = array('type' => $typeName, 'code' => $name, 'lang' => $listLangName, 'custom' => $custom, 'options' => $options); } // build the search values if (isset($field['search']) && $field['search'] == 1) { $_list = (isset($field['list'])) ? $field['list'] : 0; - $this->searchBuilder[$listViewName][] = array('type' => $typeName, 'code' => $name, 'custom' => $custom, 'list' => $_list); + $this->searchBuilder[$view_name_list][] = array('type' => $typeName, 'code' => $name, 'custom' => $custom, 'list' => $_list); } // build the filter values if ((isset($field['filter']) && $field['filter'] == 1) && (isset($field['list']) && $field['list'] == 1) && (!$multiple && $typeName != 'checkbox' && $typeName != 'checkboxes' && $typeName != 'repeatable' && $typeName != 'subform')) { - $this->filterBuilder[$listViewName][] = array('type' => $typeName, 'code' => $name, 'lang' => $listLangName, 'database' => $viewName, 'function' => ComponentbuilderHelper::safeString($name, 'F'), 'custom' => $custom, 'options' => $options); + $this->filterBuilder[$view_name_list][] = array('type' => $typeName, 'code' => $name, 'lang' => $listLangName, 'database' => $view_name_single, 'function' => ComponentbuilderHelper::safeString($name, 'F'), 'custom' => $custom, 'options' => $options); } // build the layout @@ -2152,10 +2625,10 @@ class Fields extends Structure // set to publishing tab $tabName = 'publishing'; } - $this->setLayoutBuilder($viewName, $tabName, $name, $field); + $this->setLayoutBuilder($view_name_single, $tabName, $name, $field); } - public function setCustomFieldTypeFile($data, $viewName_list, $viewName_single) + public function setCustomFieldTypeFile($data, $view_name_list, $view_name_single) { // make sure it is not already been build or if it is prime if ((isset($data['custom']['prime_php']) && $data['custom']['prime_php'] == 1) || !isset($this->fileContentDynamic['customfield_' . $data['type']]) || !ComponentbuilderHelper::checkArray($this->fileContentDynamic['customfield_' . $data['type']])) @@ -2177,10 +2650,10 @@ class Fields extends Structure '###CODE###' => $data['code'], '###component###' => $this->fileContentStatic['###component###'], '###Component###' => $this->fileContentStatic['###Component###'], - '###view_type###' => $viewName_single . '_' . $data['type'], + '###view_type###' => $view_name_single . '_' . $data['type'], '###type###' => $data['type'], - '###view###' => $viewName_single, - '###views###' => $viewName_list + '###view###' => $view_name_single, + '###views###' => $view_name_list ); // now load the php script if (isset($data['custom']['php']) && ComponentbuilderHelper::checkArray($data['custom']['php'])) @@ -2395,8 +2868,6 @@ class Fields extends Structure $xml = simplexml_import_dom($domXML); break; } - // count the dynamic fields created - $this->fieldCount++; } /** diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index f6e11d16c..6de1a6050 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -255,7 +255,7 @@ class Interpretation extends Fields $this->fileContentStatic['###HELPER_SITE_LICENSE_LOCK###'] = $this->setHelperLicenseLock($_VDM, 'site'); $this->fileContentStatic['###HELPER_LICENSE_LOCK###'] = $this->setHelperLicenseLock($_VDM, 'admin'); $this->fileContentStatic['###LICENSE_LOCKED_INT###'] = $this->setInitLicenseLock($_VDM); - $this->fileContentStatic['###LICENSE_LOCKED_DEFINED###'] = PHP_EOL . PHP_EOL . 'defined(\'' . $_VDM . '\') or die(JText:'.':_(\'NIE_REG_NIE\'));'; + $this->fileContentStatic['###LICENSE_LOCKED_DEFINED###'] = PHP_EOL . PHP_EOL . 'defined(\'' . $_VDM . '\') or die(JText:' . ':_(\'NIE_REG_NIE\'));'; } } else @@ -300,7 +300,7 @@ class Interpretation extends Fields $statment[] = PHP_EOL . "\t\tif (!" . $thIIS . "->" . $boolMethod . "())"; $statment[] = "\t\t{"; $statment[] = "\t\t\t\$app = JFactory::getApplication();"; - $statment[] = "\t\t\t\$app->enqueueMessage(JText:".":_('NIE_REG_NIE'), 'error');"; + $statment[] = "\t\t\t\$app->enqueueMessage(JText:" . ":_('NIE_REG_NIE'), 'error');"; $statment[] = "\t\t\t\$app->redirect('index.php');"; $statment[] = "\t\t\treturn false;"; $statment[] = "\t\t}"; @@ -377,7 +377,7 @@ class Interpretation extends Fields return implode(PHP_EOL, $init); } - public function setVDMCryption() + public function setWHMCSCryption() { // make sure we have the correct file if (isset($this->componentData->whmcs_key) && ComponentbuilderHelper::checkString($this->componentData->whmcs_key)) @@ -385,7 +385,7 @@ class Interpretation extends Fields // Get the basic encryption. $basickey = ComponentbuilderHelper::getCryptKey('basic'); // Get the encryption object. - $basic = new FOFEncryptAes($basickey, 128); + $basic = new FOFEncryptAes($basickey); if (!empty($this->componentData->whmcs_key) && $basickey && !is_numeric($this->componentData->whmcs_key) && $this->componentData->whmcs_key === base64_encode(base64_decode($this->componentData->whmcs_key, true))) { // basic decrypt data whmcs_key. @@ -398,9 +398,9 @@ class Interpretation extends Fields $theKey = base64_encode(serialize($key)); // set the script $encrypt[] = "/**"; - $encrypt[] = "* " . $this->setLine(__LINE__) . "VDM Class "; + $encrypt[] = "* " . $this->setLine(__LINE__) . "WHMCS Class "; $encrypt[] = "**/"; - $encrypt[] = PHP_EOL . "class VDM"; + $encrypt[] = PHP_EOL . "class WHMCS"; $encrypt[] = "{"; $encrypt[] = "\tpublic \$_key = false;"; $encrypt[] = "\tpublic \$_is = false;"; @@ -570,85 +570,159 @@ class Interpretation extends Fields { // ###ENCRYPT_FILE### $this->fileContentStatic['###ENCRYPT_FILE###'] = ''; - if ((isset($this->basicEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder)) || (isset($this->advancedEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder)) || $this->componentData->add_license) + if ((isset($this->basicEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder)) || + (isset($this->mediumEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->mediumEncryptionBuilder)) || + (isset($this->whmcsEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->whmcsEncryptionBuilder)) || + $this->componentData->add_license) { - if (isset($this->advancedEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder) || $this->componentData->add_license) + if (isset($this->whmcsEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->whmcsEncryptionBuilder) || $this->componentData->add_license) { - // set advanced encrypt file into place - $target = array('admin' => 'encrypt'); - $done = $this->buildDynamique($target, 'encrypt'); - // the text for the file ###VDM_ENCRYPTION_BODY### - $this->fileContentDynamic['encrypt']['###VDM_ENCRYPTION_BODY###'] = $this->setVDMCryption(); + // set whmcs encrypt file into place + $target = array('admin' => 'whmcs'); + $done = $this->buildDynamique($target, 'whmcs'); + // the text for the file ###WHMCS_ENCRYPTION_BODY### + $this->fileContentDynamic['whmcs']['###WHMCS_ENCRYPTION_BODY###'] = $this->setWHMCSCryption(); // ###ENCRYPT_FILE### - $this->fileContentStatic['###ENCRYPT_FILE###'] = PHP_EOL . "\t\t\tvdm.php"; + $this->fileContentStatic['###WHMCS_ENCRYPT_FILE###'] = PHP_EOL . "\t\t\twhmcs.php"; } // get component name $component = $this->fileContentStatic['###component###']; // set the getCryptKey function to the helper class $function = array(); - if (isset($this->basicEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder)) + // start building the getCryptKey function/class method + $function[] = PHP_EOL . PHP_EOL . "\t/**"; + $function[] = "\t * Get The Encryption Keys"; + $function[] = "\t *"; + $function[] = "\t * @param string \$type The type of key"; + $function[] = "\t * @param string/bool \$default The return value if no key was found"; + $function[] = "\t *"; + $function[] = "\t * @return string On success"; + $function[] = "\t *"; + $function[] = "\t **/"; + $function[] = "\tpublic static function getCryptKey(\$type, \$default = false)"; + $function[] = "\t{"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Get the global params"; + $function[] = "\t\t\$params = JComponentHelper::getParams('com_" . $component . "', true);"; + // add the basic option + if (isset($this->basicEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder)) { - $function[] = PHP_EOL . PHP_EOL . "\tpublic static function getCryptKey(\$type, \$default = null)"; - $function[] = "\t{"; - $function[] = "\t\t//" . $this->setLine(__LINE__) . " Get the global params"; - $function[] = "\t\t\$params = JComponentHelper::getParams('com_" . $component . "', true);"; - $function[] = "\t\tif ('advanced' === \$type)"; - $function[] = "\t\t{"; - $function[] = "\t\t\t\$advanced_key = \$params->get('advanced_key', \$default);"; - $function[] = "\t\t\tif (\$advanced_key)"; - $function[] = "\t\t\t{"; - $function[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " load the file"; - $function[] = "\t\t\t\tJLoader::import( 'vdm', JPATH_COMPONENT_ADMINISTRATOR);"; - $function[] = PHP_EOL . "\t\t\t\t\$the = new VDM(\$advanced_key);"; - $function[] = PHP_EOL . "\t\t\t\treturn \$the->_key;"; - $function[] = "\t\t\t}"; - $function[] = "\t\t}"; - $function[] = "\t\telseif ('basic' === \$type)"; - $function[] = "\t\t{"; - $function[] = "\t\t\t\$basic_key = \$params->get('basic_key', \$default);"; - $function[] = "\t\t\tif (\$basic_key)"; - $function[] = "\t\t\t{"; - $function[] = "\t\t\t\treturn \$basic_key;"; - $function[] = "\t\t\t}"; - $function[] = "\t\t}"; - $function[] = "\t\treturn false;"; - $function[] = "\t}"; - } - elseif (isset($this->advancedEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder)) - { - $function[] = PHP_EOL . PHP_EOL . "\tpublic static function getCryptKey(\$type, \$default = null)"; - $function[] = "\t{"; - $function[] = "\t\tif ('advanced' === \$type)"; - $function[] = "\t\t{"; - $function[] = "\t\t\t//" . $this->setLine(__LINE__) . " Get the global params"; - $function[] = "\t\t\t\$params = JComponentHelper::getParams('com_" . $component . "', true);"; - $function[] = "\t\t\t\$advanced_key = \$params->get('advanced_key', \$default);"; - $function[] = "\t\t\tif (\$advanced_key)"; - $function[] = "\t\t\t{"; - $function[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " load the file"; - $function[] = "\t\t\t\tJLoader::import( 'vdm', JPATH_COMPONENT_ADMINISTRATOR);"; - $function[] = PHP_EOL . "\t\t\t\t\$the = new VDM(\$advanced_key);"; - $function[] = PHP_EOL . "\t\t\t\treturn \$the->_key;"; - $function[] = "\t\t\t}"; - $function[] = "\t\t}"; - $function[] = "\t\treturn false;"; - $function[] = "\t}"; - } - elseif (isset($this->basicEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder)) - { - $function[] = PHP_EOL . PHP_EOL . "\tpublic static function getCryptKey(\$type, \$default = null)"; - $function[] = "\t{"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Basic Encryption Type"; $function[] = "\t\tif ('basic' === \$type)"; $function[] = "\t\t{"; - $function[] = "\t\t\t//" . $this->setLine(__LINE__) . " Get the global params"; - $function[] = "\t\t\t\$params = JComponentHelper::getParams('com_" . $component . "', true);"; $function[] = "\t\t\t\$basic_key = \$params->get('basic_key', \$default);"; - $function[] = "\t\t\tif (\$basic_key)"; + $function[] = "\t\t\tif (self::checkString(\$basic_key))"; $function[] = "\t\t\t{"; $function[] = "\t\t\t\treturn \$basic_key;"; $function[] = "\t\t\t}"; $function[] = "\t\t}"; - $function[] = "\t\treturn false;"; + } + // add the medium option + if (isset($this->mediumEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->mediumEncryptionBuilder)) + { + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Medium Encryption Type"; + $function[] = "\t\tif ('medium' === \$type)"; + $function[] = "\t\t{"; + $function[] = "\t\t\t//" . $this->setLine(__LINE__) . " check if medium key is already loaded."; + $function[] = "\t\t\tif (self::checkString(self::\$mediumCryptKey))"; + $function[] = "\t\t\t{"; + $function[] = "\t\t\t\treturn (self::\$mediumCryptKey !== 'none') ? trim(self::\$mediumCryptKey) : \$default;"; + $function[] = "\t\t\t}"; + $function[] = "\t\t\t//" . $this->setLine(__LINE__) . " get the path to the medium encryption key."; + $function[] = "\t\t\t\$medium_key_path = \$params->get('medium_key_path', null);"; + $function[] = "\t\t\tif (self::checkString(\$medium_key_path))"; + $function[] = "\t\t\t{"; + $function[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " load the key from the file."; + $function[] = "\t\t\t\tif (self::getMediumCryptKey(\$medium_key_path))"; + $function[] = "\t\t\t\t{"; + $function[] = "\t\t\t\t\treturn trim(self::\$mediumCryptKey);"; + $function[] = "\t\t\t\t}"; + $function[] = "\t\t\t}"; + $function[] = "\t\t}"; + } + // add the whmcs option + if (isset($this->whmcsEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->whmcsEncryptionBuilder) || $this->componentData->add_license) + { + $function[] = "\t\t//" . $this->setLine(__LINE__) . " WHMCS Encryption Type"; + $function[] = "\t\tif ('whmcs' === \$type || 'advanced' === \$type)"; + $function[] = "\t\t{"; + $function[] = "\t\t\t\$key = \$params->get('advanced_key', \$default);"; + $function[] = "\t\t\tif (self::checkString(\$key))"; + $function[] = "\t\t\t{"; + $function[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " load the file"; + $function[] = "\t\t\t\tJLoader::import( 'whmcs', JPATH_COMPONENT_ADMINISTRATOR);"; + $function[] = PHP_EOL . "\t\t\t\t\$the = new WHMCS(\$key);"; + $function[] = PHP_EOL . "\t\t\t\treturn \$the->_key;"; + $function[] = "\t\t\t}"; + $function[] = "\t\t}"; + } + // end the function + $function[] = PHP_EOL . "\t\treturn \$default;"; + $function[] = "\t}"; + // set the getMediumCryptKey class/method + if (isset($this->mediumEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->mediumEncryptionBuilder)) + { + $function[] = PHP_EOL . PHP_EOL . "\t/**"; + $function[] = "\t * The Medium Encryption Key"; + $function[] = "\t *"; + $function[] = "\t * @var string/bool"; + $function[] = "\t **/"; + $function[] = "\tprotected static \$mediumCryptKey = false;"; + $function[] = PHP_EOL . "\t/**"; + $function[] = "\t * Get The Medium Encryption Key"; + $function[] = "\t *"; + $function[] = "\t * @param string \$path The path to the medium crypt key folder"; + $function[] = "\t *"; + $function[] = "\t * @return string On success"; + $function[] = "\t *"; + $function[] = "\t **/"; + $function[] = "\tpublic static function getMediumCryptKey(\$path)"; + $function[] = "\t{"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Prep the path a little"; + $function[] = "\t\t\$path = '/'. trim(str_replace('//', '/', \$path), '/');"; + $function[] = "\t\tjimport('joomla.filesystem.folder');"; + $function[] = "\t\t///" . $this->setLine(__LINE__) . " Check if folder exist"; + $function[] = "\t\tif (!JFolder::exists(\$path))"; + $function[] = "\t\t{"; + $function[] = "\t\t\t//" . $this->setLine(__LINE__) . " Lock key."; + $function[] = "\t\t\tself::\$mediumCryptKey = 'none';"; + $function[] = "\t\t\t//" . $this->setLine(__LINE__) . " Set the error message."; + $function[] = "\t\t\tJFactory::getApplication()->enqueueMessage(JText::_('" . $this->langPrefix . "_CONFIG_MEDIUM_KEY_PATH_ERROR'), 'Error');"; + $function[] = "\t\t\treturn false;"; + $function[] = "\t\t}"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Create FileName and set file path"; + $function[] = "\t\t\$filePath = \$path.'/.'.md5('medium_crypt_key_file');"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Check if we already have the file set"; + $function[] = "\t\tif ((self::\$mediumCryptKey = @file_get_contents(\$filePath)) !== FALSE)"; + $function[] = "\t\t{"; + $function[] = "\t\t\treturn true;"; + $function[] = "\t\t}"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Set the key for the first time"; + $function[] = "\t\tself::\$mediumCryptKey = self::randomkey(128);"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Open the key file"; + $function[] = "\t\t\$fh = @fopen(\$filePath, 'w');"; + $function[] = "\t\tif (!is_resource(\$fh))"; + $function[] = "\t\t{"; + $function[] = "\t\t\t//" . $this->setLine(__LINE__) . " Lock key."; + $function[] = "\t\t\tself::\$mediumCryptKey = 'none';"; + $function[] = "\t\t\t//" . $this->setLine(__LINE__) . " Set the error message."; + $function[] = "\t\t\tJFactory::getApplication()->enqueueMessage(JText::_('" . $this->langPrefix . "_CONFIG_MEDIUM_KEY_PATH_ERROR'), 'Error');"; + $function[] = "\t\t\treturn false;"; + $function[] = "\t\t}"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Write to the key file"; + $function[] = "\t\tif (!fwrite(\$fh, self::\$mediumCryptKey))"; + $function[] = "\t\t{"; + $function[] = "\t\t\t//" . $this->setLine(__LINE__) . " Close key file."; + $function[] = "\t\t\tfclose(\$fh);"; + $function[] = "\t\t\t//" . $this->setLine(__LINE__) . " Lock key."; + $function[] = "\t\t\tself::\$mediumCryptKey = 'none';"; + $function[] = "\t\t\t//" . $this->setLine(__LINE__) . " Set the error message."; + $function[] = "\t\t\tJFactory::getApplication()->enqueueMessage(JText::_('" . $this->langPrefix . "_CONFIG_MEDIUM_KEY_PATH_ERROR'), 'Error');"; + $function[] = "\t\t\treturn false;"; + $function[] = "\t\t}"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Close key file."; + $function[] = "\t\tfclose(\$fh);"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Key is set."; + $function[] = "\t\treturn true;"; $function[] = "\t}"; } // return the help methods @@ -1614,33 +1688,30 @@ class Interpretation extends Fields { if (strpos($get['selection']['select'], $field) !== false) { - if ($array['decode'] === 'json') + if ('json' === $array['decode']) { $if = PHP_EOL . "\t" . $tab . "\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkJson(" . $string . "->" . $field . "))" . PHP_EOL . "\t" . $tab . "\t{"; // json_decode $decoder = $string . "->" . $field . " = json_decode(" . $string . "->" . $field . ", true);"; - // TODO Use the type of field to prepare it even more for use in the view } - elseif ($array['decode'] === 'base64') + elseif ('base64' === $array['decode']) { $if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ")))" . PHP_EOL . "\t" . $tab . "\t{"; // base64_decode $decoder = $string . "->" . $field . " = base64_decode(" . $string . "->" . $field . ");"; - // TODO Use the type of field to prepare it even more for use in the view } - elseif ($array['decode'] === 'basic_encryption') + elseif (strpos($array['decode'], '_encryption') !== false) { - $if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && \$basickey && !is_numeric(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ", true)))" . PHP_EOL . "\t" . $tab . "\t{"; - // basic decryption - $decoder = $string . "->" . $field . " = rtrim(\$basic->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");"; - $this->siteDecrypt['basic'][$code] = true; - } - elseif ($array['decode'] === 'advance_encryption') - { - $if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && \$advancedkey && !is_numeric(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ", true)))" . PHP_EOL . "\t" . $tab . "\t{"; - // advanced decryption - $decoder = $string . "->" . $field . " = rtrim(\$advanced->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");"; - $this->siteDecrypt['advanced'][$code] = true; + foreach ($this->cryptionTypes as $cryptionType) + { + if ($cryptionType . '_encryption' === $array['decode']) + { + $if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && \$" . $cryptionType . "key && !is_numeric(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ", true)))" . PHP_EOL . "\t" . $tab . "\t{"; + // set decryption + $decoder = $string . "->" . $field . " = rtrim(\$" . $cryptionType . "->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");"; + $this->siteDecrypt[$cryptionType][$code] = true; + } + } } // build decoder string @@ -1671,7 +1742,7 @@ class Interpretation extends Fields $fieldPrepare .= PHP_EOL . "\t" . $tab . "\t\$_" . $field . " = new stdClass();"; $fieldPrepare .= PHP_EOL . "\t" . $tab . "\t\$_" . $field . '->text =& ' . $string . '->' . $field . '; //' . $this->setLine(__LINE__) . ' value must be in text'; $fieldPrepare .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Since all values are now in text (Joomla Limitation), we also add the field name (" . $field . ") to context"; - $fieldPrepare .= PHP_EOL . "\t" . $tab . "\t" . '$this->_dispatcher->trigger("onContentPrepare",array(\'' . $context . '.' . $field . '\',&$_' . $field . ',&$this->params));'; // we can improve the params later (TODO) + $fieldPrepare .= PHP_EOL . "\t" . $tab . "\t" . '$this->_dispatcher->trigger("onContentPrepare", array(\'' . $context . '.' . $field . '\', &$_' . $field . ', &$this->params, 0));'; // we can improve the params later (TODO) } } // load dispatcher @@ -2070,7 +2141,7 @@ class Interpretation extends Fields { $this->langContent['site'][$langKeyWord] = 'Not authorised to view ' . $view['settings']->code . '!'; } - $accessCheck[] = "\t\t\t\$app->enqueueMessage(JText:".":_('" . $langKeyWord . "'), 'error');"; + $accessCheck[] = "\t\t\t\$app->enqueueMessage(JText:" . ":_('" . $langKeyWord . "'), 'error');"; $accessCheck[] = $redirectMessage; $accessCheck[] = "\t\t\t\$app->redirect(" . $redirectString . ");"; $accessCheck[] = "\t\t\treturn false;"; @@ -2093,10 +2164,20 @@ class Interpretation extends Fields { if (ComponentbuilderHelper::checkObject($get)) { - $this->siteDecrypt['basic'][$code] = false; - $this->siteDecrypt['advanced'][$code] = false; - - $getItem = PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get a db connection."; + // set the site decription switches + foreach ($this->cryptionTypes as $cryptionType) + { + $this->siteDecrypt[$cryptionType][$code] = false; + } + // start the get Item + $getItem = ''; + // set before item php + if (isset($get->add_php_before_getitem) && $get->add_php_before_getitem == 1 && isset($get->php_before_getitem) && ComponentbuilderHelper::checkString($get->php_before_getitem)) + { + $getItem .= $this->setPlaceholders($get->php_before_getitem, $this->placeholders); + } + // start loadin the get Item + $getItem .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get a db connection."; $getItem .= PHP_EOL . "\t" . $tab . "\t\$db = JFactory::getDbo();"; $getItem .= PHP_EOL . PHP_EOL . $tab . "\t\t//" . $this->setLine(__LINE__) . " Create a new query object."; $getItem .= PHP_EOL . "\t" . $tab . "\t\$query = \$db->getQuery(true);"; @@ -2113,6 +2194,11 @@ class Interpretation extends Fields $getItem .= PHP_EOL . "\t" . $tab . "\t\$db->setQuery(\$query);"; $getItem .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Load the results as a stdClass object."; $getItem .= PHP_EOL . "\t" . $tab . "\t\$data = \$db->loadObject();"; + // set after item php + if (isset($get->add_php_after_getitem) && $get->add_php_after_getitem == 1 && isset($get->php_after_getitem) && ComponentbuilderHelper::checkString($get->php_after_getitem)) + { + $getItem .= $this->setPlaceholders($get->php_after_getitem, $this->placeholders); + } $getItem .= PHP_EOL . PHP_EOL . $tab . "\t\tif (empty(\$data))"; $getItem .= PHP_EOL . "\t" . $tab . "\t{"; if ($type === 'main') @@ -2124,7 +2210,7 @@ class Interpretation extends Fields $this->langContent[$this->lang][$langKeyWoord] = 'Not found, or access denied.'; } $getItem .= PHP_EOL . "\t" . $tab . "\t\t//" . $this->setLine(__LINE__) . " If no data is found redirect to default page and show warning."; - $getItem .= PHP_EOL . "\t" . $tab . "\t\t\$app->enqueueMessage(JText:".":_('" . $langKeyWoord . "'), 'warning');"; + $getItem .= PHP_EOL . "\t" . $tab . "\t\t\$app->enqueueMessage(JText:" . ":_('" . $langKeyWoord . "'), 'warning');"; if ('site' === $this->target) { // check that the default and the redirect page is not the same @@ -2198,27 +2284,20 @@ class Interpretation extends Fields $asBucket[] = $main_get['as']; } } - - if ((isset($this->siteDecrypt['basic'][$code]) && $this->siteDecrypt['basic'][$code]) || (isset($this->siteDecrypt['advanced'][$code]) && $this->siteDecrypt['advanced'][$code])) + // set the scripts + $Component = $this->fileContentStatic['###Component###']; + $script = ''; + foreach ($this->cryptionTypes as $cryptionType) { - $Component = $this->fileContentStatic['###Component###']; - $script = ''; - if (isset($this->siteDecrypt['basic'][$code]) && $this->siteDecrypt['basic'][$code]) + if (isset($this->siteDecrypt[$cryptionType][$code]) && $this->siteDecrypt[$cryptionType][$code]) { - $script .= PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the basic encryption."; - $script .= PHP_EOL . "\t" . $tab . "\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; + $script .= PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption."; + $script .= PHP_EOL . "\t" . $tab . "\t\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');"; $script .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t" . $tab . "\t\$basic = new FOFEncryptAes(\$basickey, 128);"; + $script .= PHP_EOL . "\t" . $tab . "\t\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);"; } - if (isset($this->siteDecrypt['advanced'][$code]) && $this->siteDecrypt['advanced'][$code]) - { - $script .= PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the advanced encryption."; - $script .= PHP_EOL . "\t" . $tab . "\t\$advancedkey = " . $Component . "Helper::getCryptKey('advanced');"; - $script .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t" . $tab . "\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; - } - $getItem = $script . $getItem; } + $getItem = $script . $getItem; // setup Globals $getItem .= $this->setCustomViewGlobals($get->global, '$data', $asBucket, $tab); // setup the custom gets that returns multipal values @@ -2226,7 +2305,7 @@ class Interpretation extends Fields // set calculations if ($get->addcalculation == 1) { - $get->php_calculation = (array) explode(PHP_EOL, $get->php_calculation); + $get->php_calculation = (array) explode(PHP_EOL, $this->setPlaceholders($get->php_calculation, $this->placeholders)); $getItem .= PHP_EOL . "\t" . $tab . "\t" . implode(PHP_EOL . "\t" . $tab . "\t", $get->php_calculation); } if ($type === 'custom') @@ -2300,12 +2379,27 @@ class Interpretation extends Fields $main .= PHP_EOL . "\t\t}"; $main .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the global params"; $main .= PHP_EOL . "\t\t\$globalParams = JComponentHelper::getParams('com_" . $this->fileContentStatic['###component###'] . "', true);"; + // set php before listquery + if (isset($view->add_php_getlistquery) && $view->add_php_getlistquery == 1 && isset($view->php_getlistquery) && ComponentbuilderHelper::checkString($view->php_getlistquery)) + { + $main .= $this->setPlaceholders($view->php_getlistquery, $this->placeholders); + } // ###SITE_GET_LIST_QUERY### <<>> $main .= $this->setCustomViewListQuery($view, $view->code, false); + // set before items php + if (isset($view->add_php_before_getitems) && $view->add_php_before_getitems == 1 && isset($view->php_before_getitems) && ComponentbuilderHelper::checkString($view->php_before_getitems)) + { + $main .= $this->setPlaceholders($view->php_before_getitems, $this->placeholders); + } // load the object list $main .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Reset the query using our newly populated query object."; $main .= PHP_EOL . "\t\t\$db->setQuery(\$query);"; $main .= PHP_EOL . "\t\t\$items = \$db->loadObjectList();"; + // set after items php + if (isset($view->add_php_after_getitems) && $view->add_php_after_getitems == 1 && isset($view->php_after_getitems) && ComponentbuilderHelper::checkString($view->php_after_getitems)) + { + $main .= $this->setPlaceholders($view->php_after_getitems, $this->placeholders); + } $main .= PHP_EOL . PHP_EOL . "\t\tif (empty(\$items))"; $main .= PHP_EOL . "\t\t{"; $main .= PHP_EOL . "\t\t\treturn false;"; @@ -2497,8 +2591,11 @@ class Interpretation extends Fields { foreach ($main_get->custom_get as $get) { - $this->siteDecrypt['basic'][$code] = false; - $this->siteDecrypt['advanced'][$code] = false; + // set the site decription switch + foreach ($this->cryptionTypes as $cryptionType) + { + $this->siteDecrypt[$cryptionType][$code] = false; + } // set the method defaults $default = $this->setCustomViewMethodDefaults($get, $code); // build custom method @@ -2676,26 +2773,20 @@ class Interpretation extends Fields $methods .= PHP_EOL . "\t\treturn false;"; $methods .= PHP_EOL . "\t}"; - if ((isset($this->siteDecrypt['basic'][$code]) && $this->siteDecrypt['basic'][$code]) || (isset($this->siteDecrypt['advanced'][$code]) && $this->siteDecrypt['advanced'][$code])) + // set the script if it was found + $Component = $this->fileContentStatic['###Component###']; + $script = ''; + foreach ($this->cryptionTypes as $cryptionType) { - $Component = $this->fileContentStatic['###Component###']; - $script = ''; - if ($this->siteDecrypt['basic'][$code]) + if (isset($this->siteDecrypt[$cryptionType][$code]) && $this->siteDecrypt[$cryptionType][$code]) { - $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the basic encryption."; - $script .= PHP_EOL . "\t\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; + $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption."; + $script .= PHP_EOL . "\t\t\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');"; $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t\t\$basic = new FOFEncryptAes(\$basickey, 128);" . PHP_EOL; + $script .= PHP_EOL . "\t\t\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);" . PHP_EOL; } - if ($this->siteDecrypt['advanced'][$code]) - { - $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the advanced encryption."; - $script .= PHP_EOL . "\t\t\$advancedkey = " . $Component . "Helper::getCryptKey('advanced');"; - $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);" . PHP_EOL; - } - $methods = str_replace('###CRYPT###', $script, $methods); } + $methods = str_replace('###CRYPT###', $script, $methods); } // insure the crypt placeholder is removed $methods = str_replace('###CRYPT###', '', $methods); @@ -2802,9 +2893,14 @@ class Interpretation extends Fields public function setCustomViewGetItems(&$get, $code) { $getItem = ''; - $this->siteDecrypt['basic'][$code] = false; - $this->siteDecrypt['advanced'][$code] = false; + // set the site decrypt switch + foreach ($this->cryptionTypes as $cryptionType) + { + $this->siteDecrypt[$cryptionType][$code] = false; + } + // set the component name $Component = $this->fileContentStatic['###Component###']; + // start load the get item if (ComponentbuilderHelper::checkObject($get)) { $getItem .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Insure all item fields are adapted where needed."; @@ -2892,26 +2988,19 @@ class Interpretation extends Fields } } - if ($this->siteDecrypt['basic'][$code] || $this->siteDecrypt['advanced'][$code]) + // set the script if found + $script = ''; + foreach ($this->cryptionTypes as $cryptionType) { - $script = ''; - if ($this->siteDecrypt['basic'][$code]) + if ($this->siteDecrypt[$cryptionType][$code]) { - $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the basic encryption."; - $script .= PHP_EOL . "\t\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption."; + $script .= PHP_EOL . "\t\t\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');"; $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t\t\$basic = new FOFEncryptAes(\$basickey, 128);"; + $script .= PHP_EOL . "\t\t\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);"; } - if ($this->siteDecrypt['advanced'][$code]) - { - $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the advanced encryption."; - $script .= PHP_EOL . "\t\t\$advancedkey = " . $Component . "Helper::getCryptKey('advanced');"; - $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; - } - $getItem = $script . $getItem; } - return $getItem; + return $script . $getItem; } public function setCustomViewDisplayMethod(&$view) @@ -4177,37 +4266,23 @@ class Interpretation extends Fields $script .= PHP_EOL . "\t\t\t}"; } } + // get the component name + $Component = $this->fileContentStatic['###Component###']; // decryption - if ((isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view])) || (isset($this->advancedEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder[$view]))) + foreach ($this->cryptionTypes as $cryptionType) { - $Component = $this->fileContentStatic['###Component###']; - if (isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view])) + if (isset($this->{$cryptionType . 'EncryptionBuilder'}[$view]) && ComponentbuilderHelper::checkArray($this->{$cryptionType . 'EncryptionBuilder'}[$view])) { - $script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the basic encryption."; - $script .= PHP_EOL . "\t\t\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; + $script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption."; + $script .= PHP_EOL . "\t\t\t\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');"; $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t\t\t\$basic = new FOFEncryptAes(\$basickey, 128);"; - foreach ($this->basicEncryptionBuilder[$view] as $baseString) + $script .= PHP_EOL . "\t\t\t\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);"; + foreach ($this->{$cryptionType . 'EncryptionBuilder'}[$view] as $baseString) { - $script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $baseString . ") && \$basickey && !is_numeric(\$item->" . $baseString . ") && \$item->" . $baseString . " === base64_encode(base64_decode(\$item->" . $baseString . ", true)))"; + $script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $baseString . ") && \$" . $cryptionType . "key && !is_numeric(\$item->" . $baseString . ") && \$item->" . $baseString . " === base64_encode(base64_decode(\$item->" . $baseString . ", true)))"; $script .= PHP_EOL . "\t\t\t{"; - $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " basic decrypt data " . $baseString . "."; - $script .= PHP_EOL . "\t\t\t\t\$item->" . $baseString . " = rtrim(\$basic->decryptString(\$item->" . $baseString . "), " . '"\0"' . ");"; - $script .= PHP_EOL . "\t\t\t}"; - } - } - if (isset($this->advancedEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder[$view])) - { - $script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the advanced encryption key."; - $script .= PHP_EOL . "\t\t\t\$advancedkey = " . $Component . "Helper::getCryptKey('advanced');"; - $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t\t\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; - foreach ($this->advancedEncryptionBuilder[$view] as $baseString) - { - $script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $baseString . ") && \$advancedkey && !is_numeric(\$item->" . $baseString . ") && \$item->" . $baseString . " === base64_encode(base64_decode(\$item->" . $baseString . ", true)))"; - $script .= PHP_EOL . "\t\t\t{"; - $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " advanced decrypt data " . $baseString . "."; - $script .= PHP_EOL . "\t\t\t\t\$item->" . $baseString . " = rtrim(\$advanced->decryptString(\$item->" . $baseString . "), " . '"\0"' . ");"; + $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " " . $cryptionType . " decrypt data " . $baseString . "."; + $script .= PHP_EOL . "\t\t\t\t\$item->" . $baseString . " = rtrim(\$" . $cryptionType . "->decryptString(\$item->" . $baseString . "), " . '"\0"' . ");"; $script .= PHP_EOL . "\t\t\t}"; } } @@ -4285,36 +4360,21 @@ class Interpretation extends Fields } } // turn string into encrypted string - if ((isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view])) || (isset($this->advancedEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder[$view]))) + $Component = $this->fileContentStatic['###Component###']; + foreach ($this->cryptionTypes as $cryptionType) { - $Component = $this->fileContentStatic['###Component###']; - if (isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view])) + if (isset($this->{$cryptionType . 'EncryptionBuilder'}[$view]) && ComponentbuilderHelper::checkArray($this->{$cryptionType . 'EncryptionBuilder'}[$view])) { - $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the basic encryption key."; - $script .= PHP_EOL . "\t\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption key."; + $script .= PHP_EOL . "\t\t\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');"; $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object"; - $script .= PHP_EOL . "\t\t\$basic = new FOFEncryptAes(\$basickey, 128);"; - foreach ($this->basicEncryptionBuilder[$view] as $baseString) + $script .= PHP_EOL . "\t\t\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);"; + foreach ($this->{$cryptionType . 'EncryptionBuilder'}[$view] as $baseString) { $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Encrypt data " . $baseString . "."; - $script .= PHP_EOL . "\t\tif (isset(\$data['" . $baseString . "']) && \$basickey)"; + $script .= PHP_EOL . "\t\tif (isset(\$data['" . $baseString . "']) && \$" . $cryptionType . "key)"; $script .= PHP_EOL . "\t\t{"; - $script .= PHP_EOL . "\t\t\t\$data['" . $baseString . "'] = \$basic->encryptString(\$data['" . $baseString . "']);"; - $script .= PHP_EOL . "\t\t}"; - } - } - if (isset($this->advancedEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder[$view])) - { - $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the advanced encryption key."; - $script .= PHP_EOL . "\t\t\$advancedkey = " . $Component . "Helper::getCryptKey('advanced');"; - $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object"; - $script .= PHP_EOL . "\t\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; - foreach ($this->advancedEncryptionBuilder[$view] as $baseString) - { - $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Encrypt data " . $baseString . "."; - $script .= PHP_EOL . "\t\tif (isset(\$data['" . $baseString . "']) && \$advancedkey)"; - $script .= PHP_EOL . "\t\t{"; - $script .= PHP_EOL . "\t\t\t\$data['" . $baseString . "'] = \$advanced->encryptString(\$data['" . $baseString . "']);"; + $script .= PHP_EOL . "\t\t\t\$data['" . $baseString . "'] = \$" . $cryptionType . "->encryptString(\$data['" . $baseString . "']);"; $script .= PHP_EOL . "\t\t}"; } } @@ -4586,7 +4646,7 @@ class Interpretation extends Fields $script .= PHP_EOL . "\t\t\t{"; $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " If succesfully remove " . $viewName . " add queued success message."; // TODO lang is not translated - $script .= PHP_EOL . "\t\t\t\t\$app->enqueueMessage(JText:".":_('The (" . $typeAlias . ") type alias was removed from the #__content_type table'));"; + $script .= PHP_EOL . "\t\t\t\t\$app->enqueueMessage(JText:" . ":_('The (" . $typeAlias . ") type alias was removed from the #__content_type table'));"; $script .= PHP_EOL . "\t\t\t}"; // Now remove the related items from contentitem tag map table @@ -4603,7 +4663,7 @@ class Interpretation extends Fields $script .= PHP_EOL . "\t\t\t{"; $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " If succesfully remove " . $viewName . " add queued success message."; // TODO lang is not translated - $script .= PHP_EOL . "\t\t\t\t\$app->enqueueMessage(JText:".":_('The (" . $typeAlias . ") type alias was removed from the #__contentitem_tag_map table'));"; + $script .= PHP_EOL . "\t\t\t\t\$app->enqueueMessage(JText:" . ":_('The (" . $typeAlias . ") type alias was removed from the #__contentitem_tag_map table'));"; $script .= PHP_EOL . "\t\t\t}"; // Now remove the related items from ucm content table @@ -4620,7 +4680,7 @@ class Interpretation extends Fields $script .= PHP_EOL . "\t\t\t{"; $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " If succesfully remove " . $viewName . " add queued success message."; // TODO lang is not translated - $script .= PHP_EOL . "\t\t\t\t\$app->enqueueMessage(JText:".":_('The (" . $typeAlias . ") type alias was removed from the #__ucm_content table'));"; + $script .= PHP_EOL . "\t\t\t\t\$app->enqueueMessage(JText:" . ":_('The (" . $typeAlias . ") type alias was removed from the #__ucm_content table'));"; $script .= PHP_EOL . "\t\t\t}"; // setup the foreach loop of ids @@ -4657,8 +4717,8 @@ class Interpretation extends Fields $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " If All related items was removed queued success message."; // TODO lang is not translated - $script .= PHP_EOL . "\t\t\$app->enqueueMessage(JText:".":_('All related items was removed from the #__ucm_base table'));"; - $script .= PHP_EOL . "\t\t\$app->enqueueMessage(JText:".":_('All related items was removed from the #__ucm_history table'));"; + $script .= PHP_EOL . "\t\t\$app->enqueueMessage(JText:" . ":_('All related items was removed from the #__ucm_base table'));"; + $script .= PHP_EOL . "\t\t\$app->enqueueMessage(JText:" . ":_('All related items was removed from the #__ucm_history table'));"; // finaly remove the assets from the assets table $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Remove " . $component . " assets from the assets table"; $script .= PHP_EOL . "\t\t\$" . $component . "_condition = array( \$db->quoteName('name') . ' LIKE ' . \$db->quote('com_" . $component . "%') );"; @@ -4672,7 +4732,7 @@ class Interpretation extends Fields $script .= PHP_EOL . "\t\t{"; $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " If succesfully remove " . $component . " add queued success message."; // TODO lang is not translated - $script .= PHP_EOL . "\t\t\t\$app->enqueueMessage(JText:".":_('All related items was removed from the #__assets table'));"; + $script .= PHP_EOL . "\t\t\t\$app->enqueueMessage(JText:" . ":_('All related items was removed from the #__assets table'));"; $script .= PHP_EOL . "\t\t}"; // done $script .= PHP_EOL; @@ -4682,6 +4742,66 @@ class Interpretation extends Fields return $script; } + public function setMoveFolderScript() + { + if ($this->setMoveFolders) + { + // reset script + $script = array(); + $script[] = "\t\t//" . $this->setLine(__LINE__) . " We check if we have dynamic folders to copy"; + $script[] = "\t\t\$this->setDynamicF0ld3rs(\$app, \$parent);"; + // done + return PHP_EOL . implode(PHP_EOL, $script); + } + return ''; + } + + public function setMoveFolderMethod() + { + if ($this->setMoveFolders) + { + // reset script + $script = array(); + $script[] = "\t/**"; + $script[] = "\t * Method to set/copy dynamic folders into place (use with caution)"; + $script[] = "\t *"; + $script[] = "\t * @return void"; + $script[] = "\t */"; + $script[] = "\tprotected function setDynamicF0ld3rs(\$app, \$parent)"; + $script[] = "\t{"; + $script[] = "\t\t//" . $this->setLine(__LINE__) . " get the instalation path"; + $script[] = "\t\t\$installer = \$parent->getParent();"; + $script[] = "\t\t\$installPath = \$installer->getPath('source');"; + $script[] = "\t\t//" . $this->setLine(__LINE__) . " get all the folders"; + $script[] = "\t\t\$folders = JFolder::folders(\$installPath);"; + $script[] = "\t\t//" . $this->setLine(__LINE__) . " check if we have folders we may want to copy"; + $script[] = "\t\t\$doNotCopy = array('media','admin','site'); // Joomla already deals with these"; + $script[] = "\t\tif (count(\$folders) > 1)"; + $script[] = "\t\t{"; + $script[] = "\t\t\tforeach (\$folders as \$folder)"; + $script[] = "\t\t\t{"; + $script[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " Only copy if not a standard folders"; + $script[] = "\t\t\t\tif (!in_array(\$folder, \$doNotCopy))"; + $script[] = "\t\t\t\t{"; + $script[] = "\t\t\t\t\t//" . $this->setLine(__LINE__) . " set the source path"; + $script[] = "\t\t\t\t\t\$src = \$installPath.'/'.\$folder;"; + $script[] = "\t\t\t\t\t//" . $this->setLine(__LINE__) . " set the destination path"; + $script[] = "\t\t\t\t\t\$dest = JPATH_ROOT.'/'.\$folder;"; + $script[] = "\t\t\t\t\t//" . $this->setLine(__LINE__) . " now try to copy the folder"; + $script[] = "\t\t\t\t\tif (!JFolder::copy(\$src, \$dest, '', true))"; + $script[] = "\t\t\t\t\t{"; + $script[] = "\t\t\t\t\t\t\$app->enqueueMessage('Could not copy '.\$folder.' folder into place, please make sure destination is writable!', 'error');"; + $script[] = "\t\t\t\t\t}"; + $script[] = "\t\t\t\t}"; + $script[] = "\t\t\t}"; + $script[] = "\t\t}"; + $script[] = "\t}"; + // done + return PHP_EOL . PHP_EOL . implode(PHP_EOL, $script); + } + return ''; + } + public function getContentType($view, $component) { // add if history is to be kept or if tags is added @@ -4849,14 +4969,13 @@ class Interpretation extends Fields if ($viewArray && ComponentbuilderHelper::checkArray($viewArray) && isset($viewArray['settings']) && isset($viewArray['settings']->main_get)) { // check if we have custom script for this router parse switch case - if (isset($viewArray['settings']->main_get->add_php_router_parse) && $viewArray['settings']->main_get->add_php_router_parse == 1 - && isset($viewArray['settings']->main_get->php_router_parse) && ComponentbuilderHelper::checkString($viewArray['settings']->main_get->php_router_parse)) + if (isset($viewArray['settings']->main_get->add_php_router_parse) && $viewArray['settings']->main_get->add_php_router_parse == 1 && isset($viewArray['settings']->main_get->php_router_parse) && ComponentbuilderHelper::checkString($viewArray['settings']->main_get->php_router_parse)) { // load the custom script for the switch based on dynamic get $routerSwitch[] = PHP_EOL . "\t\t\tcase '" . $view . "':"; $routerSwitch[] = $this->setPlaceholders($this->setDynamicValues(base64_decode($viewArray['settings']->main_get->php_router_parse)), $this->placeholders); $routerSwitch[] = "\t\t\t\tbreak;"; - + return implode(PHP_EOL, $routerSwitch); } // is this a catogory @@ -5008,7 +5127,7 @@ class Interpretation extends Fields $batchmove[] = PHP_EOL . "\t\tif (!\$this->canDo->get('core.edit') && !\$this->canDo->get('core.batch'))"; } $batchmove[] = "\t\t{"; - $batchmove[] = "\t\t\t\$this->setError(JText:".":_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));"; + $batchmove[] = "\t\t\t\$this->setError(JText:" . ":_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));"; $batchmove[] = "\t\t\treturn false;"; $batchmove[] = "\t\t}" . $customScript; @@ -5058,7 +5177,7 @@ class Interpretation extends Fields $batchmove[] = "\t\t\tif (!\$this->user->authorise('core.edit', \$contexts[\$pk]))"; } $batchmove[] = "\t\t\t{"; - $batchmove[] = "\t\t\t\t\$this->setError(JText:".":_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));"; + $batchmove[] = "\t\t\t\t\$this->setError(JText:" . ":_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));"; $batchmove[] = "\t\t\t\treturn false;"; $batchmove[] = "\t\t\t}"; @@ -5076,7 +5195,7 @@ class Interpretation extends Fields $batchmove[] = "\t\t\t\telse"; $batchmove[] = "\t\t\t\t{"; $batchmove[] = "\t\t\t\t\t//" . $this->setLine(__LINE__) . " Not fatal error"; - $batchmove[] = "\t\t\t\t\t\$this->setError(JText:".":sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', \$pk));"; + $batchmove[] = "\t\t\t\t\t\$this->setError(JText:" . ":sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', \$pk));"; $batchmove[] = "\t\t\t\t\tcontinue;"; $batchmove[] = "\t\t\t\t}"; $batchmove[] = "\t\t\t}"; @@ -5260,7 +5379,7 @@ class Interpretation extends Fields } $batchcopy[] = "\t\t\t{"; $batchcopy[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " Not fatal error"; - $batchcopy[] = "\t\t\t\t\$this->setError(JText:".":sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', \$pk));"; + $batchcopy[] = "\t\t\t\t\$this->setError(JText:" . ":sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', \$pk));"; $batchcopy[] = "\t\t\t\tcontinue;"; $batchcopy[] = "\t\t\t}"; @@ -5277,7 +5396,7 @@ class Interpretation extends Fields $batchcopy[] = "\t\t\t\telse"; $batchcopy[] = "\t\t\t\t{"; $batchcopy[] = "\t\t\t\t\t//" . $this->setLine(__LINE__) . " Not fatal error"; - $batchcopy[] = "\t\t\t\t\t\$this->setError(JText:".":sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', \$pk));"; + $batchcopy[] = "\t\t\t\t\t\$this->setError(JText:" . ":sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', \$pk));"; $batchcopy[] = "\t\t\t\t\tcontinue;"; $batchcopy[] = "\t\t\t\t}"; $batchcopy[] = "\t\t\t}"; @@ -5442,7 +5561,7 @@ class Interpretation extends Fields { $fixUniqe[] = PHP_EOL . "\t\t\t\tif (\$table->load(array('" . $alias . "' => \$data['" . $alias . "'], '" . $category . "' => \$data['" . $category . "'])) && (\$table->id != \$data['id'] || \$data['id'] == 0))"; $fixUniqe[] = "\t\t\t\t{"; - $fixUniqe[] = "\t\t\t\t\t\$msg = JText:".":_('COM_" . $this->fileContentStatic['###COMPONENT###'] . "_" . $VIEW . "_SAVE_WARNING');"; + $fixUniqe[] = "\t\t\t\t\t\$msg = JText:" . ":_('COM_" . $this->fileContentStatic['###COMPONENT###'] . "_" . $VIEW . "_SAVE_WARNING');"; $fixUniqe[] = "\t\t\t\t}"; $fixUniqe[] = PHP_EOL . "\t\t\t\tlist(\$" . $title . ", \$" . $alias . ") = \$this->generateNewTitle(\$data['" . $category . "'], \$data['" . $alias . "'], \$data['" . $title . "']);"; } @@ -5450,7 +5569,7 @@ class Interpretation extends Fields { $fixUniqe[] = PHP_EOL . "\t\t\t\tif (\$table->load(array('" . $alias . "' => \$data['" . $alias . "'])) && (\$table->id != \$data['id'] || \$data['id'] == 0))"; $fixUniqe[] = "\t\t\t\t{"; - $fixUniqe[] = "\t\t\t\t\t\$msg = JText:".":_('COM_" . $this->fileContentStatic['###COMPONENT###'] . "_" . $VIEW . "_SAVE_WARNING');"; + $fixUniqe[] = "\t\t\t\t\t\$msg = JText:" . ":_('COM_" . $this->fileContentStatic['###COMPONENT###'] . "_" . $VIEW . "_SAVE_WARNING');"; $fixUniqe[] = "\t\t\t\t}"; $fixUniqe[] = PHP_EOL . "\t\t\t\tlist(\$" . $title . ", \$" . $alias . ") = \$this->_generateNewTitle(\$data['" . $alias . "'], \$data['" . $title . "']);"; } @@ -5541,7 +5660,6 @@ class Interpretation extends Fields // set the main db prefix $component = $this->fileContentStatic['###component###']; // start building the db - $db = ''; foreach ($this->queryBuilder as $view => $fields) { @@ -5618,9 +5736,21 @@ class Interpretation extends Fields $this->updateSQLBuilder["ALTERTABLE`#__" . $component . "_" . $view . "`ADD`" . $field . "`"] = "ALTER TABLE `#__" . $component . "_" . $view . "` ADD `" . $field . "` " . $data['type'] . $lenght . " " . $default . " AFTER `" . $last_name . "`;"; } // check if the field has changed name and/or data type and lenght - elseif (0) + elseif ((isset($this->updateSQL['field.datatype']) && isset($this->updateSQL['field.datatype'][$view . '.' . $field])) || + (isset($this->updateSQL['field.lenght']) && isset($this->updateSQL['field.lenght'][$view . '.' . $field])) || + (isset($this->updateSQL['field.name']) && isset($this->updateSQL['field.name'][$view . '.' . $field]))) { - // hmmm tough one + // if the name changed + if (isset($this->updateSQL['field.name']) && isset($this->updateSQL['field.name'][$view . '.' . $field])) + { + $oldName = $this->updateSQL['field.name'][$view . '.' . $field]['old']; + } + else + { + $oldName = $field; + } + // now set the update SQL + $this->updateSQLBuilder["ALTERTABLE`#__" . $component . "_" . $view . "`CHANGE`" . $oldName . "``" . $field . "`"] = "ALTER TABLE `#__" . $component . "_" . $view . "` CHANGE `" . $oldName . "` `" . $field . "` " . $data['type'] . $lenght . " " . $default . ";"; } // be sure to track the last name used :) $last_name = $field; @@ -6134,7 +6264,7 @@ class Interpretation extends Fields // check if translated value is used if (isset($this->selectionTranslationFixBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->selectionTranslationFixBuilder[$viewName_list]) && array_key_exists($item['code'], $this->selectionTranslationFixBuilder[$viewName_list])) { - $itemCode = '' . $item['code'] . '); ?>'; + $itemCode = '' . $item['code'] . '); ?>'; } elseif (isset($item['custom']) && ComponentbuilderHelper::checkArray($item['custom']) && $item['custom']['text'] === 'user') { @@ -6164,7 +6294,7 @@ class Interpretation extends Fields { $otherViews = $this->catCodeBuilder[$viewName_single]['views']; // category and linked - $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t" . ''; $body .= PHP_EOL . "\t\t\tuser->authorise('core.edit', 'com_" . $this->fileContentStatic['###component###'] . "." . $otherViews . ".category.' . (int)\$item->" . $item['code'] . ")): ?>"; $body .= PHP_EOL . "\t\t\t\t" . 'escape($item->category_title); ?>'; $body .= PHP_EOL . "\t\t\t"; @@ -6176,7 +6306,7 @@ class Interpretation extends Fields { // user and linked $body .= PHP_EOL . "\t\t" . $item['code'] . "); ?>"; - $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t" . ''; $body .= PHP_EOL . "\t\t\tuser->authorise('core.edit', 'com_users')): ?>"; $body .= PHP_EOL . "\t\t\t\t" . 'name; ?>'; $body .= PHP_EOL . "\t\t\t"; @@ -6212,7 +6342,7 @@ class Interpretation extends Fields { // user and linked $body .= PHP_EOL . "\t\t" . $item['id'] . "); ?>"; - $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t" . ''; $body .= PHP_EOL . "\t\t\tuser->authorise('core.edit', 'com_users')): ?>"; $body .= PHP_EOL . "\t\t\t\t" . 'name; ?>'; $body .= PHP_EOL . "\t\t\t"; @@ -6236,9 +6366,9 @@ class Interpretation extends Fields foreach ($this->customAdminViewListLink[$viewName_list] as $customLinkView) { $customAdminView .= PHP_EOL . "\t\t\tget('" . $customLinkView['link'] . ".access')): ?>"; - $customAdminView .= PHP_EOL . "\t\t\t\t" . 'fileContentStatic['###COMPONENT###'] . '_' . $customLinkView['NAME'] . "'" . '); ?>" >'; + $customAdminView .= PHP_EOL . "\t\t\t\t" . 'fileContentStatic['###COMPONENT###'] . '_' . $customLinkView['NAME'] . "'" . '); ?>" >'; $customAdminView .= PHP_EOL . "\t\t\t"; - $customAdminView .= PHP_EOL . "\t\t\t\t" . 'fileContentStatic['###COMPONENT###'] . '_' . $customLinkView['NAME'] . "'" . '); ?>">'; + $customAdminView .= PHP_EOL . "\t\t\t\t" . 'fileContentStatic['###COMPONENT###'] . '_' . $customLinkView['NAME'] . "'" . '); ?>">'; $customAdminView .= PHP_EOL . "\t\t\t"; } $customAdminView .= PHP_EOL . "\t\t\t" . ''; @@ -6261,7 +6391,7 @@ class Interpretation extends Fields if ($add) { // set as linked - $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t" . ''; $body .= PHP_EOL . "\t\t\t"; $body .= PHP_EOL . "\t\t\t\t" . '
' . PHP_EOL . "\t\t\t\t\t" . '' . $itemCode . ''; if ($checkoutTriger) @@ -6283,7 +6413,7 @@ class Interpretation extends Fields { if ($item['type'] === 'category') { - $body .= PHP_EOL . "\t\tsetListFieldClass($item['code'], $viewName_list, 'hidden-phone')."\">"; + $body .= PHP_EOL . "\t\tsetListFieldClass($item['code'], $viewName_list, 'hidden-phone') . "\">"; $body .= PHP_EOL . "\t\t\tescape(\$item->category_title); ?>"; $body .= PHP_EOL . "\t\t"; } @@ -6291,7 +6421,7 @@ class Interpretation extends Fields { // custom user and linked $body .= PHP_EOL . "\t\t" . $item['id'] . "); ?>"; - $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t" . ''; $body .= PHP_EOL . "\t\t\tuser->authorise('core.edit', 'com_users')): ?>"; $body .= PHP_EOL . "\t\t\t\t" . 'name; ?>'; $body .= PHP_EOL . "\t\t\t"; @@ -6303,14 +6433,14 @@ class Interpretation extends Fields { // user name only $body .= PHP_EOL . "\t\t" . $item['code'] . "); ?>"; - $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t" . ''; $body .= PHP_EOL . "\t\t\tname; ?>"; $body .= PHP_EOL . "\t\t"; } else { // normal not linked - $body .= PHP_EOL . "\t\tsetListFieldClass($item['code'], $viewName_list, 'hidden-phone')."\">"; + $body .= PHP_EOL . "\t\tsetListFieldClass($item['code'], $viewName_list, 'hidden-phone') . "\">"; $body .= PHP_EOL . "\t\t\t" . $itemCode; $body .= PHP_EOL . "\t\t"; } @@ -6345,7 +6475,7 @@ class Interpretation extends Fields } if (!isset($this->fieldsNames[$viewName_single]['id'])) { - $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t" . ''; $body .= PHP_EOL . "\t\t\tid; ?>"; $body .= PHP_EOL . "\t\t"; } @@ -6416,7 +6546,7 @@ class Interpretation extends Fields { $class = 'nowrap'; } - $title = ""; + $title = ""; if ($item['sort']) { $title = "listDirn, \$this->listOrder); ?>"; @@ -6435,7 +6565,7 @@ class Interpretation extends Fields $head .= PHP_EOL . "\t\t"; $head .= PHP_EOL . "\t"; $head .= PHP_EOL . "\t\t" . ''; - $head .= PHP_EOL . "\t\t\t"; + $head .= PHP_EOL . "\t\t\t"; $head .= PHP_EOL . "\t\t"; $head .= PHP_EOL . "\t"; } @@ -6761,7 +6891,7 @@ class Interpretation extends Fields $body .= PHP_EOL; } // start tab - $body .= PHP_EOL . "\t"; + $body .= PHP_EOL . "\t"; // add the main $body .= PHP_EOL . "\t\t" . '
'; $body .= $main; @@ -6944,7 +7074,7 @@ class Interpretation extends Fields } $body .= PHP_EOL . PHP_EOL . "\t"; // set the default publishing tab - $body .= PHP_EOL . "\t"; + $body .= PHP_EOL . "\t"; $body .= PHP_EOL . "\t\t" . '
'; if ($items_one) { @@ -6976,7 +7106,7 @@ class Interpretation extends Fields } // set the permissions tab $body .= PHP_EOL . PHP_EOL . "\tcanDo->get('core.admin')) : ?>"; - $body .= PHP_EOL . "\t"; + $body .= PHP_EOL . "\t"; $body .= PHP_EOL . "\t\t" . '
'; $body .= PHP_EOL . "\t\t\t" . '
'; $body .= PHP_EOL . "\t\t\t\t" . '
'; @@ -7298,7 +7428,7 @@ class Interpretation extends Fields // check if translated vlaue is used if (isset($this->selectionTranslationFixBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->selectionTranslationFixBuilder[$viewName_list]) && array_key_exists($item['code'], $this->selectionTranslationFixBuilder[$viewName_list])) { - $itemCode = '' . $item['code'] . '); ?>'; + $itemCode = '' . $item['code'] . '); ?>'; } elseif ($item['custom']['text'] === 'user') { @@ -7329,7 +7459,7 @@ class Interpretation extends Fields { $otherViews = $this->catCodeBuilder[$viewName_single]['views']; // category and linked - $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t" . ''; $body .= PHP_EOL . "\t\t\tauthorise('core.edit', 'com_" . $this->fileContentStatic['###component###'] . "." . $otherViews . ".category.' . (int)\$item->" . $item['code'] . ")): ?>"; $body .= PHP_EOL . "\t\t\t\t" . 'escape($item->category_title); ?>'; $body .= PHP_EOL . "\t\t\t"; @@ -7341,7 +7471,7 @@ class Interpretation extends Fields { // user and linked $body .= PHP_EOL . "\t\t" . $item['code'] . "); ?>"; - $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t" . ''; $body .= PHP_EOL . "\t\t\tauthorise('core.edit', 'com_users')): ?>"; $body .= PHP_EOL . "\t\t\t\t" . 'name; ?>'; $body .= PHP_EOL . "\t\t\t"; @@ -7390,7 +7520,7 @@ class Interpretation extends Fields { // user and linked $body .= PHP_EOL . "\t\t" . $item['id'] . "); ?>"; - $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t" . ''; $body .= PHP_EOL . "\t\t\tauthorise('core.edit', 'com_users')): ?>"; $body .= PHP_EOL . "\t\t\t\t" . 'name; ?>'; $body .= PHP_EOL . "\t\t\t"; @@ -7413,9 +7543,9 @@ class Interpretation extends Fields foreach ($this->customAdminViewListLink[$viewName_list] as $customLinkView) { $customAdminView .= PHP_EOL . "\t\t\tget('" . $customLinkView['link'] . ".access')): ?>"; - $customAdminView .= PHP_EOL . "\t\t\t\t" . 'fileContentStatic['###COMPONENT###'] . '_' . $customLinkView['NAME'] . "'" . '); ?>" >'; + $customAdminView .= PHP_EOL . "\t\t\t\t" . 'fileContentStatic['###COMPONENT###'] . '_' . $customLinkView['NAME'] . "'" . '); ?>" >'; $customAdminView .= PHP_EOL . "\t\t\t"; - $customAdminView .= PHP_EOL . "\t\t\t\t" . 'fileContentStatic['###COMPONENT###'] . '_' . $customLinkView['NAME'] . "'" . '); ?>">'; + $customAdminView .= PHP_EOL . "\t\t\t\t" . 'fileContentStatic['###COMPONENT###'] . '_' . $customLinkView['NAME'] . "'" . '); ?>">'; $customAdminView .= PHP_EOL . "\t\t\t"; } $customAdminView .= PHP_EOL . "\t\t\t" . '
'; @@ -7438,7 +7568,7 @@ class Interpretation extends Fields if ($add) { // set as linked - $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t" . ''; $body .= PHP_EOL . "\t\t\t"; $body .= PHP_EOL . "\t\t\t\t" . '' . $itemCode . ''; if ($checkoutTriger) @@ -7479,7 +7609,7 @@ class Interpretation extends Fields { // user name only $body .= PHP_EOL . "\t\t" . $item['code'] . "); ?>"; - $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t" . ''; $body .= PHP_EOL . "\t\t\tname; ?>"; $body .= PHP_EOL . "\t\t"; } @@ -7497,29 +7627,29 @@ class Interpretation extends Fields // add the defaults $body .= PHP_EOL . "\t\tpublished == 1):?>"; $body .= PHP_EOL . "\t\t\t" . ''; - $body .= PHP_EOL . "\t\t\t\t" . 'langPrefix . "_PUBLISHED'" . '); ?>">'; - $body .= PHP_EOL . "\t\t\t\t\t" . 'langPrefix . "_PUBLISHED'" . '); ?>'; + $body .= PHP_EOL . "\t\t\t\t" . 'langPrefix . "_PUBLISHED'" . '); ?>">'; + $body .= PHP_EOL . "\t\t\t\t\t" . 'langPrefix . "_PUBLISHED'" . '); ?>'; $body .= PHP_EOL . "\t\t\t\t" . ''; $body .= PHP_EOL . "\t\t\t" . ''; $body .= PHP_EOL . "\t\tpublished == 0):?>"; $body .= PHP_EOL . "\t\t\t" . ''; - $body .= PHP_EOL . "\t\t\t\t" . 'langPrefix . "_INACTIVE'" . '); ?>">'; - $body .= PHP_EOL . "\t\t\t\t\t" . 'langPrefix . "_INACTIVE'" . '); ?>'; + $body .= PHP_EOL . "\t\t\t\t" . 'langPrefix . "_INACTIVE'" . '); ?>">'; + $body .= PHP_EOL . "\t\t\t\t\t" . 'langPrefix . "_INACTIVE'" . '); ?>'; $body .= PHP_EOL . "\t\t\t\t" . ''; $body .= PHP_EOL . "\t\t\t" . ''; $body .= PHP_EOL . "\t\tpublished == 2):?>"; $body .= PHP_EOL . "\t\t\t" . ''; - $body .= PHP_EOL . "\t\t\t\t" . 'langPrefix . "_ARCHIVED'" . '); ?>">'; - $body .= PHP_EOL . "\t\t\t\t\t" . 'langPrefix . "_ARCHIVED'" . '); ?>'; + $body .= PHP_EOL . "\t\t\t\t" . 'langPrefix . "_ARCHIVED'" . '); ?>">'; + $body .= PHP_EOL . "\t\t\t\t\t" . 'langPrefix . "_ARCHIVED'" . '); ?>'; $body .= PHP_EOL . "\t\t\t\t" . ''; $body .= PHP_EOL . "\t\t\t" . ''; $body .= PHP_EOL . "\t\tpublished == -2):?>"; $body .= PHP_EOL . "\t\t\t" . ''; - $body .= PHP_EOL . "\t\t\t\t" . 'langPrefix . "_TRASHED'" . '); ?>">'; - $body .= PHP_EOL . "\t\t\t\t\t" . 'langPrefix . "_TRASHED'" . '); ?>'; + $body .= PHP_EOL . "\t\t\t\t" . 'langPrefix . "_TRASHED'" . '); ?>">'; + $body .= PHP_EOL . "\t\t\t\t\t" . 'langPrefix . "_TRASHED'" . '); ?>'; $body .= PHP_EOL . "\t\t\t\t" . ''; $body .= PHP_EOL . "\t\t\t" . ''; $body .= PHP_EOL . "\t\t" . ''; @@ -7543,7 +7673,7 @@ class Interpretation extends Fields $body .= PHP_EOL . ''; $body .= PHP_EOL . ''; $body .= PHP_EOL . "\t" . '
'; - $body .= PHP_EOL . "\t\t" . ''; + $body .= PHP_EOL . "\t\t" . ''; $body .= PHP_EOL . "\t" . '
'; $body .= PHP_EOL . ''; // return the build @@ -7592,12 +7722,12 @@ class Interpretation extends Fields // add the new buttons if ($addNewButon == 1 || $addNewButon == 2) { - $head .= PHP_EOL . $tabB . "\t" . ' langPrefix . "_NEW'" . '); ?>'; + $head .= PHP_EOL . $tabB . "\t" . ' langPrefix . "_NEW'" . '); ?>'; } // add the close and new button if ($addNewButon == 2 || $addNewButon == 3) { - $head .= PHP_EOL . $tabB . "\t" . ' langPrefix . "_CLOSE_NEW'" . '); ?>'; + $head .= PHP_EOL . $tabB . "\t" . ' langPrefix . "_CLOSE_NEW'" . '); ?>'; } // close group button if needed if ($addNewButon == 2) @@ -7662,7 +7792,7 @@ class Interpretation extends Fields $firstLink = false; } $head .= PHP_EOL . "\t\t"; - $head .= PHP_EOL . "\t\t\t"; + $head .= PHP_EOL . "\t\t\t"; $head .= PHP_EOL . "\t\t"; $controller++; } @@ -7671,10 +7801,10 @@ class Interpretation extends Fields $data_type = (2 == $this->footableVersion) ? 'data-type="numeric"' : 'data-type="number"'; // set default $head .= PHP_EOL . "\t\t" . ''; - $head .= PHP_EOL . "\t\t\t"; + $head .= PHP_EOL . "\t\t\t"; $head .= PHP_EOL . "\t\t"; $head .= PHP_EOL . "\t\t" . ''; - $head .= PHP_EOL . "\t\t\t"; + $head .= PHP_EOL . "\t\t\t"; $head .= PHP_EOL . "\t\t"; $head .= PHP_EOL . "\t"; $head .= PHP_EOL . ""; @@ -8037,7 +8167,7 @@ class Interpretation extends Fields $method[] = PHP_EOL . PHP_EOL . "\tpublic function redirectTo" . ComponentbuilderHelper::safeString($custom_button['link'], 'F') . "()"; $method[] = "\t{"; $method[] = "\t\t//" . $this->setLine(__LINE__) . " Check for request forgeries"; - $method[] = "\t\tJSession::checkToken() or die(JText:".":_('JINVALID_TOKEN'));"; + $method[] = "\t\tJSession::checkToken() or die(JText:" . ":_('JINVALID_TOKEN'));"; $method[] = "\t\t//" . $this->setLine(__LINE__) . " check if export is allowed for this user."; $method[] = "\t\t\$user = JFactory::getUser();"; $method[] = "\t\tif (\$user->authorise('" . $custom_button['link'] . ".access', 'com_" . $this->fileContentStatic['###component###'] . "'))"; @@ -8053,7 +8183,7 @@ class Interpretation extends Fields $method[] = "\t\t\treturn;"; $method[] = "\t\t}"; $method[] = "\t\t//" . $this->setLine(__LINE__) . " Redirect to the list screen with error."; - $method[] = "\t\t\$message = JText:".":_('" . $this->langPrefix . "_ACCESS_TO_" . $custom_button['NAME'] . "_FAILED');"; + $method[] = "\t\t\$message = JText:" . ":_('" . $this->langPrefix . "_ACCESS_TO_" . $custom_button['NAME'] . "_FAILED');"; $method[] = "\t\t\$this->setRedirect(JRoute::_('index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=" . $viewName_list . "', false), \$message, 'error');"; $method[] = "\t\treturn;"; $method[] = "\t}"; @@ -8130,7 +8260,7 @@ class Interpretation extends Fields $query .= PHP_EOL . "\t\t}"; $query .= PHP_EOL . "\t\treturn false;"; $query .= PHP_EOL . "\t}"; - + // get the header script $header = ComponentbuilderHelper::getDynamicScripts('headers'); @@ -8153,7 +8283,7 @@ class Interpretation extends Fields $method[] = PHP_EOL . PHP_EOL . "\tpublic function exportData()"; $method[] = "\t{"; $method[] = "\t\t//" . $this->setLine(__LINE__) . " Check for request forgeries"; - $method[] = "\t\tJSession::checkToken() or die(JText:".":_('JINVALID_TOKEN'));"; + $method[] = "\t\tJSession::checkToken() or die(JText:" . ":_('JINVALID_TOKEN'));"; $method[] = "\t\t//" . $this->setLine(__LINE__) . " check if export is allowed for this user."; $method[] = "\t\t\$user = JFactory::getUser();"; $method[] = "\t\tif (\$user->authorise('" . $viewName_single . ".export', 'com_" . $this->fileContentStatic['###component###'] . "') && \$user->authorise('core.export', 'com_" . $this->fileContentStatic['###component###'] . "'))"; @@ -8175,7 +8305,7 @@ class Interpretation extends Fields $method[] = "\t\t\t}"; $method[] = "\t\t}"; $method[] = "\t\t//" . $this->setLine(__LINE__) . " Redirect to the list screen with error."; - $method[] = "\t\t\$message = JText:".":_('" . $this->langPrefix . "_EXPORT_FAILED');"; + $method[] = "\t\t\$message = JText:" . ":_('" . $this->langPrefix . "_EXPORT_FAILED');"; $method[] = "\t\t\$this->setRedirect(JRoute::_('index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=" . $viewName_list . "', false), \$message, 'error');"; $method[] = "\t\treturn;"; $method[] = "\t}"; @@ -8184,7 +8314,7 @@ class Interpretation extends Fields $method[] = PHP_EOL . PHP_EOL . "\tpublic function importData()"; $method[] = "\t{"; $method[] = "\t\t//" . $this->setLine(__LINE__) . " Check for request forgeries"; - $method[] = "\t\tJSession::checkToken() or die(JText:".":_('JINVALID_TOKEN'));"; + $method[] = "\t\tJSession::checkToken() or die(JText:" . ":_('JINVALID_TOKEN'));"; $method[] = "\t\t//" . $this->setLine(__LINE__) . " check if import is allowed for this user."; $method[] = "\t\t\$user = JFactory::getUser();"; $method[] = "\t\tif (\$user->authorise('" . $viewName_single . ".import', 'com_" . $this->fileContentStatic['###component###'] . "') && \$user->authorise('core.import', 'com_" . $this->fileContentStatic['###component###'] . "'))"; @@ -8208,7 +8338,7 @@ class Interpretation extends Fields { $this->langContent[$this->lang][$selectImportFileNote] = 'Select the file to import data to ' . $viewName_list . '.'; } - $method[] = "\t\t\t\t\$message = JText:".":_('" . $selectImportFileNote . "');"; + $method[] = "\t\t\t\t\$message = JText:" . ":_('" . $selectImportFileNote . "');"; // if this view has custom script it must have as custom import (model, veiw, controller) if (isset($this->importCustomScripts[$viewName_list]) && $this->importCustomScripts[$viewName_list]) { @@ -8222,7 +8352,7 @@ class Interpretation extends Fields $method[] = "\t\t\t}"; $method[] = "\t\t}"; $method[] = "\t\t//" . $this->setLine(__LINE__) . " Redirect to the list screen with error."; - $method[] = "\t\t\$message = JText:".":_('" . $this->langPrefix . "_IMPORT_FAILED');"; + $method[] = "\t\t\$message = JText:" . ":_('" . $this->langPrefix . "_IMPORT_FAILED');"; $method[] = "\t\t\$this->setRedirect(JRoute::_('index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=" . $viewName_list . "', false), \$message, 'error');"; $method[] = "\t\treturn;"; $method[] = "\t}"; @@ -8542,7 +8672,7 @@ class Interpretation extends Fields $addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/\s+/', ' ', \$buttonNamee);"; $addButton[] = "\t\t\t\t\$buttonNamee = preg_replace(\"/[^A-Za-z ]/\", '', \$buttonNamee);"; $addButton[] = "\t\t\t\t\$buttonNamee = ucfirst(strtolower(\$buttonNamee));"; - $addButton[] = "\t\t\t\t\$button[] = 'langPrefix . "_CREATE_NEW_S', \$buttonNamee).'\" style=\"border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;\""; + $addButton[] = "\t\t\t\t\$button[] = 'langPrefix . "_CREATE_NEW_S', \$buttonNamee).'\" style=\"border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;\""; $addButton[] = "\t\t\t\t\thref=\"index.php?option=com_" . $this->fileContentStatic['###component###'] . "&view=" . $targetView . "&layout=edit'.\$ref.'\" >"; $addButton[] = "\t\t\t\t\t';"; $addButton[] = "\t\t\t}"; @@ -8563,7 +8693,7 @@ class Interpretation extends Fields $addButton[] = "\t\t\t\t\$buttonNamee = preg_replace('/\s+/', ' ', \$buttonNamee);"; $addButton[] = "\t\t\t\t\$buttonNamee = preg_replace(\"/[^A-Za-z ]/\", '', \$buttonNamee);"; $addButton[] = "\t\t\t\t\$buttonNamee = ucfirst(strtolower(\$buttonNamee));"; - $addButton[] = "\t\t\t\t\$button[] = 'langPrefix . "_EDIT_S', \$buttonNamee).'\" style=\"display: none; padding: 4px 4px 4px 7px;\" href=\"#\" >"; + $addButton[] = "\t\t\t\t\$button[] = 'langPrefix . "_EDIT_S', \$buttonNamee).'\" style=\"display: none; padding: 4px 4px 4px 7px;\" href=\"#\" >"; $addButton[] = "\t\t\t\t\t';"; $addButton[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " build script"; $addButton[] = "\t\t\t\t\$script[] = \""; @@ -9915,7 +10045,7 @@ class Interpretation extends Fields $function[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " Translate the " . $filter['code'] . " selection"; $function[] = "\t\t\t\t\$text = \$model->selectionTranslation(\$" . $filter['code'] . ",'" . $filter['code'] . "');"; $function[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " Now add the " . $filter['code'] . " and its text to the options array"; - $function[] = "\t\t\t\t\$_filter[] = JHtml::_('select.option', \$" . $filter['code'] . ", JText:".":_(\$text));"; + $function[] = "\t\t\t\t\$_filter[] = JHtml::_('select.option', \$" . $filter['code'] . ", JText:" . ":_(\$text));"; } elseif ($filter['type'] === 'user') { @@ -9986,7 +10116,7 @@ class Interpretation extends Fields $otherFilter[] = "\t\t{"; $otherFilter[] = "\t\t\t//" . $this->setLine(__LINE__) . " " . $CodeName . " Filter"; $otherFilter[] = "\t\t\tJHtmlSidebar::addFilter("; - $otherFilter[] = "\t\t\t\t'- Select '.JText:".":_('" . $filter['lang'] . "').' -',"; + $otherFilter[] = "\t\t\t\t'- Select '.JText:" . ":_('" . $filter['lang'] . "').' -',"; $otherFilter[] = "\t\t\t\t'filter_" . $filter['code'] . "',"; $otherFilter[] = "\t\t\t\tJHtml::_('select.options', \$this->" . $codeName . "Options, 'value', 'text', \$this->state->get('filter." . $filter['code'] . "'))"; $otherFilter[] = "\t\t\t);"; @@ -9995,7 +10125,7 @@ class Interpretation extends Fields $otherFilter[] = "\t\t\t{"; $otherFilter[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " " . $CodeName . " Batch Selection"; $otherFilter[] = "\t\t\t\tJHtmlBatch_::addListSelection("; - $otherFilter[] = "\t\t\t\t\t'- Keep Original '.JText:".":_('" . $filter['lang'] . "').' -',"; + $otherFilter[] = "\t\t\t\t\t'- Keep Original '.JText:" . ":_('" . $filter['lang'] . "').' -',"; $otherFilter[] = "\t\t\t\t\t'batch[" . $filter['code'] . "]',"; $otherFilter[] = "\t\t\t\t\tJHtml::_('select.options', \$this->" . $codeName . "Options, 'value', 'text')"; $otherFilter[] = "\t\t\t\t);"; @@ -10020,7 +10150,7 @@ class Interpretation extends Fields $otherFilter[] = "\t\t{"; $otherFilter[] = "\t\t\t//" . $this->setLine(__LINE__) . " " . $Codename . " Filter"; $otherFilter[] = "\t\t\tJHtmlSidebar::addFilter("; - $otherFilter[] = "\t\t\t\t'- Select '.JText:".":_('" . $filter['lang'] . "').' -',"; + $otherFilter[] = "\t\t\t\t'- Select '.JText:" . ":_('" . $filter['lang'] . "').' -',"; $otherFilter[] = "\t\t\t\t'filter_" . $filter['code'] . "',"; $otherFilter[] = "\t\t\t\tJHtml::_('select.options', \$this->" . $filter['code'] . "Options, 'value', 'text', \$this->state->get('filter." . $filter['code'] . "'))"; $otherFilter[] = "\t\t\t);"; @@ -10029,7 +10159,7 @@ class Interpretation extends Fields $otherFilter[] = "\t\t\t{"; $otherFilter[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " " . $Codename . " Batch Selection"; $otherFilter[] = "\t\t\t\tJHtmlBatch_::addListSelection("; - $otherFilter[] = "\t\t\t\t\t'- Keep Original '.JText:".":_('" . $filter['lang'] . "').' -',"; + $otherFilter[] = "\t\t\t\t\t'- Keep Original '.JText:" . ":_('" . $filter['lang'] . "').' -',"; $otherFilter[] = "\t\t\t\t\t'batch[" . $filter['code'] . "]',"; $otherFilter[] = "\t\t\t\t\tJHtml::_('select.options', \$this->" . $filter['code'] . "Options, 'value', 'text')"; $otherFilter[] = "\t\t\t\t);"; @@ -10067,7 +10197,7 @@ class Interpretation extends Fields $filter = array(); $filter[] = PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Category Filter."; $filter[] = "\t\tJHtmlSidebar::addFilter("; - $filter[] = "\t\t\tJText:".":_('JOPTION_SELECT_CATEGORY'),"; + $filter[] = "\t\t\tJText:" . ":_('JOPTION_SELECT_CATEGORY'),"; $filter[] = "\t\t\t'filter_category_id',"; $filter[] = "\t\t\tJHtml::_('select.options', JHtml::_('category.options', 'com_" . $component . "." . $otherViews . "'), 'value', 'text', \$this->state->get('filter.category_id'))"; $filter[] = "\t\t);"; @@ -10077,7 +10207,7 @@ class Interpretation extends Fields $filter[] = "\t\t{"; $filter[] = "\t\t\t//" . $this->setLine(__LINE__) . " Category Batch selection."; $filter[] = "\t\t\tJHtmlBatch_::addListSelection("; - $filter[] = "\t\t\t\tJText:".":_('COM_" . $COMONENT . "_KEEP_ORIGINAL_CATEGORY'),"; + $filter[] = "\t\t\t\tJText:" . ":_('COM_" . $COMONENT . "_KEEP_ORIGINAL_CATEGORY'),"; $filter[] = "\t\t\t\t'batch[category]',"; $filter[] = "\t\t\t\tJHtml::_('select.options', JHtml::_('category.options', 'com_" . $component . "." . $otherViews . "'), 'value', 'text')"; $filter[] = "\t\t\t);"; @@ -11166,7 +11296,7 @@ class Interpretation extends Fields // build toolbar $toolBar = "JFactory::getApplication()->input->set('hidemainmenu', true);"; - $toolBar .= PHP_EOL . "\t\tJToolBarHelper::title(JText:".":_('" . $viewNameLang_readonly . "'), '" . $viewName . "');"; + $toolBar .= PHP_EOL . "\t\tJToolBarHelper::title(JText:" . ":_('" . $viewNameLang_readonly . "'), '" . $viewName . "');"; $toolBar .= PHP_EOL . "\t\tJToolBarHelper::cancel('" . $viewName . ".cancel', 'JTOOLBAR_CLOSE');"; } else @@ -11182,7 +11312,7 @@ class Interpretation extends Fields $toolBar .= PHP_EOL . "\t\t\$user = JFactory::getUser();"; $toolBar .= PHP_EOL . "\t\t\$userId = \$user->id;"; $toolBar .= PHP_EOL . "\t\t\$isNew = \$this->item->id == 0;"; - $toolBar .= PHP_EOL . PHP_EOL . "\t\tJToolbarHelper::title( JText:".":_(\$isNew ? '" . $viewNameLang_new . "' : '" . $viewNameLang_edit . "'), 'pencil-2 article-add');"; + $toolBar .= PHP_EOL . PHP_EOL . "\t\tJToolbarHelper::title( JText:" . ":_(\$isNew ? '" . $viewNameLang_new . "' : '" . $viewNameLang_edit . "'), 'pencil-2 article-add');"; $toolBar .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Built the actions for new and existing records."; $toolBar .= PHP_EOL . "\t\tif (\$this->refid || \$this->ref)"; $toolBar .= PHP_EOL . "\t\t{"; @@ -11438,8 +11568,8 @@ class Interpretation extends Fields $donelist = array('sorting', 'published'); // set the default first $fields = "return array("; - $fields .= PHP_EOL . "\t\t\t'a.sorting' => JText:".":_('JGRID_HEADING_ORDERING')"; - $fields .= "," . PHP_EOL . "\t\t\t'a.published' => JText:".":_('JSTATUS')"; + $fields .= PHP_EOL . "\t\t\t'a.sorting' => JText:" . ":_('JGRID_HEADING_ORDERING')"; + $fields .= "," . PHP_EOL . "\t\t\t'a.published' => JText:" . ":_('JSTATUS')"; // add the rest of the set filters if (isset($this->sortBuilder[$view]) && ComponentbuilderHelper::checkArray($this->sortBuilder[$view])) @@ -11450,20 +11580,20 @@ class Interpretation extends Fields { if ($filter['type'] === 'category') { - $fields .= "," . PHP_EOL . "\t\t\t'c.category_title' => JText:".":_('" . $filter['lang'] . "')"; + $fields .= "," . PHP_EOL . "\t\t\t'c.category_title' => JText:" . ":_('" . $filter['lang'] . "')"; } elseif (ComponentbuilderHelper::checkArray($filter['custom'])) { - $fields .= "," . PHP_EOL . "\t\t\t'" . $filter['custom']['db'] . "." . $filter['custom']['text'] . "' => JText:".":_('" . $filter['lang'] . "')"; + $fields .= "," . PHP_EOL . "\t\t\t'" . $filter['custom']['db'] . "." . $filter['custom']['text'] . "' => JText:" . ":_('" . $filter['lang'] . "')"; } else { - $fields .= "," . PHP_EOL . "\t\t\t'a." . $filter['code'] . "' => JText:".":_('" . $filter['lang'] . "')"; + $fields .= "," . PHP_EOL . "\t\t\t'a." . $filter['code'] . "' => JText:" . ":_('" . $filter['lang'] . "')"; } } } } - $fields .= "," . PHP_EOL . "\t\t\t'a.id' => JText:".":_('JGRID_HEADING_ID')"; + $fields .= "," . PHP_EOL . "\t\t\t'a.id' => JText:" . ":_('JGRID_HEADING_ID')"; $fields .= PHP_EOL . "\t\t);"; // return fields return $fields; @@ -11533,8 +11663,10 @@ class Interpretation extends Fields // add the fix if this view has the need for it $fix = ''; // encryption switches - $basicCrypt = false; - $advancedCrypt = false; + foreach ($this->cryptionTypes as $cryptionType) + { + ${$cryptionType . 'Crypt'} = false; + } // setup correct core target $coreLoad = false; if (isset($this->permissionCore[$view])) @@ -11602,9 +11734,15 @@ class Interpretation extends Fields $suffix_decode = ''; break; case 4: - // ADVANCE_ENCRYPTION_VDMKEY - $decode = '$advanced->decryptString'; - $advancedCrypt = true; + // WHMCS_ENCRYPTION_WHMCS + $decode = '$whmcs->decryptString'; + $whmcsCrypt = true; + $suffix_decode = ''; + break; + case 5: + // MEDIUM_ENCRYPTION_LOCALFILE + $decode = '$medium->decryptString'; + $mediumCrypt = true; $suffix_decode = ''; break; default: @@ -11658,11 +11796,11 @@ class Interpretation extends Fields $fix .= PHP_EOL . "\t" . $tab . "\t\t\t\t{"; $fix .= PHP_EOL . "\t" . $tab . "\t\t\t\t\tif (\$counter == 0)"; $fix .= PHP_EOL . "\t" . $tab . "\t\t\t\t\t{"; - $fix .= PHP_EOL . "\t" . $tab . "\t\t\t\t\t\t\$" . $item['name'] . "Names .= JText:".":_(\$this->selectionTranslation(\$" . $item['name'] . ", '" . $item['name'] . "'));"; + $fix .= PHP_EOL . "\t" . $tab . "\t\t\t\t\t\t\$" . $item['name'] . "Names .= JText:" . ":_(\$this->selectionTranslation(\$" . $item['name'] . ", '" . $item['name'] . "'));"; $fix .= PHP_EOL . "\t" . $tab . "\t\t\t\t\t}"; $fix .= PHP_EOL . "\t" . $tab . "\t\t\t\t\telse"; $fix .= PHP_EOL . "\t" . $tab . "\t\t\t\t\t{"; - $fix .= PHP_EOL . "\t" . $tab . "\t\t\t\t\t\t\$" . $item['name'] . "Names .= ', '.JText:".":_(\$this->selectionTranslation(\$" . $item['name'] . ", '" . $item['name'] . "'));"; + $fix .= PHP_EOL . "\t" . $tab . "\t\t\t\t\t\t\$" . $item['name'] . "Names .= ', '.JText:" . ":_(\$this->selectionTranslation(\$" . $item['name'] . ", '" . $item['name'] . "'));"; $fix .= PHP_EOL . "\t" . $tab . "\t\t\t\t\t}"; $fix .= PHP_EOL . "\t" . $tab . "\t\t\t\t\t\$counter++;"; $fix .= PHP_EOL . "\t" . $tab . "\t\t\t\t}"; @@ -11671,7 +11809,7 @@ class Interpretation extends Fields } else { - if ($item['method'] == 2 || $item['method'] == 3 || $item['method'] == 4) + if ($item['method'] == 2 || $item['method'] == 3 || $item['method'] == 4 || $item['method'] == 5) { $taber = ''; if ($item['method'] == 3) @@ -11680,13 +11818,19 @@ class Interpretation extends Fields $fix .= PHP_EOL . "\t" . $tab . "\t\t\tif (\$basickey && !is_numeric(\$item->" . $item['name'] . ") && \$item->" . $item['name'] . " === base64_encode(base64_decode(\$item->" . $item['name'] . ", true)))"; $fix .= PHP_EOL . "\t" . $tab . "\t\t\t{"; } - if ($item['method'] == 4) + elseif ($item['method'] == 5) { $taber = "\t"; - $fix .= PHP_EOL . "\t" . $tab . "\t\t\tif (\$advancedkey && !is_numeric(\$item->" . $item['name'] . ") && \$item->" . $item['name'] . " === base64_encode(base64_decode(\$item->" . $item['name'] . ", true)))"; + $fix .= PHP_EOL . "\t" . $tab . "\t\t\tif (\$mediumkey && !is_numeric(\$item->" . $item['name'] . ") && \$item->" . $item['name'] . " === base64_encode(base64_decode(\$item->" . $item['name'] . ", true)))"; $fix .= PHP_EOL . "\t" . $tab . "\t\t\t{"; } - if ($item['method'] == 3 || $item['method'] == 4) + elseif ($item['method'] == 4) + { + $taber = "\t"; + $fix .= PHP_EOL . "\t" . $tab . "\t\t\tif (\$whmcskey && !is_numeric(\$item->" . $item['name'] . ") && \$item->" . $item['name'] . " === base64_encode(base64_decode(\$item->" . $item['name'] . ", true)))"; + $fix .= PHP_EOL . "\t" . $tab . "\t\t\t{"; + } + if ($item['method'] == 3 || $item['method'] == 4 || $item['method'] == 5) { $fix .= PHP_EOL . "\t" . $tab . "\t\t\t\t//" . $this->setLine(__LINE__) . " decrypt " . $item['name']; } @@ -11696,7 +11840,7 @@ class Interpretation extends Fields } $fix .= PHP_EOL . "\t" . $tab . $taber . "\t\t\t\$item->" . $item['name'] . " = " . $decode . "(\$item->" . $item['name'] . ");"; - if ($item['method'] == 3 || $item['method'] == 4) + if ($item['method'] == 3 || $item['method'] == 4 || $item['method'] == 5) { $fix .= PHP_EOL . "\t" . $tab . "\t\t\t}"; } @@ -11793,27 +11937,20 @@ class Interpretation extends Fields // add custom php to getitems method $fix .= $this->getCustomScriptBuilder('php_getitems', $view, PHP_EOL . PHP_EOL . $tab); - if ($basicCrypt) + // load the encryption object if needed + $script = ''; + foreach ($this->cryptionTypes as $cryptionType) { - $script = PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the basic encryption key."; - $script .= PHP_EOL . "\t" . $tab . "\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; - $script .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t" . $tab . "\t\$basic = new FOFEncryptAes(\$basickey, 128);"; - // add the encryption script - $fix = $script . $fix; + if (${$cryptionType . 'Crypt'}) + { + $script .= PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption key."; + $script .= PHP_EOL . "\t" . $tab . "\t\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');"; + $script .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the encryption object."; + $script .= PHP_EOL . "\t" . $tab . "\t\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);"; + } } - - if ($advancedCrypt) - { - $script = PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the advanced encryption key."; - $script .= PHP_EOL . "\t" . $tab . "\t\$advancedkey = " . $Component . "Helper::getCryptKey('advanced');"; - $script .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t" . $tab . "\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; - // add the encryption script - $fix = $script . $fix; - } - - return $fix; + // add the encryption script + return $script . $fix; } public function setSelectionTranslationFix($views, $Component, $tab = '') @@ -12152,7 +12289,7 @@ class Interpretation extends Fields $display[] = '
'; $display[] = "\t" . '
'; $display[] = "\t 'cpanel')); ?>"; - $display[] = PHP_EOL . "\t\t"; + $display[] = PHP_EOL . "\t\t"; $display[] = "\t\t" . '
'; // set the tab to insure correct spacing $tab = "\t\t\t"; @@ -12188,7 +12325,7 @@ class Interpretation extends Fields foreach ($builder as $tabname => $accordians) { $alias = ComponentbuilderHelper::safeString($tabname); - $display[] = PHP_EOL . "\t\t"; + $display[] = PHP_EOL . "\t\t"; $display[] = "\t\t" . '
'; $display[] = $tab . '
'; $display[] = $tab . "\t '" . $alias . "_one')); ?>"; @@ -12296,69 +12433,80 @@ class Interpretation extends Fields $nameUpper = ComponentbuilderHelper::safeString($menu['name_code'], 'U'); if (isset($menu['dashboard_list']) && $menu['dashboard_list'] == 1 && $view['adminview'] == $menu['before']) { - if (isset($menu['link']) && ComponentbuilderHelper::checkString($menu['link'])) + $type = ComponentbuilderHelper::imageInfo('images/' . $menu['icon']); + if ($type) { - // TODO must look at adding custom links to icons aswell - return ''; + // icon builder loader + $this->iconBuilder[$type . "." . $nameList] = 'images/' . $menu['icon']; } else { - $type = ComponentbuilderHelper::imageInfo('images/' . $menu['icon']); - if ($type) - { - $type = $type . "."; - // icon builder loader - $this->iconBuilder[$type . $nameList] = 'images/' . $menu['icon']; - } - else - { - $type = 'png.'; - } - // build lang - $langName = $menu['name'] . '

'; - $langKey = $this->langPrefix . '_DASHBOARD_' . $nameUpper; - // add to lang - $this->langContent[$this->lang][$langKey] = $langName; + $type = 'png'; + } + // build lang + $langName = $menu['name'] . '

'; + $langKey = $this->langPrefix . '_DASHBOARD_' . $nameUpper; + // add to lang + $this->langContent[$this->lang][$langKey] = $langName; + + // if this is a link build the icon values with pipe + if (isset($menu['link']) && ComponentbuilderHelper::checkString($menu['link'])) + { // set icon if ($counter == 0) { $counter++; - $icon .= "'" . $type . $nameList . "'"; + $icon .= "'" . $type . "||" . $nameList . "||" . $menu['link'] . "'"; } else { $counter++; - $icon .= ", '" . $type . $nameList . "'"; + $icon .= ", '" . $type . "||" . $nameList . "||" . $menu['link'] . "'"; + } + } + else + { + // set icon + if ($counter == 0) + { + $counter++; + $icon .= "'" . $type . "." . $nameList . "'"; + } + else + { + $counter++; + $icon .= ", '" . $type . "." . $nameList . "'"; } } } elseif (isset($menu['dashboard_list']) && $menu['dashboard_list'] == 1 && empty($menu['before'])) { - if (isset($menu['link']) && ComponentbuilderHelper::checkString($menu['link'])) + $type = ComponentbuilderHelper::imageInfo('images/' . $menu['icon']); + if ($type) { - // TODO must look at adding custom links to icons aswell - return ''; + // icon builder loader + $this->iconBuilder[$type . "." . $nameList] = 'images/' . $menu['icon']; } else { - $type = ComponentbuilderHelper::imageInfo('images/' . $menu['icon']); - if ($type) - { - $type = $type . "."; - // icon builder loader - $this->iconBuilder[$type . $nameList] = 'images/' . $menu['icon']; - } - else - { - $type = 'png.'; - } - // build lang - $langName = $menu['name'] . '

'; - $langKey = $this->langPrefix . '_DASHBOARD_' . $nameUpper; - // add to lang - $this->langContent[$this->lang][$langKey] = $langName; + $type = 'png'; + } + // build lang + $langName = $menu['name'] . '

'; + $langKey = $this->langPrefix . '_DASHBOARD_' . $nameUpper; + // add to lang + $this->langContent[$this->lang][$langKey] = $langName; + + // if this is a link build the icon values with pipe + if (isset($menu['link']) && ComponentbuilderHelper::checkString($menu['link'])) + { // set icon - $this->lastCustomDashboardIcon[$nr] = ", '" . $type . $nameList . "'"; + $this->lastCustomDashboardIcon[$nr] = ", '" . $type . "||" . $nameList . "||" . $menu['link'] . "'"; + } + else + { + // set icon + $this->lastCustomDashboardIcon[$nr] = ", '" . $type . "." . $nameList . "'"; } } } @@ -12375,9 +12523,12 @@ class Interpretation extends Fields $lang = $this->langPrefix . '_SUBMENU'; // set the code name $codeName = ComponentbuilderHelper::safeString($this->componentData->name_code); - // set dashboard - $menus .= "JHtmlSidebar::addEntry(JText:".":_('" . $lang . "_DASHBOARD'), 'index.php?option=com_" . $codeName . "&view=" . $codeName . "', \$submenu === '" . $codeName . "');"; - $this->langContent[$this->lang][$lang . '_DASHBOARD'] = 'Dashboard'; + // set default dashboard + if (!ComponentbuilderHelper::checkString($this->dynamicDashboard)) + { + $menus .= "JHtmlSidebar::addEntry(JText:" . ":_('" . $lang . "_DASHBOARD'), 'index.php?option=com_" . $codeName . "&view=" . $codeName . "', \$submenu === '" . $codeName . "');"; + $this->langContent[$this->lang][$lang . '_DASHBOARD'] = 'Dashboard'; + } $catArray = array(); foreach ($this->componentData->admin_views as $view) { @@ -12404,7 +12555,7 @@ class Interpretation extends Fields } $nameList = ComponentbuilderHelper::safeString($view['settings']->name_list); $nameUpper = ComponentbuilderHelper::safeString($view['settings']->name_list, 'U'); - $menus .= PHP_EOL . "\t\t" . $tab . "JHtmlSidebar::addEntry(JText:".":_('" . $lang . "_" . $nameUpper . "'), 'index.php?option=com_" . $codeName . "&view=" . $nameList . "', \$submenu === '" . $nameList . "');"; + $menus .= PHP_EOL . "\t\t" . $tab . "JHtmlSidebar::addEntry(JText:" . ":_('" . $lang . "_" . $nameUpper . "'), 'index.php?option=com_" . $codeName . "&view=" . $nameList . "', \$submenu === '" . $nameList . "');"; $this->langContent[$this->lang][$lang . "_" . $nameUpper] = $view['settings']->name_list; // check if category has another name if (isset($this->catOtherName[$nameList]) && ComponentbuilderHelper::checkArray($this->catOtherName[$nameList])) @@ -12417,7 +12568,7 @@ class Interpretation extends Fields } if (isset($this->categoryBuilder[$nameList]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$nameList]) && !in_array($otherViews, $catArray)) { - $menus .= PHP_EOL . "\t\t" . $tab . "JHtmlSidebar::addEntry(JText:".":_('" . $this->categoryBuilder[$nameList]['name'] . "'), 'index.php?option=com_categories&view=categories&extension=com_" . $codeName . "." . $otherViews . "', \$submenu === 'categories." . $otherViews . "');"; + $menus .= PHP_EOL . "\t\t" . $tab . "JHtmlSidebar::addEntry(JText:" . ":_('" . $this->categoryBuilder[$nameList]['name'] . "'), 'index.php?option=com_categories&view=categories&extension=com_" . $codeName . "." . $otherViews . "', \$submenu === 'categories." . $otherViews . "');"; // make sure we add a category only once $catArray[] = $otherViews; } @@ -12523,13 +12674,13 @@ class Interpretation extends Fields $this->langContent[$this->lang][$lang . '_' . $nameUpper] = $name; // add custom menu - $custom .= PHP_EOL . "\t\t" . $tab . "JHtmlSidebar::addEntry(JText:".":_('" . $lang . "_" . $nameUpper . "'), '" . $menu['link'] . "', \$submenu === '" . $nameList . "');"; + $custom .= PHP_EOL . "\t\t" . $tab . "JHtmlSidebar::addEntry(JText:" . ":_('" . $lang . "_" . $nameUpper . "'), '" . $menu['link'] . "', \$submenu === '" . $nameList . "');"; } else { $this->langContent[$this->lang][$lang . '_' . $nameUpper] = $name; // add custom menu - $custom .= PHP_EOL . "\t\t" . $tab . "JHtmlSidebar::addEntry(JText:".":_('" . $lang . "_" . $nameUpper . "'), 'index.php?option=com_" . $codeName . "&view=" . $nameList . "', \$submenu === '" . $nameList . "');"; + $custom .= PHP_EOL . "\t\t" . $tab . "JHtmlSidebar::addEntry(JText:" . ":_('" . $lang . "_" . $nameUpper . "'), 'index.php?option=com_" . $codeName . "&view=" . $nameList . "', \$submenu === '" . $nameList . "');"; } // check if the item has permissions. $custom .= PHP_EOL . "\t\t}"; @@ -12567,13 +12718,13 @@ class Interpretation extends Fields { $this->langContent[$this->lang][$lang . '_' . $nameUpper] = $name; // add custom menu - $this->lastCustomSubMenu[$nr] .= PHP_EOL . "\t\t" . $tab . "JHtmlSidebar::addEntry(JText:".":_('" . $lang . "_" . $nameUpper . "'), '" . $menu['link'] . "', \$submenu === '" . $nameList . "');"; + $this->lastCustomSubMenu[$nr] .= PHP_EOL . "\t\t" . $tab . "JHtmlSidebar::addEntry(JText:" . ":_('" . $lang . "_" . $nameUpper . "'), '" . $menu['link'] . "', \$submenu === '" . $nameList . "');"; } else { $this->langContent[$this->lang][$lang . '_' . $nameUpper] = $name; // add custom menu - $this->lastCustomSubMenu[$nr] .= PHP_EOL . "\t\t" . $tab . "JHtmlSidebar::addEntry(JText:".":_('" . $lang . "_" . $nameUpper . "'), 'index.php?option=com_" . $codeName . "&view=" . $nameList . "', \$submenu === '" . $nameList . "');"; + $this->lastCustomSubMenu[$nr] .= PHP_EOL . "\t\t" . $tab . "JHtmlSidebar::addEntry(JText:" . ":_('" . $lang . "_" . $nameUpper . "'), 'index.php?option=com_" . $codeName . "&view=" . $nameList . "', \$submenu === '" . $nameList . "');"; } // check if the item has permissions. $this->lastCustomSubMenu[$nr] .= PHP_EOL . "\t\t}"; @@ -12655,6 +12806,18 @@ class Interpretation extends Fields $nameList = ComponentbuilderHelper::safeString($menu['name']); $nameUpper = ComponentbuilderHelper::safeString($menu['name'], 'U'); $this->langContent['adminsys'][$lang . '_' . $nameUpper] = $menu['name']; + // sanitize url + if (strpos($menu['link'], 'http') === false) + { + $menu['link'] = str_replace('/administrator/index.php?', '', $menu['link']); + $menu['link'] = str_replace('administrator/index.php?', '', $menu['link']); + // check if the index is still there + if (strpos($menu['link'], 'index.php?') !== false) + { + $menu['link'] = str_replace('/index.php?', '', $menu['link']); + $menu['link'] = str_replace('index.php?', '', $menu['link']); + } + } // urlencode $menu['link'] = htmlspecialchars($menu['link'], ENT_XML1, 'UTF-8'); // add custom menu @@ -12676,6 +12839,18 @@ class Interpretation extends Fields $nameList = ComponentbuilderHelper::safeString($menu['name']); $nameUpper = ComponentbuilderHelper::safeString($menu['name'], 'U'); $this->langContent['adminsys'][$lang . '_' . $nameUpper] = $menu['name']; + // sanitize url + if (strpos($menu['link'], 'http') === false) + { + $menu['link'] = str_replace('/administrator/index.php?', '', $menu['link']); + $menu['link'] = str_replace('administrator/index.php?', '', $menu['link']); + // check if the index is still there + if (strpos($menu['link'], 'index.php?') !== false) + { + $menu['link'] = str_replace('/index.php?', '', $menu['link']); + $menu['link'] = str_replace('index.php?', '', $menu['link']); + } + } // urlencode $menu['link'] = htmlspecialchars($menu['link'], ENT_XML1, 'UTF-8'); // add custom menu @@ -12715,20 +12890,29 @@ class Interpretation extends Fields '###component###' => $component, '###view###' => $viewName, '###views###' => $listViewName); - $spacerCounter = 'a'; $view = ''; $viewType = 0; // set the custom table key $dbkey = 'g'; foreach ($this->componentData->config as $field) { - $newxmlField = $this->setDynamicField($field, $view, $viewType, $lang, $viewName, $listViewName, $spacerCounter, $placeholders, $dbkey, false); - // tmp hack untill this whole area is also done in xml (TODO) - if (isset($newxmlField->fieldXML)) + // check the field builder type + if ($this->fieldBuilderType == 1) { - $xmlField = dom_import_simplexml($newxmlField->fieldXML); - $xmlField = PHP_EOL . "\t' . PHP_EOL . "\t" . $this->xmlPrettyPrint($xmlField, 'field'); + // string manipulation + $xmlField = $this->setDynamicField($field, $view, $viewType, $lang, $viewName, $listViewName, $placeholders, $dbkey, false); } + else + { + // simpleXMLElement class + $newxmlField = $this->setDynamicField($field, $view, $viewType, $lang, $viewName, $listViewName, $placeholders, $dbkey, false); + if (isset($newxmlField->fieldXML)) + { + $xmlField = dom_import_simplexml($newxmlField->fieldXML); + $xmlField = PHP_EOL . "\t' . PHP_EOL . "\t" . $this->xmlPrettyPrint($xmlField, 'field'); + } + } + // make sure the xml is set and a string if (isset($xmlField) && ComponentbuilderHelper::checkString($xmlField)) { $this->configFieldSetsCustomField[$field['tabname']][] = $xmlField; @@ -12917,7 +13101,7 @@ class Interpretation extends Fields } } // set the fields - $this->configFieldSets[] = implode("\t\t", $bucket); + $this->configFieldSets[] = implode("", $bucket); // close field set $this->configFieldSets[] = "\t
"; // remove after loading @@ -12955,7 +13139,7 @@ class Interpretation extends Fields // add custom Target Groups fields if (isset($this->configFieldSetsCustomField['Target Groups']) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField['Target Groups'])) { - $this->configFieldSets[] = implode("\t\t", $this->configFieldSetsCustomField['Target Groups']); + $this->configFieldSets[] = implode("", $this->configFieldSetsCustomField['Target Groups']); unset($this->configFieldSetsCustomField['Target Groups']); } // close that fieldse @@ -13081,7 +13265,7 @@ class Interpretation extends Fields // add custom global fields if (isset($this->configFieldSetsCustomField['Global']) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField['Global'])) { - $this->configFieldSets[] = implode("\t\t", $this->configFieldSetsCustomField['Global']); + $this->configFieldSets[] = implode("", $this->configFieldSetsCustomField['Global']); unset($this->configFieldSetsCustomField['Global']); } // set the author details @@ -13439,7 +13623,7 @@ for developing fast and powerful web interfaces. For more info visit configFieldSetsCustomField['Uikit Settings']) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField['Uikit Settings'])) { - $this->configFieldSets[] = implode("\t\t", $this->configFieldSetsCustomField['Uikit Settings']); + $this->configFieldSets[] = implode("", $this->configFieldSetsCustomField['Uikit Settings']); unset($this->configFieldSetsCustomField['Uikit Settings']); } // close that fieldset @@ -13463,7 +13647,7 @@ for developing fast and powerful web interfaces. For more info visit configFieldSetsCustomField['Mail Configuration']) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField['Mail Configuration'])) { - $this->configFieldSets[] = implode("\t\t", $this->configFieldSetsCustomField['Mail Configuration']); + $this->configFieldSets[] = implode("", $this->configFieldSetsCustomField['Mail Configuration']); unset($this->configFieldSetsCustomField['Mail Configuration']); } else @@ -13725,7 +13909,7 @@ for developing fast and powerful web interfaces. For more info visit configFieldSetsCustomField['DKIM']) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField['DKIM'])) { - $this->configFieldSets[] = implode("\t\t", $this->configFieldSetsCustomField['DKIM']); + $this->configFieldSets[] = implode("", $this->configFieldSetsCustomField['DKIM']); unset($this->configFieldSetsCustomField['DKIM']); } else @@ -14159,7 +14343,7 @@ function vdm_dkim() { // add custom Encryption Settings fields if (isset($this->configFieldSetsCustomField['Chart Settings']) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField['Chart Settings'])) { - $this->configFieldSets[] = implode("\t\t", $this->configFieldSetsCustomField['Chart Settings']); + $this->configFieldSets[] = implode("", $this->configFieldSetsCustomField['Chart Settings']); unset($this->configFieldSetsCustomField['Chart Settings']); } @@ -14209,25 +14393,70 @@ function vdm_dkim() { */ public function setEncryptionConfigFieldsets($lang) { + // enable the loading of dynamic field sets + $dynamicAddFields = array(); // Add encryption if needed - if ((isset($this->basicEncryption) && $this->basicEncryption) || (isset($this->advancedEncryption) && $this->advancedEncryption)) + if ((isset($this->basicEncryption) && $this->basicEncryption) || + (isset($this->whmcsEncryption) && $this->whmcsEncryption) || + (isset($this->mediumEncryption) && $this->mediumEncryption) || + $this->componentData->add_license || + (isset($this->configFieldSetsCustomField['Encryption Settings']) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField['Encryption Settings']))) { + $dynamicAddFields[] = "Encryption Settings"; // start building field set for encryption functions $this->configFieldSets[] = "\tconfigFieldSets[] = "\t\t" . 'name="encryption_config"'; $this->configFieldSets[] = "\t\t" . 'label="' . $lang . '_ENCRYPTION_LABEL"'; $this->configFieldSets[] = "\t\t" . 'description="' . $lang . '_ENCRYPTION_DESC">'; + // set tab lang - $this->langContent[$this->lang][$lang . '_ENCRYPTION_LABEL'] = "Encryption Settings"; - $this->langContent[$this->lang][$lang . '_ENCRYPTION_DESC'] = "The encryption key for the field encryption is set here."; + if (((isset($this->basicEncryption) && $this->basicEncryption) || + (isset($this->mediumEncryption) && $this->mediumEncryption) || + (isset($this->whmcsEncryption) && $this->whmcsEncryption)) && + $this->componentData->add_license && $this->componentData->license_type == 3) + { + $this->langContent[$this->lang][$lang . '_ENCRYPTION_LABEL'] = "License & Encryption Settings"; + $this->langContent[$this->lang][$lang . '_ENCRYPTION_DESC'] = "The license & encryption keys are set here."; + // add the next dynamic option + $dynamicAddFields[] = "License & Encryption Settings"; + } + elseif (((isset($this->basicEncryption) && $this->basicEncryption) || + (isset($this->mediumEncryption) && $this->mediumEncryption) || + (isset($this->whmcsEncryption) && $this->whmcsEncryption)) && + $this->componentData->add_license && $this->componentData->license_type == 2) + { + $this->langContent[$this->lang][$lang . '_ENCRYPTION_LABEL'] = "Update & Encryption Settings"; + $this->langContent[$this->lang][$lang . '_ENCRYPTION_DESC'] = "The update & encryption keys are set here."; + // add the next dynamic option + $dynamicAddFields[] = "Update & Encryption Settings"; + } + elseif ($this->componentData->add_license && $this->componentData->license_type == 3) + { + $this->langContent[$this->lang][$lang . '_ENCRYPTION_LABEL'] = "License Settings"; + $this->langContent[$this->lang][$lang . '_ENCRYPTION_DESC'] = "The license key is set here."; + // add the next dynamic option + $dynamicAddFields[] = "License Settings"; + } + elseif ($this->componentData->add_license && $this->componentData->license_type == 2) + { + $this->langContent[$this->lang][$lang . '_ENCRYPTION_LABEL'] = "Update Settings"; + $this->langContent[$this->lang][$lang . '_ENCRYPTION_DESC'] = "The update key is set here."; + // add the next dynamic option + $dynamicAddFields[] = "Update Settings"; + } + else + { + $this->langContent[$this->lang][$lang . '_ENCRYPTION_LABEL'] = "Encryption Settings"; + $this->langContent[$this->lang][$lang . '_ENCRYPTION_DESC'] = "The encryption key for the field encryption is set here."; + } if (isset($this->basicEncryption) && $this->basicEncryption) { // set field lang - $this->langContent[$this->lang][$lang . '_BASIC_KEY_LABEL'] = "Basic Key (basic encryption)"; + $this->langContent[$this->lang][$lang . '_BASIC_KEY_LABEL'] = "Basic Key"; $this->langContent[$this->lang][$lang . '_BASIC_KEY_DESC'] = "Set the basic local key here."; $this->langContent[$this->lang][$lang . '_BASIC_KEY_NOTE_LABEL'] = "Basic Encryption"; - $this->langContent[$this->lang][$lang . '_BASIC_KEY_NOTE_DESC'] = "When using the basic encryption please use a 32 character passphrase.
Never change this passphrase once it is set! DATA WILL GET CORRUPTED IF YOU DO!"; + $this->langContent[$this->lang][$lang . '_BASIC_KEY_NOTE_DESC'] = "When using the basic encryption please use set a 32 character passphrase.
Never change this passphrase once it is set! DATA WILL GET CORRUPTED IF YOU DO!"; // set the field $this->configFieldSets[] = "\t\t" . ''; $this->configFieldSets[] = "\t\t" . 'configFieldSets[] = "\t\t\t" . 'default=""'; $this->configFieldSets[] = "\t\t/>"; } - - if (isset($this->advancedEncryption) && $this->advancedEncryption) + if (isset($this->mediumEncryption) && $this->mediumEncryption) { // set field lang - $this->langContent[$this->lang][$lang . '_VDM_KEY_LABEL'] = "Advanced Key (advanced encryption)"; - $this->langContent[$this->lang][$lang . '_VDM_KEY_DESC'] = "Add the advanced key here."; - $this->langContent[$this->lang][$lang . '_VDM_KEY_NOTE_LABEL'] = "Advanced Encryption"; - $this->langContent[$this->lang][$lang . '_VDM_KEY_NOTE_DESC'] = "When using the advanced encryption you need to get an advanced key from " . $this->componentData->companyname . ".
Never change this advanced key once it is set! DATA WILL GET CORRUPTED IF YOU DO!"; + $this->langContent[$this->lang][$lang . '_MEDIUM_KEY_LABEL'] = "Medium Key (Path)"; + $this->langContent[$this->lang][$lang . '_MEDIUM_KEY_DESC'] = "Set the full path to where the key file must be stored. Make sure it is behind the root folder of your website, so that it is not public accessible."; + $this->langContent[$this->lang][$lang . '_MEDIUM_KEY_NOTE_LABEL'] = "Medium Encryption"; + $this->langContent[$this->lang][$lang . '_MEDIUM_KEY_NOTE_DESC'] = "When using the medium encryption option, the system generates its own key and stores it in a file at the folder/path you set here.
Never change this key once it is set, or remove the key file! DATA WILL GET CORRUPTED IF YOU DO! Also make sure the full path to where the the key file should be stored, is behind the root folder of your website/system, so that it is not public accessible. Making a backup of this key file over a secure connection is recommended!"; // set the field - $this->configFieldSets[] = "\t\t" . ''; - $this->configFieldSets[] = "\t\t" . 'configFieldSets[] = "\t\t" . ''; + $this->configFieldSets[] = "\t\t" . 'configFieldSets[] = "\t\t\t" . 'type="text"'; - $this->configFieldSets[] = "\t\t\t" . 'label="' . $lang . '_VDM_KEY_LABEL"'; - $this->configFieldSets[] = "\t\t\t" . 'description="' . $lang . '_VDM_KEY_DESC"'; + $this->configFieldSets[] = "\t\t\t" . 'label="' . $lang . '_MEDIUM_KEY_LABEL"'; + $this->configFieldSets[] = "\t\t\t" . 'description="' . $lang . '_MEDIUM_KEY_DESC"'; + $this->configFieldSets[] = "\t\t\t" . 'size="160"'; + $this->configFieldSets[] = "\t\t\t" . 'filter="PATH"'; + $this->configFieldSets[] = "\t\t\t" . 'hint="/home/user/hiddenfolder123/"'; + $this->configFieldSets[] = "\t\t\t" . 'default=""'; + $this->configFieldSets[] = "\t\t/>"; + // set some error message if the path does not exist + $this->langContent[$this->lang][$lang . '_MEDIUM_KEY_PATH_ERROR'] = "Medium key path (for encryption of various fields) does not exist, or is not writable. Please check the path and update it in the global option of this component."; + } + if (isset($this->whmcsEncryption) && $this->whmcsEncryption || $this->componentData->add_license) + { + // set field lang label and description + if ($this->componentData->add_license && $this->componentData->license_type == 3) + { + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_LABEL'] = "License Key"; + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_DESC'] = "Add the license key you recieved from " . $this->componentData->companyname . " here."; + } + elseif ($this->componentData->add_license && $this->componentData->license_type == 2) + { + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_LABEL'] = "Update Key"; + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_DESC'] = "Add the update key you recieved from " . $this->componentData->companyname . " here."; + } + else + { + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_LABEL'] = "WHMCS Key"; + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_DESC'] = "Add the key you recieved from " . $this->componentData->companyname . " here."; + } + // ajust the notice based on license + if (isset($this->whmcsEncryption) && $this->whmcsEncryption) + { + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_NOTE_LABEL'] = "Field Encryption (whmcs)"; + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_NOTE_DESC'] = "When using this (whmcs) encryption you need to get a key from " . $this->componentData->companyname . ".
Never change this key once it is set! DATA WILL GET CORRUPTED IF YOU DO!"; + } + else + { + if ($this->componentData->license_type == 3) + { + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_NOTE_LABEL'] = "Your License Key"; + } + elseif ($this->componentData->license_type == 2) + { + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_NOTE_LABEL'] = "Your Update Key"; + } + else + { + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_NOTE_LABEL'] = "Your Key (whmcs)"; + } + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_NOTE_DESC'] = "You need to get this key from " . $this->componentData->companyname . "."; + } + // set the fields + $this->configFieldSets[] = "\t\t" . ''; + $this->configFieldSets[] = "\t\t" . 'configFieldSets[] = "\t\t\t" . 'type="text"'; + $this->configFieldSets[] = "\t\t\t" . 'label="' . $lang . '_WHMCS_KEY_LABEL"'; + $this->configFieldSets[] = "\t\t\t" . 'description="' . $lang . '_WHMCS_KEY_DESC"'; $this->configFieldSets[] = "\t\t\t" . 'size="60"'; $this->configFieldSets[] = "\t\t\t" . 'default=""'; $this->configFieldSets[] = "\t\t/>"; } - // add custom Encryption Settings fields - if (isset($this->configFieldSetsCustomField['Encryption Settings']) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField['Encryption Settings'])) + // load the dynamic field sets + foreach ($dynamicAddFields as $dynamicAddField) { - $this->configFieldSets[] = implode("\t\t", $this->configFieldSetsCustomField['Encryption Settings']); - unset($this->configFieldSetsCustomField['Encryption Settings']); + // add custom Encryption Settings fields + if (isset($this->configFieldSetsCustomField[$dynamicAddField]) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField[$dynamicAddField])) + { + $this->configFieldSets[] = implode("", $this->configFieldSetsCustomField[$dynamicAddField]); + unset($this->configFieldSetsCustomField[$dynamicAddField]); + } } // close that fieldset $this->configFieldSets[] = "\t"; @@ -14475,8 +14761,8 @@ function vdm_dkim() { $propertyType = $property; } } - $fieldType = $this->getFieldType($field['settings']->type_name, $field['settings']->xml, $propertyType); - $fieldName = $this->getFieldName($fieldType, $field['settings']->xml, $field['alias']); + $fieldType = $this->getFieldType($field); + $fieldName = $this->getFieldName($field, $nameViews); $fieldView = array(); // set the permission for this field $fieldView['action'] = 'view.edit.' . $fieldName; @@ -14825,72 +15111,6 @@ function vdm_dkim() { } } - public function getFieldName($typeName, $xml, $alias) - { - // if category then name must be catid (only one per view) - if ($typeName === 'category') - { - return 'catid'; - } - // if tag is set then enable all tag options for this view (only one per view) - elseif ($typeName === 'tag') - { - return 'tags'; - } - // if the field is set as alias it must be called alias - elseif ($alias) - { - return 'alias'; - } - elseif ($typeName === 'spacer') - { - // make sure the name is unique - return false; - } - else - { - return ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xml, 'name="', '"')); - } - } - - public function getFieldType($typeName, $xml, $property) - { - // make sure its lower case - $typeName = ComponentbuilderHelper::safeString($typeName); - - if ($typeName === 'custom' || $typeName === 'customuser') - { - $xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xml, 'type="', '"')); - } - // use field core type only if not found - elseif (ComponentbuilderHelper::checkString($typeName)) - { - $xmlValue = $typeName; - } - // make sure none adjustable fields are set - elseif (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']) && $property['adjustable'] == 0) - { - $xmlValue = $property['example']; - } - // fall back on the xml settings - else - { - $xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xml, 'type="', '"')); - } - - // check if the value is set - if (ComponentbuilderHelper::checkString($xmlValue)) - { - // add the value - return $xmlValue; - } - else - { - // fall back to text - return 'text'; - } - } - public function getInbetweenStrings($str, $start = '###', $end = '###') { $matches = array(); diff --git a/admin/helpers/compiler/f_Infusion.php b/admin/helpers/compiler/f_Infusion.php index 8465dbf8f..576b0aad6 100644 --- a/admin/helpers/compiler/f_Infusion.php +++ b/admin/helpers/compiler/f_Infusion.php @@ -753,20 +753,32 @@ class Infusion extends Interpretation // ###UPDATE_VERSION_MYSQL### $this->setVersionController(); - // ###DASHBOARDICONS### - $this->fileContentDynamic[$this->fileContentStatic['###component###']]['###DASHBOARDICONS###'] = $this->setDashboardIcons(); + // only set these if default dashboard it used + if (!ComponentbuilderHelper::checkString($this->dynamicDashboard)) + { + // ###DASHBOARDVIEW### + $this->fileContentStatic['###DASHBOARDVIEW###'] = $this->fileContentStatic['###component###']; - // ###DASHBOARDICONACCESS### - $this->fileContentDynamic[$this->fileContentStatic['###component###']]['###DASHBOARDICONACCESS###'] = $this->setDashboardIconAccess(); + // ###DASHBOARDICONS### + $this->fileContentDynamic[$this->fileContentStatic['###component###']]['###DASHBOARDICONS###'] = $this->setDashboardIcons(); - // ###DASH_MODEL_METHODS### - $this->fileContentDynamic[$this->fileContentStatic['###component###']]['###DASH_MODEL_METHODS###'] = $this->setDashboardModelMethods(); + // ###DASHBOARDICONACCESS### + $this->fileContentDynamic[$this->fileContentStatic['###component###']]['###DASHBOARDICONACCESS###'] = $this->setDashboardIconAccess(); - // ###DASH_GET_CUSTOM_DATA### - $this->fileContentDynamic[$this->fileContentStatic['###component###']]['###DASH_GET_CUSTOM_DATA###'] = $this->setDashboardGetCustomData(); + // ###DASH_MODEL_METHODS### + $this->fileContentDynamic[$this->fileContentStatic['###component###']]['###DASH_MODEL_METHODS###'] = $this->setDashboardModelMethods(); - // ###DASH_DISPLAY_DATA### - $this->fileContentDynamic[$this->fileContentStatic['###component###']]['###DASH_DISPLAY_DATA###'] = $this->setDashboardDisplayData(); + // ###DASH_GET_CUSTOM_DATA### + $this->fileContentDynamic[$this->fileContentStatic['###component###']]['###DASH_GET_CUSTOM_DATA###'] = $this->setDashboardGetCustomData(); + + // ###DASH_DISPLAY_DATA### + $this->fileContentDynamic[$this->fileContentStatic['###component###']]['###DASH_DISPLAY_DATA###'] = $this->setDashboardDisplayData(); + } + else + { + // ###DASHBOARDVIEW### + $this->fileContentStatic['###DASHBOARDVIEW###'] = $this->dynamicDashboard; + } // add import if (isset($this->addEximport) && $this->addEximport) @@ -1026,6 +1038,12 @@ class Infusion extends Interpretation // ###UNINSTALLSCRIPT### $this->fileContentStatic['###UNINSTALLSCRIPT###'] = $this->setUninstallScript(); + // ###MOVEFOLDERSSCRIPT### + $this->fileContentStatic['###MOVEFOLDERSSCRIPT###'] = $this->setMoveFolderScript(); + + // ###MOVEFOLDERSMETHOD### + $this->fileContentStatic['###MOVEFOLDERSMETHOD###'] = $this->setMoveFolderMethod(); + // ###HELPER_UIKIT### $this->fileContentStatic['###HELPER_UIKIT###'] = $this->setUikitHelperMethods(); diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index 8a9e2feff..13cfc4cdf 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -986,6 +986,57 @@ abstract class ComponentbuilderHelper **/ public static $snippetPath = 'https://raw.githubusercontent.com/vdm-io/Joomla-Component-Builder-Snippets/master/'; public static $snippetsPath = 'https://api.github.com/repos/vdm-io/Joomla-Component-Builder-Snippets/git/trees/master'; + + /** + * The array of constant paths + * + * JPATH_SITE is meant to represent the root path of the JSite application, + * just as JPATH_ADMINISTRATOR is mean to represent the root path of the JAdministrator application. + * + * JPATH_BASE is the root path for the current requested application.... so if you are in the administrator application: + * + * JPATH_BASE == JPATH_ADMINISTRATOR + * + * If you are in the site application: + * + * JPATH_BASE == JPATH_SITE + * + * If you are in the installation application: + * + * JPATH_BASE == JPATH_INSTALLATION. + * + * JPATH_ROOT is the root path for the Joomla install and does not depend upon any application. + * + * @var array + */ + public static $constantPaths = array( + // The path to the administrator folder. + 'JPATH_ADMINISTRATOR' => JPATH_ADMINISTRATOR, + // The path to the installed Joomla! site, or JPATH_ROOT/administrator if executed from the backend. + 'JPATH_BASE' => JPATH_BASE, + // The path to the cache folder. + 'JPATH_CACHE' => JPATH_CACHE, + // The path to the administration folder of the current component being executed. + 'JPATH_COMPONENT_ADMINISTRATOR' => JPATH_COMPONENT_ADMINISTRATOR, + // The path to the site folder of the current component being executed. + 'JPATH_COMPONENT_SITE' => JPATH_COMPONENT_SITE, + // The path to the current component being executed. + 'JPATH_COMPONENT' => JPATH_COMPONENT, + // The path to folder containing the configuration.php file. + 'JPATH_CONFIGURATION' => JPATH_CONFIGURATION, + // The path to the installation folder. + 'JPATH_INSTALLATION' => JPATH_INSTALLATION, + // The path to the libraries folder. + 'JPATH_LIBRARIES' => JPATH_LIBRARIES, + // The path to the plugins folder. + 'JPATH_PLUGINS' => JPATH_PLUGINS, + // The path to the installed Joomla! site. + 'JPATH_ROOT' => JPATH_ROOT, + // The path to the installed Joomla! site. + 'JPATH_SITE' => JPATH_SITE, + // The path to the templates folder. + 'JPATH_THEMES' => JPATH_THEMES + ); /** * Get the snippet contributor details @@ -1503,16 +1554,19 @@ abstract class ComponentbuilderHelper } /** - * get the localkey + * the basic localkey **/ protected static $localkey = false; - + + /** + * get the localkey + **/ public static function getLocalKey() { if (!self::$localkey) { - // get the main key - self::$localkey = md5(JComponentHelper::getParams('com_componentbuilder')->get('basic_key', 'localKey34fdWEkl')); + // get the basic key + self::$localkey = md5(self::getCryptKey('basic', 'localKey34fdWEkl')); } return self::$localkey; } @@ -1585,8 +1639,18 @@ abstract class ComponentbuilderHelper } return false; } - - public static function getBetween($content,$start,$end) + + /** + * get between + * + * @param string $content The content to search + * @param string $start The starting value + * @param string $end The ending value + * + * @return string On success / empty string on failure + * + */ + public static function getBetween($content, $start, $end) { $r = explode($start, $content); if (isset($r[1])) @@ -1596,17 +1660,32 @@ abstract class ComponentbuilderHelper } return ''; } - - public static function getAllBetween($content,$start,$end) + + /** + * get all between + * + * @param string $content The content to search + * @param string $start The starting value + * @param string $end The ending value + * + * @return array On success + * + */ + public static function getAllBetween($content, $start, $end) { - $buket = array(); + // reset bucket + $bucket = array(); for ($i = 0; ; $i++) { + // search for string $found = self::getBetween($content,$start,$end); if (self::checkString($found)) { - $buket[] = $found; + // add to bucket + $bucket[] = $found; + // build removal string $remove = $start.$found.$end; + // remove from content $content = str_replace($remove,'',$content); } else @@ -1619,9 +1698,10 @@ abstract class ComponentbuilderHelper break; } } - return array_unique($buket); + // only return unique array of values + return array_unique($bucket); } - + public static function typeField($type,$option = 'default') { // list of default fields @@ -1984,7 +2064,7 @@ abstract class ComponentbuilderHelper if (!self::$composer) { // load the autoloader - require_once JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/vendor/autoload.php'; + require_once JPATH_SITE.'/libraries/vdm_io/vendor/autoload.php'; // do not load again self::$composer = true; } @@ -2094,7 +2174,7 @@ abstract class ComponentbuilderHelper if (!class_exists('\phpseclib\Net\SFTP')) { // class not in place so send out error - JFactory::getApplication()->enqueueMessage(JText::_('COM_COMPONENTBUILDER_THE_BPHPSECLIBNETSFTPB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_ADMINHELPERSVENDOR_FOLDER_OF_JCB_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO'), 'Error'); + JFactory::getApplication()->enqueueMessage(JText::_('COM_COMPONENTBUILDER_THE_BPHPSECLIBNETSFTPB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESVDM_IOVENDORB_FOLDER_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO'), 'Error'); return false; } // insure the port is set @@ -2409,6 +2489,41 @@ abstract class ComponentbuilderHelper JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_SERVER_DETAILS_FOR_BID_SB_COULD_NOT_BE_RETRIEVED', $serverID), 'Error'); return false; } + + /** + * the Crypt objects + **/ + protected static $CRYPT = array(); + + /** + * get the Crypt object + * + * @return object on success with Crypt power + **/ + public static function crypt($TYPE) + { + // check if it was already set + if (isset(self::$CRYPT[$TYPE]) && self::checkObject(self::$CRYPT[$TYPE])) + { + return self::$CRYPT[$TYPE]; + } + // make sure we have the composer classes loaded + self::composerAutoload(); + // build class name + $CLASS = '\phpseclib\Crypt\\'.$TYPE; + // make sure we have the phpseclib classes + if (!class_exists($CLASS)) + { + // class not in place so send out error + JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_BSB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESVDM_IOVENDORB_FOLDER_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO', $CLASS), 'Error'); + return false; + } + // set the + self::$CRYPT[$TYPE] = new $CLASS(); + // return the object + return self::$CRYPT[$TYPE]; + } + /** * Load the Component xml manifest. **/ @@ -2417,12 +2532,12 @@ abstract class ComponentbuilderHelper $manifestUrl = JPATH_ADMINISTRATOR."/components/com_componentbuilder/componentbuilder.xml"; return simplexml_load_file($manifestUrl); } - + /** * Joomla version object **/ protected static $JVersion; - + /** * set/get Joomla version **/ @@ -3306,7 +3421,7 @@ abstract class ComponentbuilderHelper } return $model; } - + /** * Add to asset Table */ @@ -3368,7 +3483,7 @@ abstract class ComponentbuilderHelper } return false; } - + /** * Gets the default asset Rules for a component/view. */ @@ -3444,7 +3559,14 @@ abstract class ComponentbuilderHelper return $button->input; } - + + /** + * Check if have an json string + * + * @input string The json string to check + * + * @returns bool true on success + **/ public static function checkJson($string) { if (self::checkString($string)) @@ -3455,15 +3577,29 @@ abstract class ComponentbuilderHelper return false; } + /** + * Check if have an object with a length + * + * @input object The object to check + * + * @returns bool true on success + **/ public static function checkObject($object) { - if (isset($object) && is_object($object) && count($object) > 0) + if (isset($object) && is_object($object)) { - return true; + return count((array)$object) > 0; } return false; } + /** + * Check if have an array with a length + * + * @input array The array to check + * + * @returns bool true on success + **/ public static function checkArray($array, $removeEmptyString = false) { if (isset($array) && is_array($array) && count($array) > 0) @@ -3485,6 +3621,13 @@ abstract class ComponentbuilderHelper return false; } + /** + * Check if have a string with a length + * + * @input string The string to check + * + * @returns bool true on success + **/ public static function checkString($string) { if (isset($string) && is_string($string) && strlen($string) > 0) @@ -3493,7 +3636,7 @@ abstract class ComponentbuilderHelper } return false; } - + /** * Check if we are connected * Thanks https://stackoverflow.com/a/4860432/1429677 @@ -3519,6 +3662,13 @@ abstract class ComponentbuilderHelper return $is_conn; } + /** + * Merge an array of array's + * + * @input array The arrays you would like to merge + * + * @returns array on success + **/ public static function mergeArrays($arrays) { if(self::checkArray($arrays)) @@ -3542,6 +3692,13 @@ abstract class ComponentbuilderHelper return self::shorten($string, $length, $addTip); } + /** + * Shorten a string + * + * @input string The you would like to shorten + * + * @returns string on success + **/ public static function shorten($string, $length = 40, $addTip = true) { if (self::checkString($string)) @@ -3576,6 +3733,13 @@ abstract class ComponentbuilderHelper return $string; } + /** + * Making strings safe (various ways) + * + * @input string The you would like to make safe + * + * @returns string on success + **/ public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true) { if ($replaceNumbers === true) @@ -3703,7 +3867,7 @@ abstract class ComponentbuilderHelper // return the string with no numbers remaining. return $string; } - + /** * Convert an integer into an English word string * Thanks to Tom Nicholson @@ -3813,18 +3977,29 @@ abstract class ComponentbuilderHelper return implode($key); } - public static function getCryptKey($type, $default = null) + /** + * Get The Encryption Keys + * + * @param string $type The type of key + * @param string/bool $default The return value if no key was found + * + * @return string On success + * + **/ + public static function getCryptKey($type, $default = false) { + // Get the global params + $params = JComponentHelper::getParams('com_componentbuilder', true); + // Basic Encryption Type if ('basic' === $type) { - // Get the global params - $params = JComponentHelper::getParams('com_componentbuilder', true); $basic_key = $params->get('basic_key', $default); - if ($basic_key) + if (self::checkString($basic_key)) { return $basic_key; } } - return false; + + return $default; } } diff --git a/admin/helpers/vendor/phpseclib/phpseclib/composer.lock b/admin/helpers/vendor/phpseclib/phpseclib/composer.lock deleted file mode 100644 index beda2d640..000000000 --- a/admin/helpers/vendor/phpseclib/phpseclib/composer.lock +++ /dev/null @@ -1,1819 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "hash": "8599992bf6058a9da82372eb8bcae2c2", - "content-hash": "fde47c84178c55c06de858a2128e3d07", - "packages": [], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", - "shasum": "" - }, - "require": { - "php": ">=5.3,<8.0-DEV" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2015-06-14 21:17:01" - }, - { - "name": "michelf/php-markdown", - "version": "1.6.0", - "source": { - "type": "git", - "url": "https://github.com/michelf/php-markdown.git", - "reference": "156e56ee036505ec637d761ee62dc425d807183c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/michelf/php-markdown/zipball/156e56ee036505ec637d761ee62dc425d807183c", - "reference": "156e56ee036505ec637d761ee62dc425d807183c", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-lib": "1.4.x-dev" - } - }, - "autoload": { - "psr-0": { - "Michelf": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Michel Fortin", - "email": "michel.fortin@michelf.ca", - "homepage": "https://michelf.ca/", - "role": "Developer" - }, - { - "name": "John Gruber", - "homepage": "https://daringfireball.net/" - } - ], - "description": "PHP Markdown", - "homepage": "https://michelf.ca/projects/php-markdown/", - "keywords": [ - "markdown" - ], - "time": "2015-12-24 01:37:31" - }, - { - "name": "nikic/php-parser", - "version": "v0.9.5", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ef70767475434bdb3615b43c327e2cae17ef12eb", - "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.9-dev" - } - }, - "autoload": { - "psr-0": { - "PHPParser": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "time": "2014-07-23 18:24:17" - }, - { - "name": "phing/phing", - "version": "2.14.0", - "source": { - "type": "git", - "url": "https://github.com/phingofficial/phing.git", - "reference": "7dd73c83c377623def54b58121f46b4dcb35dd61" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phingofficial/phing/zipball/7dd73c83c377623def54b58121f46b4dcb35dd61", - "reference": "7dd73c83c377623def54b58121f46b4dcb35dd61", - "shasum": "" - }, - "require": { - "php": ">=5.2.0" - }, - "require-dev": { - "ext-pdo_sqlite": "*", - "lastcraft/simpletest": "@dev", - "mikey179/vfsstream": "^1.6", - "pdepend/pdepend": "2.x", - "pear/archive_tar": "1.4.x", - "pear/http_request2": "dev-trunk", - "pear/net_growl": "dev-trunk", - "pear/pear-core-minimal": "1.10.1", - "pear/versioncontrol_git": "@dev", - "pear/versioncontrol_svn": "~0.5", - "phpdocumentor/phpdocumentor": "2.x", - "phploc/phploc": "~2.0.6", - "phpmd/phpmd": "~2.2", - "phpunit/phpunit": ">=3.7", - "sebastian/git": "~1.0", - "sebastian/phpcpd": "2.x", - "squizlabs/php_codesniffer": "~2.2", - "symfony/yaml": "~2.7" - }, - "suggest": { - "pdepend/pdepend": "PHP version of JDepend", - "pear/archive_tar": "Tar file management class", - "pear/versioncontrol_git": "A library that provides OO interface to handle Git repository", - "pear/versioncontrol_svn": "A simple OO-style interface for Subversion, the free/open-source version control system", - "phpdocumentor/phpdocumentor": "Documentation Generator for PHP", - "phploc/phploc": "A tool for quickly measuring the size of a PHP project", - "phpmd/phpmd": "PHP version of PMD tool", - "phpunit/php-code-coverage": "Library that provides collection, processing, and rendering functionality for PHP code coverage information", - "phpunit/phpunit": "The PHP Unit Testing Framework", - "sebastian/phpcpd": "Copy/Paste Detector (CPD) for PHP code", - "tedivm/jshrink": "Javascript Minifier built in PHP" - }, - "bin": [ - "bin/phing" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.14.x-dev" - } - }, - "autoload": { - "classmap": [ - "classes/phing/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "classes" - ], - "license": [ - "LGPL-3.0" - ], - "authors": [ - { - "name": "Michiel Rook", - "email": "mrook@php.net" - }, - { - "name": "Phing Community", - "homepage": "https://www.phing.info/trac/wiki/Development/Contributors" - } - ], - "description": "PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.", - "homepage": "https://www.phing.info/", - "keywords": [ - "build", - "phing", - "task", - "tool" - ], - "time": "2016-03-10 21:39:23" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "1.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2015-12-27 11:43:31" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "9270140b940ff02e58ec577c237274e92cd40cdd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9270140b940ff02e58ec577c237274e92cd40cdd", - "reference": "9270140b940ff02e58ec577c237274e92cd40cdd", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-06-10 09:48:41" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "0.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443", - "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "time": "2016-06-10 07:14:17" - }, - { - "name": "phpspec/prophecy", - "version": "v1.6.1", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "58a8137754bc24b25740d4281399a4a3596058e0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0", - "reference": "58a8137754bc24b25740d4281399a4a3596058e0", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1", - "sebastian/recursion-context": "^1.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2016-06-07 08:13:47" - }, - { - "name": "phpunit/php-code-coverage", - "version": "2.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" - }, - "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2015-10-06 15:47:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2015-06-21 13:08:43" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21 13:50:34" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4|~5" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2016-05-12 18:03:57" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.4.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2015-09-15 10:49:45" - }, - { - "name": "phpunit/phpunit", - "version": "4.8.26", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "fc1d8cd5b5de11625979125c5639347896ac2c74" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fc1d8cd5b5de11625979125c5639347896ac2c74", - "reference": "fc1d8cd5b5de11625979125c5639347896ac2c74", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.1", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.1|~3.0" - }, - "suggest": { - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.8.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2016-05-17 03:09:28" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2015-10-02 06:51:40" - }, - { - "name": "pimple/pimple", - "version": "v2.1.1", - "source": { - "type": "git", - "url": "https://github.com/silexphp/Pimple.git", - "reference": "ea22fb2880faf7b7b0e17c9809c6fe25b071fd76" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/ea22fb2880faf7b7b0e17c9809c6fe25b071fd76", - "reference": "ea22fb2880faf7b7b0e17c9809c6fe25b071fd76", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" - } - }, - "autoload": { - "psr-0": { - "Pimple": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", - "homepage": "http://pimple.sensiolabs.org", - "keywords": [ - "container", - "dependency injection" - ], - "time": "2014-07-24 07:10:08" - }, - { - "name": "sami/sami", - "version": "v2.0.0", - "source": { - "type": "git", - "url": "https://github.com/FriendsOfPHP/Sami.git", - "reference": "fa58b324f41aa2aefe21dac4f22d8c98965fc012" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/Sami/zipball/fa58b324f41aa2aefe21dac4f22d8c98965fc012", - "reference": "fa58b324f41aa2aefe21dac4f22d8c98965fc012", - "shasum": "" - }, - "require": { - "michelf/php-markdown": "~1.3", - "nikic/php-parser": "0.9.*", - "php": ">=5.3.0", - "pimple/pimple": "2.*", - "symfony/console": "~2.1", - "symfony/filesystem": "~2.1", - "symfony/finder": "~2.1", - "symfony/process": "~2.1", - "symfony/yaml": "~2.1", - "twig/twig": "1.*" - }, - "bin": [ - "sami.php" - ], - "type": "application", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "psr-0": { - "Sami": "." - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Sami, an API documentation generator", - "homepage": "http://sami.sensiolabs.org", - "keywords": [ - "phpdoc" - ], - "time": "2014-06-25 12:05:18" - }, - { - "name": "sebastian/comparator", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2015-07-26 15:48:44" - }, - { - "name": "sebastian/diff", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2015-12-08 07:14:41" - }, - { - "name": "sebastian/environment", - "version": "1.3.7", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716", - "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2016-05-17 03:18:57" - }, - { - "name": "sebastian/exporter", - "version": "1.2.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2016-06-17 09:04:28" - }, - { - "name": "sebastian/global-state", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2015-10-12 03:26:01" - }, - { - "name": "sebastian/recursion-context", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-11-11 19:50:13" - }, - { - "name": "sebastian/version", - "version": "1.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "shasum": "" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" - }, - { - "name": "squizlabs/php_codesniffer", - "version": "2.6.1", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "fb72ed32f8418db5e7770be1653e62e0d6f5dd3d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/fb72ed32f8418db5e7770be1653e62e0d6f5dd3d", - "reference": "fb72ed32f8418db5e7770be1653e62e0d6f5dd3d", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "bin": [ - "scripts/phpcs", - "scripts/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "classmap": [ - "CodeSniffer.php", - "CodeSniffer/CLI.php", - "CodeSniffer/Exception.php", - "CodeSniffer/File.php", - "CodeSniffer/Fixer.php", - "CodeSniffer/Report.php", - "CodeSniffer/Reporting.php", - "CodeSniffer/Sniff.php", - "CodeSniffer/Tokens.php", - "CodeSniffer/Reports/", - "CodeSniffer/Tokenizers/", - "CodeSniffer/DocGenerators/", - "CodeSniffer/Standards/AbstractPatternSniff.php", - "CodeSniffer/Standards/AbstractScopeSniff.php", - "CodeSniffer/Standards/AbstractVariableSniff.php", - "CodeSniffer/Standards/IncorrectPatternException.php", - "CodeSniffer/Standards/Generic/Sniffs/", - "CodeSniffer/Standards/MySource/Sniffs/", - "CodeSniffer/Standards/PEAR/Sniffs/", - "CodeSniffer/Standards/PSR1/Sniffs/", - "CodeSniffer/Standards/PSR2/Sniffs/", - "CodeSniffer/Standards/Squiz/Sniffs/", - "CodeSniffer/Standards/Zend/Sniffs/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", - "keywords": [ - "phpcs", - "standards" - ], - "time": "2016-05-30 22:24:32" - }, - { - "name": "symfony/console", - "version": "v2.8.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "5ac8bc9aa77bb2edf06af3a1bb6bc1020d23acd3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/5ac8bc9aa77bb2edf06af3a1bb6bc1020d23acd3", - "reference": "5ac8bc9aa77bb2edf06af3a1bb6bc1020d23acd3", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "symfony/polyfill-mbstring": "~1.0" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1|~3.0.0", - "symfony/process": "~2.1|~3.0.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2016-06-06 15:06:25" - }, - { - "name": "symfony/filesystem", - "version": "v2.8.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "dee379131dceed90a429e951546b33edfe7dccbb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/dee379131dceed90a429e951546b33edfe7dccbb", - "reference": "dee379131dceed90a429e951546b33edfe7dccbb", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2016-04-12 18:01:21" - }, - { - "name": "symfony/finder", - "version": "v2.8.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "3ec095fab1800222732ca522a95dce8fa124007b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/3ec095fab1800222732ca522a95dce8fa124007b", - "reference": "3ec095fab1800222732ca522a95dce8fa124007b", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2016-06-06 11:11:27" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.2.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "dff51f72b0706335131b00a7f49606168c582594" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594", - "reference": "dff51f72b0706335131b00a7f49606168c582594", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2016-05-18 14:26:46" - }, - { - "name": "symfony/process", - "version": "v2.8.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "115347d00c342198cdc52a7bd8bc15b5ab43500c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/115347d00c342198cdc52a7bd8bc15b5ab43500c", - "reference": "115347d00c342198cdc52a7bd8bc15b5ab43500c", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2016-06-06 11:11:27" - }, - { - "name": "symfony/yaml", - "version": "v2.8.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "815fabf3f48c7d1df345a69d1ad1a88f59757b34" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/815fabf3f48c7d1df345a69d1ad1a88f59757b34", - "reference": "815fabf3f48c7d1df345a69d1ad1a88f59757b34", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2016-06-06 11:11:27" - }, - { - "name": "twig/twig", - "version": "v1.24.1", - "source": { - "type": "git", - "url": "https://github.com/twigphp/Twig.git", - "reference": "3566d311a92aae4deec6e48682dc5a4528c4a512" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/3566d311a92aae4deec6e48682dc5a4528c4a512", - "reference": "3566d311a92aae4deec6e48682dc5a4528c4a512", - "shasum": "" - }, - "require": { - "php": ">=5.2.7" - }, - "require-dev": { - "symfony/debug": "~2.7", - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.24-dev" - } - }, - "autoload": { - "psr-0": { - "Twig_": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "role": "Project Founder" - }, - { - "name": "Twig Team", - "homepage": "http://twig.sensiolabs.org/contributors", - "role": "Contributors" - } - ], - "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "http://twig.sensiolabs.org", - "keywords": [ - "templating" - ], - "time": "2016-05-30 09:11:59" - }, - { - "name": "webmozart/assert", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde", - "reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2015-08-24 13:29:44" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=5.3.3" - }, - "platform-dev": [] -} diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 3a9c848e9..4b9338b4b 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -2001,13 +2001,50 @@ COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_MODIFIED_DATE_DESC="The date this C COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_MODIFIED_DATE_LABEL="Modified Date" COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NEW="A New Component Files & Folders" COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FILES_DESCRIPTION="You can add custom files to the component, simply add the files to the administrator/components/com_componentbuilder/custom folder and then select them here." -COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FILES_FULLPATH_DESCRIPTION="You can add any files to the component, by using the full system path. Example: /home/user/folder/file.php (make sure that php has permission to read the file)" +COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FILES_FULLPATH_DESCRIPTION="You can add any files to the component, by using the full system path. Example: /home/user/folder/file.php (make sure that php has permission to read the file)
Please note that you can also use constant paths in your full path (directly without quotes), this is highly recommended to insure portability.
To see a list of constant paths please read the notes below. Example: JPATH_ROOT/file.php or JPATH_ROOT/components/com_yourcomponentname/helpers/file.php" COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FILES_FULLPATH_LABEL="Adding Files" COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FILES_LABEL="Adding Custom Files" COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FOLDERS_DESCRIPTION="You can add custom folders to the component, simply add the folders to the administrator/components/com_componentbuilder/custom folder and then select them here." -COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FOLDERS_FULLPATH_DESCRIPTION="You can any folders to the component, by using the full system path. Example: /home/user/folder (make sure that php has permission to read the folder)" +COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FOLDERS_FULLPATH_DESCRIPTION="You can any folders to the component, by using the full system path. Example: /home/user/folder (make sure that php has permission to read the folder)
Please note that you can also use constant paths in your full path (directly without quotes), this is highly recommended to insure portability.
To see a list of constant paths please read the notes below. Example: JPATH_ROOT/folder or JPATH_ROOT/components/com_yourcomponentname/helpers/folder" COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FOLDERS_FULLPATH_LABEL="Adding Folders" COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FOLDERS_LABEL="Adding Custom Folders" +COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_CONSTANT_PATHS_DESCRIPTION="

// The path to the administrator folder.
+JPATH_ADMINISTRATOR
+// The path to the installed Joomla! site, or JPATH_ROOT/administrator if executed from the backend.
+JPATH_BASE
+// The path to the cache folder.
+JPATH_CACHE
+// The path to the administration folder of the current component being executed.
+JPATH_COMPONENT_ADMINISTRATOR
+// The path to the site folder of the current component being executed.
+JPATH_COMPONENT_SITE
+// The path to the current component being executed.
+JPATH_COMPONENT
+// The path to folder containing the configuration.php file.
+JPATH_CONFIGURATION
+// The path to the installation folder.
+JPATH_INSTALLATION
+// The path to the libraries folder.
+JPATH_LIBRARIES
+// The path to the plugins folder.
+JPATH_PLUGINS
+// The path to the installed Joomla! site.
+JPATH_ROOT
+// The path to the installed Joomla! site.
+JPATH_SITE
+// The path to the templates folder.
+JPATH_THEMES

+ +

JPATH_SITE is meant to represent the root path of the JSite application,
+just as JPATH_ADMINISTRATOR is mean to represent the root path of the JAdministrator application.
+JPATH_BASE is the root path for the current requested application.... so if you are in the administrator application:
+JPATH_BASE == JPATH_ADMINISTRATOR
+If you are in the site application:
+JPATH_BASE == JPATH_SITE
+If you are in the installation application:
+JPATH_BASE == JPATH_INSTALLATION.
+JPATH_ROOT is the root path for the Joomla install and does not depend upon any application.

" +COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_CONSTANT_PATHS_LABEL="Constant Paths" COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTNEW_DESCRIPTION="Should file be updated." COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTNEW_LABEL="Update" COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_ORDERING_LABEL="Ordering" @@ -2221,8 +2258,8 @@ COM_COMPONENTBUILDER_CONFIG_BACKUP_PACKAGE_NAME_HINT="JCB_Backup_[YEAR]_[MONTH]_ COM_COMPONENTBUILDER_CONFIG_BACKUP_PACKAGE_NAME_LABEL="Package Name" COM_COMPONENTBUILDER_CONFIG_BACKUP_PACKAGE_NAME_MESSAGE="Error! Please add name here." COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_DESC="Set the basic local key here." -COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_LABEL="Basic Key (basic encryption)" -COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_NOTE_DESC="When using the basic encryption please use a 32 character passphrase.
Never change this passphrase once it is set! DATA WILL GET CORRUPTED IF YOU DO!" +COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_LABEL="Basic Key" +COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_NOTE_DESC="When using the basic encryption please use set a 32 character passphrase.
Never change this passphrase once it is set! DATA WILL GET CORRUPTED IF YOU DO!" COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_NOTE_LABEL="Basic Encryption" COM_COMPONENTBUILDER_CONFIG_CHECK_TIMER_DESC="Set the intervals for the auto checkin fuction of tables that checks out the items to an user." COM_COMPONENTBUILDER_CONFIG_CHECK_TIMER_LABEL="Check in timer" @@ -2233,6 +2270,8 @@ COM_COMPONENTBUILDER_CONFIG_CHECK_TIMER_OPTION_SIX="Never" COM_COMPONENTBUILDER_CONFIG_CHECK_TIMER_OPTION_THREE="Once a day" COM_COMPONENTBUILDER_CONFIG_CHECK_TIMER_OPTION_TWO="Every twelve hours" COM_COMPONENTBUILDER_CONFIG_COMPANY="Company" +COM_COMPONENTBUILDER_CONFIG_COMPILER_FIELD_BUILDER_TYPE_DESCRIPTION="Select the method to use when building the xml fields in the compiler. The SimpleXMLElement Class is best practice, and String Manipulation is faster and works without special extensions." +COM_COMPONENTBUILDER_CONFIG_COMPILER_FIELD_BUILDER_TYPE_LABEL="Field Builder Type
(in compiler)" COM_COMPONENTBUILDER_CONFIG_COMPILER_FOLDER_PATH_DESCRIPTION="Here you can set the path to the compiler folder" COM_COMPONENTBUILDER_CONFIG_COMPILER_FOLDER_PATH_HINT="/home/user/compiler" COM_COMPONENTBUILDER_CONFIG_COMPILER_FOLDER_PATH_LABEL="Compiler Folder Path" @@ -2400,6 +2439,7 @@ COM_COMPONENTBUILDER_CONFIG_SENDMAIL_HINT="/usr/sbin/sendmail" COM_COMPONENTBUILDER_CONFIG_SENDMAIL_LABEL="Sendmail Path" COM_COMPONENTBUILDER_CONFIG_SET_BROWSER_STORAGE_DESCRIPTION="Select if browser storage should be used to save on Ajax calls and speed up this components site pages." COM_COMPONENTBUILDER_CONFIG_SET_BROWSER_STORAGE_LABEL="Browser Storage" +COM_COMPONENTBUILDER_CONFIG_SIMPLEXMLELEMENT_CLASS="SimpleXMLElement Class" COM_COMPONENTBUILDER_CONFIG_SMTP="SMTP" COM_COMPONENTBUILDER_CONFIG_SMTPAUTH_DESCRIPTION="Select yes if your SMTP host requires SMTP Authentication." COM_COMPONENTBUILDER_CONFIG_SMTPAUTH_LABEL="SMTP Authentication" @@ -2419,6 +2459,7 @@ COM_COMPONENTBUILDER_CONFIG_SMTPUSER_LABEL="SMTP Username" COM_COMPONENTBUILDER_CONFIG_SSL="SSL" COM_COMPONENTBUILDER_CONFIG_STORAGE_TIME_TO_LIVE_DESCRIPTION="How long should the data that is stored in the browser memory remain unchanged before it is removed and updated." COM_COMPONENTBUILDER_CONFIG_STORAGE_TIME_TO_LIVE_LABEL="Update Cycle" +COM_COMPONENTBUILDER_CONFIG_STRING_MANIPULATION="String Manipulation" COM_COMPONENTBUILDER_CONFIG_TLS="TLS" COM_COMPONENTBUILDER_CONFIG_UIKIT_DESC="The Parameters for the uikit are set here.
Uikit is a lightweight and modular front-end framework for developing fast and powerful web interfaces. For more info visit
https://getuikit.com/v2/" @@ -3144,6 +3185,7 @@ COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPES="Fieldtypes

" COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPES_CATID="Category  For
Fieldtypes" COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPE_ADD="Add Fieldtype

" COM_COMPONENTBUILDER_DASHBOARD_FIELD_ADD="Add Field

" +COM_COMPONENTBUILDER_DASHBOARD_GETSNIPPETS="Get Snippets

" COM_COMPONENTBUILDER_DASHBOARD_HELP_DOCUMENTS="Help Documents

" COM_COMPONENTBUILDER_DASHBOARD_HELP_DOCUMENT_ADD="Add Help Document

" COM_COMPONENTBUILDER_DASHBOARD_JOOMLA_COMPONENTS="Joomla Components

" @@ -3681,9 +3723,8 @@ COM_COMPONENTBUILDER_FIELD_ADD_JAVASCRIPT_VIEWS_FOOTER="Add Javascript Views Foo COM_COMPONENTBUILDER_FIELD_ADD_JAVASCRIPT_VIEWS_FOOTER_LABEL="Add JavaScript (views-footer)" COM_COMPONENTBUILDER_FIELD_ADD_JAVASCRIPT_VIEW_FOOTER="Add Javascript View Footer" COM_COMPONENTBUILDER_FIELD_ADD_JAVASCRIPT_VIEW_FOOTER_LABEL="Add JavaScript (view-footer)" -COM_COMPONENTBUILDER_FIELD_ADVANCE_ENCRYPTION_WHMCSKEY="Advance Encryption (WHMCS-key)" COM_COMPONENTBUILDER_FIELD_BASESIXTY_FOUR="base64" -COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALKEY="Basic Encryption (local-key)" +COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY="Basic Encryption (local-DB-key)" COM_COMPONENTBUILDER_FIELD_BIGINT="BIGINT" COM_COMPONENTBUILDER_FIELD_CATID_DESCRIPTION="select one of the following categories" COM_COMPONENTBUILDER_FIELD_CATID_LABEL="Category" @@ -3752,6 +3793,7 @@ COM_COMPONENTBUILDER_FIELD_JSON="JSON" COM_COMPONENTBUILDER_FIELD_KEY="KEY" COM_COMPONENTBUILDER_FIELD_LONGTEXT="LONGTEXT" COM_COMPONENTBUILDER_FIELD_MEDIUMTEXT="MEDIUMTEXT" +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_LABEL="Modified By" COM_COMPONENTBUILDER_FIELD_MODIFIED_DATE_DESC="The date this Field was modified." @@ -3792,8 +3834,10 @@ COM_COMPONENTBUILDER_FIELD_NOTE_FILTER_INFORMATION_DESCRIPTION="
Searching the database.
" -COM_COMPONENTBUILDER_FIELD_NOTE_VDM_ENCRYPTION_DESCRIPTION="When using the VDM encryption you need to get a VDM public key from https://www.vdm.io/ " -COM_COMPONENTBUILDER_FIELD_NOTE_VDM_ENCRYPTION_LABEL="The VDM Encryption" +COM_COMPONENTBUILDER_FIELD_NOTE_WHMCS_ENCRYPTION_DESCRIPTION="

When using the WHMCS encryption you need to get a WHMCS key from:
https://www.vdm.io, or your own WHMCS install.

Please note that you will need to enable the add-on in the Joomla Component area (Add WHMCS)->Yes.

You can get more info about the WHMCS licensing add-on at the following links.

Helpful Links:
+https://www.whmcs.com/addons/licensing-addon/
+http://docs.whmcs.com/Licensing_Addon/

" +COM_COMPONENTBUILDER_FIELD_NOTE_WHMCS_ENCRYPTION_LABEL="The WHMCS Encryption" COM_COMPONENTBUILDER_FIELD_NOT_NULL="NOT NULL" COM_COMPONENTBUILDER_FIELD_NOT_REQUIRED="Not Required" COM_COMPONENTBUILDER_FIELD_NULL="NULL" @@ -3824,6 +3868,7 @@ COM_COMPONENTBUILDER_FIELD_UNIQUE_KEY="UNIQUE KEY" COM_COMPONENTBUILDER_FIELD_VARCHAR="VARCHAR" COM_COMPONENTBUILDER_FIELD_VERSION_DESC="A count of the number of times this Field has been revised." COM_COMPONENTBUILDER_FIELD_VERSION_LABEL="Revision" +COM_COMPONENTBUILDER_FIELD_WHMCSKEY_ENCRYPTION="WHMCS-key Encryption" COM_COMPONENTBUILDER_FIELD_XML="Xml" COM_COMPONENTBUILDER_FIELD_XML_DESCRIPTION="Text Area" COM_COMPONENTBUILDER_FIELD_XML_HINT="Field XML Go Here" @@ -3831,8 +3876,10 @@ COM_COMPONENTBUILDER_FIELD_XML_LABEL="XML field definition (Please set the field COM_COMPONENTBUILDER_FIELD_YES="Yes" COM_COMPONENTBUILDER_FIELD_ZERO="0" COM_COMPONENTBUILDER_FILE="File" +COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVE_TO_S="File %s was not move to (%s)!" COM_COMPONENTBUILDER_FILTER="Filter" COM_COMPONENTBUILDER_FOLDER="Folder" +COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVE_TO_S="Folder %s was not move to (%s)!" COM_COMPONENTBUILDER_FORCE_LOCAL_UPDATE="Force Local Update" COM_COMPONENTBUILDER_FULL_WIDTH_IN_TAB="Full Width in Tab" COM_COMPONENTBUILDER_GENERAL_OVERVIEW_OF_HOW_THINGS_WORK_BSB="General overview of how things work: %s" @@ -4111,8 +4158,8 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_FOOTABLE_VTWO="Add FooTable V2" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_JAVASCRIPT="Add Javascript" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_JAVASCRIPT_LABEL="Add Javascript" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_LICENSE="Add License" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_LICENSE_DESCRIPTION="Add the option to use a license in the component." -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_LICENSE_LABEL="Add License (whmcs)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_LICENSE_DESCRIPTION="Add the option to use the whmcs license add-on in the component." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_LICENSE_LABEL="Add WHMCS
(license add-on)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_HELPER_ADMIN="Add Php Helper Admin" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_HELPER_ADMIN_LABEL="Add PHP (helper_admin Class)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_HELPER_BOTH="Add Php Helper Both" @@ -4143,7 +4190,6 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UIKIT_VTWO="Add Uikit v2" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UPDATE_SERVER="Add Update Server" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UPDATE_SERVER_LABEL="Add Update Server" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADMIN_VIEWS="Admin Views" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADVANCED_ENCRYPTION_ONLY_TO_LOCK_DATA="Advanced encryption (only to lock data)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR="Author" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_DESCRIPTION="The Author's Name & Surname." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_HINT="Author Name & Surname Here" @@ -4194,9 +4240,17 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CSS_SITE_HINT="// CSS for the entire front COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CSS_SITE_LABEL="CSS (site)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CUSTOM_ADMIN_VIEWS="Custom Admin Views" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CUSTOM_USED_IN_CUSTOM_CODE="Custom (used in custom code)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DASHBOARD="Dashboard" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DASHBOARD_DESCRIPTION="Select a custom admin view that is already linked to this component as a dynamic dashboard." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DASHBOARD_LABEL="Dynamic Dashboard
(admin or custom admin view)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DASHBOARD_TYPE="Dashboard Type" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DASHBOARD_TYPE_DESCRIPTION="Select the type of dashboard you would like to use." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DASHBOARD_TYPE_LABEL="Dashboard Type" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DASH_INSTALL="Dash & Install" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DEBUG_LINENR="Debug Linenr" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DEBUG_LINENR_DESCRIPTION="Add corresponding line numbers to the dynamic comments, so to see where in the compiler the lines of code was build. This will help if you need to get more technical with an issue on github." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DEBUG_LINENR_LABEL="Debug (line numbers)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DEFAULT="Default" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION="Description" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_DESCRIPTION="Add Description Here" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_HINT="Add Description Here" @@ -4269,9 +4323,9 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_CODE_HINT="codename" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_CODE_LABEL="Name in Code" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_CODE_MESSAGE="Error! Please add name in code here." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_DESCRIPTION="Enter Name Here" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_HINT="Name Here" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_HINT="Component Name" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_LABEL="Name" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_MESSAGE="Error! Please add name here." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_MESSAGE="Error! Please add component name here." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NEW="A New Joomla Component" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO="No" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NONE="None" @@ -4279,8 +4333,8 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_ADD_CONFIG_DESCRIPTION="You can add c COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_ADD_CONFIG_LABEL="Adding Custom Config Fields" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_ADD_CUSTOM_MENUS_DESCRIPTION="You can add custom menus to the component here. The normal Menus are already being added so only add custom Menus that you would like to use for custom scripts." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_ADD_CUSTOM_MENUS_LABEL="Adding Custom Menus" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BOTTON_COMPONENT_DASHBOARD_DESCRIPTION="

You can add more tabs to the component dashboard.

" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BOTTON_COMPONENT_DASHBOARD_LABEL="Customize the Component Dashboard" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BOTTON_COMPONENT_DASHBOARD_DESCRIPTION="

The default dashboard has all the icons of the views you have selected as Dashboard (add record) or Dashboard (list of records), to expand it you can add more tabs.

" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BOTTON_COMPONENT_DASHBOARD_LABEL="Default Dashboard Option" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BUILDCOMP_DYNAMIC_MYSQL_DESCRIPTION="You can dynamically build the components back-end views and fields by adding a mySql table dump, that has all the tables, or some more tables with its columns and data types. A very basic and generic set of fields and tables will be created, and added to the existing fields and tables of this component." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_BUILDCOMP_DYNAMIC_MYSQL_LABEL="Dynamic Builder (mySql) Option" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_COMPONENT_FILES_FOLDERS_DESCRIPTION="You can add custom files and folders to the component, simply add the files to the administrator/components/com_componentbuilder/custom folder and then select them here." @@ -4288,6 +4342,8 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_COMPONENT_FILES_FOLDERS_LABEL="Adding COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_DISPLAY_COMPONENT_ADMIN_VIEWS_DESCRIPTION="

Linked Admin Views

Display of the admin views will load here!
" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_DISPLAY_COMPONENT_CUSTOM_ADMIN_VIEWS_DESCRIPTION="

Linked Custom Admin Views

Display of the custom admin views will load here!
" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_DISPLAY_COMPONENT_SITE_VIEWS_DESCRIPTION="

Linked Site Views

Display of the site views will load here!
" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_DYNAMIC_DASHBOARD_DESCRIPTION="The dynamic dashboard is basically the option of taking an Admin View or Custom Admin View that is already linked to this component, and making it the dashboard." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_DYNAMIC_DASHBOARD_LABEL="Dynamic Dashboard Option" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_MOVED_VIEWS_DESCRIPTION="We have moved the views in to their own tabs for your convenience." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_MOVED_VIEWS_LABEL="To add views, please open the corresponding tab." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_MYSQL_TWEAK_OPTIONS_DESCRIPTION="In each admin view you can add data from a MySQL Table (this is done in the admin view MySQL tab). Here you can limit that data in relation to this component. This feature is useful when an admin view with demo data is used in more then one component, and you would like to exclude some demo data without creating a new admin view." @@ -4373,7 +4429,6 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NUMBER_LABEL="Number" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ORDERING_LABEL="Ordering" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_OTHER="Other" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PERMISSION="Permissions" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP="PHP" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_ADMIN_EVENT="Php Admin Event" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_ADMIN_EVENT_DESCRIPTION="PHP script for the global helper admin event method." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_ADMIN_EVENT_HINT="// add custom PHP script to the global helper admin event method." @@ -4451,8 +4506,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_TOIGNORE_HINT="Coma separated names of fol COM_COMPONENTBUILDER_JOOMLA_COMPONENT_TOIGNORE_LABEL="Repository Folders or Files to Ignore" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_TO_IGNORE_NOTE_DESCRIPTION="During compilation JCB deletes all files and folders from the repository folder, and then adds the newly created files and folders back into the repository folder. Yet there may be files or folders you may not want deleted, like the .git folder, since JCB does not dynamically create that folder and so it will not be placed back, but simply delete it, unless you add it in this text field below, so that it will be ignored, and therefore not deleted in the first place. You can add multiple folders and files, separated by commas. Like: .git, .hg" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_TO_IGNORE_NOTE_LABEL="Repository Folders or Files to Ignore" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_TRANSLATION="Translation" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATES_USED_IN_JOOMLA_UPDATER="Updates (used in Joomla updater)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATES_NOT_READY="Updates (NOT READY!)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER="Update Server" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_DESCRIPTION="Select your update server for this component." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_LABEL="Update Server" @@ -4477,6 +4531,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_DESCRIPTION="Enter website address COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_HINT="http://www.example.com" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_LABEL="Website" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_MESSAGE="Error! Please add website here." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_ENCRYPTION_ONLY_TO_LOCK_DATAFIELDS="WHMCS encryption (only to lock data/fields)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_KEY="Whmcs Key" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_KEY_DESCRIPTION="Add your WHMCS Secret Key here that is needed for this license" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WHMCS_KEY_HINT="Secret Key" @@ -5002,15 +5057,52 @@ COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_MODIFIED_DATE_DESC="The date thi COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_MODIFIED_DATE_LABEL="Modified Date" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NEW="A New Library Files, Folders & URLs" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_FILES_DESCRIPTION="You can add custom files to the component, simply add the files to the administrator/components/com_componentbuilder/custom folder and then select them here." -COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_FILES_FULLPATH_DESCRIPTION="You can add any files to the component, by using the full system path. Example: /home/user/folder/file.php (make sure that php has permission to read the file)" +COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_FILES_FULLPATH_DESCRIPTION="You can add any files to the component, by using the full system path. Example: /home/user/folder/file.php (make sure that php has permission to read the file)
Please note that you can also use constant paths in your full path (directly without quotes), this is highly recommended to insure portability.
To see a list of constant paths please read the notes below. Example: JPATH_ROOT/file.php or JPATH_ROOT/components/com_yourcomponentname/helpers/file.php" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_FILES_FULLPATH_LABEL="Adding Files" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_FILES_LABEL="Adding Custom Files" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_FOLDERS_DESCRIPTION="You can add custom folders to the component, simply add the folders to the administrator/components/com_componentbuilder/custom folder and then select them here." -COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_FOLDERS_FULLPATH_DESCRIPTION="You can any folders to the component, by using the full system path. Example: /home/user/folder (make sure that php has permission to read the folder)" +COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_FOLDERS_FULLPATH_DESCRIPTION="You can any folders to the component, by using the full system path. Example: /home/user/folder (make sure that php has permission to read the folder)
Please note that you can also use constant paths in your full path (directly without quotes), this is highly recommended to insure portability.
To see a list of constant paths please read the notes below. Example: JPATH_ROOT/folder or JPATH_ROOT/components/com_yourcomponentname/helpers/folder" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_FOLDERS_FULLPATH_LABEL="Adding Folders" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_FOLDERS_LABEL="Adding Custom Folders" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_URLS_DESCRIPTION="You can add urls here, and it can be used in three ways. As a direct link (default) or to get the file content and add it to the component (get) or as both local and link (dynamic)" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_URLS_LABEL="Adding Urls" +COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_CONSTANT_PATHS_DESCRIPTION="

// The path to the administrator folder.
+JPATH_ADMINISTRATOR
+// The path to the installed Joomla! site, or JPATH_ROOT/administrator if executed from the backend.
+JPATH_BASE
+// The path to the cache folder.
+JPATH_CACHE
+// The path to the administration folder of the current component being executed.
+JPATH_COMPONENT_ADMINISTRATOR
+// The path to the site folder of the current component being executed.
+JPATH_COMPONENT_SITE
+// The path to the current component being executed.
+JPATH_COMPONENT
+// The path to folder containing the configuration.php file.
+JPATH_CONFIGURATION
+// The path to the installation folder.
+JPATH_INSTALLATION
+// The path to the libraries folder.
+JPATH_LIBRARIES
+// The path to the plugins folder.
+JPATH_PLUGINS
+// The path to the installed Joomla! site.
+JPATH_ROOT
+// The path to the installed Joomla! site.
+JPATH_SITE
+// The path to the templates folder.
+JPATH_THEMES

+ +

JPATH_SITE is meant to represent the root path of the JSite application,
+just as JPATH_ADMINISTRATOR is mean to represent the root path of the JAdministrator application.
+JPATH_BASE is the root path for the current requested application.... so if you are in the administrator application:
+JPATH_BASE == JPATH_ADMINISTRATOR
+If you are in the site application:
+JPATH_BASE == JPATH_SITE
+If you are in the installation application:
+JPATH_BASE == JPATH_INSTALLATION.
+JPATH_ROOT is the root path for the Joomla install and does not depend upon any application.

" +COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_CONSTANT_PATHS_LABEL="Constant Paths" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTNEW_DESCRIPTION="Should file be updated." COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTNEW_LABEL="Update" COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ORDERING_LABEL="Ordering" @@ -5192,6 +5284,7 @@ COM_COMPONENTBUILDER_RIGHT_OF_TABS="Right of Tabs" COM_COMPONENTBUILDER_SAVE_SUCCESS="Great! Item successfully saved." COM_COMPONENTBUILDER_SAVE_WARNING="The value already existed so please select another." COM_COMPONENTBUILDER_SEARCHABLE="Searchable" +COM_COMPONENTBUILDER_SELECT_AN_OPTION="Select an option" COM_COMPONENTBUILDER_SELECT_A_SNIPPET="select a snippet" COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_TO_COMPILE="Select the component to compile" COM_COMPONENTBUILDER_SERVER="Server" @@ -5259,7 +5352,7 @@ COM_COMPONENTBUILDER_SERVER_FTP="FTP" COM_COMPONENTBUILDER_SERVER_HOST="Host" COM_COMPONENTBUILDER_SERVER_HOST_DESCRIPTION="Add the server host name/IP here" COM_COMPONENTBUILDER_SERVER_HOST_HINT="yourhost.com" -COM_COMPONENTBUILDER_SERVER_HOST_LABEL="Host/IP
(basic encryption)" +COM_COMPONENTBUILDER_SERVER_HOST_LABEL="Host/IP
(encrypted field)" COM_COMPONENTBUILDER_SERVER_HOST_MESSAGE="Error! Please add server host name here." COM_COMPONENTBUILDER_SERVER_ID="Id" COM_COMPONENTBUILDER_SERVER_LINKED_COMPONENTS="Linked Components" @@ -5281,23 +5374,23 @@ COM_COMPONENTBUILDER_SERVER_NOT_REQUIRED="Not Required" COM_COMPONENTBUILDER_SERVER_ORDERING_LABEL="Ordering" COM_COMPONENTBUILDER_SERVER_PASSWORD="Password" COM_COMPONENTBUILDER_SERVER_PASSWORD_DESCRIPTION="Enter the password." -COM_COMPONENTBUILDER_SERVER_PASSWORD_LABEL="Password
(basic encryption)" +COM_COMPONENTBUILDER_SERVER_PASSWORD_LABEL="Password
(encrypted field)" COM_COMPONENTBUILDER_SERVER_PATH="Path" COM_COMPONENTBUILDER_SERVER_PATH_DESCRIPTION="Set the path to the remote destination folder. The user must have write permissions to this folder." COM_COMPONENTBUILDER_SERVER_PATH_HINT="/home/username/folder/" -COM_COMPONENTBUILDER_SERVER_PATH_LABEL="Remote Destination Folder Path
(basic encryption)" +COM_COMPONENTBUILDER_SERVER_PATH_LABEL="Remote Destination Folder Path
(encrypted field)" COM_COMPONENTBUILDER_SERVER_PATH_MESSAGE="Error! Please add destination path." COM_COMPONENTBUILDER_SERVER_PERMISSION="Permissions" COM_COMPONENTBUILDER_SERVER_PORT="Port" COM_COMPONENTBUILDER_SERVER_PORT_DESCRIPTION="The port number" COM_COMPONENTBUILDER_SERVER_PORT_HINT="22" -COM_COMPONENTBUILDER_SERVER_PORT_LABEL="Port Number
(basic encryption)" +COM_COMPONENTBUILDER_SERVER_PORT_LABEL="Port Number
(encrypted field)" COM_COMPONENTBUILDER_SERVER_PORT_MESSAGE="Error! Please add port number here." COM_COMPONENTBUILDER_SERVER_PRIVATE="Private" COM_COMPONENTBUILDER_SERVER_PRIVATE_DESCRIPTION="Set the path to the private key." COM_COMPONENTBUILDER_SERVER_PRIVATE_HINT="/home/username/.ssh/id_rsa" COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY="Private Key" -COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_DESCRIPTION="Add your private key here! Yes this field in encrypted in the DB, but if your DB gets compromised this key must also be considered compromised. The system path option is considered more secure and seen as best practice." +COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_DESCRIPTION="Add your private key here! Yes this field is encrypted in the DB, but if your DB gets compromised this key must also be considered compromised! The system path option is considered more secure and seen as best practice." COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_FILE_PATH="Private Key - File Path" COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_HINT="-----BEGIN RSA PRIVATE KEY----- MIICXQIBAAKBgQDPF9uyDuHtD+sCYBaEIV34uAc+eRa62souVUcmsVwKUUBbk7sY @@ -5314,9 +5407,9 @@ MD4pm2tpMRV52YIRi07J70ex/PbLULd5cCTh6jgXAwz71AVSiBY/jTtKqV3YkzJo 09oGIZIcI/wzk1zLloqNAkB8qHxAtmUZFdo5sssaUDTOB82QAPfiHUqIFPaYuc0f 4NqtXZm+fv4liR3QJEo8zkiBs3NjBnm7Hh3BMSqGh3d+ -----END RSA PRIVATE KEY-----" -COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_LABEL="PRIVATE KEY
(basic encryption)" +COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_LABEL="PRIVATE KEY
(encrypted field)" COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_TEXT_FIELD="Private Key - Text Field" -COM_COMPONENTBUILDER_SERVER_PRIVATE_LABEL="Private Key Path
(basic encryption)" +COM_COMPONENTBUILDER_SERVER_PRIVATE_LABEL="Private Key Path
(encrypted field)" COM_COMPONENTBUILDER_SERVER_PRIVATE_MESSAGE="Error! Please add private key path." COM_COMPONENTBUILDER_SERVER_PROTOCOL="Protocol" COM_COMPONENTBUILDER_SERVER_PROTOCOL_DESCRIPTION="Select the protocol used to connect to this server." @@ -5325,7 +5418,7 @@ COM_COMPONENTBUILDER_SERVER_PUBLISHING="Publishing" COM_COMPONENTBUILDER_SERVER_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Server to customise the alias." COM_COMPONENTBUILDER_SERVER_SECRET="Secret" COM_COMPONENTBUILDER_SERVER_SECRET_DESCRIPTION="If private key file is encrypted (which it should be), the passphrase must be provided." -COM_COMPONENTBUILDER_SERVER_SECRET_LABEL="Passphrase
(basic encryption)" +COM_COMPONENTBUILDER_SERVER_SECRET_LABEL="Passphrase
(encrypted field)" COM_COMPONENTBUILDER_SERVER_SELECT_AN_OPTION="Select an option" COM_COMPONENTBUILDER_SERVER_SFTP="SFTP" COM_COMPONENTBUILDER_SERVER_SIGNATURE="Signature" @@ -5337,7 +5430,7 @@ COM_COMPONENTBUILDER_SERVER_STATUS="Status" COM_COMPONENTBUILDER_SERVER_USERNAME="Username" COM_COMPONENTBUILDER_SERVER_USERNAME_DESCRIPTION="Enter the username." COM_COMPONENTBUILDER_SERVER_USERNAME_HINT="root" -COM_COMPONENTBUILDER_SERVER_USERNAME_LABEL="Username
(basic encryption)" +COM_COMPONENTBUILDER_SERVER_USERNAME_LABEL="Username
(encrypted field)" COM_COMPONENTBUILDER_SERVER_USERNAME_MESSAGE="Error! Please add the username here." COM_COMPONENTBUILDER_SERVER_VERSION_DESC="A count of the number of times this Server has been revised." COM_COMPONENTBUILDER_SERVER_VERSION_LABEL="Revision" @@ -6160,9 +6253,10 @@ COM_COMPONENTBUILDER_THERE_ARE_NO_OUT_OF_DATE_SNIPPETS_AT_THIS_TIME="There are n COM_COMPONENTBUILDER_THERE_ARE_NO_SNIPPETS_TO_UPDATE_AT_THIS_TIME="There are no snippets to update at this time" COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_IF_THIS_CONTINUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR_OF_A_TYPE_ERROR_IN_THE_FIELDS_DISPLAY_REQUEST="There has been an error, if this continues please inform your system administrator of a type error in the fields display request!" COM_COMPONENTBUILDER_THERE_WAS_A_PROBLEM_BNO_VIEW_OR_ID_FOUND_IN_SESSION_OR_VIEW_NOT_ALLOWED_TO_ACCESS_AREAB_WE_COULD_NOT_LOAD_ANY_LINKED_TO_VALUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR="There was a problem, no view or id found in session or view not allowed to access area, we could not load any linked to values. Please inform your system administrator!" -COM_COMPONENTBUILDER_THE_BPHPSECLIBNETSFTPB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_ADMINHELPERSVENDOR_FOLDER_OF_JCB_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="The phpseclib\NET\SFTP library\class is not available! This library\class should have been added to your admin/helpers/vendor folder of JCB. Please contact your system administrator for more info" +COM_COMPONENTBUILDER_THE_BPHPSECLIBNETSFTPB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESVDM_IOVENDORB_FOLDER_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="The phpseclib\NET\SFTP library\class is not available! This library\class should have been added to your libraries/vdm_io/vendor folder. Please contact your system administrator for more info" COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_PATH_ON_BSB_SERVER="The %s file could not be moved to %s path on %s server." COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_SERVER="The %s file could not be moved to %s server." +COM_COMPONENTBUILDER_THE_BSB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESVDM_IOVENDORB_FOLDER_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="The %s library\class is not available! This library\class should have been added to your libraries/vdm_io/vendor folder. Please contact your system administrator for more info!" COM_COMPONENTBUILDER_THE_BSB_LIBRARY_CAN_NOT_BE_DELETED_OR_THINGS_WILL_BREAK="The %s library can not be deleted, or things will break." COM_COMPONENTBUILDER_THE_COMPONENT_ADMIN_VIEWS="The component admin views" COM_COMPONENTBUILDER_THE_COMPONENT_CONFIG="The component config" @@ -6243,6 +6337,7 @@ COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_IMPORT_A_COMPONENT_PLEASE_CON COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_SHARE_THE_SNIPPETS_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP="You do not have permission to share the snippets, please contact your system administrator for more help." COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_FIFTY_S_IS_CONSIDERED_BAD_PRACTICE="You have %s %s. Adding more then 50 %s is considered bad practice." COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_FIFTY_S_IS_CONSIDERED_BAD_PRACTICE_YOUR_S_PAGE_LOAD_IN_JCB_WILL_SLOWDOWN_YOU_SHOULD_CONSIDER_DECOUPLING_SOME_OF_THESE_S="You have %s %s. Adding more then 50 %s is considered bad practice. Your %s page load in JCB will slowdown. You should consider decoupling some of these %s." +COM_COMPONENTBUILDER_YOU_MUST_FIRST_LINK_AN_ADMIN_OR_A_CUSTOM_ADMIN_VIEW_TO_THIS_COMPONENT_THEN_YOU_CAN_SELECT_IT_HERE="You must first link an admin or a custom admin view to this component, then you can select it here" COM_COMPONENTBUILDER_YOU_MUST_SELECT_A_COMPONENT="You must select a component!" COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS="You should add the correct owner details." COM_COMPONENTBUILDER_YOU_SHOULD_ONLY_CONTINUE_THIS_IMPORT_IF_YOU_HAVE_BACKUP_YOUR_COMPONENTS_AND_INSURED_THAT_THE_PACKAGE_OWNER_IS_REPUTABLE="You should only continue this import if you have backup your components, and insured that the package owner is reputable." diff --git a/admin/layouts/component_files_folders/advance_fullwidth.php b/admin/layouts/component_files_folders/advance_fullwidth.php index 36f1ccd1e..2fda89c69 100644 --- a/admin/layouts/component_files_folders/advance_fullwidth.php +++ b/admin/layouts/component_files_folders/advance_fullwidth.php @@ -33,7 +33,8 @@ $fields = $displayData->get('fields') ?: array( 'note_add_files_fullpath', 'addfilesfullpath', 'note_add_folders_fullpath', - 'addfoldersfullpath' + 'addfoldersfullpath', + 'note_constant_paths' ); ?> diff --git a/admin/layouts/field/details_left.php b/admin/layouts/field/details_left.php index dbdbdf562..5b25ca0ef 100644 --- a/admin/layouts/field/details_left.php +++ b/admin/layouts/field/details_left.php @@ -41,7 +41,7 @@ $fields = $displayData->get('fields') ?: array( 'indexes', 'null_switch', 'store', - 'note_vdm_encryption' + 'note_whmcs_encryption' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); diff --git a/admin/layouts/fieldtype/fields_fullwidth.php b/admin/layouts/fieldtype/fields_fullwidth.php index 878d60898..5e135e3d6 100644 --- a/admin/layouts/fieldtype/fields_fullwidth.php +++ b/admin/layouts/fieldtype/fields_fullwidth.php @@ -28,7 +28,7 @@ defined('_JEXEC') or die('Restricted access'); // set the defaults -$items = $displayData->wadfields; +$items = $displayData->wacfields; $user = JFactory::getUser(); $id = $displayData->item->id; $edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit"; diff --git a/admin/layouts/joomla_component/php_fullwidth.php b/admin/layouts/joomla_component/dash_install_fullwidth.php similarity index 96% rename from admin/layouts/joomla_component/php_fullwidth.php rename to admin/layouts/joomla_component/dash_install_fullwidth.php index 9edca08ef..ae292cd4a 100644 --- a/admin/layouts/joomla_component/php_fullwidth.php +++ b/admin/layouts/joomla_component/dash_install_fullwidth.php @@ -13,7 +13,7 @@ @version 2.6.x @created 30th April, 2015 @package Component Builder - @subpackage php_fullwidth.php + @subpackage dash_install_fullwidth.php @author Llewellyn van der Merwe @github Joomla Component Builder @copyright Copyright (C) 2015. All Rights Reserved diff --git a/admin/layouts/joomla_component/php_left.php b/admin/layouts/joomla_component/dash_install_left.php similarity index 95% rename from admin/layouts/joomla_component/php_left.php rename to admin/layouts/joomla_component/dash_install_left.php index 4c5b5578f..678b42a7f 100644 --- a/admin/layouts/joomla_component/php_left.php +++ b/admin/layouts/joomla_component/dash_install_left.php @@ -13,7 +13,7 @@ @version 2.6.x @created 30th April, 2015 @package Component Builder - @subpackage php_left.php + @subpackage dash_install_left.php @author Llewellyn van der Merwe @github Joomla Component Builder @copyright Copyright (C) 2015. All Rights Reserved @@ -30,7 +30,7 @@ defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( - 'note_botton_component_dashboard' + 'dashboard_type' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); diff --git a/admin/layouts/joomla_component/dash_install_right.php b/admin/layouts/joomla_component/dash_install_right.php new file mode 100644 index 000000000..6405802b0 --- /dev/null +++ b/admin/layouts/joomla_component/dash_install_right.php @@ -0,0 +1,56 @@ + + @github Joomla Component Builder + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'note_dynamic_dashboard', + 'dashboard', + 'note_botton_component_dashboard' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/joomla_component/settings_fullwidth.php b/admin/layouts/joomla_component/settings_fullwidth.php index 68a447d9b..03edff532 100644 --- a/admin/layouts/joomla_component/settings_fullwidth.php +++ b/admin/layouts/joomla_component/settings_fullwidth.php @@ -30,7 +30,7 @@ defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( - 'spacer_hr_f', + 'spacer_hr_six', 'note_on_contributors', 'addcontributors', 'emptycontributors', diff --git a/admin/layouts/joomla_component/settings_left.php b/admin/layouts/joomla_component/settings_left.php index 0ec23edf9..56d91f74a 100644 --- a/admin/layouts/joomla_component/settings_left.php +++ b/admin/layouts/joomla_component/settings_left.php @@ -31,11 +31,11 @@ $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( 'note_moved_views', - 'spacer_hr_a', + 'spacer_hr_one', 'note_mysql_tweak_options', - 'spacer_hr_b', + 'spacer_hr_two', 'note_add_custom_menus', - 'spacer_hr_c', + 'spacer_hr_three', 'note_add_config' ); diff --git a/admin/layouts/joomla_component/settings_right.php b/admin/layouts/joomla_component/settings_right.php index 18a4336e7..5a3dd8f27 100644 --- a/admin/layouts/joomla_component/settings_right.php +++ b/admin/layouts/joomla_component/settings_right.php @@ -31,10 +31,10 @@ $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( 'note_component_files_folders', - 'spacer_hr_d', + 'spacer_hr_four', 'to_ignore_note', 'toignore', - 'spacer_hr_e', + 'spacer_hr_five', 'jcb_export_package_note', 'export_key', 'export_package_link', diff --git a/admin/layouts/joomla_component/translation_fullwidth.php b/admin/layouts/joomla_component/translation_fullwidth.php deleted file mode 100644 index 11a586ad2..000000000 --- a/admin/layouts/joomla_component/translation_fullwidth.php +++ /dev/null @@ -1,108 +0,0 @@ - - @github Joomla Component Builder - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - - Builds Complex Joomla Components - -/-----------------------------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file - -defined('_JEXEC') or die('Restricted access'); - -// set the defaults -$items = $displayData->vwntranslation; -$user = JFactory::getUser(); -$id = $displayData->item->id; -$edit = "index.php?option=com_componentbuilder&view=language_translations&task=language_translation.edit"; - -?> -
- - - - - - - - - - - $item): ?> - authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; - $userChkOut = JFactory::getUser($item->checked_out); - $canDo = ComponentbuilderHelper::getActions('language_translation',$item,'language_translations'); - ?> - - - published == 1):?> - - published == 0):?> - - published == 2):?> - - published == -2):?> - - - - - - -
- - - - - -
- get('language_translation.edit')): ?> - entranslation; ?> - checked_out): ?> - name, $item->checked_out_time, 'language_translations.', $canCheckin); ?> - - -
entranslation; ?>
- -
- - - - - - - - - - - - - - - - - id; ?> -
- -
- -
- -
diff --git a/admin/layouts/library_files_folders_urls/advance_fullwidth.php b/admin/layouts/library_files_folders_urls/advance_fullwidth.php index 36f1ccd1e..2fda89c69 100644 --- a/admin/layouts/library_files_folders_urls/advance_fullwidth.php +++ b/admin/layouts/library_files_folders_urls/advance_fullwidth.php @@ -33,7 +33,8 @@ $fields = $displayData->get('fields') ?: array( 'note_add_files_fullpath', 'addfilesfullpath', 'note_add_folders_fullpath', - 'addfoldersfullpath' + 'addfoldersfullpath', + 'note_constant_paths' ); ?> diff --git a/admin/layouts/template/details_right.php b/admin/layouts/template/details_right.php index 63354f956..cdf47a26c 100644 --- a/admin/layouts/template/details_right.php +++ b/admin/layouts/template/details_right.php @@ -31,8 +31,8 @@ $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( 'snippet', - 'note_uikit_snippet', - 'note_snippet_usage' + 'note_snippet_usage', + 'note_uikit_snippet' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); diff --git a/admin/models/admin_view.php b/admin/models/admin_view.php index 2068277b8..b1a2000a3 100644 --- a/admin/models/admin_view.php +++ b/admin/models/admin_view.php @@ -100,14 +100,6 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->metadata = $registry->toArray(); } - if (!empty($item->addtables)) - { - // Convert the addtables field to an array. - $addtables = new Registry; - $addtables->loadString($item->addtables); - $item->addtables = $addtables->toArray(); - } - if (!empty($item->addpermissions)) { // Convert the addpermissions field to an array. @@ -132,6 +124,14 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->addlinked_views = $addlinked_views->toArray(); } + if (!empty($item->addtables)) + { + // Convert the addtables field to an array. + $addtables = new Registry; + $addtables->loadString($item->addtables); + $item->addtables = $addtables->toArray(); + } + if (!empty($item->custom_button)) { // Convert the custom_button field to an array. @@ -148,10 +148,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->ajax_input = $ajax_input->toArray(); } - if (!empty($item->php_import_headers)) + if (!empty($item->php_import_save)) { - // base64 Decode php_import_headers. - $item->php_import_headers = base64_decode($item->php_import_headers); + // base64 Decode php_import_save. + $item->php_import_save = base64_decode($item->php_import_save); } if (!empty($item->html_import_view)) @@ -160,16 +160,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->html_import_view = base64_decode($item->html_import_view); } - if (!empty($item->php_import_save)) + if (!empty($item->php_import_headers)) { - // base64 Decode php_import_save. - $item->php_import_save = base64_decode($item->php_import_save); - } - - if (!empty($item->php_getitem)) - { - // base64 Decode php_getitem. - $item->php_getitem = base64_decode($item->php_getitem); + // base64 Decode php_import_headers. + $item->php_import_headers = base64_decode($item->php_import_headers); } if (!empty($item->css_view)) @@ -352,6 +346,12 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->php_import_ext = base64_decode($item->php_import_ext); } + if (!empty($item->php_getitem)) + { + // base64 Decode php_getitem. + $item->php_getitem = base64_decode($item->php_getitem); + } + if (empty($item->id)) { @@ -1184,19 +1184,6 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['system_name'] = $data['name_single']; } - // Set the addtables items to data. - if (isset($data['addtables']) && is_array($data['addtables'])) - { - $addtables = new JRegistry; - $addtables->loadArray($data['addtables']); - $data['addtables'] = (string) $addtables; - } - elseif (!isset($data['addtables'])) - { - // Set the empty addtables to data - $data['addtables'] = ''; - } - // Set the addpermissions items to data. if (isset($data['addpermissions']) && is_array($data['addpermissions'])) { @@ -1236,6 +1223,19 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['addlinked_views'] = ''; } + // Set the addtables items to data. + if (isset($data['addtables']) && is_array($data['addtables'])) + { + $addtables = new JRegistry; + $addtables->loadArray($data['addtables']); + $data['addtables'] = (string) $addtables; + } + elseif (!isset($data['addtables'])) + { + // Set the empty addtables to data + $data['addtables'] = ''; + } + // Set the custom_button items to data. if (isset($data['custom_button']) && is_array($data['custom_button'])) { @@ -1262,10 +1262,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['ajax_input'] = ''; } - // Set the php_import_headers string to base64 string. - if (isset($data['php_import_headers'])) + // Set the php_import_save string to base64 string. + if (isset($data['php_import_save'])) { - $data['php_import_headers'] = base64_encode($data['php_import_headers']); + $data['php_import_save'] = base64_encode($data['php_import_save']); } // Set the html_import_view string to base64 string. @@ -1274,16 +1274,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['html_import_view'] = base64_encode($data['html_import_view']); } - // Set the php_import_save string to base64 string. - if (isset($data['php_import_save'])) + // Set the php_import_headers string to base64 string. + if (isset($data['php_import_headers'])) { - $data['php_import_save'] = base64_encode($data['php_import_save']); - } - - // Set the php_getitem string to base64 string. - if (isset($data['php_getitem'])) - { - $data['php_getitem'] = base64_encode($data['php_getitem']); + $data['php_import_headers'] = base64_encode($data['php_import_headers']); } // Set the css_view string to base64 string. @@ -1464,6 +1458,12 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin if (isset($data['php_import_ext'])) { $data['php_import_ext'] = base64_encode($data['php_import_ext']); + } + + // Set the php_getitem string to base64 string. + if (isset($data['php_getitem'])) + { + $data['php_getitem'] = base64_encode($data['php_getitem']); } // Set the Params Items to data diff --git a/admin/models/admin_views.php b/admin/models/admin_views.php index ddba14a1f..8d898ca38 100644 --- a/admin/models/admin_views.php +++ b/admin/models/admin_views.php @@ -262,14 +262,12 @@ class ComponentbuilderModelAdmin_views extends JModelList continue; } - // decode php_import_headers - $item->php_import_headers = base64_decode($item->php_import_headers); - // decode html_import_view - $item->html_import_view = base64_decode($item->html_import_view); // decode php_import_save $item->php_import_save = base64_decode($item->php_import_save); - // decode php_getitem - $item->php_getitem = base64_decode($item->php_getitem); + // decode html_import_view + $item->html_import_view = base64_decode($item->html_import_view); + // decode php_import_headers + $item->php_import_headers = base64_decode($item->php_import_headers); // decode css_view $item->css_view = base64_decode($item->css_view); // decode php_getitems @@ -330,6 +328,8 @@ class ComponentbuilderModelAdmin_views extends JModelList $item->php_import_setdata = base64_decode($item->php_import_setdata); // decode php_import_ext $item->php_import_ext = base64_decode($item->php_import_ext); + // decode php_getitem + $item->php_getitem = base64_decode($item->php_getitem); // unset the values we don't want exported. unset($item->asset_id); unset($item->checked_out); diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 39d61c045..c25995180 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -274,11 +274,13 @@ class ComponentbuilderModelAjax extends JModelList { // get the view name & id $values = $this->getViewID(); + // set the button ID + $css_class = 'control-group-'.ComponentbuilderHelper::safeString($type. '-' . $size, 'L', '-'); // check if new item $ref = ''; if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view'])) { - // only load referal if not new item. + // only load referral if not new item. $ref = '&ref=' . $values['a_view'] . '&refid=' . $values['a_id']; // get item id if ($id = ComponentbuilderHelper::getVar($type, $values['a_id'], $values['a_view'], 'id')) @@ -299,7 +301,7 @@ class ComponentbuilderModelAjax extends JModelList $button = array(); if (1 == $size) { - $button[] = '
'; + $button[] = '
'; $button[] = '
'; $button[] = ''; $button[] = '
'; @@ -326,7 +328,7 @@ class ComponentbuilderModelAjax extends JModelList // only return notice if big button if (1 == $size) { - return '
' . JText::sprintf('COM_COMPONENTBUILDER_BUTTON_TO_CREATE_S_WILL_SHOW_ONCE_S_IS_SAVED_FOR_THE_FIRST_TIME', ComponentbuilderHelper::safeString($type, 'w'), ComponentbuilderHelper::safeString($values['a_view'], 'w')) . '
'; + return '
' . JText::sprintf('COM_COMPONENTBUILDER_BUTTON_TO_CREATE_S_WILL_SHOW_ONCE_S_IS_SAVED_FOR_THE_FIRST_TIME', ComponentbuilderHelper::safeString($type, 'w'), ComponentbuilderHelper::safeString($values['a_view'], 'w')) . '
'; } } } diff --git a/admin/models/compiler.php b/admin/models/compiler.php index f430b2cd2..cd3bbd26a 100644 --- a/admin/models/compiler.php +++ b/admin/models/compiler.php @@ -124,7 +124,7 @@ class ComponentbuilderModelCompiler extends JModelList $_copyright = new stdClass(); $_copyright->text =& $item->copyright; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (copyright) to context - $this->_dispatcher->trigger("onContentPrepare",array('com_componentbuilder.compiler.copyright',&$_copyright,&$this->params)); + $this->_dispatcher->trigger("onContentPrepare", array('com_componentbuilder.compiler.copyright', &$_copyright, &$this->params, 0)); // Checking if copyright has uikit components that must be loaded. $this->uikitComp = ComponentbuilderHelper::getUikitComp($item->copyright,$this->uikitComp); } @@ -228,6 +228,8 @@ class ComponentbuilderModelCompiler extends JModelList public function install($p_file) { + $this->setState('action', 'install'); + // Set FTP credentials, if given. JClientHelper::setCredentialsFromRequest('ftp'); $app = JFactory::getApplication(); @@ -235,7 +237,7 @@ class ComponentbuilderModelCompiler extends JModelList // Load installer plugins for assistance if required: JPluginHelper::importPlugin('installer'); $dispatcher = JEventDispatcher::getInstance(); - + $package = null; // This event allows an input pre-treatment, a custom pre-packing or custom installation. @@ -246,7 +248,8 @@ class ComponentbuilderModelCompiler extends JModelList { return true; } - elseif (in_array(false, $results, true)) + + if (in_array(false, $results, true)) { return false; } @@ -256,8 +259,10 @@ class ComponentbuilderModelCompiler extends JModelList // Unpack the downloaded package file. $package = JInstallerHelper::unpack($tmp_dest . '/' . $p_file, true); - // insure the install type is folder + + // insure the install type is folder (JCB zip file is in the folder) $installType = 'folder'; + // This event allows a custom installation of the package or a customization of the package: $results = $dispatcher->trigger('onInstallerBeforeInstaller', array($this, &$package)); @@ -300,7 +305,7 @@ class ComponentbuilderModelCompiler extends JModelList $dispatcher->trigger('onInstallerAfterInstaller', array($this, &$package, $installer, &$result, &$msg)); // Set some model state values. - $app = JFactory::getApplication(); + $app = JFactory::getApplication(); $app->enqueueMessage($msg, $msgType); $this->setState('name', $installer->get('name')); $this->setState('result', $result); @@ -317,6 +322,16 @@ class ComponentbuilderModelCompiler extends JModelList JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']); + // Clear the cached extension data and menu cache + $this->cleanCache('_system', 0); + $this->cleanCache('_system', 1); + $this->cleanCache('com_modules', 0); + $this->cleanCache('com_modules', 1); + $this->cleanCache('com_plugins', 0); + $this->cleanCache('com_plugins', 1); + $this->cleanCache('mod_menu', 0); + $this->cleanCache('mod_menu', 1); + return $result; } } diff --git a/admin/models/component_files_folders.php b/admin/models/component_files_folders.php index fc73d1254..93cd931ee 100644 --- a/admin/models/component_files_folders.php +++ b/admin/models/component_files_folders.php @@ -95,20 +95,12 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin $item->metadata = $registry->toArray(); } - if (!empty($item->addfiles)) + if (!empty($item->addfoldersfullpath)) { - // Convert the addfiles field to an array. - $addfiles = new Registry; - $addfiles->loadString($item->addfiles); - $item->addfiles = $addfiles->toArray(); - } - - if (!empty($item->addfolders)) - { - // Convert the addfolders field to an array. - $addfolders = new Registry; - $addfolders->loadString($item->addfolders); - $item->addfolders = $addfolders->toArray(); + // Convert the addfoldersfullpath field to an array. + $addfoldersfullpath = new Registry; + $addfoldersfullpath->loadString($item->addfoldersfullpath); + $item->addfoldersfullpath = $addfoldersfullpath->toArray(); } if (!empty($item->addfilesfullpath)) @@ -119,12 +111,20 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin $item->addfilesfullpath = $addfilesfullpath->toArray(); } - if (!empty($item->addfoldersfullpath)) + if (!empty($item->addfolders)) { - // Convert the addfoldersfullpath field to an array. - $addfoldersfullpath = new Registry; - $addfoldersfullpath->loadString($item->addfoldersfullpath); - $item->addfoldersfullpath = $addfoldersfullpath->toArray(); + // Convert the addfolders field to an array. + $addfolders = new Registry; + $addfolders->loadString($item->addfolders); + $item->addfolders = $addfolders->toArray(); + } + + if (!empty($item->addfiles)) + { + // Convert the addfiles field to an array. + $addfiles = new Registry; + $addfiles->loadString($item->addfiles); + $item->addfiles = $addfiles->toArray(); } // update the fields @@ -838,30 +838,17 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin $data['metadata'] = (string) $metadata; } - // Set the addfiles items to data. - if (isset($data['addfiles']) && is_array($data['addfiles'])) + // Set the addfoldersfullpath items to data. + if (isset($data['addfoldersfullpath']) && is_array($data['addfoldersfullpath'])) { - $addfiles = new JRegistry; - $addfiles->loadArray($data['addfiles']); - $data['addfiles'] = (string) $addfiles; + $addfoldersfullpath = new JRegistry; + $addfoldersfullpath->loadArray($data['addfoldersfullpath']); + $data['addfoldersfullpath'] = (string) $addfoldersfullpath; } - elseif (!isset($data['addfiles'])) + elseif (!isset($data['addfoldersfullpath'])) { - // Set the empty addfiles to data - $data['addfiles'] = ''; - } - - // Set the addfolders items to data. - if (isset($data['addfolders']) && is_array($data['addfolders'])) - { - $addfolders = new JRegistry; - $addfolders->loadArray($data['addfolders']); - $data['addfolders'] = (string) $addfolders; - } - elseif (!isset($data['addfolders'])) - { - // Set the empty addfolders to data - $data['addfolders'] = ''; + // Set the empty addfoldersfullpath to data + $data['addfoldersfullpath'] = ''; } // Set the addfilesfullpath items to data. @@ -877,17 +864,30 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin $data['addfilesfullpath'] = ''; } - // Set the addfoldersfullpath items to data. - if (isset($data['addfoldersfullpath']) && is_array($data['addfoldersfullpath'])) + // Set the addfolders items to data. + if (isset($data['addfolders']) && is_array($data['addfolders'])) { - $addfoldersfullpath = new JRegistry; - $addfoldersfullpath->loadArray($data['addfoldersfullpath']); - $data['addfoldersfullpath'] = (string) $addfoldersfullpath; + $addfolders = new JRegistry; + $addfolders->loadArray($data['addfolders']); + $data['addfolders'] = (string) $addfolders; } - elseif (!isset($data['addfoldersfullpath'])) + elseif (!isset($data['addfolders'])) { - // Set the empty addfoldersfullpath to data - $data['addfoldersfullpath'] = ''; + // Set the empty addfolders to data + $data['addfolders'] = ''; + } + + // Set the addfiles items to data. + if (isset($data['addfiles']) && is_array($data['addfiles'])) + { + $addfiles = new JRegistry; + $addfiles->loadArray($data['addfiles']); + $data['addfiles'] = (string) $addfiles; + } + elseif (!isset($data['addfiles'])) + { + // Set the empty addfiles to data + $data['addfiles'] = ''; } // Set the Params Items to data diff --git a/admin/models/componentbuilder.php b/admin/models/componentbuilder.php index f87531edd..7e768ddc7 100644 --- a/admin/models/componentbuilder.php +++ b/admin/models/componentbuilder.php @@ -43,7 +43,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList $icons = array(); // view groups array $viewGroups = array( - 'main' => array('png.compiler', 'png.joomla_component.add', 'png.joomla_components', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.libraries', 'png.snippet.add', 'png.snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.servers', 'png.help_document.add', 'png.help_documents') + 'main' => array('png.compiler', 'png.joomla_component.add', 'png.joomla_components', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.libraries', 'png.snippet.add', 'png.snippets', 'png||getsnippets||index.php?option=com_componentbuilder&view=get_snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.servers', 'png.help_document.add', 'png.help_documents') ); // view access array $viewAccess = array( @@ -176,6 +176,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList 'library_files_folders_urls.create' => 'library_files_folders_urls.create', 'libraries_files_folders_urls.access' => 'library_files_folders_urls.access', 'library_files_folders_urls.access' => 'library_files_folders_urls.access'); + // loop over the $views foreach($viewGroups as $group => $views) { $i = 0; @@ -184,47 +185,62 @@ class ComponentbuilderModelComponentbuilder extends JModelList foreach($views as $view) { $add = false; - if (strpos($view,'.') !== false) + // external views (links) + if (strpos($view,'||') !== false) { - $dwd = explode('.', $view); - if (count($dwd) == 3) + $dwd = explode('||', $view); + if (count($dwd) == 3) + { + list($type, $name, $url) = $dwd; + $viewName = $name; + $alt = $name; + $url = $url; + $image = $name.'.'.$type; + $name = 'COM_COMPONENTBUILDER_DASHBOARD_'.ComponentbuilderHelper::safeString($name,'U'); + } + } + // internal views + elseif (strpos($view,'.') !== false) + { + $dwd = explode('.', $view); + if (count($dwd) == 3) + { + list($type, $name, $action) = $dwd; + } + elseif (count($dwd) == 2) + { + list($type, $name) = $dwd; + $action = false; + } + if ($action) + { + $viewName = $name; + switch($action) { - list($type, $name, $action) = $dwd; - } - elseif (count($dwd) == 2) - { - list($type, $name) = $dwd; - $action = false; - } - if ($action) - { - $viewName = $name; - switch($action) - { - case 'add': - $url ='index.php?option=com_componentbuilder&view='.$name.'&layout=edit'; - $image = $name.'_'.$action.'.'.$type; - $alt = $name.' '.$action; - $name = 'COM_COMPONENTBUILDER_DASHBOARD_'.ComponentbuilderHelper::safeString($name,'U').'_ADD'; - $add = true; - break; - default: - $url = 'index.php?option=com_categories&view=categories&extension=com_componentbuilder.'.$name; - $image = $name.'_'.$action.'.'.$type; - $alt = $name.' '.$action; - $name = 'COM_COMPONENTBUILDER_DASHBOARD_'.ComponentbuilderHelper::safeString($name,'U').'_'.ComponentbuilderHelper::safeString($action,'U'); - break; - } - } - else - { - $viewName = $name; - $alt = $name; - $url = 'index.php?option=com_componentbuilder&view='.$name; - $image = $name.'.'.$type; - $name = 'COM_COMPONENTBUILDER_DASHBOARD_'.ComponentbuilderHelper::safeString($name,'U'); - $hover = false; + case 'add': + $url = 'index.php?option=com_componentbuilder&view='.$name.'&layout=edit'; + $image = $name.'_'.$action.'.'.$type; + $alt = $name.' '.$action; + $name = 'COM_COMPONENTBUILDER_DASHBOARD_'.ComponentbuilderHelper::safeString($name,'U').'_ADD'; + $add = true; + break; + default: + $url = 'index.php?option=com_categories&view=categories&extension=com_componentbuilder.'.$name; + $image = $name.'_'.$action.'.'.$type; + $alt = $name.' '.$action; + $name = 'COM_COMPONENTBUILDER_DASHBOARD_'.ComponentbuilderHelper::safeString($name,'U').'_'.ComponentbuilderHelper::safeString($action,'U'); + break; } + } + else + { + $viewName = $name; + $alt = $name; + $url = 'index.php?option=com_componentbuilder&view='.$name; + $image = $name.'.'.$type; + $name = 'COM_COMPONENTBUILDER_DASHBOARD_'.ComponentbuilderHelper::safeString($name,'U'); + $hover = false; + } } else { @@ -277,7 +293,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList // check access if($user->authorise($accessAdd, 'com_componentbuilder') && $user->authorise($accessTo, 'com_componentbuilder') && $dashboard_add) { - $icons[$group][$i] = new StdClass; + $icons[$group][$i] = new StdClass; $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; @@ -289,7 +305,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList // check access if($user->authorise($accessTo, 'com_componentbuilder') && $dashboard_list) { - $icons[$group][$i] = new StdClass; + $icons[$group][$i] = new StdClass; $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; @@ -301,7 +317,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList // check access if($user->authorise($accessAdd, 'com_componentbuilder') && $dashboard_add) { - $icons[$group][$i] = new StdClass; + $icons[$group][$i] = new StdClass; $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; @@ -310,7 +326,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList } else { - $icons[$group][$i] = new StdClass; + $icons[$group][$i] = new StdClass; $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; @@ -319,7 +335,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList } else { - $icons[$group][$i] = new StdClass; + $icons[$group][$i] = new StdClass; $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; diff --git a/admin/models/custom_admin_view.php b/admin/models/custom_admin_view.php index f955f7eb6..f2ca14854 100644 --- a/admin/models/custom_admin_view.php +++ b/admin/models/custom_admin_view.php @@ -100,14 +100,6 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $item->metadata = $registry->toArray(); } - if (!empty($item->libraries)) - { - // Convert the libraries field to an array. - $libraries = new Registry; - $libraries->loadString($item->libraries); - $item->libraries = $libraries->toArray(); - } - if (!empty($item->ajax_input)) { // Convert the ajax_input field to an array. @@ -116,6 +108,14 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $item->ajax_input = $ajax_input->toArray(); } + if (!empty($item->libraries)) + { + // Convert the libraries field to an array. + $libraries = new Registry; + $libraries->loadString($item->libraries); + $item->libraries = $libraries->toArray(); + } + if (!empty($item->custom_get)) { // Convert the custom_get field to an array. @@ -132,12 +132,6 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $item->custom_button = $custom_button->toArray(); } - if (!empty($item->php_document)) - { - // base64 Decode php_document. - $item->php_document = base64_decode($item->php_document); - } - if (!empty($item->php_jview_display)) { // base64 Decode php_jview_display. @@ -150,10 +144,10 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $item->php_view = base64_decode($item->php_view); } - if (!empty($item->php_jview)) + if (!empty($item->php_document)) { - // base64 Decode php_jview. - $item->php_jview = base64_decode($item->php_jview); + // base64 Decode php_document. + $item->php_document = base64_decode($item->php_document); } if (!empty($item->default)) @@ -162,6 +156,12 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $item->default = base64_decode($item->default); } + if (!empty($item->php_jview)) + { + // base64 Decode php_jview. + $item->php_jview = base64_decode($item->php_jview); + } + if (!empty($item->js_document)) { // base64 Decode js_document. @@ -962,19 +962,6 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin // always reset the snippets $data['snippet'] = 0; - // Set the libraries items to data. - if (isset($data['libraries']) && is_array($data['libraries'])) - { - $libraries = new JRegistry; - $libraries->loadArray($data['libraries']); - $data['libraries'] = (string) $libraries; - } - elseif (!isset($data['libraries'])) - { - // Set the empty libraries to data - $data['libraries'] = ''; - } - // Set the ajax_input items to data. if (isset($data['ajax_input']) && is_array($data['ajax_input'])) { @@ -988,6 +975,19 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $data['ajax_input'] = ''; } + // Set the libraries items to data. + if (isset($data['libraries']) && is_array($data['libraries'])) + { + $libraries = new JRegistry; + $libraries->loadArray($data['libraries']); + $data['libraries'] = (string) $libraries; + } + elseif (!isset($data['libraries'])) + { + // Set the empty libraries to data + $data['libraries'] = ''; + } + // Set the custom_get items to data. if (isset($data['custom_get']) && is_array($data['custom_get'])) { @@ -1014,12 +1014,6 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $data['custom_button'] = ''; } - // Set the php_document string to base64 string. - if (isset($data['php_document'])) - { - $data['php_document'] = base64_encode($data['php_document']); - } - // Set the php_jview_display string to base64 string. if (isset($data['php_jview_display'])) { @@ -1032,10 +1026,10 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $data['php_view'] = base64_encode($data['php_view']); } - // Set the php_jview string to base64 string. - if (isset($data['php_jview'])) + // Set the php_document string to base64 string. + if (isset($data['php_document'])) { - $data['php_jview'] = base64_encode($data['php_jview']); + $data['php_document'] = base64_encode($data['php_document']); } // Set the default string to base64 string. @@ -1044,6 +1038,12 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $data['default'] = base64_encode($data['default']); } + // Set the php_jview string to base64 string. + if (isset($data['php_jview'])) + { + $data['php_jview'] = base64_encode($data['php_jview']); + } + // Set the js_document string to base64 string. if (isset($data['js_document'])) { diff --git a/admin/models/custom_admin_views.php b/admin/models/custom_admin_views.php index b4b6f9f8b..d574eda5e 100644 --- a/admin/models/custom_admin_views.php +++ b/admin/models/custom_admin_views.php @@ -266,16 +266,16 @@ class ComponentbuilderModelCustom_admin_views extends JModelList continue; } - // decode php_document - $item->php_document = base64_decode($item->php_document); // decode php_jview_display $item->php_jview_display = base64_decode($item->php_jview_display); // decode php_view $item->php_view = base64_decode($item->php_view); - // decode php_jview - $item->php_jview = base64_decode($item->php_jview); + // decode php_document + $item->php_document = base64_decode($item->php_document); // decode default $item->default = base64_decode($item->default); + // decode php_jview + $item->php_jview = base64_decode($item->php_jview); // decode js_document $item->js_document = base64_decode($item->js_document); // decode javascript_file diff --git a/admin/models/dynamic_get.php b/admin/models/dynamic_get.php index 5adcf74ec..49be4200e 100644 --- a/admin/models/dynamic_get.php +++ b/admin/models/dynamic_get.php @@ -100,14 +100,6 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin $item->metadata = $registry->toArray(); } - if (!empty($item->join_db_table)) - { - // Convert the join_db_table field to an array. - $join_db_table = new Registry; - $join_db_table->loadString($item->join_db_table); - $item->join_db_table = $join_db_table->toArray(); - } - if (!empty($item->filter)) { // Convert the filter field to an array. @@ -148,6 +140,14 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin $item->join_view_table = $join_view_table->toArray(); } + if (!empty($item->join_db_table)) + { + // Convert the join_db_table field to an array. + $join_db_table = new Registry; + $join_db_table->loadString($item->join_db_table); + $item->join_db_table = $join_db_table->toArray(); + } + if (!empty($item->php_custom_get)) { // base64 Decode php_custom_get. @@ -966,19 +966,6 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin $data['metadata'] = (string) $metadata; } - // Set the join_db_table items to data. - if (isset($data['join_db_table']) && is_array($data['join_db_table'])) - { - $join_db_table = new JRegistry; - $join_db_table->loadArray($data['join_db_table']); - $data['join_db_table'] = (string) $join_db_table; - } - elseif (!isset($data['join_db_table'])) - { - // Set the empty join_db_table to data - $data['join_db_table'] = ''; - } - // Set the filter items to data. if (isset($data['filter']) && is_array($data['filter'])) { @@ -1044,6 +1031,19 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin $data['join_view_table'] = ''; } + // Set the join_db_table items to data. + if (isset($data['join_db_table']) && is_array($data['join_db_table'])) + { + $join_db_table = new JRegistry; + $join_db_table->loadArray($data['join_db_table']); + $data['join_db_table'] = (string) $join_db_table; + } + elseif (!isset($data['join_db_table'])) + { + // Set the empty join_db_table to data + $data['join_db_table'] = ''; + } + // Set the php_custom_get string to base64 string. if (isset($data['php_custom_get'])) { diff --git a/admin/models/fields.php b/admin/models/fields.php index 6666d984b..db8925421 100644 --- a/admin/models/fields.php +++ b/admin/models/fields.php @@ -239,8 +239,9 @@ class ComponentbuilderModelFields extends JModelList 0 => 'COM_COMPONENTBUILDER_FIELD_DEFAULT', 1 => 'COM_COMPONENTBUILDER_FIELD_JSON', 2 => 'COM_COMPONENTBUILDER_FIELD_BASESIXTY_FOUR', - 3 => 'COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALKEY', - 4 => 'COM_COMPONENTBUILDER_FIELD_ADVANCE_ENCRYPTION_WHMCSKEY' + 3 => 'COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY', + 5 => 'COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY', + 4 => 'COM_COMPONENTBUILDER_FIELD_WHMCSKEY_ENCRYPTION' ); // Now check if value is found in this array if (isset($storeArray[$value]) && ComponentbuilderHelper::checkString($storeArray[$value])) @@ -312,7 +313,7 @@ class ComponentbuilderModelFields extends JModelList else { $search = $db->quote('%' . $db->escape($search) . '%'); - $query->where('(a.name LIKE '.$search.' OR a.fieldtype LIKE '.$search.' OR g.name LIKE '.$search.' OR a.datatype LIKE '.$search.' OR a.indexes LIKE '.$search.' OR a.null_switch LIKE '.$search.' OR a.xml LIKE '.$search.' OR a.catid LIKE '.$search.' OR a.store LIKE '.$search.')'); + $query->where('(a.name LIKE '.$search.' OR a.fieldtype LIKE '.$search.' OR g.name LIKE '.$search.' OR a.datatype LIKE '.$search.' OR a.indexes LIKE '.$search.' OR a.null_switch LIKE '.$search.' OR a.catid LIKE '.$search.' OR a.xml LIKE '.$search.' OR a.store LIKE '.$search.')'); } } diff --git a/admin/models/fields/dynamicdashboard.php b/admin/models/fields/dynamicdashboard.php new file mode 100644 index 000000000..5a37c929e --- /dev/null +++ b/admin/models/fields/dynamicdashboard.php @@ -0,0 +1,217 @@ + + @github Joomla Component Builder + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Dynamicdashboard Form Field class for the Componentbuilder component + */ +class JFormFieldDynamicdashboard extends JFormFieldList +{ + /** + * The dynamicdashboard field type. + * + * @var string + */ + public $type = 'dynamicdashboard'; + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $setButton = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($setButton === 'true') + { + $button = array(); + $script = array(); + $buttonName = $this->getAttribute('name'); + // get the input from url + $app = JFactory::getApplication(); + $jinput = $app->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + $refJ = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referal if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + } + $user = JFactory::getUser(); + // only add if user allowed to create custom_admin_view + if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + { + // build Create button + $buttonNamee = trim($buttonName); + $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee); + $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee); + $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee); + $buttonNamee = ucfirst(strtolower($buttonNamee)); + $button[] = ' + '; + } + // only add if user allowed to edit custom_admin_view + if (($buttonName === 'custom_admin_view' || $buttonName === 'custom_admin_views') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + { + // build edit button + $buttonNamee = trim($buttonName); + $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee); + $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee); + $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee); + $buttonNamee = ucfirst(strtolower($buttonNamee)); + $button[] = ''; + // build script + $script[] = " + jQuery(document).ready(function() { + jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) { + e.preventDefault(); + var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val(); + ".$buttonName."Button(".$buttonName."Value); + }); + var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val(); + ".$buttonName."Button(".$buttonName."Value); + }); + function ".$buttonName."Button(value) { + if (value > 0) { + // hide the create button + jQuery('#".$buttonName."Create').hide(); + // show edit button + jQuery('#".$buttonName."Edit').show(); + var url = 'index.php?option=com_componentbuilder&view=custom_admin_views&task=custom_admin_view.edit&id='+value+'".$refJ."'; + jQuery('#".$buttonName."Edit').attr('href', url); + } else { + // show the create button + jQuery('#".$buttonName."Create').show(); + // hide edit button + jQuery('#".$buttonName."Edit').hide(); + } + }"; + } + // check if button was created for custom_admin_view field. + if (is_array($button) && count($button) > 0) + { + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return '
' .$html . implode('',$button).'
'; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + public function getOptions() + { + // load the db opbject + $db = JFactory::getDBO(); + // get the input from url + $jinput = JFactory::getApplication()->input; + // get the id + $ID = $jinput->getInt('id', 0); + // set the targets + $targets = array('adminview' => 'admin_view', 'customadminview' => 'custom_admin_view'); + $t = array('adminview' => 'A', 'customadminview' => 'C'); + // rest the options + $options = array(); + // reset the custom admin views array + $views = false; + if (is_numeric($ID) && $ID >= 1) + { + // get the linked back-end views + foreach ($targets as $target => $view) + { + if ($result = ComponentbuilderHelper::getVar('component_'.$view.'s', (int) $ID, 'joomla_component', 'add'.$view.'s')) + { + $views[$target] = $result; + } + } + } + else + { + // not linked so there is none available + return array(JHtml::_('select.option', '', JText::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_LINK_AN_ADMIN_OR_A_CUSTOM_ADMIN_VIEW_TO_THIS_COMPONENT_THEN_YOU_CAN_SELECT_IT_HERE'))); + } + // check if we found any values + if (ComponentbuilderHelper::checkArray($views)) + { + foreach ($targets as $target => $view) + { + if (isset($views[$target]) && ComponentbuilderHelper::checkJson($views[$target])) + { + // convert to an array + $value = json_decode($views[$target], true); + $type = ComponentbuilderHelper::safeString($view, 'w'); + if (ComponentbuilderHelper::checkArray($value)) + { + foreach ($value as $_view) + { + if (isset($_view[$target]) && is_numeric($_view[$target])) + { + // set the view to the selections if found + if ($name = ComponentbuilderHelper::getVar($view, (int) $_view[$target], 'id', 'system_name')) + { + $options[] = JHtml::_('select.option', $t[$target].'_'.$_view[$target], $name.' ['.$type.']'); + } + } + } + } + } + } + } + // return found options + if (ComponentbuilderHelper::checkArray($options)) + { + array_unshift($options , JHtml::_('select.option', '', JText::_('COM_COMPONENTBUILDER_SELECT_AN_OPTION'))); + return $options; + } + // not linked so there is none available + return array(JHtml::_('select.option', '', JText::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_LINK_AN_ADMIN_OR_A_CUSTOM_ADMIN_VIEW_TO_THIS_COMPONENT_THEN_YOU_CAN_SELECT_IT_HERE'))); + } +} diff --git a/admin/models/fieldtype.php b/admin/models/fieldtype.php index 9835abd82..9f07998b3 100644 --- a/admin/models/fieldtype.php +++ b/admin/models/fieldtype.php @@ -129,7 +129,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin $item->tags->getTagIds($item->id, 'com_componentbuilder.fieldtype'); } } - $this->fieldtypevvvw = $item->id; + $this->fieldtypevvvv = $item->id; return $item; } @@ -139,7 +139,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin * * @return mixed An array of data items on success, false on failure. */ - public function getWadfields() + public function getWacfields() { // Get the user object. $user = JFactory::getUser(); @@ -159,15 +159,15 @@ class ComponentbuilderModelFieldtype extends JModelAdmin $query->select($db->quoteName('g.name','fieldtype_name')); $query->join('LEFT', $db->quoteName('#__componentbuilder_fieldtype', 'g') . ' ON (' . $db->quoteName('a.fieldtype') . ' = ' . $db->quoteName('g.id') . ')'); - // Filter by fieldtypevvvw global. - $fieldtypevvvw = $this->fieldtypevvvw; - if (is_numeric($fieldtypevvvw )) + // Filter by fieldtypevvvv global. + $fieldtypevvvv = $this->fieldtypevvvv; + if (is_numeric($fieldtypevvvv )) { - $query->where('a.fieldtype = ' . (int) $fieldtypevvvw ); + $query->where('a.fieldtype = ' . (int) $fieldtypevvvv ); } - elseif (is_string($fieldtypevvvw)) + elseif (is_string($fieldtypevvvv)) { - $query->where('a.fieldtype = ' . $db->quote($fieldtypevvvw)); + $query->where('a.fieldtype = ' . $db->quote($fieldtypevvvv)); } else { @@ -223,13 +223,13 @@ class ComponentbuilderModelFieldtype extends JModelAdmin foreach ($items as $nr => &$item) { // convert datatype - $item->datatype = $this->selectionTranslationWadfields($item->datatype, 'datatype'); + $item->datatype = $this->selectionTranslationWacfields($item->datatype, 'datatype'); // convert indexes - $item->indexes = $this->selectionTranslationWadfields($item->indexes, 'indexes'); + $item->indexes = $this->selectionTranslationWacfields($item->indexes, 'indexes'); // convert null_switch - $item->null_switch = $this->selectionTranslationWadfields($item->null_switch, 'null_switch'); + $item->null_switch = $this->selectionTranslationWacfields($item->null_switch, 'null_switch'); // convert store - $item->store = $this->selectionTranslationWadfields($item->store, 'store'); + $item->store = $this->selectionTranslationWacfields($item->store, 'store'); } } @@ -243,7 +243,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin * * @return translatable string */ - public function selectionTranslationWadfields($value,$name) + public function selectionTranslationWacfields($value,$name) { // Array of datatype language strings if ($name === 'datatype') @@ -304,8 +304,9 @@ class ComponentbuilderModelFieldtype extends JModelAdmin 0 => 'COM_COMPONENTBUILDER_FIELD_DEFAULT', 1 => 'COM_COMPONENTBUILDER_FIELD_JSON', 2 => 'COM_COMPONENTBUILDER_FIELD_BASESIXTY_FOUR', - 3 => 'COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALKEY', - 4 => 'COM_COMPONENTBUILDER_FIELD_ADVANCE_ENCRYPTION_WHMCSKEY' + 3 => 'COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY', + 5 => 'COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY', + 4 => 'COM_COMPONENTBUILDER_FIELD_WHMCSKEY_ENCRYPTION' ); // Now check if value is found in this array if (isset($storeArray[$value]) && ComponentbuilderHelper::checkString($storeArray[$value])) @@ -403,6 +404,22 @@ class ComponentbuilderModelFieldtype extends JModelAdmin $form->setFieldAttribute('name', 'required', 'false'); } } + // Modify the form based on Edit Properties access controls. + if ($id != 0 && (!$user->authorise('fieldtype.edit.properties', 'com_componentbuilder.fieldtype.' . (int) $id)) + || ($id == 0 && !$user->authorise('fieldtype.edit.properties', 'com_componentbuilder'))) + { + // Disable fields for display. + $form->setFieldAttribute('properties', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('properties', 'readonly', 'true'); + if (!$form->getValue('properties')) + { + // Disable fields while saving. + $form->setFieldAttribute('properties', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('properties', 'required', 'false'); + } + } // Modify the form based on Edit Description access controls. if ($id != 0 && (!$user->authorise('fieldtype.edit.description', 'com_componentbuilder.fieldtype.' . (int) $id)) || ($id == 0 && !$user->authorise('fieldtype.edit.description', 'com_componentbuilder'))) @@ -435,22 +452,6 @@ class ComponentbuilderModelFieldtype extends JModelAdmin $form->setFieldAttribute('short_description', 'required', 'false'); } } - // Modify the form based on Edit Properties access controls. - if ($id != 0 && (!$user->authorise('fieldtype.edit.properties', 'com_componentbuilder.fieldtype.' . (int) $id)) - || ($id == 0 && !$user->authorise('fieldtype.edit.properties', 'com_componentbuilder'))) - { - // Disable fields for display. - $form->setFieldAttribute('properties', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('properties', 'readonly', 'true'); - if (!$form->getValue('properties')) - { - // Disable fields while saving. - $form->setFieldAttribute('properties', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('properties', 'required', 'false'); - } - } // Only load these values if no id is found if (0 == $id) { diff --git a/admin/models/fieldtypes.php b/admin/models/fieldtypes.php index bbab3cca7..85147c31f 100644 --- a/admin/models/fieldtypes.php +++ b/admin/models/fieldtypes.php @@ -45,10 +45,10 @@ class ComponentbuilderModelFieldtypes extends JModelList 'a.created_by','created_by', 'a.modified_by','modified_by', 'a.name','name', + 'a.short_description','short_description', 'c.title','category_title', 'c.id', 'category_id', - 'a.catid', 'catid', - 'a.short_description','short_description' + 'a.catid', 'catid' ); } @@ -72,6 +72,9 @@ class ComponentbuilderModelFieldtypes extends JModelList $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); $this->setState('filter.name', $name); + $short_description = $this->getUserStateFromRequest($this->context . '.filter.short_description', 'filter_short_description'); + $this->setState('filter.short_description', $short_description); + $category = $app->getUserStateFromRequest($this->context . '.filter.category', 'filter_category'); $this->setState('filter.category', $category); @@ -79,10 +82,7 @@ class ComponentbuilderModelFieldtypes extends JModelList $this->setState('filter.category_id', $categoryId); $catid = $app->getUserStateFromRequest($this->context . '.filter.catid', 'filter_catid'); - $this->setState('filter.catid', $catid); - - $short_description = $this->getUserStateFromRequest($this->context . '.filter.short_description', 'filter_short_description'); - $this->setState('filter.short_description', $short_description); + $this->setState('filter.catid', $catid); $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); $this->setState('filter.sorting', $sorting); @@ -197,7 +197,7 @@ class ComponentbuilderModelFieldtypes extends JModelList else { $search = $db->quote('%' . $db->escape($search) . '%'); - $query->where('(a.name LIKE '.$search.' OR a.catid LIKE '.$search.' OR a.description LIKE '.$search.' OR a.short_description LIKE '.$search.')'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.short_description LIKE '.$search.' OR a.catid LIKE '.$search.')'); } } @@ -351,10 +351,10 @@ class ComponentbuilderModelFieldtypes extends JModelList $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.short_description'); $id .= ':' . $this->getState('filter.category'); $id .= ':' . $this->getState('filter.category_id'); - $id .= ':' . $this->getState('filter.catid'); - $id .= ':' . $this->getState('filter.short_description'); + $id .= ':' . $this->getState('filter.catid'); return parent::getStoreId($id); } diff --git a/admin/models/forms/admin_fields.xml b/admin/models/forms/admin_fields.xml index 1b4cb4744..136769215 100644 --- a/admin/models/forms/admin_fields.xml +++ b/admin/models/forms/admin_fields.xml @@ -4,242 +4,277 @@ addfieldpath="/administrator/components/com_componentbuilder/models/fields" >
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +