fixed copy error and undeclared variable in ajax.php

This commit is contained in:
Llewellyn van der Merwe 2017-10-26 23:11:52 +02:00
parent f15b67cff1
commit 18946f8ef6
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
25 changed files with 33 additions and 64 deletions

View File

@ -114,7 +114,7 @@ Component Builder is mapped as a component in itself on my local development env
+ *Version*: 2.5.9 + *Version*: 2.5.9
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **160841** + *Line count*: **160810**
+ *File count*: **1000** + *File count*: **1000**
+ *Folder count*: **165** + *Folder count*: **165**

View File

@ -114,7 +114,7 @@ Component Builder is mapped as a component in itself on my local development env
+ *Version*: 2.5.9 + *Version*: 2.5.9
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **160841** + *Line count*: **160810**
+ *File count*: **1000** + *File count*: **1000**
+ *Folder count*: **165** + *Folder count*: **165**

View File

@ -9,7 +9,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -9,7 +9,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -1270,7 +1270,7 @@ class Get
// if Details tab is not set, then set it here // if Details tab is not set, then set it here
if (!isset($view->tabs[1])) if (!isset($view->tabs[1]))
{ {
$view->tabs[1] = 'details'; $view->tabs[1] = 'Details';
} }
// always make sure that publishing is lowercase // always make sure that publishing is lowercase
if (($removeKey = array_search('publishing', array_map('strtolower', $view->tabs))) !== false) if (($removeKey = array_search('publishing', array_map('strtolower', $view->tabs))) !== false)

View File

