Bug fixes, error on compilation when using view date & version was fixed, headercheck file missing was fixed. Added swithces to controle custom import placeholders and if view version and date should be used

This commit is contained in:
2017-02-02 13:54:07 +02:00
parent 1a79b92b07
commit 655708cfa3
211 changed files with 1401 additions and 895 deletions

View File

@ -54,12 +54,12 @@ class Get
/* The custom script placeholders - we use the (xxx) to avoid detection it should be (***)
*
* New Insert Code = /xxx[INSERT<>$$$$]xxx/ /xxx[/INSERT<>$$$$]xxx/
* New Insert Code = /xxx[INSERT<>$$$$]xxx/ /xxx[/INSERT<>$$$$]xxx/
* New Replace Code = /xxx[REPLACE<>$$$$]xxx/ /xxx[/REPLACE<>$$$$]xxx/
*
* //////////////////////////// when JCB adds it back ///////////////////////////////
* JCB Add Inserted Code = /xxx[INSERTED$$$$]xxx/ //23 /xxx[/INSERTED$$$$]xxx/
* JCB Add Replaced Code = /xxx[REPLACED$$$$]xxx/ //25 /xxx[/REPLACED$$$$]xxx/
* JCB Add Inserted Code = /xxx[INSERTED$$$$]xxx///23 /xxx[/INSERTED$$$$]xxx/
* JCB Add Replaced Code = /xxx[REPLACED$$$$]xxx///25 /xxx[/REPLACED$$$$]xxx/
*
* ///////////////////////// changeing existing custom code /////////////////////////
* Update Inserted Code = /xxx[INSERTED<>$$$$]xxx///23 /xxx[/INSERTED<>$$$$]xxx/
@ -798,7 +798,7 @@ class Get
{
foreach ($values as $nr => $value)
{
if ('html' == $option)
if ('html' === $option)
{
$value = $this->setCustomContentLang($value);
}
@ -2197,13 +2197,13 @@ class Get
if (ComponentbuilderHelper::checkArray($lines))
{
$db = JFactory::getDbo();
if ('db' == $type)
if ('db' === $type)
{
$table = '#__'.$asset;
$queryName = $asset;
$view = '';
}
elseif ('view' == $type)
elseif ('view' === $type)
{
$view = $this->getViewTableName($asset);
$table = '#__'.$this->componentCodeName.'_'.$view;
@ -2229,7 +2229,7 @@ class Get
$get = trim($get);
$key = trim($key);
// only add the view
if ('a' != $as && 1 == $row_type && 'view' == $type && strpos('#'.$key,'#'.$view.'_') === false)
if ('a' != $as && 1 == $row_type && 'view' === $type && strpos('#'.$key,'#'.$view.'_') === false)
{
$key = $view.'_'.trim($key);
}

View File

@ -448,24 +448,25 @@ class Structure extends Get
{
if (ComponentbuilderHelper::checkObject($view['settings']))
{
$created = $this->getCreatedDate($view);
$modified = $this->getLastModifiedDate($view);
if ($view['settings']->name_list != 'null')
{
$target = array('admin' => $view['settings']->name_list);
$config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
$config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
$this->buildDynamique($target,'list', false, $config);
}
if ($view['settings']->name_single != 'null')
{
$target = array('admin' => $view['settings']->name_single);
$config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
$config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
$this->buildDynamique($target,'single', false, $config);
}
if($view['edit_create_site_view'])
{
// setup the front site edit-view files
$target = array('site' => $view['settings']->name_single);
$config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
$config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
$this->buildDynamique($target,'edit', false, $config);
}
}
@ -483,19 +484,20 @@ class Structure extends Get
foreach ($this->componentData->site_views as $nr => $view)
{
$created = $this->getCreatedDate($view);
$modified = $this->getLastModifiedDate($view);
if ($view['settings']->main_get->gettype == 2)
{
// set list view
$target = array('site' => $view['settings']->code);
$config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
$config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
$this->buildDynamique($target,'list', false, $config);
}
elseif ($view['settings']->main_get->gettype == 1)
{
// set single view
$target = array('site' => $view['settings']->code);
$config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
$config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
$this->buildDynamique($target,'single', false, $config);
}
}
@ -505,19 +507,20 @@ class Structure extends Get
{
foreach ($this->componentData->custom_admin_views as $nr => $view)
{
$created = $this->getCreatedDate($view);
$modified = $this->getLastModifiedDate($view);
if ($view['settings']->main_get->gettype == 2)
{
// set list view
// set list view$view
$target = array('custom_admin' => $view['settings']->code);
$config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => JFactory::getDate($view['settings']->modified)->format('jS F, Y'),'###VERSION###' => $view['settings']->version);
$config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => JFactory::getDate($view['settings']->modified)->format('jS F, Y'),'###VERSION###' => $view['settings']->version);
$this->buildDynamique($target,'list', false, $config);
}
elseif ($view['settings']->main_get->gettype == 1)
{
// set single view
$target = array('custom_admin' => $view['settings']->code);
$config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => JFactory::getDate($view['settings']->modified)->format('jS F, Y'),'###VERSION###' => $view['settings']->version);
$config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => JFactory::getDate($view['settings']->modified)->format('jS F, Y'),'###VERSION###' => $view['settings']->version);
$this->buildDynamique($target, 'single', false, $config);
}
}
@ -531,6 +534,29 @@ class Structure extends Get
return false;
}
/**
* get the created date of the (view)
*
* @param array $view The view values
*
* @return string Last Modified Date
*
*/
public function getCreatedDate($view)
{
if (isset($view['settings']->created) && ComponentbuilderHelper::checkString($view['settings']->created))
{
// first set the main date
$date = strtotime($view['settings']->created);
}
else
{
// first set the main date
$date = strtotime("now");
}
return JFactory::getDate($date)->format('jS F, Y');
}
/**
* get the last modified date of a MVC (view)
*
@ -541,8 +567,16 @@ class Structure extends Get
*/
public function getLastModifiedDate($view)
{
// first set the main date
$date = strtotime($view['settings']->modified);
if (isset($view['settings']->modified) && ComponentbuilderHelper::checkString($view['settings']->modified))
{
// first set the main date
$date = strtotime($view['settings']->modified);
}
else
{
// first set the main date
$date = strtotime("now");
}
if (isset($view['adminview']))
{
$id = $view['adminview'].'admin';

View File

@ -1018,7 +1018,7 @@ class Fields extends Structure
}
$fieldSet .= "\n\t\t" . $taber . "/>";
// incase the field is in the config and has not been set
if ('config' == $viewName && 'configs' == $listViewName)
if ('config' === $viewName && 'configs' === $listViewName)
{
// set lang (just incase)
$listLangName = $langView . '_' . ComponentbuilderHelper::safeString($name, 'U');
@ -1350,7 +1350,7 @@ class Fields extends Structure
{
$xmlValue = (string) ComponentbuilderHelper::getBetween($field['settings']->xml, $property['name'] . '="', '"');
// add the multipal
if ('true' == $xmlValue)
if ('true' === $xmlValue)
{
$multiple = true;
}

View File

@ -281,15 +281,15 @@ class Interpretation extends Fields
$encrypt[] = "\t\t\$session = JFactory::getSession();";
$encrypt[] = "\t\t\$V2uekt2wcgwk = \$session->get(\$Vk5smi0wjnjb, null);";
$encrypt[] = "\t\t\$h4sgrGsqq = \$this->get(\$Vk5smi0wjnjb,\$V2uekt2wcgwk);";
$encrypt[] = "\t\tif (isset(\$h4sgrGsqq['nuut']) && \$h4sgrGsqq['nuut'] && (isset(\$h4sgrGsqq['status']) && 'Active' == \$h4sgrGsqq['status']) && isset(\$h4sgrGsqq['eiegrendel']) && strlen(\$h4sgrGsqq['eiegrendel']) > 300)";
$encrypt[] = "\t\tif (isset(\$h4sgrGsqq['nuut']) && \$h4sgrGsqq['nuut'] && (isset(\$h4sgrGsqq['status']) && 'Active' === \$h4sgrGsqq['status']) && isset(\$h4sgrGsqq['eiegrendel']) && strlen(\$h4sgrGsqq['eiegrendel']) > 300)";
$encrypt[] = "\t\t{";
$encrypt[] = "\t\t\t\$session->set(\$Vk5smi0wjnjb, \$h4sgrGsqq['eiegrendel']);";
$encrypt[] = "\t\t}";
$encrypt[] = "\t\tif ((isset(\$h4sgrGsqq['status']) && 'Active' == \$h4sgrGsqq['status']) && isset(\$h4sgrGsqq['md5hash']) && strlen(\$h4sgrGsqq['md5hash']) == 32 && isset(\$h4sgrGsqq['customfields']) && strlen(\$h4sgrGsqq['customfields']) > 4)";
$encrypt[] = "\t\tif ((isset(\$h4sgrGsqq['status']) && 'Active' === \$h4sgrGsqq['status']) && isset(\$h4sgrGsqq['md5hash']) && strlen(\$h4sgrGsqq['md5hash']) == 32 && isset(\$h4sgrGsqq['customfields']) && strlen(\$h4sgrGsqq['customfields']) > 4)";
$encrypt[] = "\t\t{";
$encrypt[] = "\t\t\t\$this->_key = md5(\$h4sgrGsqq['customfields']);";
$encrypt[] = "\t\t}";
$encrypt[] = "\t\tif ((isset(\$h4sgrGsqq['status']) && 'Active' == \$h4sgrGsqq['status']) && isset(\$h4sgrGsqq['md5hash']) && strlen(\$h4sgrGsqq['md5hash']) == 32 )";
$encrypt[] = "\t\tif ((isset(\$h4sgrGsqq['status']) && 'Active' === \$h4sgrGsqq['status']) && isset(\$h4sgrGsqq['md5hash']) && strlen(\$h4sgrGsqq['md5hash']) == 32 )";
$encrypt[] = "\t\t{";
$encrypt[] = "\t\t\t\$this->_is = true;";
$encrypt[] = "\t\t}";
@ -462,7 +462,7 @@ class Interpretation extends Fields
$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\tif ('advanced' === \$type)";
$function[] = "\t\t{";
$function[] = "\t\t\t\$advanced_key = \$params->get('advanced_key', \$default);";
$function[] = "\t\t\tif (\$advanced_key)";
@ -473,7 +473,7 @@ class Interpretation extends Fields
$function[] = "\n\t\t\t\treturn \$the->_key;";
$function[] = "\t\t\t}";
$function[] = "\t\t}";
$function[] = "\t\telseif ('basic' == \$type)";
$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)";
@ -488,7 +488,7 @@ class Interpretation extends Fields
{
$function[] = "\n\n\tpublic static function getCryptKey(\$type, \$default = null)";
$function[] = "\t{";
$function[] = "\t\tif ('advanced' == \$type)";
$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);";
@ -508,7 +508,7 @@ class Interpretation extends Fields
{
$function[] = "\n\n\tpublic static function getCryptKey(\$type, \$default = null)";
$function[] = "\t{";
$function[] = "\t\tif ('basic' == \$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);";
@ -1802,7 +1802,7 @@ class Interpretation extends Fields
}
$getItem .= "\n\t".$tab."\t\t//".$this->setLine(__LINE__)." If no data is found redirect to default page and show warning.";
$getItem .= "\n\t".$tab."\t\t\$app->enqueueMessage(JText::_('".$langKeyWord."'), 'warning');";
if ('site' == $this->target)
if ('site' === $this->target)
{
// check that the default and the redirect page is not the same
if ($this->fileContentStatic['###SITE_DEFAULT_VIEW###'] != $code)
@ -2576,14 +2576,14 @@ class Interpretation extends Fields
$method .= str_replace(array_keys($this->placeholders),array_values($this->placeholders),"\n\t\t".implode("\n\t\t",$view['settings']->php_jview_display));
}
}
if ('site' == $this->target)
if ('site' === $this->target)
{
$method .= "\n\n\t\t//".$this->setLine(__LINE__)." Set the toolbar";
$method .= "\n\t\t\$this->addToolBar();";
$method .= "\n\n\t\t//".$this->setLine(__LINE__)." set the document";
$method .= "\n\t\t\$this->_prepareDocument();";
}
elseif ('custom_admin' == $this->target)
elseif ('custom_admin' === $this->target)
{
$method .= "\n\n\t\t//".$this->setLine(__LINE__)." We don't need toolbar in the modal window.";
$method .= "\n\t\tif (\$this->getLayout() !== 'modal')";
@ -2631,7 +2631,7 @@ class Interpretation extends Fields
$this->fileContentDynamic[$view['settings']->code]['###'.$TARGET.'_CUSTOM_BUTTONS###'] = $this->setCustomButtons($view);
// only set the custom get form method if site target
if ('site' == $this->target)
if ('site' === $this->target)
{
// set the custom get form method ###SITE_CUSTOM_GET_FORM_METHOD###
$this->fileContentDynamic[$view['settings']->code]['###SITE_CUSTOM_GET_FORM_METHOD###'] = $this->setCustomGetForm($view);
@ -2791,7 +2791,7 @@ class Interpretation extends Fields
// set the custom buttons ###CUSTOM_BUTTONS_CONTROLLER###
$this->fileContentDynamic[$viewName]['###'.$TARGET.'_CUSTOM_BUTTONS_CONTROLLER###'] =
"\n\n".str_replace(array_keys($this->placeholders),array_values($this->placeholders),$view['settings']->php_controller);
if ('site' == $this->target)
if ('site' === $this->target)
{
// add the controller for this view
// build the file
@ -3025,7 +3025,14 @@ class Interpretation extends Fields
$setter .= "\n\n\t\t//".$this->setLine(__LINE__)." always make sure jquery is loaded.";
$setter .= "\n\t\tJHtml::_('jquery.framework');";
$setter .= "\n\t\t//".$this->setLine(__LINE__)." Load the header checker class.";
$setter .= "\n\t\trequire_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' );";
if ($this->target === 'site')
{
$setter .= "\n\t\trequire_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' );";
}
else
{
$setter .= "\n\t\trequire_once( JPATH_COMPONENT_ADMINISTRATOR.'/helpers/headercheck.php' );";
}
$setter .= "\n\t\t//".$this->setLine(__LINE__)." Initialize the header checker.";
$setter .= "\n\t\t\$HeaderCheck = new HeaderCheck;";
// load the defaults needed
@ -3236,12 +3243,13 @@ class Interpretation extends Fields
{
if (isset($this->templateData[$this->target][$view['settings']->code]) && ComponentbuilderHelper::checkArray($this->templateData[$this->target][$view['settings']->code]))
{
$created = $this->getCreatedDate($view);
$modified = $this->getLastModifiedDate($view);
foreach ($this->templateData[$this->target][$view['settings']->code] as $template => $data)
{
// build the file
$target = array($this->target => $view['settings']->code);
$config = array('###CREATIONDATE###' => JFactory::getDate($view['settings']->created)->format('jS F, Y'), '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
$config = array('###CREATIONDATE###' => $created, '###BUILDDATE###' => $modified,'###VERSION###' => $view['settings']->version);
$this->buildDynamique($target,'template', $template, $config);
// set the file data
$TARGET = ComponentbuilderHelper::safeString($this->target,'U');
@ -3994,7 +4002,7 @@ class Interpretation extends Fields
$routeHelper[] = "\n\n\t/**";
$routeHelper[] = "\t* @param int The route of the ".$View;
$routeHelper[] = "\t*/";
if ('category' == $viewName_single || 'categories' == $viewName_single)
if ('category' === $viewName_single || 'categories' === $viewName_single)
{
$routeHelper[] = "\tpublic static function get".$View."Route(\$id = 0)";
}
@ -4259,7 +4267,7 @@ class Interpretation extends Fields
$batchmove[] = "\t\t\t\tforeach (\$values as \$key => \$value)";
$batchmove[] = "\t\t\t\t{";
$batchmove[] = "\t\t\t\t\t//".$this->setLine(__LINE__)." Do special action for access.";
$batchmove[] = "\t\t\t\t\tif ('access' == \$key && strlen(\$value) > 0)";
$batchmove[] = "\t\t\t\t\tif ('access' === \$key && strlen(\$value) > 0)";
$batchmove[] = "\t\t\t\t\t{";
$batchmove[] = "\t\t\t\t\t\t\$this->table->\$key = \$value;";
$batchmove[] = "\t\t\t\t\t}";
@ -9614,7 +9622,7 @@ class Interpretation extends Fields
$allow[] = "\t\t\t\$form->setFieldAttribute('".$fieldName."', 'disabled', 'true');";
$allow[] = "\t\t\t//".$this->setLine(__LINE__)." Disable fields for display.";
$allow[] = "\t\t\t\$form->setFieldAttribute('".$fieldName."', 'readonly', 'true');";
if ('radio' == $fieldType || 'repeatable' == $fieldType)
if ('radio' === $fieldType || 'repeatable' === $fieldType)
{
$allow[] = "\t\t\t//".$this->setLine(__LINE__)." Disable radio button for display.";
$allow[] = "\t\t\t\$class = \$form->getFieldAttribute('".$fieldName."', 'class', '');";