This is the API documentation for concrete5 version 5.6 and earlier. View Current API Documentation
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 
<?php
/**
 * general.php
 *
 * @package MCManager.includes
 * @author Moxiecode

 */

@error_reporting(E_ALL ^ E_NOTICE);
$config = array();

require_once(dirname(__FILE__) . "/../classes/utils/Logger.php");
require_once(dirname(__FILE__) . "/../classes/utils/JSON.php");
require_once(dirname(__FILE__) . "/../config.php");
require_once(dirname(__FILE__) . "/../classes/SpellChecker.php");

if (isset($config['general.engine']))
    require_once(dirname(__FILE__) . "/../classes/" . $config["general.engine"] . ".php");

/**
 * Returns an request value by name without magic quoting.
 *
 * @param String $name Name of parameter to get.
 * @param String $default_value Default value to return if value not found.
 * @return String request value by name without magic quoting or default value.
 */
function getRequestParam($name, $default_value = false) {
    if (!isset($_REQUEST[$name]))
        return $default_value;

    if (is_array($_REQUEST[$name])) {
        $newarray = array();

        foreach ($_REQUEST[$name] as $name => $value)
            $newarray[$name] = $value;

        return $newarray;
    }

    return $_REQUEST[$name];
}

function &getLogger() {
    global $mcLogger, $man;

    if (isset($man))
        $mcLogger = $man->getLogger();

    if (!$mcLogger) {
        $mcLogger = new Moxiecode_Logger();

        // Set logger options
        $mcLogger->setPath(dirname(__FILE__) . "/../logs");
        $mcLogger->setMaxSize("100kb");
        $mcLogger->setMaxFiles("10");
        $mcLogger->setFormat("{time} - {message}");
    }

    return $mcLogger;
}

function debug($msg) {
    $args = func_get_args();

    $log = getLogger();
    $log->debug(implode(', ', $args));
}

function info($msg) {
    $args = func_get_args();

    $log = getLogger();
    $log->info(implode(', ', $args));
}

function error($msg) {
    $args = func_get_args();

    $log = getLogger();
    $log->error(implode(', ', $args));
}

function warn($msg) {
    $args = func_get_args();

    $log = getLogger();
    $log->warn(implode(', ', $args));
}

function fatal($msg) {
    $args = func_get_args();

    $log = getLogger();
    $log->fatal(implode(', ', $args));
}

?>