<commit_before><?php
/*"******************************************************************************************************
*   (c) 2004-2006 by MulchProductions, www.mulchprod.de                                                 *
*   (c) 2007-2014 by Kajona, www.kajona.de                                                              *
*       Published under the GNU LGPL v2.1, see /system/licence_lgpl.txt                                 *
*-------------------------------------------------------------------------------------------------------*
*   $Id$                                                *
********************************************************************************************************/

/**
 * @package module_system
 */

//For the sake of different loaders - check again :(
//Mbstring loaded? If yes, we could use unicode-safe string-functions
if(!defined("_mbstringloaded_")) {
    if(extension_loaded("mbstring")) {
        define("_mbstringloaded_", true);
        mb_internal_encoding("UTF-8");
    }
    else {
        define("_mbstringloaded_", false);
    }
}

/**
 * Helper to load and scan all module-ids available. Triggered by the bootloader.
 * Change with care
 *
 * @return void
 */
function bootstrapIncludeModuleIds() {
    //Module-Constants
    foreach(scandir(_realpath_) as $strRootFolder) {

        if(uniStrpos($strRootFolder, "core") === false)
            continue;

        foreach(scandir(_realpath_."/".$strRootFolder) as $strDirEntry ) {
            if(is_dir(_realpath_."/".$strRootFolder."/".$strDirEntry) && is_dir(_realpath_."/".$strRootFolder."/".$strDirEntry."/system/") && is_dir(_realpath_."/".$strRootFolder."/".$strDirEntry."/system/config/")) {
                foreach(scandir(_realpath_."/".$strRootFolder."/".$strDirEntry."/system/config/") as $strModuleEntry ) {
                    if(preg_match("/module\_([a-z\_])+\_id\.php/", $strModuleEntry))
                        @include_once _realpath_."/".$strRootFolder."/".$strDirEntry."/system/config/".$strModuleEntry;
                }
            }
        }
    }
}

/**
 * Returns a value from the GET-array
 *
 * @param string $strKey
 * @return string
 * @deprecated use @link{class_carrier::getInstance()->getParam("")} instead
 */
function getGet($strKey) {
    if(issetGet($strKey))
        return $_GET[$strKey];
    else
        return "";
}

/**
 * Returns the complete GET-Array
 *
 * @return mixed
 */
function getArrayGet() {
    return $_GET;
}

/**
 * Returns the complete FILE-Array
 *
 * @return mixed
 */
function getArrayFiles() {
    return $_FILES;
}


/**
 * Checks whether a kay exists in GET-array, or not
 *
 * @param string $strKey
 * @return bool
 */
function issetGet($strKey) {
    if(isset($_GET[$strKey]))
        return true;
    else
        return false;
}

/**
 * Returns a value from the Post-array
 *
 * @param string $strKey
 * @return string
 * @deprecated use @link{class_carrier::getInstance()->getParam("")} instead
 */
function getPost($strKey) {
    if(issetPost($strKey))
        return $_POST[$strKey];
    else
        return "";
}

/**
 * Returns the complete POST-array
 *
 * @return mixed
 */
function getArrayPost() {
    return $_POST;
}

/**
 * Looks, if a key is in POST-array or not
 *
 * @param string $strKey
 * @return bool
 */
function issetPost($strKey) {
    if(isset($_POST[$strKey]))
        return true;
    else
        return false;
}

/**
 * Returns the complete http-post-body as raw-data.
 * Please indicate whether the source is encoded in "multipart/form-data", in this case
 * the data is read another way internally.
 *
 * @param bool $bitMultipart
 * @return string
 * @since 3.4.0
 */
function getPostRawData($bitMultipart = false) {
    if($bitMultipart)
        return $HTTP_RAW_POST_DATA;
    else
        return file_get_contents("php://input");
}

/**
 * Returns a value from the SERVER-Array
 *
 * @param mixed $strKey
 * @return string
 */
