示例#1
0
 public function install()
 {
     $mod = new Modules();
     $mod->getModuleByName('roles');
     $perms = array('create roles', 'update roles', 'delete roles', 'manage roles');
     $perm_ids = FabriqModules::register_perms($mod->id, $perms);
     global $db;
     $sql = "CREATE TABLE IF NOT EXISTS `fabmod_roles_roles` (\n\t\t\t`id` INT(11) NOT NULL AUTO_INCREMENT,\n\t\t\t`role` VARCHAR(100) NOT NULL,\n\t\t\t`enabled` TINYINT(1) NOT NULL DEFAULT 1,\n\t\t\t`created` DATETIME NOT NULL,\n\t\t\t`updated` DATETIME NOT NULL,\n\t\t\tPRIMARY KEY (`id`)\n\t\t) ENGINE=INNODB;";
     $db->query($sql);
     $sql = "CREATE TABLE IF NOT EXISTS `fabmod_roles_moduleperms` (\n\t\t\t`id` INT(11) NOT NULL AUTO_INCREMENT,\n\t\t\t`permission` INT(11) NOT NULL,\n\t\t\t`role` INT(11) NOT NULL,\n\t\t\t`created` DATETIME NOT NULL,\n\t\t\t`updated` DATETIME NOT NULL,\n\t\t\tPRIMARY KEY (`id`),\n\t\t\tCONSTRAINT `fk_moduleperms_permission` FOREIGN KEY (`permission`) REFERENCES fabmods_perms(id) ON DELETE CASCADE,\n\t\t\tCONSTRAINT `fk_moduleperms_role` FOREIGN KEY (`role`) REFERENCES fabmod_roles_roles(id) ON DELETE CASCADE\n\t\t) ENGINE=INNODB;";
     $db->query($sql);
     // create base roles
     $role = FabriqModules::new_model('roles', 'Roles');
     $role->role = "unauthenticated";
     $role->enabled = 1;
     $role->id = $role->create();
     $role = FabriqModules::new_model('roles', 'Roles');
     $role->role = "authenticated";
     $role->enabled = 1;
     $role->id = $role->create();
     $role = FabriqModules::new_model('roles', 'Roles');
     $role->role = "administrator";
     $role->enabled = 1;
     $role->id = $role->create();
     // map paths
     $pathmap =& FabriqModules::module('pathmap');
     $pathmap->register_path('fabriqadmin/roles/manage', 'roles', 'index', 'module');
     $pathmap->register_path('fabriqadmin/roles/create', 'roles', 'create', 'module');
     $pathmap->register_path('fabriqadmin/roles/perms', 'roles', 'perms', 'module');
     // set module as installed
     $mod->installed = 1;
     $mod->update();
 }
 public function install()
 {
     $mod = new Modules();
     $mod->getModuleByName('sitemenus');
     $perms = array('create menus', 'update menus', 'delete menus', 'administer menus');
     $perm_ids = FabriqModules::register_perms($mod->id, $perms);
     global $db;
     $sql = "CREATE TABLE fabmod_sitemenus_menus (\n\t\t\t`id` INT(11) NOT NULL AUTO_INCREMENT,\n\t\t\t`menuName` VARCHAR(50) NOT NULL,\n\t\t\t`description` TEXT NULL,\n\t\t\t`created` DATETIME NOT NULL,\n\t\t\t`updated` DATETIME NOT NULL,\n\t\t\tPRIMARY KEY (`id`)\n\t\t) ENGINE=INNODB;";
     $db->query($sql);
     $sql = "CREATE TABLE fabmod_sitemenus_menuitems (\n\t\t\t`id` INT(11) NOT NULL AUTO_INCREMENT,\n\t\t\t`itemName` VARCHAR(100) NOT NULL,\n\t\t\t`path` VARCHAR(255) NULL,\n\t\t\t`menu` INT(11) NOT NULL,\n\t\t\t`parentItem` INT(11) NULL,\n\t\t\t`weight` INT(11) NOT NULL DEFAULT 0,\n\t\t\t`newWindow` TINYINT(1) NOT NULL DEFAULT 0,\n\t\t\t`created` DATETIME NOT NULL,\n\t\t\t`updated` DATETIME NOT NULL,\n\t\t\tPRIMARY KEY (`id`)\n\t\t) ENGINE=INNODB;";
     $db->query($sql);
     // map paths
     $pathmap =& FabriqModules::module('pathmap');
     $pathmap->register_path('sitemenus', 'sitemenus', 'index', 'module');
     $pathmap->register_path('sitemenus/index', 'sitemenus', 'index', 'module');
     $pathmap->register_path('sitemenus/create', 'sitemenus', 'create', 'module');
     $pathmap->register_path('sitemenus/update/!#', 'sitemenus', 'update', 'module', null, 2);
     $pathmap->register_path('sitemenus/destroy/!#', 'sitemenus', 'destroy', 'module', null, 2);
     $pathmap->register_path('sitemenus/items/index/!#', 'sitemenus', 'itemsIndex', 'module', null, 3);
     $pathmap->register_path('sitemenus/items/create/!#', 'sitemenus', 'itemsCreate', 'module', null, 3);
     $pathmap->register_path('sitemenus/items/update/!#', 'sitemenus', 'itemsUpdate', 'module', null, 3);
     $pathmap->register_path('sitemenus/items/destroy/!#', 'sitemenus', 'itemsDestroy', 'module', null, 3);
     // set module as installed
     $mod->installed = 1;
     $mod->update();
 }
 public function install()
 {
     $mod = new Modules();
     $mod->getModuleByName('fabriqmodules');
     $perms = array('manage modules');
     $perm_ids = FabriqModules::register_perms($mod->id, $perms);
     // map paths
     $pathmap =& FabriqModules::module('pathmap');
     $pathmap->register_path('fabriqmodules', 'fabriqmodules', 'manage', 'module');
     $pathmap->register_path('fabriqmodules/manage', 'fabriqmodules', 'manage', 'module');
     $pathmap->register_path('fabriqmodules/configure/!#', 'fabriqmodules', 'configure', 'module', null, 2);
     $pathmap->register_path('fabriqmodules/disable/!#', 'fabriqmodules', 'disable', 'module', null, 2);
     $pathmap->register_path('fabriqmodules/enable/!#', 'fabriqmodules', 'enable', 'module', null, 2);
     $pathmap->register_path('fabriqmodules/install/!#', 'fabriqmodules', 'install', 'module', null, 2);
     $pathmap->register_path('fabriqmodules/uninstall/!#', 'fabriqmodules', 'uninstall', 'module', null, 2);
     // give administrators the ability to manage modules
     $adminPerm = FabriqModules::new_model('roles', 'ModulePerms');
     $adminPerm->permission = $perm_ids[0];
     $adminRole = FabriqModules::new_model('roles', 'Roles');
     $adminRole->getRole('administrator');
     $adminPerm->role = $adminRole->id;
     $adminPerm->id = $adminPerm->create();
     // set module as installed
     $mod->installed = 1;
     $mod->update();
 }
