function sscall($args) { $_GET = $args; $_REQUEST = $args; $_POST = $args; try { $server = Base_Server::singleton('server.ini', 'working/server.ini'); $server->main(); } catch (Exception $e) { echo 'Error: ' . $e->getMessage(); } }
function sscall($args) { $_GET = $args; $_REQUEST = $args; $_POST = $args; ob_start(); $server = Base_Server::singleton('server.ini', 'working/server.ini'); $server->main(); $result = ob_get_contents(); ob_end_clean(); return $result; }
public static function singleton($filename, $workingFilename) { $name = substr(basename($filename), 0, -4); $config = new Ini_Object($filename); if (!empty($config->server) && !empty($config->server['class'])) { $class = $config->server['class']; } else { $class = 'Server'; } if (!isset(self::$instance)) { try { define('BASE_SERVER', strtolower($name)); self::$instance = new $class($filename, $workingFilename); } catch (Exception $e) { $class = 'Server'; self::$instance = new $class($filename, $workingFilename); } } return self::$instance; }
<?php $dir = dirname(__FILE__); require_once "{$dir}/library/base.php"; try { $server = Base_Server::singleton('server.ini', 'working/server.ini'); $server->main(); } catch (Exception $e) { echo 'Error: ' . $e->getMessage(); } // testing