Ejemplo n.º 1
0
fORM::mapClassToTable('Role', TBL_ROLE);
fORM::mapClassToTable('Permission', TBL_PERMISSION);
fORM::mapClassToTable('Category', TBL_CATEGORY);
fORM::mapClassToTable('UserPermission', TBL_USER_PERMISSION);
fORM::mapClassToTable('Log', 'log');
/* Public Directories & Files */
define('SITE', 'http:' . DS . DS . $_SERVER['HTTP_HOST'] . DS . 'adminv3' . DS);
define('CSS', SITE . 'css' . DS);
define('JS', SITE . 'js' . DS);
define('SCRIPT', JS . 'script' . DS);
define('HOME', SITE . 'home' . DS);
define('BANNER', SITE . 'banner' . DS);
define('GEOLOCATION', SITE . 'geolocation' . DS);
define('USER', SITE . 'user' . DS);
define('CATEGORIES', SITE . 'categories' . DS);
define('LOGOUT', SITE . 'logout' . DS);
define('LOGIN', SITE . 'login' . DS);
define('IMAGES', SITE . 'images' . DS);
define('ICON', IMAGES . 'icon' . DS);
/* Private Directories & Files */
define('INCLUDES', ROOT . 'includes' . DS);
define('LOAD', ROOT . 'load' . DS);
/* Session */
define('SESSION_ID_USER', 'idUser');
define('SESSION_REGIONS', 'regions');
define('SALT', '#^&(!)()');
$db = new fDatabase('mysql', 'adminv2n', 'root', 'tortoise');
fORMDatabase::attach($db);
fAuthorization::setLoginPage(SITE . 'login.php');
fAuthorization::setAuthLevels(array('super' => 100, 'admin' => 80, 'cliente' => 20, 'adminUsers' => 80, 'employee' => 50, 'guest' => 25));
$acceptedFiles = array('image/gif', 'image/bmp', 'image/jpeg', 'image/pjpeg', 'image/png', 'application/msword', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'text/plain', 'text/richtext', 'text/html', 'video/mpeg', 'video/x-mpeg2', 'video/msvideo', 'video/quicktime', 'video/vivo', 'video/wavelet', 'video/x-sgi-movie', 'video/x-flv', 'video/mp4', 'audio/x-wav', 'audio/x-mp3', 'audio/midi');
Ejemplo n.º 2
0
<?php

define('DOC_ROOT', realpath(dirname(__FILE__) . '/../'));
define('URL_ROOT', path_fix(substr(DOC_ROOT, strlen(realpath($_SERVER['DOCUMENT_ROOT'])))) . '/');
define('URL_ROOT_TRIM', ltrim(URL_ROOT, "\\"));
error_reporting(E_STRICT | E_ALL);
fCore::enableErrorHandling('html');
fCore::enableExceptionHandling('html');
fTimestamp::setDefaultTimezone('Asia/Kuala_Lumpur');
fAuthorization::setLoginPage(URL_ROOT . 'authentication.php');
fAuthorization::setAuthLevels(array('super' => 1000, 'admin' => 100, 'user' => 50, 'guest' => 25));
// This prevents cross-site session transfer
fSession::setPath(DOC_ROOT . '/session/');
include DOC_ROOT . '/resources/library/flourish/constructor_functions.php';
/**
 * Configuration Settings
 *
 */
$config = array("db" => array("dbName" => "umw_mms", "dbHost" => "localhost", "dbUsername" => "useradmin", "password" => "test0"), "title" => "Material Management System", "version" => "v2.00b");
/**
 * Automatically includes classes
 * 
 * @throws Exception
 * 
 * @param  string $class  Name of the class to load
 * @return void
 */
function __autoload($class)
{
    $flourish_file = DOC_ROOT . '/resources/library/flourish/' . $class . '.php';
    if (file_exists($flourish_file)) {
 public function testCheckLoggedIn2()
 {
     $this->assertEquals(FALSE, fAuthorization::checkLoggedIn());
     fAuthorization::setAuthLevels(array('user' => 20, 'admin' => 50));
     fAuthorization::setUserAuthLevel('admin');
     $this->assertEquals(TRUE, fAuthorization::checkLoggedIn());
 }
Ejemplo n.º 4
0
 /**
  * Set user level structure. Automatically does the same to fAuthorization.
  * 
  * @param array $levels 	An associative array, similar to what flourish would use.
  */
 public static function setAuthLevels($levels)
 {
     self::$levels = $levels;
     fAuthorization::setAuthLevels($levels);
 }