Esempio n. 1
0
 public function __construct($url, $arguments, $accept)
 {
     $this->response = new ResponseObject();
     $this->response->setStatus = 500;
     // set error code to be overwritten in implementations
     $this->apiConfig = SmintapiConfig::getConfig();
     $this->url = $url;
     $this->arguments = $arguments;
     $this->accept = $accept;
     $this->dbconnection = SmintapiConfig::getDBConnection();
 }
Esempio n. 2
0
<?php

// I expect $CONFIGFILENAME to be set, otherwise bail out
if (isset($CONFIGFILENAME)) {
    $apiConfig = SmintapiConfig::initConfig($CONFIGFILENAME);
    $apiConfig = SmintapiConfig::getConfig();
} else {
    throw new Exception('Please set $CONFIGFILENAME to the config file to be used.');
}
// init logger with log level defined in the config file
$mylog = MyLog::singleton($apiConfig["logging"]["logLevel"]);
// define the autoloader to load classes from the lib folder
function __autoload($className)
{
    $filename = dirname(__FILE__) . '/../lib/' . $className . '.php';
    if (file_exists($filename)) {
        require $filename;
    } else {
        throw new Exception('Class "' . $className . '" could not be autoloaded. File not found: ' . $filename);
    }
}
function stripslashes_deep($value)
{
    $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
    return $value;
}