Moved FTP signature to its own table, so we can use it more securely around JCB (even in the global settings). Improved the Linked view option in admin-views.

This commit is contained in:
2017-08-25 02:46:12 +01:00
parent 8501e37b3e
commit 4b3bc9bd03
261 changed files with 5281 additions and 638 deletions

View File

@ -244,7 +244,7 @@ class Compiler extends Infusion
protected function setUpdateServer()
{
// move the update server to host
if ($this->componentData->add_update_server && $this->componentData->update_server_target == 1 && isset($this->updateServerFileName) && $this->dynamicIntegration)
if ($this->componentData->add_update_server == 1 && $this->componentData->update_server_target == 1 && isset($this->updateServerFileName) && $this->dynamicIntegration)
{
$xml_update_server_path = $this->componentPath.'/'.$this->updateServerFileName.'.xml';
// make sure we have the correct file
@ -423,8 +423,9 @@ class Compiler extends Infusion
{
JFile::copy($this->filepath, $this->backupPath);
}
// move to sales server host
if ($this->componentData->add_sales_server && $this->dynamicIntegration)
if ($this->componentData->add_sales_server == 1 && $this->dynamicIntegration)
{
// make sure we have the correct file
if (isset($this->componentData->sales_server_ftp))
@ -474,30 +475,31 @@ class Compiler extends Infusion
private function getFTP($clientInput)
{
$signature = md5($clientInput);
if (isset($this->FTP[$signature]) && $this->FTP[$signature] instanceof JClientFtp)
$s1GnAtnr3 = md5($clientInput);
if (isset($this->FTP[$s1GnAtnr3]) && $this->FTP[$s1GnAtnr3] instanceof JClientFtp)
{
return $this->FTP[$signature];
// return the FTP instance
return $this->FTP[$s1GnAtnr3];
}
else
{
// make sure we have a string and it is not default or empty
if (ComponentbuilderHelper::checkString($clientInput))
{
// turn into vars
parse_str($clientInput);
// turn into variables
parse_str($clientInput); // because of this I am using strand variable naming to avoid any collisions.
// set options
if (isset($options) && ComponentbuilderHelper::checkArray($options))
{
foreach ($options as $option => $value)
foreach ($options as $o__p0t1on => $vAln3)
{
if ('timeout' === $option)
if ('timeout' === $o__p0t1on)
{
$options[$option] = (int) $value;
$options[$o__p0t1on] = (int) $vAln3;
}
if ('type' === $option)
if ('type' === $o__p0t1on)
{
$options[$option] = (string) $value;
$options[$o__p0t1on] = (string) $vAln3;
}
}
}
@ -509,8 +511,9 @@ class Compiler extends Infusion
if (isset($host) && $host != 'HOSTNAME' && isset($port) && $port != 'PORT_INT' && isset($username) && $username != 'user@name.com' && isset($password) && $password != 'password')
{
// load for reuse
$this->FTP[$signature] = JClientFtp::getInstance($host, $port, $options, $username, $password);
return $this->FTP[$signature];
$this->FTP[$s1GnAtnr3] = JClientFtp::getInstance($host, $port, $options, $username, $password);
// return the FTP instance
return $this->FTP[$s1GnAtnr3];
}
}
}

View File

@ -1032,7 +1032,26 @@ class Get
$component->php_dashboard_methods = '';
$component->dashboard_tab = '';
}
// add the update FTP server sig
if ($component->add_update_server == 1 && is_numeric($component->update_server_ftp) && $component->update_server_ftp > 0)
{
$component->update_server_ftp = ComponentbuilderHelper::getVar('ftp', (int) $component->update_server_ftp, 'id', 'signature');
}
else
{
$component->update_server_ftp = 0;
}
// add the sales FTP server sig
if ($component->add_sales_server == 1 && is_numeric($component->sales_server_ftp) && $component->sales_server_ftp > 0)
{
$component->sales_server_ftp = ComponentbuilderHelper::getVar('ftp', (int) $component->sales_server_ftp, 'id', 'signature');
}
else
{
$component->sales_server_ftp = 0;
$component->add_sales_server = 0;
}
// return the found component data
return $component;
}

View File

@ -3117,7 +3117,7 @@ class Interpretation extends Fields
{
$this->onlyFunctionButton[$viewsName] = array();
}
$this->onlyFunctionButton[$viewsName][] = "\t".$tab."if (\$this->user->authorise('".$viewName.".".$keyCode."'))";
$this->onlyFunctionButton[$viewsName][] = "\t".$tab."if (\$this->user->authorise('".$viewName.".".$keyCode."', 'com_".$this->fileContentStatic['###component###']."'))";
$this->onlyFunctionButton[$viewsName][] = "\t".$tab."{";
$this->onlyFunctionButton[$viewsName][] = "\t".$tab."\t//".$this->setLine(__LINE__)." add ".$custom_button['name']." button.";
$this->onlyFunctionButton[$viewsName][] = "\t".$tab."\tJToolBarHelper::custom('".$viewsName.".".$custom_button['method']."', '".$custom_button['icomoon']."', '', '".$keyLang."', false);";
@ -3125,7 +3125,7 @@ class Interpretation extends Fields
}
else
{
$buttons[] = "\t".$tab."\tif (\$this->user->authorise('".$viewName.".".$keyCode."'))";
$buttons[] = "\t".$tab."\tif (\$this->user->authorise('".$viewName.".".$keyCode."', 'com_".$this->fileContentStatic['###component###']."'))";
$buttons[] = "\t".$tab."\t{";
$buttons[] = "\t".$tab."\t\t//".$this->setLine(__LINE__)." add ".$custom_button['name']." button.";
$buttons[] = "\t".$tab."\t\tJToolBarHelper::custom('".$viewsName.".".$custom_button['method']."', '".$custom_button['icomoon']."', '', '".$keyLang."', false);";
@ -6628,7 +6628,7 @@ class Interpretation extends Fields
/**
* @param $args
*/
*/
public function setLinkedView($args)
{
/**
@ -6676,22 +6676,44 @@ class Interpretation extends Fields
{
list($parent_key) = explode('-',$parentKey);
}
elseif(strpos($parentKey, '-OR>') !== false)
{
// this is not good... (TODO)
$parent_keys = explode('-OR>',$parentKey);
}
else
{
$parent_key = $parentKey;
}
if(strpos($key, '-R>') !== false || strpos($key, '-A>') !== false)
{
list($_key) = explode('-',$key);
}
elseif(strpos($key, '-OR>') !== false)
{
$_key = str_replace('-OR>', '',$key);
}
else
{
$_key = $key;
}
// set the global key
$globalKey = ComponentbuilderHelper::safeString($_key.$this->uniquekey(4));
// ###LINKEDVIEWGLOBAL### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single]['###LINKEDVIEWGLOBAL###'] .= PHP_EOL."\t\t\$this->".$globalKey." = \$item->".$parent_key.";";
if (isset($parent_keys) && ComponentbuilderHelper::checkArray($parent_keys))
{
$globalKey = array();
foreach ($parent_keys as $parent_key)
{
$globalKey[$parent_key] = ComponentbuilderHelper::safeString($_key.$this->uniquekey(4));
$this->fileContentDynamic[$viewName_single]['###LINKEDVIEWGLOBAL###'] .= PHP_EOL."\t\t\$this->".$globalKey[$parent_key]." = \$item->".$parent_key.";";
}
}
else
{
// set the global key
$globalKey = ComponentbuilderHelper::safeString($_key.$this->uniquekey(4));
$this->fileContentDynamic[$viewName_single]['###LINKEDVIEWGLOBAL###'] .= PHP_EOL."\t\t\$this->".$globalKey." = \$item->".$parent_key.";";
}
// ###LINKEDVIEWMETHODS### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single]['###LINKEDVIEWMETHODS###'] .= $this->setListQueryLinked($single, $list, $functionName, $key, $_key, $parentKey, $parent_key, $globalKey);
}
@ -7221,7 +7243,9 @@ class Interpretation extends Fields
$query .= $this->getCustomScriptBuilder('php_getlistquery', $viewName_single, PHP_EOL.PHP_EOL);
// add the custom fields query
$query .= $this->setCustomQuery($viewName_list, $viewName_single);
if ($key && strpos($key,'-R>') === false && strpos($key,'-A>') === false && strpos($parentKey,'-R>') === false && strpos($parentKey,'-A>') === false)
if (ComponentbuilderHelper::checkString($globalKey) &&
$key && strpos($key,'-R>') === false && strpos($key,'-A>') === false && strpos($key,'-OR>') === false &&
$parentKey && strpos($parentKey,'-R>') === false && strpos($parentKey,'-A>') === false && strpos($parentKey,'-OR>') === false)
{
$query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Filter by ".$globalKey." global.";
$query .= PHP_EOL."\t\t\$".$globalKey." = \$this->".$globalKey.";";
@ -7238,6 +7262,48 @@ class Interpretation extends Fields
$query .= PHP_EOL."\t\t\t\$query->where('a.".$key." = -5');";
$query .= PHP_EOL."\t\t}";
}
elseif (strpos($parentKey,'-OR>') !== false || strpos($key,'-OR>') !== false)
{
// get both strings
if (strpos($key,'-OR>') !== false)
{
$ORarray = explode('-OR>', $key);
}
else
{
$ORarray = array($key);
}
// make sure we have an array
if (!ComponentbuilderHelper::checkArray($globalKey))
{
$globalKey = array($globalKey);
}
// now load the query (this may be to much... but hey let it write the code :)
foreach ($globalKey as $_globalKey)
{
// now build the query
$ORquery = array('s' => array(), 'i' => array());
foreach ($ORarray as $ORkey)
{
$ORquery['i'][] = "a.".$ORkey." = ' . (int) \$".$_globalKey;
$ORquery['s'][] = "a.".$ORkey." = ' . \$db->quote(\$".$_globalKey.")";
}
$query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Filter by ".$_globalKey." global.";
$query .= PHP_EOL."\t\t\$".$_globalKey." = \$this->".$_globalKey.";";
$query .= PHP_EOL."\t\tif (is_numeric(\$".$_globalKey." ))";
$query .= PHP_EOL."\t\t{";
$query .= PHP_EOL."\t\t\t\$query->where('" . implode(" . ' OR ", $ORquery['i']) . ", ' OR');";
$query .= PHP_EOL."\t\t}";
$query .= PHP_EOL."\t\telseif (is_string(\$".$_globalKey."))";
$query .= PHP_EOL."\t\t{";
$query .= PHP_EOL."\t\t\t\$query->where('" . implode(" . ' OR ", $ORquery['s']) . ", ' OR');";
$query .= PHP_EOL."\t\t}";
$query .= PHP_EOL."\t\telse";
$query .= PHP_EOL."\t\t{";
$query .= PHP_EOL."\t\t\t\$query->where('a.".$ORkey." = -5');";
$query .= PHP_EOL."\t\t}";
}
}
if (isset($this->accessBuilder[$viewName_single]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName_single]))
{
$query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Join over the asset groups.";
@ -7269,7 +7335,7 @@ class Interpretation extends Fields
// ###SELECTIONTRANSLATIONFIX### <<<DYNAMIC>>>
$query .= $this->setSelectionTranslationFix($viewName_list,$this->fileContentStatic['###Component###'],"\t");
// filter by child repetable field values
if ($key && strpos($key,'-R>') !== false && strpos($key,'-A>') === false)
if (ComponentbuilderHelper::checkString($globalKey) && $key && strpos($key,'-R>') !== false && strpos($key,'-A>') === false)
{
list($field,$target) = explode('-R>',$key);
$query .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Filter by ".$globalKey." in this Repetable Field";
@ -7299,7 +7365,7 @@ class Interpretation extends Fields
$query .= PHP_EOL."\t\t\t}";
}
// filter by child array field values
if ($key && strpos($key,'-R>') === false && strpos($key,'-A>') !== false)
if (ComponentbuilderHelper::checkString($globalKey) && $key && strpos($key,'-R>') === false && strpos($key,'-A>') !== false)
{
$query .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Filter by ".$globalKey." Array Field";
$query .= PHP_EOL."\t\t\t\$".$globalKey." = \$this->".$globalKey.";";
@ -7347,7 +7413,7 @@ class Interpretation extends Fields
}
// filter by parent repetable field values
if ($key && strpos($parentKey,'-R>') !== false && strpos($parentKey,'-A>') === false)
if (ComponentbuilderHelper::checkString($globalKey) && $key && strpos($parentKey,'-R>') !== false && strpos($parentKey,'-A>') === false)
{
list($bin,$target) = explode('-R>',$parentKey);
$query .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Filter by ".$_key." Repetable Field";
@ -7377,7 +7443,7 @@ class Interpretation extends Fields
$query .= PHP_EOL."\t\t\t}";
}
// filter by parent array field values
if ($key && strpos($parentKey,'-R>') === false && strpos($parentKey,'-A>') !== false)
if (ComponentbuilderHelper::checkString($globalKey) && $key && strpos($parentKey,'-R>') === false && strpos($parentKey,'-A>') !== false)
{
$query .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Filter by ".$globalKey." Array Field";
$query .= PHP_EOL."\t\t\t\$".$globalKey." = \$this->".$globalKey.";";

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.5.1
@build 23rd August, 2017
@version 2.5.2
@build 25th August, 2017
@created 30th April, 2015
@package Component Builder
@subpackage componentbuilder.php
@ -41,6 +41,11 @@ abstract class ComponentbuilderHelper
self::loadSession();
}
/**
* The global params
**/
protected static $params = false;
/*
* get all component IDs
*/
@ -209,31 +214,6 @@ abstract class ComponentbuilderHelper
fclose($fh);
return $klaar;
}
/**
* The user notice info File Name
**/
protected static $usernotice = false;
/**
* The backup hash file name
**/
protected static $backuphash = false;
public static function getFilePath($type, $name = 'listing', $key = '', $fileType = '.json', $PATH = JPATH_COMPONENT_SITE)
{
if (!self::checkString(self::${$type.$name}))
{
// Get local key
$localkey = self::getLocalKey();
// set the name
$fileName = md5($type.$name.$localkey.$key);
// set file path
self::${$type.$name} = $PATH.'/helpers/'.$fileName.$fileType;
}
// return the path
return self::${$type.$name};
}
public static function getFieldOptions($value, $type, $settings = array())
{
@ -1162,13 +1142,13 @@ abstract class ComponentbuilderHelper
/**
* check if it is a new hash
**/
public static function newHash($hash, $name = 'backup', $type = 'hash', $key = '', $fileType = '.txt')
public static function newHash($hash, $name = 'backup', $type = 'hash', $key = '', $fileType = 'txt')
{
// make sure we have a hash
if (self::checkString($hash))
{
// first get the file path
$path_filename = self::getFilePath($name, $type, $key, $fileType, JPATH_COMPONENT_ADMINISTRATOR);
$path_filename = self::getFilePath('path', $name.$type, $fileType, $key, JPATH_COMPONENT_ADMINISTRATOR);
// set as read if not already set
if (($content = @file_get_contents($path_filename)) !== FALSE)
{
@ -1182,6 +1162,71 @@ abstract class ComponentbuilderHelper
}
return false;
}
/**
* Get the file path or url
*
* @param string $type The (url/path) type to return
* @param string $target The Params Target name (if set)
* @param string $fileType The kind of filename to generate (if not set no file name is generated)
* @param string $key The key to adjust the filename (if not set ignored)
* @param string $default The default path if not set in Params (fallback path)
* @param bool $createIfNotSet The switch to create the folder if not found
*
* @return string On success the path or url is returned based on the type requested
*
*/
public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = JPATH_SITE . '/images/', $createIfNotSet = true)
{
// get the global settings
if (!self::checkObject(self::$params))
{
self::$params = JComponentHelper::getParams('com_componentbuilder');
}
$filePath = self::$params->get($target, $default);
// check the file path (revert to default only of not a hidden file path)
if ('hiddenfilepath' !== $target && strpos($filePath, JPATH_SITE) === false)
{
$filePath = JPATH_SITE . '/images/';
}
jimport('joomla.filesystem.folder');
// create the folder if it does not exist
if ($createIfNotSet && !JFolder::exists($filePath))
{
JFolder::create($filePath);
}
// setup the file name
$fileName = '';
if (self::checkString($fileType))
{
// Get basic key
$basickey = 'Th!s_iS_n0t_sAfe_buT_b3tter_then_n0thiug';
if (method_exists(get_called_class(), "getCryptKey"))
{
$basickey = self::getCryptKey('basic', $basickey);
}
// check the key
if (self::checkString($key))
{
$key = 'vDm';
}
// set the name
$fileName = trim(md5($type.$target.$basickey.$key) . '.' . trim($fileType, '.'));
}
// return the url
if ($type === 'url')
{
if (strpos($filePath, JPATH_SITE) !== false)
{
$filePath = trim( str_replace( JPATH_SITE, '', $filePath), '/');
return JURI::root() . $filePath . '/' . $fileName;
}
// since the path is behind the root folder of the site, return only the root url (may be used to build the link)
return JURI::root();
}
// sanitize the path
return '/' . trim( $filePath, '/' ) . '/' . $fileName;
}
/**
* Load the Component xml manifest.
**/
@ -1369,6 +1414,10 @@ abstract class ComponentbuilderHelper
{
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_LANGUAGES'), 'index.php?option=com_componentbuilder&view=languages', $submenu === 'languages');
}
if ($user->authorise('ftp.access', 'com_componentbuilder') && $user->authorise('ftp.submenu', 'com_componentbuilder'))
{
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_FTPS'), 'index.php?option=com_componentbuilder&view=ftps', $submenu === 'ftps');
}
if ($user->authorise('help_document.access', 'com_componentbuilder') && $user->authorise('help_document.submenu', 'com_componentbuilder'))
{
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_HELP_DOCUMENTS'), 'index.php?option=com_componentbuilder&view=help_documents', $submenu === 'help_documents');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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