Example #1
0
 static function init()
 {
     self::$time_start = sys_get_microtime();
     // clean request vars
     if (ini_get("magic_quotes_gpc") !== false and get_magic_quotes_gpc()) {
         modify::stripslashes($_REQUEST);
     }
     foreach ($_REQUEST as $key => $val) {
         if (is_array($val) and count($val) > 0) {
             $_REQUEST[$key] = array();
             foreach ($val as $val2) {
                 if (!is_array($val2)) {
                     $_REQUEST[$key][$val2] = $val2;
                 }
             }
         }
     }
     // set up smarty
     self::$smarty = new Smarty();
     self::$smarty->register_prefilter(array("modify", "urladdon_quote"));
     if (isset($_REQUEST["print"])) {
         self::$smarty->register_outputfilter(array("modify", "striplinksforms"));
     }
     if (isset($_REQUEST["print"])) {
         self::$smarty->assign("print", $_REQUEST["print"]);
     }
     self::$smarty->compile_dir = SIMPLE_CACHE . "/smarty";
     self::$smarty->template_dir = "templates";
     self::$smarty->config_dir = "templates/css";
     self::$smarty->compile_check = false;
     // refresh smarty cache
     if (DEBUG) {
         debug_check_tpl();
     }
     // set up database
     if (!sql_connect(SETUP_DB_HOST, SETUP_DB_USER, sys_decrypt(SETUP_DB_PW, sha1(SETUP_ADMIN_USER)), SETUP_DB_NAME)) {
         $err = sprintf("{t}Cannot connect to database %s on %s.{/t}\n", SETUP_DB_NAME, SETUP_DB_HOST) . sql_error();
         trigger_error($err, E_USER_ERROR);
         sys_die($err);
     }
     // verify credentials
     login_handle_login();
 }
Example #2
0
}
if (empty($_SERVER["SERVER_ADDR"])) {
    $_SERVER["SERVER_ADDR"] = "127.0.0.1";
}
@ignore_user_abort(1);
if (!sql_connect(SETUP_DB_HOST, SETUP_DB_USER, sys_decrypt(SETUP_DB_PW, sha1(SETUP_ADMIN_USER)), SETUP_DB_NAME)) {
    $err = t("{t}Cannot connect to database %s on %s.{/t}", SETUP_DB_NAME, SETUP_DB_HOST) . "\n" . sql_error();
    trigger_error($err, E_USER_ERROR);
    exit($err);
}
$save_session = false;
if (ini_get("suhosin.session.encrypt")) {
    $save_session = true;
}
// workaround for broken session_encode()
login_handle_login($save_session);
$class = "ajax";
if (!empty($_REQUEST["class"]) and strpos($_REQUEST["class"], "_ajax")) {
    $class = $_REQUEST["class"];
}
if (empty($_REQUEST["function"]) and empty($_SERVER["HTTP_SOAPACTION"])) {
    $reflect = new ReflectionClass($class);
    $output = "";
    foreach ($reflect->getMethods(ReflectionMethod::IS_PUBLIC) as $reflectmethod) {
        $output .= $reflectmethod->getDocComment() . "\n";
        $output .= "{$reflectmethod->getName()}(";
        foreach ($reflectmethod->getParameters() as $num => $param) {
            if ($param->isArray()) {
                $output .= " array";
            }
            $output .= " \$" . $param->getName();