Permalink
Browse files

Moved the composer vendor folder to libraries and removed it from the…

… admin/helpers folder. Improved the dynamic folder include concept.
  • Loading branch information...
Llewellynvdm committed Feb 28, 2018
1 parent 1b86f15 commit 7f3dae297a56b0869d8dd576b92cea7bd19a3c18
Showing with 470 additions and 2,108 deletions.
  1. +3 −3 README.md
  2. +3 −3 admin/README.txt
  3. +3 −1 admin/compiler/joomla_3/script.php
  4. +100 −8 admin/helpers/compiler/b_Structure.php
  5. +60 −0 admin/helpers/compiler/e_Interpretation.php
  6. +6 −0 admin/helpers/compiler/f_Infusion.php
  7. +2 −2 admin/helpers/componentbuilder.php
  8. +0 −1,819 admin/helpers/vendor/phpseclib/phpseclib/composer.lock
  9. +1 −1 admin/language/en-GB/en-GB.com_componentbuilder.ini
  10. +1 −1 componentbuilder.xml
  11. +1 −0 libraries/vdm_io/index.html
  12. 0 {admin/helpers → libraries/vdm_io}/vendor/.htaccess
  13. +1 −1 {admin/helpers → libraries/vdm_io}/vendor/autoload.php
  14. 0 {admin/helpers → libraries/vdm_io}/vendor/composer/ClassLoader.php
  15. 0 {admin/helpers → libraries/vdm_io}/vendor/composer/LICENSE
  16. 0 {admin/helpers → libraries/vdm_io}/vendor/composer/autoload_classmap.php
  17. 0 {admin/helpers → libraries/vdm_io}/vendor/composer/autoload_files.php
  18. 0 {admin/helpers → libraries/vdm_io}/vendor/composer/autoload_namespaces.php
  19. 0 {admin/helpers → libraries/vdm_io}/vendor/composer/autoload_psr4.php
  20. +7 −7 {admin/helpers → libraries/vdm_io}/vendor/composer/autoload_real.php
  21. +4 −4 {admin/helpers → libraries/vdm_io}/vendor/composer/autoload_static.php
  22. +7 −7 {admin/helpers → libraries/vdm_io}/vendor/composer/installed.json
  23. +9 −0 libraries/vdm_io/vendor/htaccess.txt
  24. +1 −0 libraries/vdm_io/vendor/index.html
  25. 0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/AUTHORS
  26. 0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/LICENSE
  27. +1 −2 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/README.md
  28. +1 −1 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/composer.json
  29. 0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Crypt/AES.php
  30. +40 −0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Crypt/Base.php
  31. +19 −25 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php
  32. 0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Crypt/DES.php
  33. +6 −1 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Crypt/Hash.php
  34. +1 −1 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC2.php
  35. 0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Crypt/RC4.php
  36. 0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php
  37. +4 −0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Crypt/Random.php
  38. 0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php
  39. 0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php
  40. +38 −30 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php
  41. 0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/File/ANSI.php
  42. 0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php
  43. 0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/File/ASN1/Element.php
  44. +23 −4 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/File/X509.php
  45. +2 −2 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php
  46. 0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Net/SCP.php
  47. +2 −2 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php
  48. +1 −1 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php
  49. 0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Net/SSH1.php
  50. +73 −70 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php
  51. 0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php
  52. 0 ...in/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php
  53. 0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/bootstrap.php
  54. 0 {admin/helpers → libraries/vdm_io}/vendor/phpseclib/phpseclib/phpseclib/openssl.cnf
  55. 0 {admin/helpers → libraries/vdm_io}/vendor/web.config
  56. +47 −0 script.php
  57. +0 −109 site/controllers/api.php
  58. +2 −2 site/helpers/componentbuilder.php
  59. +1 −1 site/language/en-GB/en-GB.com_componentbuilder.ini
@@ -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
+ *Last Build*: 28th February, 2018
+ *Version*: 2.6.17
+ *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**
+ *Line count*: **183036**
+ *Field count*: **1641**
+ *File count*: **1169**
+ *Folder count*: **188**
+ *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)
@@ -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
+ *Last Build*: 28th February, 2018
+ *Version*: 2.6.17
+ *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**
+ *Line count*: **183036**
+ *Field count*: **1641**
+ *File count*: **1169**
+ *Folder count*: **188**
+ *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)
@@ -111,6 +111,8 @@ function preflight($type, $parent)
*/
function postflight($type, $parent)
{
// get application
$app = JFactory::getApplication();###MOVEFOLDERSSCRIPT###
// set the default component settings
if ($type == 'install')
{###POSTINSTALLSCRIPT###
@@ -119,5 +121,5 @@ function postflight($type, $parent)
if ($type == 'update')
{###POSTUPDATESCRIPT###
}
}
}###MOVEFOLDERSMETHOD###
}
@@ -306,12 +306,69 @@ class Structure extends Get
*/
public $addCheckin = false;
/**
* The Move Folders Switch
*
* @var boolean
*/
public $setMoveFolders = false;
/**
* The array of last modified dates
*
* @var array
*/
protected $lastModifiedDate = array();
/**
* The array of dynamic 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
*/
protected $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
);
/**
* Constructor
@@ -718,40 +775,58 @@ private function setStatic()
$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
// 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: <b>%s</b> does not exist, and was not added!', $templatePath . $item), 'Error');
$this->app->enqueueMessage(JText::sprintf('The file path: <b>%s</b> 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: <b>%s</b> does not exist, and was not added!', $templatePath . $item), 'Error');
$this->app->enqueueMessage(JText::sprintf('The folder path: <b>%s</b> 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('<p><b>Dynamic folder/s were detected.</b><br />A method (setDynamicF0ld3rs) was added to the install <b>script.php</b> of this package to insure that the folder/s are copied into the correct place when this componet is installed!</p>'), 'Notice');
}
}
}
return true;
}
@@ -1128,6 +1203,8 @@ private function setJoomlaVersionData()
if(!isset($custom['folder']) && isset($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
@@ -1237,6 +1314,8 @@ private function setJoomlaVersionData()
if(!isset($custom['file']) && isset($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 +1391,19 @@ private function indexHTML($path)
}
}
/**
* Update paths with real value
*
* @param string $path The full path
*
* @return string The updated path
*
*/
protected function updateDynamicPath($path)
{
return $this->setPlaceholders($path, $this->constantPaths);
}
/**
* Remove folders with files
*
@@ -4682,6 +4682,66 @@ public function setUninstallScript()
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
@@ -1026,6 +1026,12 @@ protected function buildFileContent()
// ###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();
@@ -1984,7 +1984,7 @@ public static function composerAutoload()
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 +2094,7 @@ public static function getSftp($serverID, $permission = 'core.export')
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
Oops, something went wrong.

0 comments on commit 7f3dae2

Please sign in to comment.