require_once 'PHP/firebasephp/firebaseLib.php';
//extendedexception files, Will add more over time.
require_once 'PHP/extendedexception/errorcodeininput.php';
require_once 'PHP/extendedexception/erroremptyinput.php';
require_once 'PHP/extendedexception/errorusernameexist.php';
require_once 'PHP/extendedexception/errorpasswordnomatch.php';
require_once 'PHP/extendedexception/errorwrongcredentials.php';
require_once 'PHP/extendedexception/erroroverlayingerror.php';
require_once 'PHP/extendedexception/errorwhitespaceusername.php';
//class the firebase database
$firebase = new \firebase\FirebaseLib('https://frontpagecustom.firebaseio.com/', 'hKaHrJbh6NSCLXWjrBtqgCvepeYB6fF0dviia05D');
$DataBase = new DataBase($firebase);
$SessionModel = new SessionModel();
$LoginModel = new LoginModel($SessionModel, $DataBase);
$RegisterModel = new RegisterModel($SessionModel, $DataBase);
$OptionsModel = new OptionsModel($SessionModel, $DataBase);
$MainModel = new MainModel($SessionModel);
$MainView = new MainView();
$OptionsView = new OptionsView();
$LoginView = new LoginView();
$RegisterView = new RegisterView();
$RegisterHandler = new RegisterHandler($RegisterView, $RegisterModel);
$LoginHandler = new LoginHandler($LoginView, $LoginModel, $DataBase);
$OptionsHandler = new OptionsHandler($OptionsView, $OptionsModel);
$MainHandler = new MainHandler($MainView, $MainModel);
$ViewHandler = new ViewHandler();
$LoginToken = $LoginHandler->login();
$RegisterHandler->register();
$OptionsHandler->options();
$MainHandler->logout();
$ViewHandler->render($LoginToken, $DataBase, $RegisterView, $LoginView, $OptionsView, $MainView);
Esempio n. 2
0
                continue;
            }
            $errno = curl_errno($ch);
            $error = curl_error($ch);
            if ($errno == 0) {
                $this->code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
                curl_close($ch);
                #error_log("Status: {$this->code}\n".print_r($this->headers, True));
                return $this->sendResponse($this->code, $this->headers, $content);
            }
            if ($errno <= 7) {
                break;
            }
            error_log("Urlfetch error: [{$errno}]{$error}");
        }
        curl_close($ch);
        return $this->sendNotify(555, "Urlfetch error: [{$errno}]{$error}");
    }
    protected function get()
    {
        header('Location: http://twitter.com/hexieshe');
    }
    function run()
    {
        ob_start();
        $method = strtoupper($_SERVER['REQUEST_METHOD']);
        $method == 'POST' ? $this->post() : $this->get();
    }
}
$handler = new MainHandler();
$handler->run();