function getServer($strKey) {
    if(issetServer($strKey))<commit_msg>UPDATE: module_system | functions.php -> removed the direct access to $HTTP_RAW_POST_DATA, will be removed post php 5.6<commit_after><?php
/*"******************************************************************************************************
*   (c) 2004-2006 by MulchProductions, www.mulchprod.de                                                 *
*   (c) 2007-2014 by Kajona, www.kajona.de                                                              *
*       Published under the GNU LGPL v2.1, see /system/licence_lgpl.txt                                 *
*-------------------------------------------------------------------------------------------------------*
*   $Id$                                                *
********************************************************************************************************/

/**
 * @package module_system
 */

//For the sake of different loaders - check again :(
//Mbstring loaded? If yes, we could use unicode-safe string-functions
if(!defined("_mbstringloaded_")) {
    if(extension_loaded("mbstring")) {
        define("_mbstringloaded_", true);
        mb_internal_encoding("UTF-8");
    }
    else {
        define("_mbstringloaded_", false);
    }
}

/**
 * Helper to load and scan all module-ids available. Triggered by the bootloader.
 * Change with care
 *
 * @return void
 */
function bootstrapIncludeModuleIds() {
    //Module-Constants
    foreach(scandir(_realpath_) as $strRootFolder) {

        if(uniStrpos($strRootFolder, "core") === false)
            continue;

        foreach(scandir(_realpath_."/".$strRootFolder) as $strDirEntry ) {
            if(is_dir(_realpath_."/".$strRootFolder."/".$strDirEntry) && is_dir(_realpath_."/".$strRootFolder."/".$strDirEntry."/system/") && is_dir(_realpath_."/".$strRootFolder."/".$strDirEntry."/system/config/")) {
                foreach(scandir(_realpath_."/".$strRootFolder."/".$strDirEntry."/system/config/") as $strModuleEntry ) {
                    if(preg_match("/module\_([a-z\_])+\_id\.php/", $strModuleEntry))
                        @include_once _realpath_."/".$strRootFolder."/".$strDirEntry."/system/config/".$strModuleEntry;
                }
            }
        }
    }
}

/**
 * Returns a value from the GET-array
 *
 * @param string $strKey
 * @return string
 * @deprecated use @link{class_carrier::getInstance()->getParam("")} instead
 */
function getGet($strKey) {
    if(issetGet($strKey))
        return $_GET[$strKey];
    else
        return "";
}

/**
 * Returns the complete GET-Array
 *
 * @return mixed
 */
function getArrayGet() {
    return $_GET;
}

/**
 * Returns the complete FILE-Array
 *
 * @return mixed
 */
function getArrayFiles() {
    return $_FILES;
}


/**
 * Checks whether a kay exists in GET-array, or not
 *
 * @param string $strKey
 * @return bool
 */
function issetGet($strKey) {
    if(isset($_GET[$strKey]))
        return true;
    else
        return false;
}

/**
 * Returns a value from the Post-array
 *
 * @param string $strKey
 * @return string
 * @deprecated use @link{class_carrier::getInstance()->getParam("")} instead
 */
function getPost($strKey) {
    if(issetPost($strKey))
        return $_POST[$strKey];
    else
        return "";
}

/**
 * Returns the complete POST-array
 *
 * @return mixed
 */
function getArrayPost() {
    return $_POST;
}

/**
 * Looks, if a key is in POST-array or not
 *
 * @param string $strKey
 * @return bool
 */
function issetPost($strKey) {
    if(isset($_POST[$strKey]))
        return true;
    else
        return false;
}

/**
 * Returns the complete http-post-body as raw-data.
 * Please indicate whether the source is encoded in "multipart/form-data", in this case
 * the data is read another way internally.
 *
 * @param bool $bitMultipart
 * @return string
 * @since 3.4.0
 */
function getPostRawData($bitMultipart = false) {
    /*
      sidler, 06/2014: removed, since no longer supported and deprecated up from php 5.6

    if($bitMultipart)
        return $HTTP_RAW_POST_DATA;
    else
    */
    return file_get_contents("php://input");
}

/**
 * Returns a value from the SERVER-Array
 *
 * @param mixed $strKey
 * @return string
 */
function getServer($strKey) {
    if(issetServer($strKey))
{'fraction_non_alphanumeric': 0.20842437484826415, 'fraction_numerical': 0.0065549890750182084, 'mean_word_length': 2.362857142857143, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5305516', 'n_tokens_mistral': 2429, 'n_tokens_neox': 2328, 'n_words': 546}