>>
$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\t setListFieldClass($item['code'], $viewName_list, 'hidden-phone')."\">";
+ $body .= PHP_EOL . "\t\t | setListFieldClass($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\t setListFieldClass($item['code'], $viewName_list, 'hidden-phone')."\">";
+ $body .= PHP_EOL . "\t\t | setListFieldClass($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" . ' |