resolve gh-115 to allow excluding of folders and files in the repository folder

This commit is contained in:
2017-09-13 02:37:43 +02:00
parent 4b3bc9bd03
commit 8ccb13f3e0
298 changed files with 7160 additions and 3829 deletions

View File

@ -408,7 +408,7 @@ class Compiler extends Infusion
// set the git path
$this->gitPath = $this->gitPath.'/com_'.$this->componentData->sales_name.'__joomla_'.$this->joomlaVersion;
// remove old data
$this->removeFolder($this->gitPath,true);
$this->removeFolder($this->gitPath, $this->componentData->toignore);
// set the new data
JFolder::copy($this->componentPath, $this->gitPath, '', true);
}

View File

@ -1051,6 +1051,23 @@ class Get
$component->sales_server_ftp = 0;
$component->add_sales_server = 0;
}
// set the ignore folders for git if found
if (isset($component->toignore) && ComponentbuilderHelper::checkString($component->toignore))
{
if (strpos($component->toignore, ',') !== false)
{
$component->toignore = array_map('trim', (array) explode(',', $component->toignore));
}
else
{
$component->toignore = array(trim($component->toignore));
}
}
else
{
// the default is to ignore the git folder
$component->toignore = array('.git');
}
// return the found component data
return $component;
@ -1395,7 +1412,7 @@ class Get
}
}
// add_php
$addArrayP = array('php_getitem','php_save','php_postsavehook','php_getitems','php_getitems_after_all','php_getlistquery','php_allowedit','php_before_delete','php_after_delete','php_before_publish','php_after_publish','php_batchcopy','php_batchmove','php_document');
$addArrayP = array('php_getitem','php_before_save','php_save','php_postsavehook','php_getitems','php_getitems_after_all','php_getlistquery','php_allowedit','php_before_delete','php_after_delete','php_before_publish','php_after_publish','php_batchcopy','php_batchmove','php_document');
foreach ($addArrayP as $scripter)
{
if (isset($view->{'add_'.$scripter}) && $view->{'add_'.$scripter} == 1)

View File

@ -379,13 +379,13 @@ class Interpretation extends Fields
// make sure we have the correct file
if (isset($this->componentData->whmcs_key) && ComponentbuilderHelper::checkString($this->componentData->whmcs_key))
{
// Get the basic encription.
// Get the basic encryption.
$basickey = ComponentbuilderHelper::getCryptKey('basic');
// Get the encription object.
// Get the encryption object.
$basic = new FOFEncryptAes($basickey, 128);
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 decript data whmcs_key.
// basic decrypt data whmcs_key.
$this->componentData->whmcs_key = rtrim($basic->decryptString($this->componentData->whmcs_key), "\0");
// set the needed string to connect to whmcs
$key["kasier"] = $this->componentData->whmcs_url;
@ -2145,16 +2145,16 @@ class Interpretation extends Fields
$script = '';
if (isset($this->siteDecrypt['basic'][$code]) && $this->siteDecrypt['basic'][$code])
{
$script .= PHP_EOL.PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Get the basic encription.";
$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."\t".$tab."\t//".$this->setLine(__LINE__)." Get the encription object.";
$script .= PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Get the encryption object.";
$script .= PHP_EOL."\t".$tab."\t\$basic = new FOFEncryptAes(\$basickey, 128);";
}
if (isset($this->siteDecrypt['advanced'][$code]) && $this->siteDecrypt['advanced'][$code])
{
$script .= PHP_EOL.PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Get the advanced encription.";
$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 encription object.";
$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;
@ -2593,16 +2593,16 @@ class Interpretation extends Fields
$script = '';
if ($this->siteDecrypt['basic'][$code])
{
$script .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the basic encription.";
$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 encription object.";
$script .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the encryption object.";
$script .= PHP_EOL."\t\t\$basic = new FOFEncryptAes(\$basickey, 128);".PHP_EOL;
}
if ($this->siteDecrypt['advanced'][$code])
{
$script .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the advanced encription.";
$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 encription object.";
$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);
@ -2777,16 +2777,16 @@ class Interpretation extends Fields
$script = '';
if ($this->siteDecrypt['basic'][$code])
{
$script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the basic encription.";
$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."\t\t//".$this->setLine(__LINE__)." Get the encription object.";
$script .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the encryption object.";
$script .= PHP_EOL."\t\t\$basic = new FOFEncryptAes(\$basickey, 128);";
}
if ($this->siteDecrypt['advanced'][$code])
{
$script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the advanced encription.";
$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 encription object.";
$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;
@ -3787,30 +3787,30 @@ class Interpretation extends Fields
$Component = $this->fileContentStatic['###Component###'];
if (isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view]))
{
$script .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Get the basic encription.";
$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."\t\t\t//".$this->setLine(__LINE__)." Get the encription object.";
$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.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."\t\t\t{";
$script .= PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." basic decript data ".$baseString.".";
$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 encription key.";
$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 encription object.";
$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 decript data ".$baseString.".";
$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}";
}
@ -3843,6 +3843,8 @@ class Interpretation extends Fields
public function setMethodItemSave(&$view)
{
$script = '';
// check if there was script added before modeling of data
$script .= $this->getCustomScriptBuilder('php_before_save', $view, PHP_EOL.PHP_EOL);
// turn array into JSON string
if(isset($this->jsonItemBuilder[$view]) && ComponentbuilderHelper::checkArray($this->jsonItemBuilder[$view]))
{
@ -3892,13 +3894,13 @@ class Interpretation extends Fields
$Component = $this->fileContentStatic['###Component###'];
if(isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view]))
{
$script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the basic encription key.";
$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."\t\t//".$this->setLine(__LINE__)." Get the encription object";
$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.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Encript data ".$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\t{";
$script .= PHP_EOL."\t\t\t\$data['".$baseString."'] = \$basic->encryptString(\$data['".$baseString."']);";
@ -3907,13 +3909,13 @@ class Interpretation extends Fields
}
if(isset($this->advancedEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder[$view]))
{
$script .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Get the advanced encription key.";
$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 encription object";
$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__)." Encript data ".$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."']);";
@ -11070,7 +11072,7 @@ class Interpretation extends Fields
{
// add the fix if this view has the need for it
$fix = '';
// encription switches
// encryption switches
$basicCrypt = false;
$advancedCrypt = false;
// setup correct core target
@ -11334,9 +11336,9 @@ class Interpretation extends Fields
if ($basicCrypt)
{
$script = PHP_EOL.PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Get the basic encription key.";
$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 encription object.";
$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;
@ -11344,9 +11346,9 @@ class Interpretation extends Fields
if ($advancedCrypt)
{
$script = PHP_EOL.PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Get the advanced encription key.";
$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 encription object.";
$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;
@ -13705,7 +13707,7 @@ function vdm_dkim() {
$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 encription key for the field encryption is set here.";
$this->langContent[$this->lang][$lang.'_ENCRYPTION_DESC'] = "The encryption key for the field encryption is set here.";
if (isset($this->basicEncryption) && $this->basicEncryption)
{

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.2
@build 25th August, 2017
@version 2.5.4
@build 13th September, 2017
@created 30th April, 2015
@package Component Builder
@subpackage componentbuilder.php
@ -107,13 +107,13 @@ abstract class ComponentbuilderHelper
/**
* Remove folders with files
*
* @param string $dir The path to folder to remove
* @param boolean $git if there is a git folder in that must not be removed
* @param string $dir The path to folder to remove
* @param boolean $ignore The folders and files to ignore and not remove
*
* @return boolean True in all is removed
*
*/
public static function removeFolder($dir, $git = false)
public static function removeFolder($dir, $ignore = false)
{
if (JFolder::exists($dir))
{
@ -124,22 +124,53 @@ abstract class ComponentbuilderHelper
if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue;
if ($file->isDir())
{
if ($git && strpos($file->getPathname(), $dir.'/.git') !== false) continue;
$keeper = false;
if (self::checkArray($ignore))
{
foreach ($ignore as $keep)
{
if (strpos($file->getPathname(), $dir.'/'.$keep) !== false)
{
$keeper = true;
}
}
}
if ($keeper)
{
continue;
}
JFolder::delete($file->getPathname());
}
else
{
if ($git && strpos($file->getPathname(), $dir.'/.git') !== false) continue;
$keeper = false;
if (self::checkArray($ignore))
{
foreach ($ignore as $keep)
{
if (strpos($file->getPathname(), $dir.'/'.$keep) !== false)
{
$keeper = true;
}
}
}
if ($keeper)
{
continue;
}
JFile::delete($file->getPathname());
}
}
if (!$git && JFolder::delete($dir))
if (!self::checkArray($ignore))
{
return true;
return JFolder::delete($dir);
}
return true;
}
return false;
} /**
}
/**
* The dynamic builder of views, tables and fields
**/
public static function dynamicBuilder(&$data, $type)

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.2
@build 25th August, 2017
@version 2.5.4
@build 13th September, 2017
@created 30th April, 2015
@package Component Builder
@subpackage componentbuilderemail.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.2
@build 25th August, 2017
@version 2.5.4
@build 13th September, 2017
@created 30th April, 2015
@package Component Builder
@subpackage headercheck.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.2
@build 25th August, 2017
@version 2.5.4
@build 13th September, 2017
@created 30th April, 2015
@package Component Builder
@subpackage batch_.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.2
@build 25th August, 2017
@version 2.5.4
@build 13th September, 2017
@created 30th April, 2015
@package Component Builder
@subpackage indenter.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.2
@build 25th August, 2017
@version 2.5.4
@build 13th September, 2017
@created 30th April, 2015
@package Component Builder
@subpackage js.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.2
@build 25th August, 2017
@version 2.5.4
@build 13th September, 2017
@created 30th April, 2015
@package Component Builder
@subpackage minify.php