@ -42,7 +42,7 @@ abstract class ComponentbuilderHelper
} }
/** /**
* Copy Any Item * Copy Any Item (only use for direct database copying)
* *
* @param int $id The item to copy * @param int $id The item to copy
* @param string $table The table and model to copy from and with * @param string $table The table and model to copy from and with
@ -95,41 +95,8 @@ abstract class ComponentbuilderHelper
unset($data['asset_id']); unset($data['asset_id']);
unset($data['checked_out']); unset($data['checked_out']);
unset($data['checked_out_time']); unset($data['checked_out_time']);
// get the form
$form = $model->getForm($data, false);
// make sure we have the form
if (!$form)
{
$app->enqueueMessage($model->getError(), 'error');
return false;
}
// Test whether the data is valid.
$validData = $model->validate($form, $data);
// Check for validation errors.
if ($validData === false)
{
// Get the validation messages.
$errors = $model->getErrors();
// Push up to three validation messages out to the user.
for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)
{
if ($errors[$i] instanceof \Exception)
{
$app->enqueueMessage($errors[$i]->getMessage(), 'warning');
}
else
{
$app->enqueueMessage($errors[$i], 'warning');
}
}
return false;
}
// Attempt to save the data. // Attempt to save the data.
if ($model->save($validData)) if ($model->save($data))
{ {
return true; return true;
} }
@ -411,7 +378,8 @@ abstract class ComponentbuilderHelper
return $indenter->indent($html); return $indenter->indent($html);
} }
public static function checkFileType($file, $sufix) { public static function checkFileType($file, $sufix)
{
// now check if the file ends with the sufix // now check if the file ends with the sufix
return $sufix === "" || ($sufix == substr(strrchr($file, "."), -strlen($sufix))); return $sufix === "" || ($sufix == substr(strrchr($file, "."), -strlen($sufix)));
} }
@ -513,7 +481,7 @@ abstract class ComponentbuilderHelper
'chromestyle','contenttype','databaseconnection','editors','email','file', 'chromestyle','contenttype','databaseconnection','editors','email','file',
'filelist','folderlist','groupedlist','hidden','file','headertag','helpsite', 'filelist','folderlist','groupedlist','hidden','file','headertag','helpsite',
'imagelist','integer','language','list','media','menu','note','password', 'imagelist','integer','language','list','media','menu','note','password',
'plugins','range','radio','repeatable','rules','sessionhandler','spacer','sql','tag', 'plugins','range','radio','repeatable','rules','subform','sessionhandler','spacer','sql','tag',
'tel','menuitem','modulelayout','meter','moduleorder','moduleposition','moduletag', 'tel','menuitem','modulelayout','meter','moduleorder','moduleposition','moduletag',
'templatestyle','text','textarea','timezone','url','user','usergroup' 'templatestyle','text','textarea','timezone','url','user','usergroup'
), ),

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -617,7 +617,7 @@ class ComponentbuilderModelAjax extends JModelList
$this->customadminviewNames[$view] = JText::_('COM_COMPONENTBUILDER_NO_CUSTOM_ADMIN_VIEW_FOUND'); $this->customadminviewNames[$view] = JText::_('COM_COMPONENTBUILDER_NO_CUSTOM_ADMIN_VIEW_FOUND');
} }
} }
$bucket[] = $this->customadminviewNames[$view] . $this->addEditLink($value, 'custom_admin_view', 'custom_admin_views'); $bucket[] = $this->customadminviewNames[$view] . $this->addEditLink($view, 'custom_admin_view', 'custom_admin_views');
} }
} }
elseif (is_numeric($value)) elseif (is_numeric($value))
@ -655,7 +655,7 @@ class ComponentbuilderModelAjax extends JModelList
$this->adminviewNames[$view] = JText::_('COM_COMPONENTBUILDER_NO_ADMIN_VIEW_FOUND'); $this->adminviewNames[$view] = JText::_('COM_COMPONENTBUILDER_NO_ADMIN_VIEW_FOUND');
} }
} }
$bucket[] = $this->adminviewNames[$view] . $this->addEditLink($value, 'admin_view', 'admin_views'); $bucket[] = $this->adminviewNames[$view] . $this->addEditLink($view, 'admin_view', 'admin_views');
} }
} }
elseif (is_numeric($value)) elseif (is_numeric($value))
@ -693,7 +693,7 @@ class ComponentbuilderModelAjax extends JModelList
$this->siteviewNames[$view] = JText::_('COM_COMPONENTBUILDER_NO_SITE_VIEW_FOUND'); $this->siteviewNames[$view] = JText::_('COM_COMPONENTBUILDER_NO_SITE_VIEW_FOUND');
} }
} }
$bucket[] = $this->siteviewNames[$view] . $this->addEditLink($value, 'site_view', 'site_views'); $bucket[] = $this->siteviewNames[$view] . $this->addEditLink($view, 'site_view', 'site_views');
} }
} }
elseif (is_numeric($value)) elseif (is_numeric($value))

View File

@ -9,7 +9,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -9,7 +9,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 228 of this MVC @version @update number 229 of this MVC
@build 26th October, 2017 @build 26th October, 2017
@created 30th April, 2015 @created 30th April, 2015
@package Component Builder @package Component Builder

View File

@ -305,7 +305,8 @@ abstract class ComponentbuilderHelper
return $indenter->indent($html); return $indenter->indent($html);
} }
public static function checkFileType($file, $sufix) { public static function checkFileType($file, $sufix)
{
// now check if the file ends with the sufix // now check if the file ends with the sufix
return $sufix === "" || ($sufix == substr(strrchr($file, "."), -strlen($sufix))); return $sufix === "" || ($sufix == substr(strrchr($file, "."), -strlen($sufix)));
} }
@ -407,7 +408,7 @@ abstract class ComponentbuilderHelper
'chromestyle','contenttype','databaseconnection','editors','email','file', 'chromestyle','contenttype','databaseconnection','editors','email','file',
'filelist','folderlist','groupedlist','hidden','file','headertag','helpsite', 'filelist','folderlist','groupedlist','hidden','file','headertag','helpsite',
'imagelist','integer','language','list','media','menu','note','password', 'imagelist','integer','language','list','media','menu','note','password',
'plugins','range','radio','repeatable','rules','sessionhandler','spacer','sql','tag', 'plugins','range','radio','repeatable','rules','subform','sessionhandler','spacer','sql','tag',
'tel','menuitem','modulelayout','meter','moduleorder','moduleposition','moduletag', 'tel','menuitem','modulelayout','meter','moduleorder','moduleposition','moduletag',
'templatestyle','text','textarea','timezone','url','user','usergroup' 'templatestyle','text','textarea','timezone','url','user','usergroup'
), ),