auto-format all files; add table-definitions to test-bootstrap file

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-12-21 12:24:07 +01:00
parent 1ff784198c
commit 97b5439c0d
209 changed files with 6840 additions and 4534 deletions

View File

@@ -16,28 +16,20 @@
* @package Functions
*
*/
function array_merge_prefix($array1, $key_prefix, $array2)
{
if(is_array($array1) && is_array($array2))
{
if($key_prefix != '')
{
foreach($array2 as $key => $value)
{
if (is_array($array1) && is_array($array2)) {
if ($key_prefix != '') {
foreach ($array2 as $key => $value) {
$array1[$key_prefix . '_' . $key] = $value;
unset($array2[$key]);
}
unset($array2);
return $array1;
}
else
{
} else {
return array_merge($array1, $array2);
}
}
else
{
} else {
return $array1;
}
}

View File

@@ -21,19 +21,17 @@
* Returns a double of the given value which isn't negative.
* Returns -1 if the given value was -1.
*
* @param any The value
* @param
* any The value
* @return double The positive value
* @author Florian Lippert <flo@syscp.org>
*/
function doubleval_ressource($the_value)
{
$the_value = doubleval($the_value);
if($the_value < 0
&& $the_value != '-1')
{
$the_value*= - 1;
if ($the_value < 0 && $the_value != '-1') {
$the_value *= - 1;
}
return $the_value;

View File

@@ -22,29 +22,28 @@
* can select which fields should be handled by htmlentities and with advantage,
* that you can eliminate all html entities by setting complete=true
*
* @param array The subject array
* @param string The fields which should be checked for, separated by spaces
* @param bool Select true to use html_entity_decode_complete instead of html_entity_decode
* @param int See php documentation about this
* @param string See php documentation about this
* @param
* array The subject array
* @param
* string The fields which should be checked for, separated by spaces
* @param
* bool Select true to use html_entity_decode_complete instead of html_entity_decode
* @param
* int See php documentation about this
* @param
* string See php documentation about this
* @return array The array with html_entity_decode'd strings
* @author Florian Lippert <flo@syscp.org>
*/
function html_entity_decode_array($subject, $fields = '', $complete = false, $quote_style = ENT_COMPAT, $charset = 'UTF-8')
{
if(is_array($subject))
{
if(!is_array($fields))
{
if (is_array($subject)) {
if (! is_array($fields)) {
$fields = array_trim(explode(' ', $fields));
}
foreach($subject as $field => $value)
{
if((!is_array($fields) || empty($fields))
|| (is_array($fields) && !empty($fields) && in_array($field, $fields)))
{
foreach ($subject as $field => $value) {
if ((! is_array($fields) || empty($fields)) || (is_array($fields) && ! empty($fields) && in_array($field, $fields))) {
/**
* Just call ourselve to manage multi-dimensional arrays
*/
@@ -52,15 +51,10 @@ function html_entity_decode_array($subject, $fields = '', $complete = false, $qu
$subject[$field] = html_entity_decode_array($subject[$field], $fields, $complete, $quote_style, $charset);
}
}
}
else
{
if($complete == true)
{
} else {
if ($complete == true) {
$subject = html_entity_decode_complete($subject, $quote_style, $charset);
}
else
{
} else {
$subject = html_entity_decode($subject, $quote_style, $charset);
}
}

View File

@@ -20,26 +20,21 @@
/**
* Calls html_entity_decode in a loop until the result doesn't differ from original anymore
*
* @param string The string in which the html entities should be eliminated.
* @param
* string The string in which the html entities should be eliminated.
* @return string The cleaned string
* @author Florian Lippert <flo@syscp.org>
*/
function html_entity_decode_complete($string)
{
global $theme;
if($theme == 'Classic')
{
while($string != html_entity_decode($string))
{
if ($theme == 'Classic') {
while ($string != html_entity_decode($string)) {
$string = html_entity_decode($string);
}
}
else
{
while($string != html_entity_decode($string, ENT_COMPAT | ENT_HTML5, 'UTF-8'))
{
} else {
while ($string != html_entity_decode($string, ENT_COMPAT | ENT_HTML5, 'UTF-8')) {
$string = html_entity_decode($string, ENT_COMPAT | ENT_HTML5, 'UTF-8');
}
}

View File

@@ -21,28 +21,26 @@
* Wrapper around htmlentities to handle arrays, with the advantage that you
* can select which fields should be handled by htmlentities
*
* @param array The subject array
* @param string The fields which should be checked for, separated by spaces
* @param int See php documentation about this
* @param string See php documentation about this
* @param
* array The subject array
* @param
* string The fields which should be checked for, separated by spaces
* @param
* int See php documentation about this
* @param
* string See php documentation about this
* @return array The array with htmlentitie'd strings
* @author Florian Lippert <flo@syscp.org>
*/
function htmlentities_array($subject, $fields = '', $quote_style = ENT_QUOTES, $charset = 'UTF-8')
{
if(is_array($subject))
{
if(!is_array($fields))
{
if (is_array($subject)) {
if (! is_array($fields)) {
$fields = array_trim(explode(' ', $fields));
}
foreach($subject as $field => $value)
{
if((!is_array($fields) || empty($fields))
|| (is_array($fields) && !empty($fields) && in_array($field, $fields)))
{
foreach ($subject as $field => $value) {
if ((! is_array($fields) || empty($fields)) || (is_array($fields) && ! empty($fields) && in_array($field, $fields))) {
/**
* Just call ourselve to manage multi-dimensional arrays
*/
@@ -50,9 +48,7 @@ function htmlentities_array($subject, $fields = '', $quote_style = ENT_QUOTES, $
$subject[$field] = htmlentities_array($subject[$field], $fields, $quote_style, $charset);
}
}
}
else
{
} else {
$subject = htmlentities($subject, $quote_style, $charset);
}

View File

@@ -21,19 +21,17 @@
* Returns an integer of the given value which isn't negative.
* Returns -1 if the given value was -1.
*
* @param any The value
* @param
* any The value
* @return int The positive value
* @author Florian Lippert <flo@syscp.org>
*/
function intval_ressource($the_value)
{
$the_value = intval($the_value);
if($the_value < 0
&& $the_value != '-1')
{
$the_value*= - 1;
if ($the_value < 0 && $the_value != '-1') {
$the_value *= - 1;
}
return $the_value;

View File

@@ -21,30 +21,27 @@
* Replaces Strings in an array, with the advantage that you
* can select which fields should be str_replace'd
*
* @param mixed String or array of strings to search for
* @param mixed String or array to replace with
* @param array The subject array
* @param string The fields which should be checked for, separated by spaces
* @param
* mixed String or array of strings to search for
* @param
* mixed String or array to replace with
* @param
* array The subject array
* @param
* string The fields which should be checked for, separated by spaces
* @return array The str_replace'd array
* @author Florian Lippert <flo@syscp.org>
*/
function str_replace_array($search, $replace, $subject, $fields = '')
{
if(is_array($subject))
{
if (is_array($subject)) {
$fields = array_trim(explode(' ', $fields));
foreach($subject as $field => $value)
{
if((!is_array($fields) || empty($fields))
|| (is_array($fields) && !empty($fields) && in_array($field, $fields)))
{
foreach ($subject as $field => $value) {
if ((! is_array($fields) || empty($fields)) || (is_array($fields) && ! empty($fields) && in_array($field, $fields))) {
$subject[$field] = str_replace($search, $replace, $subject[$field]);
}
}
}
else
{
} else {
$subject = str_replace($search, $replace, $subject);
}

View File

@@ -22,29 +22,28 @@
* can select which fields should be handled by htmlentities and with advantage,
* that you can eliminate all slashes by setting complete=true
*
* @param array The subject array
* @param int See php documentation about this
* @param string See php documentation about this
* @param string The fields which should be checked for, separated by spaces
* @param bool Select true to use stripslashes_complete instead of stripslashes
* @param
* array The subject array
* @param
* int See php documentation about this
* @param
* string See php documentation about this
* @param
* string The fields which should be checked for, separated by spaces
* @param
* bool Select true to use stripslashes_complete instead of stripslashes
* @return array The array with stripslashe'd strings
* @author Florian Lippert <flo@syscp.org>
*/
function stripslashes_array($subject, $fields = '', $complete = false)
{
if(is_array($subject))
{
if(!is_array($fields))
{
if (is_array($subject)) {
if (! is_array($fields)) {
$fields = array_trim(explode(' ', $fields));
}
foreach($subject as $field => $value)
{
if((!is_array($fields) || empty($fields))
|| (is_array($fields) && !empty($fields) && in_array($field, $fields)))
{
foreach ($subject as $field => $value) {
if ((! is_array($fields) || empty($fields)) || (is_array($fields) && ! empty($fields) && in_array($field, $fields))) {
/**
* Just call ourselve to manage multi-dimensional arrays
*/
@@ -52,15 +51,10 @@ function stripslashes_array($subject, $fields = '', $complete = false)
$subject[$field] = stripslashes_array($subject[$field], $fields, $complete);
}
}
}
else
{
if($complete == true)
{
} else {
if ($complete == true) {
$subject = stripslashes_complete($subject);
}
else
{
} else {
$subject = stripslashes($subject);
}
}

View File

@@ -20,15 +20,14 @@
/**
* Calls stripslashes in a loop until the result doesn't differ from original anymore
*
* @param string The string in which the slashes should be eliminated.
* @param
* string The string in which the slashes should be eliminated.
* @return string The cleaned string
* @author Florian Lippert <flo@syscp.org>
*/
function stripslashes_complete($string)
{
while($string != stripslashes($string))
{
while ($string != stripslashes($string)) {
$string = stripslashes($string);
}