public static function routefunction($ctrlName, $funcName, $param = null) { return function ($url_parameter = null) use($ctrlName, $funcName, $param) { $mixed_param = array('static' => $param, 'uri' => $url_parameter); $controller = factory::getContoller($ctrlName); echo $controller->{$funcName}($mixed_param); }; }
/** * * @throws \Exception */ private function setPassword() { //$this->setFromPost(); $sql = src\factory::getSql(); $ret = $sql->sql_call('password_user', array($this->uid, $this->reseturi, $this->upw, $this->getRndString()), array('success')); if ($ret[0]->success == 1) { return true; } else { throw new \Exception('SQL-Error creating password'); } }
echo __DIR__ . config::get('classroot') . $classname . '.php'; throw new Exception('Can\'t find file to include. /index.php/loadClass(\'' . $classname . '\')'); } } spl_autoload_register('snowcms\\loadClass'); config::start_session(); //init routing src\route::init(); src\route::add('test', config::routefunction('main', 'testJSON')); // src\route::add('test', function(){ // echo $_POST['data']; // }); src\route::add('', config::routefunction('main', 'welcome')); src\route::add('file/(.*)', config::routefunction('file', 'getFile')); src\route::add('register', function () { $ble = src\factory::getAuth(); echo $ble->register(); }); src\route::add('login', function () { $ble = new aut\userauth(); if ($ble->login()) { echo 'logged in'; } else { echo 'nooob'; } }); src\route::add('userschema', function () { $data = factory::getSql(); if ($data == null) { echo 'shut the f**k up'; }