示例#4
0
 public function install()
 {
     $mod = new Modules();
     $mod->getModuleByName('users');
     $perms = array('administer users', 'ban users', 'enable users');
     $perm_ids = FabriqModules::register_perms($mod->id, $perms);
     global $db;
     $sql = "CREATE TABLE IF NOT EXISTS `fabmod_users_users` (\n\t\t\t`id` INT(11) NOT NULL AUTO_INCREMENT,\n\t\t\t`display` VARCHAR(24) NOT NULL,\n\t\t\t`email` VARCHAR(100) NOT NULL,\n\t\t\t`encpwd` VARCHAR(100) NOT NULL,\n\t\t\t`status` INT(4) NOT NULL DEFAULT 0,\n\t\t\t`banned` TINYINT(1) NOT NULL DEFAULT 0,\n\t\t\t`forcepwdreset` TINYINT(1) NOT NULL DEFAULT 0,\n\t\t\t`created` DATETIME NOT NULL,\n\t\t\t`updated` DATETIME NOT NULL,\n\t\t\tPRIMARY KEY (`id`)\n\t\t) ENGINE=INNODB;";
     $db->query($sql);
     $sql = "CREATE TABLE IF NOT EXISTS `fabmod_users_roles` (\n\t\t\t`id` INT(11) NOT NULL AUTO_INCREMENT,\n\t\t\t`user` INT(11) NOT NULL,\n\t\t\t`role` INT(11) NOT NULL,\n\t\t\t`created` DATETIME NOT NULL,\n\t\t\t`updated` DATETIME NOT NULL,\n\t\t\tPRIMARY KEY (`id`),\n\t\t\tCONSTRAINT `fk_users_user` FOREIGN KEY (`user`) REFERENCES `fabmod_users_users`(`id`) ON DELETE CASCADE,\n\t\t\tCONSTRAINT `fk_users_role` FOREIGN KEY (`role`) REFERENCES `fabmod_roles_roles`(`id`) ON DELETE CASCADE\n\t\t) ENGINE=INNODB;";
     $db->query($sql);
     // map paths
     $pathmap =& FabriqModules::module('pathmap');
     $pathmap->register_path('users/index', 'users', 'index', 'module');
     $pathmap->register_path('users/index/!#', 'users', 'index', 'module', null, 2);
     $pathmap->register_path('users/login', 'users', 'login', 'module');
     $pathmap->register_path('users/login/!#', 'users', 'login', 'module', null, 2);
     $pathmap->register_path('users/logout', 'users', 'logout', 'module');
     $pathmap->register_path('users/forgotpassword', 'users', 'forgotpassword', 'module');
     $pathmap->register_path('users/create', 'users', 'create', 'module');
     $pathmap->register_path('users/update/!#', 'users', 'update', 'module', null, 2);
     $pathmap->register_path('users/enable', 'users', 'enable', 'module');
     $pathmap->register_path('users/ban', 'users', 'ban', 'module');
     $pathmap->register_path('users/register', 'users', 'register', 'module');
     $pathmap->register_path('users/checkDisplay', 'users', 'checkDisplay', 'module');
     $pathmap->register_path('users/checkEmail', 'users', 'checkEmail', 'module');
     $pathmap->register_path('users/changePassword/!#', 'users', 'changePassword', 'module', null, 2);
     $pathmap->register_path('users/myAccount', 'users', 'myAccount', 'module');
     $pathmap->register_path('users/updateAccount', 'users', 'updateAccount', 'module');
     $pathmap->register_path('users/getRoles', 'users', 'getRoles', 'module');
     // set module as installed
     $mod->installed = 1;
     $mod->update();
 }
 public function install()
 {
     $mod = new Modules();
     $mod->getModuleByName('pathmap');
     $perms = array('create paths', 'update paths', 'delete paths', 'access paths');
     $perm_ids = FabriqModules::register_perms($mod->id, $perms);
     global $db;
     $sql = "CREATE TABLE `fabmod_pathmap_paths` (\n\t\t\t`id` INT(11) NOT NULL AUTO_INCREMENT,\n\t\t\t`path` VARCHAR(100) NOT NULL,\n\t\t\t`modpage` ENUM('module', 'page') NOT NULL DEFAULT 'module',\n\t\t\t`controller` VARCHAR(100) NOT NULL,\n\t\t\t`action` VARCHAR(100) NOT NULL,\n\t\t\t`extra` VARCHAR(100) NULL,\n\t\t\t`wildcard` INT(11) NULL,\n\t\t\t`created` DATETIME NOT NULL,\n\t\t\t`updated` DATETIME NOT NULL,\n\t\t\tPRIMARY KEY (`id`)\n\t\t) ENGINE=INNODB;";
     $db->query($sql);
     // map paths
     $pathmap =& FabriqModules::module('pathmap');
     $pathmap->register_path('403', 'pathmap', '_403', 'module');
     $pathmap->register_path('404', 'pathmap', '_404', 'module');
     $pathmap->register_path('500', 'pathmap', '_500', 'module');
     // set module as installed
     $mod->installed = 1;
     $mod->update();
 }
 public function install()
 {
     $mod = new Modules();
     $mod->getModuleByName('blog');
     $perms = array('view blog posts', 'create blog posts', 'update blog posts', 'delete blog posts');
     $perm_ids = FabriqModules::register_perms($mod->id, $perms);
     global $db;
     $sql = "CREATE TABLE IF NOT EXISTS `fabmod_blog_blogs` (\n\t\t\t`id` INT(11) NOT NULL AUTO_INCREMENT,\n\t\t\t`title` VARCHAR(100) NOT NULL,\n\t\t\t`body` TEXT NOT NULL,\n\t\t\t`locked` TINYINT(1) NOT NULL DEFAULT 0,\n\t\t\t`user` INT(11) NOT NULL,\n\t\t\t`created` DATETIME NOT NULL,\n\t\t\t`updated` DATETIME NOT NULL,\n\t\t\tPRIMARY KEY (`id`)\n\t\t) ENGINE=INNODB;";
     $db->query($sql);
     $sql = "ALTER TABLE `fabmod_blog_blogs`\n\t\t\tADD CONSTRAINT `fk_blog_user`\n\t\t\tFOREIGN KEY (`user`)\n\t\t\tREFERENCES `fabmod_users_users`(`id`)\n\t\t\tON DELETE CASCADE";
     $db->query($sql);
     // map paths
     $pathmap =& FabriqModules::module('pathmap');
     $pathmap->register_path('blog/!#', 'blog', 'index', 'module', null, 1);
     $pathmap->register_path('blog/create', 'blog', 'create', 'module');
     $pathmap->register_path('blog/update/!#', 'blog', 'update', 'module', null, 2);
     $pathmap->register_path('blog/destroy/!#', 'blog', 'destroy', 'module', null, 2);
     $pathmap->register_path('blog/show/!#', 'blog', 'show', 'module', null, 2);
     // set module as installed
     $mod->installed = 1;
     $mod->update();
 }
 public function install()
 {
     $mod = new Modules();
     $mod->getModuleByName('fabriqinstall');
     $perms = array('update Fabriq');
     $perm_ids = FabriqModules::register_perms($mod->id, $perms);
     // map paths
     $pathmap =& FabriqModules::module('pathmap');
     $pathmap->register_path('fabriqinstall', 'fabriqinstall', 'install', 'module');
     $pathmap->register_path('fabriqinstall/install', 'fabriqinstall', 'install', 'module');
     $pathmap->register_path('fabriqinstall/install/!#', 'fabriqinstall', 'install', 'module', null, 2);
     $pathmap->register_path('fabriqinstall/update', 'fabriqinstall', 'update', 'module');
     $pathmap->register_path('fabriqinstall/update/!#', 'fabriqinstall', 'update', 'module', null, 2);
     // give administrators the ability to update the framework
     $adminPerm = FabriqModules::new_model('roles', 'ModulePerms');
     $adminPerm->permission = $perm_ids[0];
     $adminRole = FabriqModules::new_model('roles', 'Roles');
     $adminRole->getRole('administrator');
     $adminPerm->role = $adminRole->id;
     $adminPerm->id = $adminPerm->create();
     // set module as installed
     $mod->installed = 1;
     $mod->update();
 }