Moved more helper methods out to the utility classes.
This commit is contained in:
parent
3331a4c28d
commit
ec827b7369
@ -143,13 +143,13 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 10th March, 2022
|
||||
+ *Last Build*: 12th March, 2022
|
||||
+ *Version*: 2.12.15
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **286315**
|
||||
+ *Line count*: **286346**
|
||||
+ *Field count*: **1580**
|
||||
+ *File count*: **1848**
|
||||
+ *File count*: **1850**
|
||||
+ *Folder count*: **260**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
|
||||
|
@ -143,13 +143,13 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 10th March, 2022
|
||||
+ *Last Build*: 12th March, 2022
|
||||
+ *Version*: 2.12.15
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **286315**
|
||||
+ *Line count*: **286346**
|
||||
+ *Field count*: **1580**
|
||||
+ *File count*: **1848**
|
||||
+ *File count*: **1850**
|
||||
+ *Folder count*: **260**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
|
||||
|
@ -29059,7 +29059,7 @@ function vdm_dkim() {
|
||||
if (strpos($power->description, '/*') === false)
|
||||
{
|
||||
// make this description escaped
|
||||
$power->description = '/**' . PHP_EOL . ' * ' . implode(' * ', explode(PHP_EOL, $power->description)) . PHP_EOL . ' */';
|
||||
$power->description = '/**' . PHP_EOL . ' * ' . implode(PHP_EOL . ' * ', explode(PHP_EOL, $power->description)) . PHP_EOL . ' */';
|
||||
}
|
||||
$code[] = PHP_EOL . $power->description;
|
||||
}
|
||||
|
@ -2170,172 +2170,6 @@ abstract class ComponentbuilderHelper
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a GUIDv4 string
|
||||
*
|
||||
* Thanks to Dave Pearson (and other)
|
||||
* https://www.php.net/manual/en/function.com-create-guid.php#119168
|
||||
*
|
||||
* Uses the best cryptographically secure method
|
||||
* for all supported platforms with fallback to an older,
|
||||
* less secure version.
|
||||
*
|
||||
* @param bool $trim
|
||||
* @return string
|
||||
*/
|
||||
public static function GUID ($trim = true)
|
||||
{
|
||||
// Windows
|
||||
if (function_exists('com_create_guid') === true)
|
||||
{
|
||||
if ($trim === true)
|
||||
{
|
||||
return trim(com_create_guid(), '{}');
|
||||
}
|
||||
return com_create_guid();
|
||||
}
|
||||
|
||||
// set the braces if needed
|
||||
$lbrace = $trim ? "" : chr(123); // "{"
|
||||
$rbrace = $trim ? "" : chr(125); // "}"
|
||||
|
||||
// OSX/Linux
|
||||
if (function_exists('openssl_random_pseudo_bytes') === true)
|
||||
{
|
||||
$data = openssl_random_pseudo_bytes(16);
|
||||
$data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
|
||||
$data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
|
||||
return $lbrace . vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)) . $lbrace;
|
||||
}
|
||||
|
||||
// Fallback (PHP 4.2+)
|
||||
mt_srand((double)microtime() * 10000);
|
||||
$charid = strtolower(md5(uniqid(rand(), true)));
|
||||
$hyphen = chr(45); // "-"
|
||||
$guidv4 = $lbrace.
|
||||
substr($charid, 0, 8).$hyphen.
|
||||
substr($charid, 8, 4).$hyphen.
|
||||
substr($charid, 12, 4).$hyphen.
|
||||
substr($charid, 16, 4).$hyphen.
|
||||
substr($charid, 20, 12).
|
||||
$rbrace;
|
||||
return $guidv4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the Globally Unique Identifier ( and check if table already has this identifier)
|
||||
*
|
||||
* @param string $guid
|
||||
* @param string $table
|
||||
* @param int $id
|
||||
* @return bool
|
||||
*/
|
||||
public static function validGUID ($guid, $table = null, $id = 0)
|
||||
{
|
||||
// check if we have a string
|
||||
if (self::validateGUID($guid))
|
||||
{
|
||||
// check if table already has this identifier
|
||||
if (self::checkString($table))
|
||||
{
|
||||
// Get the database object and a new query object.
|
||||
$db = \JFactory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('COUNT(*)')
|
||||
->from('#__componentbuilder_' . (string) $table)
|
||||
->where($db->quoteName('guid') . ' = ' . $db->quote($guid));
|
||||
|
||||
// remove this item from the list
|
||||
if ($id > 0)
|
||||
{
|
||||
$query->where($db->quoteName('id') . ' <> ' . (int) $id);
|
||||
}
|
||||
|
||||
// Set and query the database.
|
||||
$db->setQuery($query);
|
||||
$duplicate = (bool) $db->loadResult();
|
||||
|
||||
if ($duplicate)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the ITEM of a GUID by table
|
||||
*
|
||||
* @param string $guid
|
||||
* @param string $table
|
||||
* @param string/array $what
|
||||
*
|
||||
* @return mix
|
||||
*/
|
||||
public static function getGUID ($guid, $table, $what = 'a.id')
|
||||
{
|
||||
// check if we have a string
|
||||
if (self::validateGUID($guid))
|
||||
{
|
||||
// check if table already has this identifier
|
||||
if (self::checkString($table))
|
||||
{
|
||||
// Get the database object and a new query object.
|
||||
$db = \JFactory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
if (self::checkArray($what))
|
||||
{
|
||||
$query->select($db->quoteName($what));
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->select($what);
|
||||
}
|
||||
$query->from($db->quoteName('#__componentbuilder_' . (string) $table, 'a'))
|
||||
->where($db->quoteName('a.guid') . ' = ' . $db->quote($guid));
|
||||
|
||||
// Set and query the database.
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
if (self::checkArray($what) || $what === 'a.*')
|
||||
{
|
||||
return $db->loadObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $db->loadResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the Globally Unique Identifier
|
||||
*
|
||||
* Thanks to Lewie
|
||||
* https://stackoverflow.com/a/1515456/1429677
|
||||
*
|
||||
* @param string $guid
|
||||
* @return bool
|
||||
*/
|
||||
protected static function validateGUID ($guid)
|
||||
{
|
||||
// check if we have a string
|
||||
if (self::checkString($guid))
|
||||
{
|
||||
return preg_match("/^(\{)?[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}(?(1)\})$/i", $guid);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tab/spacer bucket (to speed-up the build)
|
||||
*
|
||||
@ -2694,91 +2528,6 @@ abstract class ComponentbuilderHelper
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The zipper method
|
||||
*
|
||||
* @param string $workingDIR The directory where the items must be zipped
|
||||
* @param string $filepath The path to where the zip file must be placed
|
||||
*
|
||||
* @return bool true On success
|
||||
*
|
||||
*/
|
||||
public static function zip($workingDIR, &$filepath)
|
||||
{
|
||||
// store the current joomla working directory
|
||||
$joomla = getcwd();
|
||||
|
||||
// we are changing the working directory to the component temp folder
|
||||
chdir($workingDIR);
|
||||
|
||||
// the full file path of the zip file
|
||||
$filepath = Path::clean($filepath);
|
||||
|
||||
// delete an existing zip file (or use an exclusion parameter in Folder::files()
|
||||
File::delete($filepath);
|
||||
|
||||
// get a list of files in the current directory tree (also the hidden files)
|
||||
$files = Folder::files('.', '', true, true, array('.svn', 'CVS', '.DS_Store', '__MACOSX'), array('.*~'));
|
||||
$zipArray = array();
|
||||
// setup the zip array
|
||||
foreach ($files as $file)
|
||||
{
|
||||
$tmp = array();
|
||||
$tmp['name'] = str_replace('./', '', $file);
|
||||
$tmp['data'] = self::getFileContents($file);
|
||||
$tmp['time'] = filemtime($file);
|
||||
$zipArray[] = $tmp;
|
||||
}
|
||||
|
||||
// change back to joomla working directory
|
||||
chdir($joomla);
|
||||
|
||||
// get the zip adapter
|
||||
$adapter = new Archive();
|
||||
$zip = $adapter->getAdapter('zip');
|
||||
|
||||
//create the zip file
|
||||
if ($zip->create($filepath, $zipArray))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Write a file to the server
|
||||
*
|
||||
* @param string $path The path and file name where to safe the data
|
||||
* @param string $data The data to safe
|
||||
*
|
||||
* @return bool true On success
|
||||
*
|
||||
*/
|
||||
public static function writeFile($path, $data)
|
||||
{
|
||||
$klaar = false;
|
||||
if (self::checkString($data))
|
||||
{
|
||||
// open the file
|
||||
$fh = fopen($path, "w");
|
||||
if (!is_resource($fh))
|
||||
{
|
||||
return $klaar;
|
||||
}
|
||||
// write to the file
|
||||
if (fwrite($fh, $data))
|
||||
{
|
||||
// has been done
|
||||
$klaar = true;
|
||||
}
|
||||
// close file.
|
||||
fclose($fh);
|
||||
}
|
||||
return $klaar;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove folders with files
|
||||
*
|
||||
@ -3807,70 +3556,6 @@ abstract class ComponentbuilderHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get between
|
||||
*
|
||||
* @param string $content The content to search
|
||||
* @param string $start The starting value
|
||||
* @param string $end The ending value
|
||||
* @param string $default The default value if none found
|
||||
*
|
||||
* @return string On success / empty string on failure
|
||||
*
|
||||
*/
|
||||
public static function getBetween($content, $start, $end, $default = '')
|
||||
{
|
||||
$r = explode($start, $content);
|
||||
if (isset($r[1]))
|
||||
{
|
||||
$r = explode($end, $r[1]);
|
||||
return $r[0];
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* get all between
|
||||
*
|
||||
* @param string $content The content to search
|
||||
* @param string $start The starting value
|
||||
* @param string $end The ending value
|
||||
*
|
||||
* @return array On success
|
||||
*
|
||||
*/
|
||||
public static function getAllBetween($content, $start, $end)
|
||||
{
|
||||
// reset bucket
|
||||
$bucket = array();
|
||||
for ($i = 0; ; $i++)
|
||||
{
|
||||
// search for string
|
||||
$found = self::getBetween($content,$start,$end);
|
||||
if (self::checkString($found))
|
||||
{
|
||||
// add to bucket
|
||||
$bucket[] = $found;
|
||||
// build removal string
|
||||
$remove = $start.$found.$end;
|
||||
// remove from content
|
||||
$content = str_replace($remove,'',$content);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
// safety catch
|
||||
if ($i == 500)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
// only return unique array of values
|
||||
return array_unique($bucket);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Field Grouping https://docs.joomla.org/Form_field
|
||||
**/
|
||||
@ -4223,59 +3908,6 @@ abstract class ComponentbuilderHelper
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the content of a file
|
||||
*
|
||||
* @param string $path The path to the file
|
||||
* @param string/bool $none The return value if no content was found
|
||||
*
|
||||
* @return string On success
|
||||
*
|
||||
*/
|
||||
public static function getFileContents($path, $none = '')
|
||||
{
|
||||
if (self::checkString($path))
|
||||
{
|
||||
// use basic file get content for now
|
||||
if (($content = @file_get_contents($path)) !== FALSE)
|
||||
{
|
||||
return $content;
|
||||
}
|
||||
// use curl if available
|
||||
elseif (function_exists('curl_version'))
|
||||
{
|
||||
// start curl
|
||||
$ch = curl_init();
|
||||
// set the options
|
||||
$options = array();
|
||||
$options[CURLOPT_URL] = $path;
|
||||
$options[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12';
|
||||
$options[CURLOPT_RETURNTRANSFER] = TRUE;
|
||||
$options[CURLOPT_SSL_VERIFYPEER] = FALSE;
|
||||
// load the options
|
||||
curl_setopt_array($ch, $options);
|
||||
// get the content
|
||||
$content = curl_exec($ch);
|
||||
// close the connection
|
||||
curl_close($ch);
|
||||
// return if found
|
||||
if (self::checkString($content))
|
||||
{
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
elseif (property_exists('ComponentbuilderHelper', 'curlErrorLoaded') && !self::$curlErrorLoaded)
|
||||
{
|
||||
// set the notice
|
||||
JFactory::getApplication()->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BCOMPONENTBUILDERB_WILL_NOT_FUNCTION_CORRECTLYP'), 'Error');
|
||||
// load this notice only once
|
||||
self::$curlErrorLoaded = true;
|
||||
}
|
||||
}
|
||||
return $none;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* the Crypt objects
|
||||
**/
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="4" method="upgrade">
|
||||
<name>COM_COMPONENTBUILDER</name>
|
||||
<creationDate>10th March, 2022</creationDate>
|
||||
<creationDate>12th March, 2022</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
|
||||
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
|
||||
|
@ -19,6 +19,8 @@ use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\MathHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Utilities\GuidHelper;
|
||||
use VDM\Joomla\Utilities\FileHelper;
|
||||
use VDM\Joomla\Utilities\String\FieldHelper;
|
||||
use VDM\Joomla\Utilities\String\TypeHelper;
|
||||
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
|
||||
@ -28,6 +30,8 @@ use VDM\Joomla\Utilities\String\PluginHelper;
|
||||
|
||||
/**
|
||||
* Basic shared utilities, a legacy implementation
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
trait Utilities
|
||||
{
|
||||
@ -35,6 +39,8 @@ trait Utilities
|
||||
* The Main Active Language
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static $langTag;
|
||||
|
||||
@ -45,6 +51,8 @@ trait Utilities
|
||||
*
|
||||
* @returns bool true on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use StringHelper::check($string);
|
||||
*/
|
||||
public static function checkString($string): bool
|
||||
@ -59,6 +67,8 @@ trait Utilities
|
||||
*
|
||||
* @returns string on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use StringHelper::shorten($string, $length, $addTip);
|
||||
*/
|
||||
public static function shorten($string, $length = 40, $addTip = true)
|
||||
@ -73,6 +83,8 @@ trait Utilities
|
||||
*
|
||||
* @returns string on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use StringHelper::safe($string, $type, $spacer, $replaceNumbers, $keepOnlyCharacters);
|
||||
*/
|
||||
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true)
|
||||
@ -87,6 +99,8 @@ trait Utilities
|
||||
*
|
||||
* @returns string on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use ClassfunctionHelper::safe($name);
|
||||
*/
|
||||
public static function safeClassFunctionName($name)
|
||||
@ -103,6 +117,8 @@ trait Utilities
|
||||
*
|
||||
* @returns string on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use FieldHelper::safe($string, $allcap, $spacer);
|
||||
*/
|
||||
public static function safeFieldName($string, $allcap = false, $spacer = '_')
|
||||
@ -117,6 +133,8 @@ trait Utilities
|
||||
*
|
||||
* @returns string on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use TypeHelper::safe($string);
|
||||
*/
|
||||
public static function safeTypeName($string)
|
||||
@ -131,6 +149,8 @@ trait Utilities
|
||||
*
|
||||
* @returns string on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use NamespaceHelper::safe($string);
|
||||
*/
|
||||
public static function safeNamespace($string)
|
||||
@ -139,6 +159,8 @@ trait Utilities
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use StringHelper::transliterate($string);
|
||||
*/
|
||||
public static function transliterate($string)
|
||||
@ -147,6 +169,8 @@ trait Utilities
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use StringHelper::html($var, $charset, $shorten, $length);
|
||||
*/
|
||||
public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40)
|
||||
@ -155,6 +179,8 @@ trait Utilities
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use StringHelper::numbers($string);
|
||||
*/
|
||||
public static function replaceNumbers($string)
|
||||
@ -170,6 +196,8 @@ trait Utilities
|
||||
*
|
||||
* @returns string a string
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use StringHelper::number($x);
|
||||
*/
|
||||
public static function numberToString($x)
|
||||
@ -184,6 +212,8 @@ trait Utilities
|
||||
*
|
||||
* @returns string a string of random characters
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use StringHelper::random($size);
|
||||
*/
|
||||
public static function randomkey($size): string
|
||||
@ -198,6 +228,8 @@ trait Utilities
|
||||
*
|
||||
* @returns bool true on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use JsonHelper::check($string);
|
||||
*/
|
||||
public static function checkJson($string): bool
|
||||
@ -206,6 +238,8 @@ trait Utilities
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use JsonHelper::string($value, $sperator, $table, $id, $name);
|
||||
*/
|
||||
public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name')
|
||||
@ -221,6 +255,8 @@ trait Utilities
|
||||
*
|
||||
* @returns int number of items in array on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use ArrayHelper::check($array, $removeEmptyString);
|
||||
*/
|
||||
public static function checkArray($array, $removeEmptyString = false): int
|
||||
@ -235,6 +271,8 @@ trait Utilities
|
||||
*
|
||||
* @returns mixed array on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use ArrayHelper::merge($arrays);
|
||||
*/
|
||||
public static function mergeArrays($arrays)
|
||||
@ -249,6 +287,8 @@ trait Utilities
|
||||
*
|
||||
* @returns bool true on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use ObjectHelper::check($object);
|
||||
*/
|
||||
public static function checkObject($object): bool
|
||||
@ -268,6 +308,8 @@ trait Utilities
|
||||
*
|
||||
* @return mix string/int/float
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use GetHelper::var($table, $where, $whereString, $what, $operator, $main);
|
||||
*/
|
||||
public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = 'componentbuilder')
|
||||
@ -288,6 +330,8 @@ trait Utilities
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use GetHelper::vars($table, $where, $whereString, $what, $operator, $main, $unique);
|
||||
*/
|
||||
public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = 'componentbuilder', $unique = true)
|
||||
@ -295,6 +339,43 @@ trait Utilities
|
||||
return GetHelper::vars($table, $where, $whereString, $what, $operator, $main, $unique);
|
||||
}
|
||||
|
||||
/**
|
||||
* get all strings between two other strings
|
||||
*
|
||||
* @param string $content The content to search
|
||||
* @param string $start The starting value
|
||||
* @param string $end The ending value
|
||||
*
|
||||
* @return array On success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use GetHelper::allBetween($content, $start, $end);
|
||||
*/
|
||||
public static function getAllBetween($content, $start, $end)
|
||||
{
|
||||
return GetHelper::allBetween($content, $start, $end);
|
||||
}
|
||||
|
||||
/**
|
||||
* get a string between two other strings
|
||||
*
|
||||
* @param string $content The content to search
|
||||
* @param string $start The starting value
|
||||
* @param string $end The ending value
|
||||
* @param string $default The default value if none found
|
||||
*
|
||||
* @return string On success / empty string on failure
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use GetHelper::between($content, $start, $end, $default);
|
||||
*/
|
||||
public static function getBetween($content, $start, $end, $default = '')
|
||||
{
|
||||
return GetHelper::between($content, $start, $end, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* bc math wrapper (very basic not for accounting)
|
||||
*
|
||||
@ -303,7 +384,9 @@ trait Utilities
|
||||
* @param int $val2 The second value
|
||||
* @param int $scale The scale value
|
||||
*
|
||||
* @return int
|
||||
* @return float|int
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use MathHelper::bc($type, $val1, $val2, $scale);
|
||||
*/
|
||||
@ -318,7 +401,9 @@ trait Utilities
|
||||
* @param array $array The values to sum
|
||||
* @param int $scale The scale value
|
||||
*
|
||||
* @return float
|
||||
* @return float|int
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use MathHelper::sum($array, $scale);
|
||||
*/
|
||||
@ -333,7 +418,9 @@ trait Utilities
|
||||
* @input string The group name
|
||||
* @input string The name
|
||||
*
|
||||
* @return float
|
||||
* @return string
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use PluginHelper::safe($name, $group);
|
||||
*/
|
||||
@ -342,5 +429,132 @@ trait Utilities
|
||||
return PluginHelper::safeClassName($name, $group);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a GUIDv4 string
|
||||
*
|
||||
* Thanks to Dave Pearson (and other)
|
||||
* https://www.php.net/manual/en/function.com-create-guid.php#119168
|
||||
*
|
||||
* Uses the best cryptographically secure method
|
||||
* for all supported platforms with fallback to an older,
|
||||
* less secure version.
|
||||
*
|
||||
* @param bool $trim
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use GuidHelper::get($trim);
|
||||
*/
|
||||
public static function GUID($trim = true)
|
||||
{
|
||||
return GuidHelper::get($trim);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the Globally Unique Identifier ( and check if table already has this identifier)
|
||||
*
|
||||
* @param string $guid
|
||||
* @param string $table
|
||||
* @param int $id
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use GuidHelper::valid($guid, $table, $id);
|
||||
*/
|
||||
public static function validGUID($guid, $table = null, $id = 0)
|
||||
{
|
||||
return GuidHelper::valid($guid, $table, $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the ITEM of a GUID by table
|
||||
*
|
||||
* @param string $guid
|
||||
* @param string $table
|
||||
* @param string/array $what
|
||||
*
|
||||
* @return mix
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use GuidHelper::valid($guid, $table, $id);
|
||||
*/
|
||||
public static function getGUID($guid, $table, $what = 'a.id')
|
||||
{
|
||||
return GuidHelper::item($guid, $table, $what);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the Globally Unique Identifier
|
||||
*
|
||||
* Thanks to Lewie
|
||||
* https://stackoverflow.com/a/1515456/1429677
|
||||
*
|
||||
* @param string $guid
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @deprecated 4.0 - Use GuidHelper::validate($guid);
|
||||
*/
|
||||
protected static function validateGUID($guid)
|
||||
{
|
||||
return GuidHelper::validate($guid);
|
||||
}
|
||||
|
||||
/**
|
||||
* The zipper method
|
||||
*
|
||||
* @param string $workingDIR The directory where the items must be zipped
|
||||
* @param string $filepath The path to where the zip file must be placed
|
||||
*
|
||||
* @return bool true On success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use FileHelper::zip($workingDIR, $filepath);
|
||||
*/
|
||||
public static function zip($workingDIR, &$filepath)
|
||||
{
|
||||
return FileHelper::zip($workingDIR, $filepath);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the content of a file
|
||||
*
|
||||
* @param string $path The path to the file
|
||||
* @param string/bool $none The return value if no content was found
|
||||
*
|
||||
* @return string On success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use FileHelper::getContent($path, $none);
|
||||
*/
|
||||
public static function getFileContents($path, $none = '')
|
||||
{
|
||||
return FileHelper::getContent($path, $none);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a file to the server
|
||||
*
|
||||
* @param string $path The path and file name where to safe the data
|
||||
* @param string $data The data to safe
|
||||
*
|
||||
* @return bool true On success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*
|
||||
* @deprecated 4.0 - Use FileHelper::write($path, $data);
|
||||
*/
|
||||
public static function writeFile($path, $data)
|
||||
{
|
||||
return FileHelper::write($path, $data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,8 @@ namespace VDM\Joomla\Utilities;
|
||||
|
||||
/**
|
||||
* Some array tricks helper
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
abstract class ArrayHelper
|
||||
{
|
||||
@ -24,6 +26,8 @@ abstract class ArrayHelper
|
||||
* @input array The array to check
|
||||
*
|
||||
* @returns bool/int number of items in array on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function check($array, $removeEmptyString = false)
|
||||
{
|
||||
@ -52,6 +56,8 @@ abstract class ArrayHelper
|
||||
* @input array The arrays you would like to merge
|
||||
*
|
||||
* @returns array on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function merge($arrays)
|
||||
{
|
||||
|
181
libraries/jcb_powers/VDM.Joomla/src/Utilities/FileHelper.php
Normal file
181
libraries/jcb_powers/VDM.Joomla/src/Utilities/FileHelper.php
Normal file
@ -0,0 +1,181 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @gitea Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Utilities;
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Filesystem\Path;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
use Joomla\Archive\Archive;
|
||||
|
||||
|
||||
/**
|
||||
* File helper
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
abstract class FileHelper
|
||||
{
|
||||
/**
|
||||
* Trigger error notice only once
|
||||
*
|
||||
* @var bool
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
protected static $curlError = false;
|
||||
|
||||
/**
|
||||
* The zipper method
|
||||
*
|
||||
* @param string $workingDirectory The directory where the items must be zipped
|
||||
* @param string $filepath The path to where the zip file must be placed
|
||||
*
|
||||
* @return bool true On success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function zip($workingDirectory, &$filepath)
|
||||
{
|
||||
// store the current joomla working directory
|
||||
$joomla = getcwd();
|
||||
|
||||
// we are changing the working directory to the component temp folder
|
||||
chdir($workingDirectory);
|
||||
|
||||
// the full file path of the zip file
|
||||
$filepath = Path::clean($filepath);
|
||||
|
||||
// delete an existing zip file (or use an exclusion parameter in Folder::files()
|
||||
File::delete($filepath);
|
||||
|
||||
// get a list of files in the current directory tree (also the hidden files)
|
||||
$files = Folder::files('.', '', true, true, array('.svn', 'CVS', '.DS_Store', '__MACOSX'), array('.*~'));
|
||||
|
||||
$zipArray = array();
|
||||
// setup the zip array
|
||||
foreach ($files as $file)
|
||||
{
|
||||
$tmp = array();
|
||||
$tmp['name'] = str_replace('./', '', $file);
|
||||
$tmp['data'] = self::getContent($file);
|
||||
$tmp['time'] = filemtime($file);
|
||||
$zipArray[] = $tmp;
|
||||
}
|
||||
|
||||
// change back to joomla working directory
|
||||
chdir($joomla);
|
||||
|
||||
// get the zip adapter
|
||||
$adapter = new Archive();
|
||||
$zip = $adapter->getAdapter('zip');
|
||||
|
||||
//create the zip file
|
||||
if ($zip->create($filepath, $zipArray))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the content of a file
|
||||
*
|
||||
* @param string $path The path to the file
|
||||
* @param string/bool $none The return value if no content was found
|
||||
*
|
||||
* @return string On success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function getContent($path, $none = '')
|
||||
{
|
||||
if (StringHelper::check($path))
|
||||
{
|
||||
// use basic file get content for now
|
||||
if (($content = @file_get_contents($path)) !== FALSE)
|
||||
{
|
||||
return $content;
|
||||
}
|
||||
// use curl if available
|
||||
elseif (function_exists('curl_version'))
|
||||
{
|
||||
// start curl
|
||||
$ch = curl_init();
|
||||
// set the options
|
||||
$options = array();
|
||||
$options[CURLOPT_URL] = $path;
|
||||
$options[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12';
|
||||
$options[CURLOPT_RETURNTRANSFER] = TRUE;
|
||||
$options[CURLOPT_SSL_VERIFYPEER] = FALSE;
|
||||
// load the options
|
||||
curl_setopt_array($ch, $options);
|
||||
// get the content
|
||||
$content = curl_exec($ch);
|
||||
// close the connection
|
||||
curl_close($ch);
|
||||
|
||||
// return if found
|
||||
if (StringHelper::check($content))
|
||||
{
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
elseif (!self::$curlError)
|
||||
{
|
||||
// set the notice
|
||||
Factory::getApplication()->enqueueMessage(Text::_('COM_COMPONENTBUILDER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BCOMPONENTBUILDERB_WILL_NOT_FUNCTION_CORRECTLYP'), 'Error');
|
||||
// load this notice only once
|
||||
self::$curlError = true;
|
||||
}
|
||||
}
|
||||
return $none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a file to the server
|
||||
*
|
||||
* @param string $path The path and file name where to safe the data
|
||||
* @param string $data The data to safe
|
||||
*
|
||||
* @return bool true On success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function write($path, $data)
|
||||
{
|
||||
$klaar = false;
|
||||
if (StringHelper::check($data))
|
||||
{
|
||||
// open the file
|
||||
$fh = fopen($path, "w");
|
||||
if (!is_resource($fh))
|
||||
{
|
||||
return $klaar;
|
||||
}
|
||||
// write to the file
|
||||
if (fwrite($fh, $data))
|
||||
{
|
||||
// has been done
|
||||
$klaar = true;
|
||||
}
|
||||
// close file.
|
||||
fclose($fh);
|
||||
}
|
||||
return $klaar;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ use Joomla\CMS\Factory;
|
||||
|
||||
/**
|
||||
* Some easy get...
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
abstract class GetHelper
|
||||
{
|
||||
@ -33,6 +35,7 @@ abstract class GetHelper
|
||||
*
|
||||
* @return mix string/int/float
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function var($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = 'componentbuilder')
|
||||
{
|
||||
@ -93,6 +96,7 @@ abstract class GetHelper
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function vars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = 'componentbuilder', $unique = true)
|
||||
{
|
||||
@ -155,5 +159,70 @@ abstract class GetHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get all strings between two other strings
|
||||
*
|
||||
* @param string $content The content to search
|
||||
* @param string $start The starting value
|
||||
* @param string $end The ending value
|
||||
*
|
||||
* @return array On success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function allBetween($content, $start, $end)
|
||||
{
|
||||
// reset bucket
|
||||
$bucket = array();
|
||||
for ($i = 0; ; $i++)
|
||||
{
|
||||
// search for string
|
||||
$found = self::between($content,$start,$end);
|
||||
if (StringHelper::check($found))
|
||||
{
|
||||
// add to bucket
|
||||
$bucket[] = $found;
|
||||
// build removal string
|
||||
$remove = $start.$found.$end;
|
||||
// remove from content
|
||||
$content = str_replace($remove,'',$content);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
// safety catch
|
||||
if ($i == 500)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
// only return unique array of values
|
||||
return array_unique($bucket);
|
||||
}
|
||||
|
||||
/**
|
||||
* get a string between two other strings
|
||||
*
|
||||
* @param string $content The content to search
|
||||
* @param string $start The starting value
|
||||
* @param string $end The ending value
|
||||
* @param string $default The default value if none found
|
||||
*
|
||||
* @return string On success / empty string on failure
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function between($content, $start, $end, $default = '')
|
||||
{
|
||||
$r = explode($start, $content);
|
||||
if (isset($r[1]))
|
||||
{
|
||||
$r = explode($end, $r[1]);
|
||||
return $r[0];
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
205
libraries/jcb_powers/VDM.Joomla/src/Utilities/GuidHelper.php
Normal file
205
libraries/jcb_powers/VDM.Joomla/src/Utilities/GuidHelper.php
Normal file
@ -0,0 +1,205 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @gitea Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Utilities;
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
|
||||
|
||||
/**
|
||||
* Global Unique ID Helper
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
abstract class GuidHelper
|
||||
{
|
||||
/**
|
||||
* Returns a GUIDv4 string
|
||||
*
|
||||
* Thanks to Dave Pearson (and other)
|
||||
* https://www.php.net/manual/en/function.com-create-guid.php#119168
|
||||
*
|
||||
* Uses the best cryptographically secure method
|
||||
* for all supported platforms with fallback to an older,
|
||||
* less secure version.
|
||||
*
|
||||
* @param bool $trim
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function get($trim = true)
|
||||
{
|
||||
// Windows
|
||||
if (function_exists('com_create_guid') === true)
|
||||
{
|
||||
if ($trim === true)
|
||||
{
|
||||
return trim(com_create_guid(), '{}');
|
||||
}
|
||||
return com_create_guid();
|
||||
}
|
||||
|
||||
// set the braces if needed
|
||||
$lbrace = $trim ? "" : chr(123); // "{"
|
||||
$rbrace = $trim ? "" : chr(125); // "}"
|
||||
|
||||
// OSX/Linux
|
||||
if (function_exists('openssl_random_pseudo_bytes') === true)
|
||||
{
|
||||
$data = openssl_random_pseudo_bytes(16);
|
||||
$data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
|
||||
$data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
|
||||
return $lbrace . vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)) . $lbrace;
|
||||
}
|
||||
|
||||
// Fallback (PHP 4.2+)
|
||||
mt_srand((double)microtime() * 10000);
|
||||
$charid = strtolower(md5(uniqid(rand(), true)));
|
||||
$hyphen = chr(45); // "-"
|
||||
$guidv4 = $lbrace.
|
||||
substr($charid, 0, 8).$hyphen.
|
||||
substr($charid, 8, 4).$hyphen.
|
||||
substr($charid, 12, 4).$hyphen.
|
||||
substr($charid, 16, 4).$hyphen.
|
||||
substr($charid, 20, 12).
|
||||
$rbrace;
|
||||
return $guidv4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the Globally Unique Identifier ( and check if table already has this identifier)
|
||||
*
|
||||
* @param string $guid
|
||||
* @param string $table
|
||||
* @param int $id
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function valid($guid, $table = null, $id = 0)
|
||||
{
|
||||
// check if we have a string
|
||||
if (self::validate($guid))
|
||||
{
|
||||
// check if table already has this identifier
|
||||
if (StringHelper::check($table))
|
||||
{
|
||||
// Get the database object and a new query object.
|
||||
$db = Factory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('COUNT(*)')
|
||||
->from('#__componentbuilder_' . (string) $table)
|
||||
->where($db->quoteName('guid') . ' = ' . $db->quote($guid));
|
||||
|
||||
// remove this item from the list
|
||||
if ($id > 0)
|
||||
{
|
||||
$query->where($db->quoteName('id') . ' <> ' . (int) $id);
|
||||
}
|
||||
|
||||
// Set and query the database.
|
||||
$db->setQuery($query);
|
||||
$duplicate = (bool) $db->loadResult();
|
||||
|
||||
if ($duplicate)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the item by guid in a table
|
||||
*
|
||||
* @param string $guid
|
||||
* @param string $table
|
||||
* @param string/array $what
|
||||
*
|
||||
* @return mix
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function item($guid, $table, $what = 'a.id')
|
||||
{
|
||||
// check if we have a string
|
||||
if (self::validate($guid))
|
||||
{
|
||||
// check if table already has this identifier
|
||||
if (StringHelper::check($table))
|
||||
{
|
||||
// Get the database object and a new query object.
|
||||
$db = Factory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
if (ArrayHelper::check($what))
|
||||
{
|
||||
$query->select($db->quoteName($what));
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->select($what);
|
||||
}
|
||||
|
||||
$query->from($db->quoteName('#__componentbuilder_' . (string) $table, 'a'))
|
||||
->where($db->quoteName('a.guid') . ' = ' . $db->quote($guid));
|
||||
|
||||
// Set and query the database.
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
if (ArrayHelper::check($what) || $what === 'a.*')
|
||||
{
|
||||
return $db->loadObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $db->loadResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the Globally Unique Identifier
|
||||
*
|
||||
* Thanks to Lewie
|
||||
* https://stackoverflow.com/a/1515456/1429677
|
||||
*
|
||||
* @param string $guid
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
protected static function validate($guid)
|
||||
{
|
||||
// check if we have a string
|
||||
if (StringHelper::check($guid))
|
||||
{
|
||||
return preg_match("/^(\{)?[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}(?(1)\})$/i", $guid);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,8 @@ namespace VDM\Joomla\Utilities;
|
||||
|
||||
/**
|
||||
* The json checker
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
abstract class JsonHelper
|
||||
{
|
||||
@ -24,6 +26,8 @@ abstract class JsonHelper
|
||||
* @input string $string The json string to check
|
||||
*
|
||||
* @returns bool true on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function check($string): bool
|
||||
{
|
||||
@ -36,6 +40,15 @@ abstract class JsonHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a json object to a string
|
||||
*
|
||||
* @input string $value The json string to convert
|
||||
*
|
||||
* @returns a string
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function string($value, $separator = ", ", $table = null, $id = 'id', $name = 'name')
|
||||
{
|
||||
// do some table foot work
|
||||
|
@ -15,6 +15,8 @@ namespace VDM\Joomla\Utilities;
|
||||
|
||||
/**
|
||||
* Basic Math Helper
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
abstract class MathHelper
|
||||
{
|
||||
@ -28,6 +30,7 @@ abstract class MathHelper
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function bc($type, $val1, $val2, $scale = 0)
|
||||
{
|
||||
@ -77,6 +80,7 @@ abstract class MathHelper
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function sum($array, $scale = 4)
|
||||
{
|
||||
|
@ -15,6 +15,8 @@ namespace VDM\Joomla\Utilities;
|
||||
|
||||
/**
|
||||
* Some object tricks
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
abstract class ObjectHelper
|
||||
{
|
||||
@ -24,6 +26,8 @@ abstract class ObjectHelper
|
||||
* @input object The object to check
|
||||
*
|
||||
* @returns bool true on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function check($object)
|
||||
{
|
||||
|
@ -18,6 +18,8 @@ use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
/**
|
||||
* Control the naming of a class and function
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
abstract class ClassfunctionHelper
|
||||
{
|
||||
@ -27,7 +29,9 @@ abstract class ClassfunctionHelper
|
||||
* @input string The name you would like to make safe
|
||||
*
|
||||
* @returns string on success
|
||||
**/
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function safe($name)
|
||||
{
|
||||
// remove numbers if the first character is a number
|
||||
|
@ -19,12 +19,16 @@ use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
/**
|
||||
* Control the naming of a field
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
abstract class FieldHelper
|
||||
{
|
||||
/**
|
||||
* The field builder switch
|
||||
**/
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
protected static $builder = false;
|
||||
|
||||
/**
|
||||
@ -35,7 +39,9 @@ abstract class FieldHelper
|
||||
* @input string The string to use in white space
|
||||
*
|
||||
* @returns string on success
|
||||
**/
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function safe($string, $allcap = false, $spacer = '_')
|
||||
{
|
||||
// get global value
|
||||
|
@ -18,6 +18,8 @@ use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
/**
|
||||
* Control the naming of a namespace helper
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
abstract class NamespaceHelper
|
||||
{
|
||||
@ -27,7 +29,9 @@ abstract class NamespaceHelper
|
||||
* @input string The you would like to make safe
|
||||
*
|
||||
* @returns string on success
|
||||
**/
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function safe($string)
|
||||
{
|
||||
// 0nly continue if we have a string
|
||||
|
@ -15,6 +15,8 @@ namespace VDM\Joomla\Utilities\String;
|
||||
|
||||
/**
|
||||
* Control the naming of a plugin
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
abstract class PluginHelper
|
||||
{
|
||||
@ -25,6 +27,8 @@ abstract class PluginHelper
|
||||
* @input string $group The group name
|
||||
*
|
||||
* @returns string on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function safeFolderName($codeName, $group)
|
||||
{
|
||||
@ -46,6 +50,8 @@ abstract class PluginHelper
|
||||
* @input string $group The group name
|
||||
*
|
||||
* @returns string on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function safeClassName($codeName, $group)
|
||||
{
|
||||
@ -67,6 +73,8 @@ abstract class PluginHelper
|
||||
* @input string $group The group name
|
||||
*
|
||||
* @returns string on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function safeInstallClassName($codeName, $group)
|
||||
{
|
||||
@ -88,6 +96,8 @@ abstract class PluginHelper
|
||||
* @input string $group The group name
|
||||
*
|
||||
* @returns string on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function safeLangPrefix($codeName, $group)
|
||||
{
|
||||
|
@ -19,12 +19,16 @@ use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
/**
|
||||
* Control the naming of a field type
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
abstract class TypeHelper
|
||||
{
|
||||
/**
|
||||
* The field builder switch
|
||||
**/
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
protected static $builder = false;
|
||||
|
||||
/**
|
||||
@ -33,7 +37,9 @@ abstract class TypeHelper
|
||||
* @input string The you would like to make safe
|
||||
*
|
||||
* @returns string on success
|
||||
**/
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function safe($string)
|
||||
{
|
||||
// get global value
|
||||
|
@ -20,6 +20,8 @@ use Joomla\CMS\Component\ComponentHelper;
|
||||
|
||||
/**
|
||||
* Some string tricks
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
abstract class StringHelper
|
||||
{
|
||||
@ -27,6 +29,8 @@ abstract class StringHelper
|
||||
* The Main Active Language
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static $langTag;
|
||||
|
||||
@ -36,6 +40,8 @@ abstract class StringHelper
|
||||
* @input string $string The string to check
|
||||
*
|
||||
* @returns bool true on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function check($string): bool
|
||||
{
|
||||
@ -53,6 +59,8 @@ abstract class StringHelper
|
||||
* @input string The you would like to shorten
|
||||
*
|
||||
* @returns string on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function shorten($string, $length = 40, $addTip = true)
|
||||
{
|
||||
@ -94,6 +102,8 @@ abstract class StringHelper
|
||||
* @input string The you would like to make safe
|
||||
*
|
||||
* @returns string on success
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function safe($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true)
|
||||
{
|
||||
@ -195,6 +205,15 @@ abstract class StringHelper
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert none English strings to code usable string
|
||||
*
|
||||
* @input an string
|
||||
*
|
||||
* @returns a string
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function transliterate($string)
|
||||
{
|
||||
// set tag only once
|
||||
@ -210,6 +229,15 @@ abstract class StringHelper
|
||||
return $lang->transliterate($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* make sure a string is HTML save
|
||||
*
|
||||
* @input an html string
|
||||
*
|
||||
* @returns a string
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function html($var, $charset = 'UTF-8', $shorten = false, $length = 40)
|
||||
{
|
||||
if (self::check($var))
|
||||
@ -237,6 +265,15 @@ abstract class StringHelper
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert all int in a string to an English word string
|
||||
*
|
||||
* @input an string with numbers
|
||||
*
|
||||
* @returns a string
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function numbers($string)
|
||||
{
|
||||
// set numbers array
|
||||
@ -270,6 +307,8 @@ abstract class StringHelper
|
||||
*
|
||||
* @input an int
|
||||
* @returns a string
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function number($x)
|
||||
{
|
||||
@ -359,6 +398,8 @@ abstract class StringHelper
|
||||
* Random Key
|
||||
*
|
||||
* @returns a string
|
||||
*
|
||||
* @since 3.0.9
|
||||
*/
|
||||
public static function random($size)
|
||||
{
|
||||
|
@ -2167,172 +2167,6 @@ abstract class ComponentbuilderHelper
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a GUIDv4 string
|
||||
*
|
||||
* Thanks to Dave Pearson (and other)
|
||||
* https://www.php.net/manual/en/function.com-create-guid.php#119168
|
||||
*
|
||||
* Uses the best cryptographically secure method
|
||||
* for all supported platforms with fallback to an older,
|
||||
* less secure version.
|
||||
*
|
||||
* @param bool $trim
|
||||
* @return string
|
||||
*/
|
||||
public static function GUID ($trim = true)
|
||||
{
|
||||
// Windows
|
||||
if (function_exists('com_create_guid') === true)
|
||||
{
|
||||
if ($trim === true)
|
||||
{
|
||||
return trim(com_create_guid(), '{}');
|
||||
}
|
||||
return com_create_guid();
|
||||
}
|
||||
|
||||
// set the braces if needed
|
||||
$lbrace = $trim ? "" : chr(123); // "{"
|
||||
$rbrace = $trim ? "" : chr(125); // "}"
|
||||
|
||||
// OSX/Linux
|
||||
if (function_exists('openssl_random_pseudo_bytes') === true)
|
||||
{
|
||||
$data = openssl_random_pseudo_bytes(16);
|
||||
$data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
|
||||
$data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
|
||||
return $lbrace . vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)) . $lbrace;
|
||||
}
|
||||
|
||||
// Fallback (PHP 4.2+)
|
||||
mt_srand((double)microtime() * 10000);
|
||||
$charid = strtolower(md5(uniqid(rand(), true)));
|
||||
$hyphen = chr(45); // "-"
|
||||
$guidv4 = $lbrace.
|
||||
substr($charid, 0, 8).$hyphen.
|
||||
substr($charid, 8, 4).$hyphen.
|
||||
substr($charid, 12, 4).$hyphen.
|
||||
substr($charid, 16, 4).$hyphen.
|
||||
substr($charid, 20, 12).
|
||||
$rbrace;
|
||||
return $guidv4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the Globally Unique Identifier ( and check if table already has this identifier)
|
||||
*
|
||||
* @param string $guid
|
||||
* @param string $table
|
||||
* @param int $id
|
||||
* @return bool
|
||||
*/
|
||||
public static function validGUID ($guid, $table = null, $id = 0)
|
||||
{
|
||||
// check if we have a string
|
||||
if (self::validateGUID($guid))
|
||||
{
|
||||
// check if table already has this identifier
|
||||
if (self::checkString($table))
|
||||
{
|
||||
// Get the database object and a new query object.
|
||||
$db = \JFactory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('COUNT(*)')
|
||||
->from('#__componentbuilder_' . (string) $table)
|
||||
->where($db->quoteName('guid') . ' = ' . $db->quote($guid));
|
||||
|
||||
// remove this item from the list
|
||||
if ($id > 0)
|
||||
{
|
||||
$query->where($db->quoteName('id') . ' <> ' . (int) $id);
|
||||
}
|
||||
|
||||
// Set and query the database.
|
||||
$db->setQuery($query);
|
||||
$duplicate = (bool) $db->loadResult();
|
||||
|
||||
if ($duplicate)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the ITEM of a GUID by table
|
||||
*
|
||||
* @param string $guid
|
||||
* @param string $table
|
||||
* @param string/array $what
|
||||
*
|
||||
* @return mix
|
||||
*/
|
||||
public static function getGUID ($guid, $table, $what = 'a.id')
|
||||
{
|
||||
// check if we have a string
|
||||
if (self::validateGUID($guid))
|
||||
{
|
||||
// check if table already has this identifier
|
||||
if (self::checkString($table))
|
||||
{
|
||||
// Get the database object and a new query object.
|
||||
$db = \JFactory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
if (self::checkArray($what))
|
||||
{
|
||||
$query->select($db->quoteName($what));
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->select($what);
|
||||
}
|
||||
$query->from($db->quoteName('#__componentbuilder_' . (string) $table, 'a'))
|
||||
->where($db->quoteName('a.guid') . ' = ' . $db->quote($guid));
|
||||
|
||||
// Set and query the database.
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
if (self::checkArray($what) || $what === 'a.*')
|
||||
{
|
||||
return $db->loadObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $db->loadResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the Globally Unique Identifier
|
||||
*
|
||||
* Thanks to Lewie
|
||||
* https://stackoverflow.com/a/1515456/1429677
|
||||
*
|
||||
* @param string $guid
|
||||
* @return bool
|
||||
*/
|
||||
protected static function validateGUID ($guid)
|
||||
{
|
||||
// check if we have a string
|
||||
if (self::checkString($guid))
|
||||
{
|
||||
return preg_match("/^(\{)?[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}(?(1)\})$/i", $guid);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tab/spacer bucket (to speed-up the build)
|
||||
*
|
||||
@ -2691,91 +2525,6 @@ abstract class ComponentbuilderHelper
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The zipper method
|
||||
*
|
||||
* @param string $workingDIR The directory where the items must be zipped
|
||||
* @param string $filepath The path to where the zip file must be placed
|
||||
*
|
||||
* @return bool true On success
|
||||
*
|
||||
*/
|
||||
public static function zip($workingDIR, &$filepath)
|
||||
{
|
||||
// store the current joomla working directory
|
||||
$joomla = getcwd();
|
||||
|
||||
// we are changing the working directory to the component temp folder
|
||||
chdir($workingDIR);
|
||||
|
||||
// the full file path of the zip file
|
||||
$filepath = Path::clean($filepath);
|
||||
|
||||
// delete an existing zip file (or use an exclusion parameter in Folder::files()
|
||||
File::delete($filepath);
|
||||
|
||||
// get a list of files in the current directory tree (also the hidden files)
|
||||
$files = Folder::files('.', '', true, true, array('.svn', 'CVS', '.DS_Store', '__MACOSX'), array('.*~'));
|
||||
$zipArray = array();
|
||||
// setup the zip array
|
||||
foreach ($files as $file)
|
||||
{
|
||||
$tmp = array();
|
||||
$tmp['name'] = str_replace('./', '', $file);
|
||||
$tmp['data'] = self::getFileContents($file);
|
||||
$tmp['time'] = filemtime($file);
|
||||
$zipArray[] = $tmp;
|
||||
}
|
||||
|
||||
// change back to joomla working directory
|
||||
chdir($joomla);
|
||||
|
||||
// get the zip adapter
|
||||
$adapter = new Archive();
|
||||
$zip = $adapter->getAdapter('zip');
|
||||
|
||||
//create the zip file
|
||||
if ($zip->create($filepath, $zipArray))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Write a file to the server
|
||||
*
|
||||
* @param string $path The path and file name where to safe the data
|
||||
* @param string $data The data to safe
|
||||
*
|
||||
* @return bool true On success
|
||||
*
|
||||
*/
|
||||
public static function writeFile($path, $data)
|
||||
{
|
||||
$klaar = false;
|
||||
if (self::checkString($data))
|
||||
{
|
||||
// open the file
|
||||
$fh = fopen($path, "w");
|
||||
if (!is_resource($fh))
|
||||
{
|
||||
return $klaar;
|
||||
}
|
||||
// write to the file
|
||||
if (fwrite($fh, $data))
|
||||
{
|
||||
// has been done
|
||||
$klaar = true;
|
||||
}
|
||||
// close file.
|
||||
fclose($fh);
|
||||
}
|
||||
return $klaar;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove folders with files
|
||||
*
|
||||
@ -3804,70 +3553,6 @@ abstract class ComponentbuilderHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get between
|
||||
*
|
||||
* @param string $content The content to search
|
||||
* @param string $start The starting value
|
||||
* @param string $end The ending value
|
||||
* @param string $default The default value if none found
|
||||
*
|
||||
* @return string On success / empty string on failure
|
||||
*
|
||||
*/
|
||||
public static function getBetween($content, $start, $end, $default = '')
|
||||
{
|
||||
$r = explode($start, $content);
|
||||
if (isset($r[1]))
|
||||
{
|
||||
$r = explode($end, $r[1]);
|
||||
return $r[0];
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* get all between
|
||||
*
|
||||
* @param string $content The content to search
|
||||
* @param string $start The starting value
|
||||
* @param string $end The ending value
|
||||
*
|
||||
* @return array On success
|
||||
*
|
||||
*/
|
||||
public static function getAllBetween($content, $start, $end)
|
||||
{
|
||||
// reset bucket
|
||||
$bucket = array();
|
||||
for ($i = 0; ; $i++)
|
||||
{
|
||||
// search for string
|
||||
$found = self::getBetween($content,$start,$end);
|
||||
if (self::checkString($found))
|
||||
{
|
||||
// add to bucket
|
||||
$bucket[] = $found;
|
||||
// build removal string
|
||||
$remove = $start.$found.$end;
|
||||
// remove from content
|
||||
$content = str_replace($remove,'',$content);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
// safety catch
|
||||
if ($i == 500)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
// only return unique array of values
|
||||
return array_unique($bucket);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Field Grouping https://docs.joomla.org/Form_field
|
||||
**/
|
||||
@ -4220,59 +3905,6 @@ abstract class ComponentbuilderHelper
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the content of a file
|
||||
*
|
||||
* @param string $path The path to the file
|
||||
* @param string/bool $none The return value if no content was found
|
||||
*
|
||||
* @return string On success
|
||||
*
|
||||
*/
|
||||
public static function getFileContents($path, $none = '')
|
||||
{
|
||||
if (self::checkString($path))
|
||||
{
|
||||
// use basic file get content for now
|
||||
if (($content = @file_get_contents($path)) !== FALSE)
|
||||
{
|
||||
return $content;
|
||||
}
|
||||
// use curl if available
|
||||
elseif (function_exists('curl_version'))
|
||||
{
|
||||
// start curl
|
||||
$ch = curl_init();
|
||||
// set the options
|
||||
$options = array();
|
||||
$options[CURLOPT_URL] = $path;
|
||||
$options[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12';
|
||||
$options[CURLOPT_RETURNTRANSFER] = TRUE;
|
||||
$options[CURLOPT_SSL_VERIFYPEER] = FALSE;
|
||||
// load the options
|
||||
curl_setopt_array($ch, $options);
|
||||
// get the content
|
||||
$content = curl_exec($ch);
|
||||
// close the connection
|
||||
curl_close($ch);
|
||||
// return if found
|
||||
if (self::checkString($content))
|
||||
{
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
elseif (property_exists('ComponentbuilderHelper', 'curlErrorLoaded') && !self::$curlErrorLoaded)
|
||||
{
|
||||
// set the notice
|
||||
JFactory::getApplication()->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BCOMPONENTBUILDERB_WILL_NOT_FUNCTION_CORRECTLYP'), 'Error');
|
||||
// load this notice only once
|
||||
self::$curlErrorLoaded = true;
|
||||
}
|
||||
}
|
||||
return $none;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* the Crypt objects
|
||||
**/
|
||||
|
Loading…
Reference in New Issue
Block a user