예제 #1
0
 */
// GET route
$app->get('/', function () use($app) {
    //get start page
    $app->render('client.html');
});
$app->get('/install', function () use($app) {
    if (file_exists(dirname(__FILE__) . '/config.php')) {
        echo "Configuration file has already been created!";
    } else {
        $host = $app->request()->get('host');
        $dbname = $app->request()->get('dbname');
        $dbuser = $app->request()->get('dbuser');
        $dbpass = $app->request()->get('dbpass');
        echo $host . $dbname . $dbuser . $dbpass;
        installer($host, $dbname, $dbuser, $dbpass);
        //$app->render('install.php');
    }
});
// section for registration
$app->post('/api/register', function () use($app) {
    $body = json_decode($app->request->getBody(), true);
    $usertool = new UserTool();
    echo $usertool->registerUser($body["username"], $body["password"], $body["invite_code"], $body["salt"], $body["public_key"], $body["private_key"]);
});
$app->get('/api/newsalt', function () {
    $usertool = new UserTool();
    echo $usertool->getNewPasswordSalt();
});
// section for login
$app->post('/api/login', function () use($app) {
예제 #2
0
파일: install.php 프로젝트: yfix/yf
 /**
  */
 function show_form()
 {
     $vars = installer()->prepare_vars();
     installer()->pre_init_yf_core($vars);
     $form_items = [];
     $validate_rules = [];
     foreach (installer()->get_form_keys() as $id => $desc) {
         $type = 'text';
         if (strpos($id, '_checkbox_') !== false) {
             $type = 'check_box';
         }
         $form_items[$id] = [$type, $id, $desc];
         $validate_rules[$id] = 'trim|required';
     }
     $defaults = installer()->get_form_defaults();
     $form = form($defaults)->validate($validate_rules)->array_to_form($form_items)->save('', 'Install');
     #		print _class('html')->layout(array(
     #			'nav_bar'	=> _class('html')->nav_bar(),
     #			'body'		=> $form,
     #		));
     print $form;
 }