예제 #1
0
파일: setup.php 프로젝트: toastedghost/rbac
function installMysqli($host, $user, $pass, $dbname)
{
    $sqls = getSqls("mysql");
    $db = new mysqli($host, $user, $pass);
    $db->query("CREATE DATABASE {$dbname}");
    $db->select_db($dbname);
    if (is_array($sqls)) {
        foreach ($sqls as $query) {
            $db->query($query);
        }
    }
    Jf::$Db = new mysqli($host, $user, $pass, $dbname);
    Jf::$Rbac->reset(true);
}
예제 #2
0
     fclose($handle);
     unset($handle);
     $handle = fopen(RSA_PUBLIC_KEY_FILE, 'w');
     $data = $keypair['publickey'];
     fwrite($handle, $data);
     fclose($handle);
     unset($handle);
 } else {
     exit('Critical error while installing ! Unable to write to /app/crypto/ !');
 }
 //---------------------------------------------------------+
 // Creating Database Schema
 require "./sql/full.php";
 //---------------------------------------------------------+
 // Creating System Permissions
 Jf::$Db = $dbh;
 $rbac = new PhpRbac\Rbac();
 $perms = array();
 $handle = opendir(MODS_DIR);
 if ($handle) {
     // Foreach modules
     while (false !== ($entry = readdir($handle))) {
         // Dump specific directories
         if ($entry != "." && $entry != "..") {
             $module = $entry;
             // Exceptions
             if ($module != 'login') {
                 // Get Module Pages
                 $pages = Core_Reflection::getModulePublicPages($module);
                 if (!empty($pages)) {
                     // Create Page Access Permission
예제 #3
0
<?php

require_once __DIR__ . '/core/Jf.php';
require_once __DIR__ . '/Rbac.php';
Jf::$Db = Core_DBH::getDBH();