当前位置: 首页>>代码示例>>PHP>>正文


PHP access::register_permission方法代码示例

本文整理汇总了PHP中access::register_permission方法的典型用法代码示例。如果您正苦于以下问题:PHP access::register_permission方法的具体用法?PHP access::register_permission怎么用?PHP access::register_permission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在access的用法示例。


在下文中一共展示了access::register_permission方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: upgrade

 static function upgrade($version)
 {
     if ($version == 2) {
         access::register_permission("downloadalbum", "Download album");
         module::set_version("downloadalbum", 3);
     }
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:7,代码来源:downloadalbum_installer.php

示例2: install

 static function install()
 {
     $db = Database::instance();
     $version = module::get_version("server_add");
     if ($version == 0) {
         access::register_permission("server_add", t("Add files from server"));
         module::set_version("server_add", 1);
     }
     server_add::check_config();
 }
开发者ID:xafr,项目名称:gallery3,代码行数:10,代码来源:server_add_installer.php

示例3: groups_and_permissions_are_bound_to_columns_test

 public function groups_and_permissions_are_bound_to_columns_test()
 {
     access::register_permission("access_test", "Access Test");
     $group = identity::create_group("access_test");
     // We have a new column for this perm / group combo
     $fields = Database::instance()->list_fields("access_caches");
     $this->assert_true(array_key_exists("access_test_{$group->id}", $fields));
     access::delete_permission("access_test");
     $group->delete();
     // Now the column has gone away
     $fields = Database::instance()->list_fields("access_caches");
     $this->assert_false(array_key_exists("access_test_{$group->id}", $fields));
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:13,代码来源:Access_Helper_Test.php

示例4: install

 static function install()
 {
     $db = Database::instance();
     $db->query("CREATE TABLE {access_caches} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `item_id` int(9),\n                 PRIMARY KEY (`id`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {access_intents} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `item_id` int(9),\n                 PRIMARY KEY (`id`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {caches} (\n                `id` int(9) NOT NULL auto_increment,\n                `key` varchar(255) NOT NULL,\n                `tags` varchar(255),\n                `expiration` int(9) NOT NULL,\n                `cache` longblob,\n                PRIMARY KEY (`id`),\n                KEY (`tags`))\n                DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {graphics_rules} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `active` BOOLEAN default 0,\n                 `args` varchar(255) default NULL,\n                 `module_name` varchar(64) NOT NULL,\n                 `operation` varchar(64) NOT NULL,\n                 `priority` int(9) NOT NULL,\n                 `target`  varchar(32) NOT NULL,\n                 PRIMARY KEY (`id`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {incoming_translations} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `key` char(32) NOT NULL,\n                 `locale` char(10) NOT NULL,\n                 `message` text NOT NULL,\n                 `revision` int(9) DEFAULT NULL,\n                 `translation` text,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`key`, `locale`),\n                 KEY `locale_key` (`locale`, `key`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {items} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `album_cover_item_id` int(9) default NULL,\n                 `captured` int(9) default NULL,\n                 `created` int(9) default NULL,\n                 `description` varchar(2048) default NULL,\n                 `height` int(9) default NULL,\n                 `left_ptr` int(9) NOT NULL,\n                 `level` int(9) NOT NULL,\n                 `mime_type` varchar(64) default NULL,\n                 `name` varchar(255) default NULL,\n                 `owner_id` int(9) default NULL,\n                 `parent_id` int(9) NOT NULL,\n                 `rand_key` float default NULL,\n                 `relative_path_cache` varchar(255) default NULL,\n                 `relative_url_cache` varchar(255) default NULL,\n                 `resize_dirty` boolean default 1,\n                 `resize_height` int(9) default NULL,\n                 `resize_width` int(9) default NULL,\n                 `right_ptr` int(9) NOT NULL,\n                 `slug` varchar(255) default NULL,\n                 `sort_column` varchar(64) default NULL,\n                 `sort_order` char(4) default 'ASC',\n                 `thumb_dirty` boolean default 1,\n                 `thumb_height` int(9) default NULL,\n                 `thumb_width` int(9) default NULL,\n                 `title` varchar(255) default NULL,\n                 `type` varchar(32) NOT NULL,\n                 `updated` int(9) default NULL,\n                 `view_count` int(9) default 0,\n                 `weight` int(9) NOT NULL default 0,\n                 `width` int(9) default NULL,\n                 PRIMARY KEY (`id`),\n                 KEY `parent_id` (`parent_id`),\n                 KEY `type` (`type`),\n                 KEY `random` (`rand_key`),\n                 KEY `weight` (`weight` DESC))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {logs} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `category` varchar(64) default NULL,\n                 `html` varchar(255) default NULL,\n                 `message` text default NULL,\n                 `referer` varchar(255) default NULL,\n                 `severity` int(9) default 0,\n                 `timestamp` int(9) default 0,\n                 `url` varchar(255) default NULL,\n                 `user_id` int(9) default 0,\n                 PRIMARY KEY (`id`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {messages} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `key` varchar(255) default NULL,\n                 `severity` varchar(32) default NULL,\n                 `value` varchar(255) default NULL,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`key`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {modules} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `active` BOOLEAN default 0,\n                 `name` varchar(64) default NULL,\n                 `version` int(9) default NULL,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`name`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {outgoing_translations} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `base_revision` int(9) DEFAULT NULL,\n                 `key` char(32) NOT NULL,\n                 `locale` char(10) NOT NULL,\n                 `message` text NOT NULL,\n                 `translation` text,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`key`, `locale`),\n                 KEY `locale_key` (`locale`, `key`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {permissions} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `display_name` varchar(64) default NULL,\n                 `name` varchar(64) default NULL,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`name`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {sessions} (\n                `session_id` varchar(127) NOT NULL,\n                `data` text NOT NULL,\n                `last_activity` int(10) UNSIGNED NOT NULL,\n                PRIMARY KEY (`session_id`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {tasks} (\n                `id` int(9) NOT NULL auto_increment,\n                `callback` varchar(128) default NULL,\n                `context` text NOT NULL,\n                `done` boolean default 0,\n                `name` varchar(128) default NULL,\n                `owner_id` int(9) default NULL,\n                `percent_complete` int(9) default 0,\n                `state` varchar(32) default NULL,\n                `status` varchar(255) default NULL,\n                `updated` int(9) default NULL,\n                PRIMARY KEY (`id`),\n                KEY (`owner_id`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {themes} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `name` varchar(64) default NULL,\n                 `version` int(9) default NULL,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`name`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {vars} (\n                `id` int(9) NOT NULL auto_increment,\n                `module_name` varchar(64) NOT NULL,\n                `name` varchar(64) NOT NULL,\n                `value` text,\n                PRIMARY KEY (`id`),\n                UNIQUE KEY(`module_name`, `name`))\n               DEFAULT CHARSET=utf8;");
     foreach (array("albums", "logs", "modules", "resizes", "thumbs", "tmp", "uploads") as $dir) {
         @mkdir(VARPATH . $dir);
     }
     access::register_permission("view", "View");
     access::register_permission("view_full", "View full size");
     access::register_permission("edit", "Edit");
     access::register_permission("add", "Add");
     // Mark for translation (must be the same strings as used above)
     t("View full size");
     t("View");
     t("Edit");
     t("Add");
     $root = ORM::factory("item");
     $root->type = "album";
     $root->title = "Gallery";
     $root->description = "";
     $root->left_ptr = 1;
     $root->right_ptr = 2;
     $root->parent_id = 0;
     $root->level = 1;
     $root->thumb_dirty = 1;
     $root->resize_dirty = 1;
     $root->sort_column = "weight";
     $root->sort_order = "ASC";
     $root->save();
     access::add_item($root);
     module::set_var("gallery", "active_site_theme", "wind");
     module::set_var("gallery", "active_admin_theme", "admin_wind");
     module::set_var("gallery", "page_size", 9);
     module::set_var("gallery", "thumb_size", 200);
     module::set_var("gallery", "resize_size", 640);
     module::set_var("gallery", "default_locale", "en_US");
     module::set_var("gallery", "image_quality", 75);
     module::set_var("gallery", "image_sharpen", 15);
     // Add rules for generating our thumbnails and resizes
     graphics::add_rule("gallery", "thumb", "gallery_graphics::resize", array("width" => 200, "height" => 200, "master" => Image::AUTO), 100);
     graphics::add_rule("gallery", "resize", "gallery_graphics::resize", array("width" => 640, "height" => 480, "master" => Image::AUTO), 100);
     // Instantiate default themes (site and admin)
     foreach (array("wind", "admin_wind") as $theme_name) {
         $theme_info = new ArrayObject(parse_ini_file(THEMEPATH . $theme_name . "/theme.info"), ArrayObject::ARRAY_AS_PROPS);
         $theme = ORM::factory("theme");
         $theme->name = $theme_name;
         $theme->version = $theme_info->version;
         $theme->save();
     }
     block_manager::add("dashboard_sidebar", "gallery", "block_adder");
     block_manager::add("dashboard_sidebar", "gallery", "stats");
     block_manager::add("dashboard_sidebar", "gallery", "platform_info");
     block_manager::add("dashboard_sidebar", "gallery", "project_news");
     block_manager::add("dashboard_center", "gallery", "welcome");
     block_manager::add("dashboard_center", "gallery", "photo_stream");
     block_manager::add("dashboard_center", "gallery", "log_entries");
     module::set_var("gallery", "choose_default_tookit", 1);
     module::set_var("gallery", "date_format", "Y-M-d");
     module::set_var("gallery", "date_time_format", "Y-M-d H:i:s");
     module::set_var("gallery", "time_format", "H:i:s");
     module::set_var("gallery", "show_credits", 1);
     // @todo this string needs to be picked up by l10n_scanner
     module::set_var("gallery", "credits", "Powered by <a href=\"%url\">Gallery %version</a>");
     module::set_var("gallery", "simultaneous_upload_limit", 5);
     module::set_version("gallery", 21);
 }
开发者ID:viosca,项目名称:gallery3,代码行数:80,代码来源:gallery_installer.php

示例5: install

 static function install()
 {
     $db = Database::instance();
     $db->query("CREATE TABLE {access_caches} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `item_id` int(9),\n                 PRIMARY KEY (`id`),\n                 KEY (`item_id`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {access_intents} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `item_id` int(9),\n                 PRIMARY KEY (`id`))\n               DEFAULT CHARSET=utf8;");
     // Using a simple index instead of a unique key for the
     // key column to avoid handling of concurrency issues
     // on insert. Thus allowing concurrent inserts on the
     // same cache key, as does Memcache / xcache.
     $db->query("CREATE TABLE {caches} (\n                `id` int(9) NOT NULL auto_increment,\n                `key` varchar(255) NOT NULL,\n                `tags` varchar(255),\n                `expiration` int(9) NOT NULL,\n                `cache` longblob,\n                PRIMARY KEY (`id`),\n                UNIQUE KEY (`key`),\n                KEY (`tags`))\n                DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {failed_auths} (\n                `id` int(9) NOT NULL auto_increment,\n                `count` int(9) NOT NULL,\n                `name` varchar(255) NOT NULL,\n                `time` int(9) NOT NULL,\n                PRIMARY KEY (`id`))\n                DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {graphics_rules} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `active` BOOLEAN default 0,\n                 `args` varchar(255) default NULL,\n                 `module_name` varchar(64) NOT NULL,\n                 `operation` varchar(64) NOT NULL,\n                 `priority` int(9) NOT NULL,\n                 `target`  varchar(32) NOT NULL,\n                 PRIMARY KEY (`id`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {incoming_translations} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `key` char(32) NOT NULL,\n                 `locale` char(10) NOT NULL,\n                 `message` text NOT NULL,\n                 `revision` int(9) DEFAULT NULL,\n                 `translation` text,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`key`, `locale`),\n                 KEY `locale_key` (`locale`, `key`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {items} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `album_cover_item_id` int(9) default NULL,\n                 `captured` int(9) default NULL,\n                 `created` int(9) default NULL,\n                 `description` text default NULL,\n                 `height` int(9) default NULL,\n                 `left_ptr` int(9) NOT NULL,\n                 `level` int(9) NOT NULL,\n                 `mime_type` varchar(64) default NULL,\n                 `name` varchar(255) default NULL,\n                 `owner_id` int(9) default NULL,\n                 `parent_id` int(9) NOT NULL,\n                 `rand_key` decimal(11,10) default NULL,\n                 `relative_path_cache` varchar(255) default NULL,\n                 `relative_url_cache` varchar(255) default NULL,\n                 `resize_dirty` boolean default 1,\n                 `resize_height` int(9) default NULL,\n                 `resize_width` int(9) default NULL,\n                 `right_ptr` int(9) NOT NULL,\n                 `slug` varchar(255) default NULL,\n                 `sort_column` varchar(64) default NULL,\n                 `sort_order` char(4) default 'ASC',\n                 `thumb_dirty` boolean default 1,\n                 `thumb_height` int(9) default NULL,\n                 `thumb_width` int(9) default NULL,\n                 `title` varchar(255) default NULL,\n                 `type` varchar(32) NOT NULL,\n                 `updated` int(9) default NULL,\n                 `view_count` int(9) default 0,\n                 `weight` int(9) NOT NULL default 0,\n                 `width` int(9) default NULL,\n                 PRIMARY KEY (`id`),\n                 KEY `parent_id` (`parent_id`),\n                 KEY `type` (`type`),\n                 KEY `random` (`rand_key`),\n                 KEY `weight` (`weight` DESC),\n                 KEY `left_ptr` (`left_ptr`),\n                 KEY `relative_path_cache` (`relative_path_cache`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {logs} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `category` varchar(64) default NULL,\n                 `html` varchar(255) default NULL,\n                 `message` text default NULL,\n                 `referer` varchar(255) default NULL,\n                 `severity` int(9) default 0,\n                 `timestamp` int(9) default 0,\n                 `url` varchar(255) default NULL,\n                 `user_id` int(9) default 0,\n                 PRIMARY KEY (`id`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {messages} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `key` varchar(255) default NULL,\n                 `severity` varchar(32) default NULL,\n                 `value` text default NULL,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`key`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {modules} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `active` BOOLEAN default 0,\n                 `name` varchar(64) default NULL,\n                 `version` int(9) default NULL,\n                 `weight` int(9) default NULL,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`name`),\n                 KEY (`weight`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {outgoing_translations} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `base_revision` int(9) DEFAULT NULL,\n                 `key` char(32) NOT NULL,\n                 `locale` char(10) NOT NULL,\n                 `message` text NOT NULL,\n                 `translation` text,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`key`, `locale`),\n                 KEY `locale_key` (`locale`, `key`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {permissions} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `display_name` varchar(64) default NULL,\n                 `name` varchar(64) default NULL,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`name`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {sessions} (\n                `session_id` varchar(127) NOT NULL,\n                `data` text NOT NULL,\n                `last_activity` int(10) UNSIGNED NOT NULL,\n                PRIMARY KEY (`session_id`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {tasks} (\n                `id` int(9) NOT NULL auto_increment,\n                `callback` varchar(128) default NULL,\n                `context` text NOT NULL,\n                `done` boolean default 0,\n                `name` varchar(128) default NULL,\n                `owner_id` int(9) default NULL,\n                `percent_complete` int(9) default 0,\n                `state` varchar(32) default NULL,\n                `status` varchar(255) default NULL,\n                `updated` int(9) default NULL,\n                PRIMARY KEY (`id`),\n                KEY (`owner_id`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {themes} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `name` varchar(64) default NULL,\n                 `version` int(9) default NULL,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`name`))\n               DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {vars} (\n                `id` int(9) NOT NULL auto_increment,\n                `module_name` varchar(64) NOT NULL,\n                `name` varchar(64) NOT NULL,\n                `value` text,\n                PRIMARY KEY (`id`),\n                UNIQUE KEY(`module_name`, `name`))\n               DEFAULT CHARSET=utf8;");
     foreach (array("albums", "logs", "modules", "resizes", "thumbs", "tmp", "uploads") as $dir) {
         @mkdir(VARPATH . $dir);
         if (in_array($dir, array("logs", "tmp", "uploads"))) {
             self::_protect_directory(VARPATH . $dir);
         }
     }
     access::register_permission("view", "View");
     access::register_permission("view_full", "View full size");
     access::register_permission("edit", "Edit");
     access::register_permission("add", "Add");
     // Mark for translation (must be the same strings as used above)
     t("View full size");
     t("View");
     t("Edit");
     t("Add");
     // Hardcode the first item to sidestep ORM validation rules
     $now = time();
     db::build()->insert("items", array("created" => $now, "description" => "", "left_ptr" => 1, "level" => 1, "parent_id" => 0, "resize_dirty" => 1, "right_ptr" => 2, "sort_column" => "weight", "sort_order" => "ASC", "thumb_dirty" => 1, "title" => "Gallery", "type" => "album", "updated" => $now, "weight" => 1))->execute();
     $root = ORM::factory("item", 1);
     access::add_item($root);
     module::set_var("gallery", "active_site_theme", "wind");
     module::set_var("gallery", "active_admin_theme", "admin_wind");
     module::set_var("gallery", "page_size", 9);
     module::set_var("gallery", "thumb_size", 200);
     module::set_var("gallery", "resize_size", 640);
     module::set_var("gallery", "default_locale", "en_US");
     module::set_var("gallery", "image_quality", 75);
     module::set_var("gallery", "image_sharpen", 15);
     module::set_var("gallery", "upgrade_checker_auto_enabled", true);
     // Add rules for generating our thumbnails and resizes
     graphics::add_rule("gallery", "thumb", "gallery_graphics::resize", array("width" => 200, "height" => 200, "master" => Image::AUTO), 100);
     graphics::add_rule("gallery", "resize", "gallery_graphics::resize", array("width" => 640, "height" => 640, "master" => Image::AUTO), 100);
     // Instantiate default themes (site and admin)
     foreach (array("wind", "admin_wind") as $theme_name) {
         $theme_info = new ArrayObject(parse_ini_file(THEMEPATH . $theme_name . "/theme.info"), ArrayObject::ARRAY_AS_PROPS);
         $theme = ORM::factory("theme");
         $theme->name = $theme_name;
         $theme->version = $theme_info->version;
         $theme->save();
     }
     block_manager::add("dashboard_sidebar", "gallery", "block_adder");
     block_manager::add("dashboard_sidebar", "gallery", "stats");
     block_manager::add("dashboard_sidebar", "gallery", "platform_info");
     block_manager::add("dashboard_sidebar", "gallery", "project_news");
     block_manager::add("dashboard_center", "gallery", "welcome");
     block_manager::add("dashboard_center", "gallery", "upgrade_checker");
     block_manager::add("dashboard_center", "gallery", "photo_stream");
     block_manager::add("dashboard_center", "gallery", "log_entries");
     module::set_var("gallery", "choose_default_tookit", 1);
     module::set_var("gallery", "date_format", "Y-M-d");
     module::set_var("gallery", "date_time_format", "Y-M-d H:i:s");
     module::set_var("gallery", "time_format", "H:i:s");
     module::set_var("gallery", "show_credits", 1);
     // Mark string for translation
     $powered_by_string = t("Powered by <a href=\"%url\">%gallery_version</a>", array("locale" => "root"));
     module::set_var("gallery", "credits", (string) $powered_by_string);
     module::set_var("gallery", "simultaneous_upload_limit", 5);
     module::set_var("gallery", "admin_area_timeout", 90 * 60);
     module::set_var("gallery", "maintenance_mode", 0);
     module::set_var("gallery", "visible_title_length", 15);
     module::set_var("gallery", "favicon_url", "lib/images/favicon.ico");
     module::set_var("gallery", "apple_touch_icon_url", "lib/images/apple-touch-icon.png");
     module::set_var("gallery", "email_from", "");
     module::set_var("gallery", "email_reply_to", "");
     module::set_var("gallery", "email_line_length", 70);
     module::set_var("gallery", "email_header_separator", serialize("\n"));
     module::set_var("gallery", "show_user_profiles_to", "registered_users");
     module::set_var("gallery", "extra_binary_paths", "/usr/local/bin:/opt/local/bin:/opt/bin");
     module::set_var("gallery", "timezone", null);
     module::set_var("gallery", "lock_timeout", 1);
     module::set_var("gallery", "movie_extract_frame_time", 3);
     module::set_var("gallery", "movie_allow_uploads", "autodetect");
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:96,代码来源:gallery_installer.php

示例6: install

 static function install()
 {
     $db = Database::instance();
     $version = 0;
     try {
         $version = module::get_version("core");
     } catch (Exception $e) {
         if ($e->getCode() != E_DATABASE_ERROR) {
             Kohana::log("error", $e);
             throw $e;
         }
     }
     if ($version == 0) {
         $db->query("CREATE TABLE `access_caches` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `item_id` int(9),\n                   PRIMARY KEY (`id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `access_intents` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `item_id` int(9),\n                   PRIMARY KEY (`id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `graphics_rules` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `priority` int(9) NOT NULL,\n                   `module_name` varchar(64) NOT NULL,\n                   `target`  varchar(32) NOT NULL,\n                   `operation` varchar(64) NOT NULL,\n                   `args` varchar(255) default NULL,\n                   PRIMARY KEY (`id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `items` (\n                   `album_cover_item_id` int(9) default NULL,\n                   `created` int(9) default NULL,\n                   `description` varchar(255) default NULL,\n                   `height` int(9) default NULL,\n                   `id` int(9) NOT NULL auto_increment,\n                   `left` int(9) NOT NULL,\n                   `level` int(9) NOT NULL,\n                   `mime_type` varchar(64) default NULL,\n                   `name` varchar(255) default NULL,\n                   `owner_id` int(9) default NULL,\n                   `parent_id` int(9) NOT NULL,\n                   `resize_height` int(9) default NULL,\n                   `resize_width` int(9) default NULL,\n                   `resize_dirty` boolean default 1,\n                   `right` int(9) NOT NULL,\n                   `thumb_height` int(9) default NULL,\n                   `thumb_width` int(9) default NULL,\n                   `thumb_dirty` boolean default 1,\n                   `title` varchar(255) default NULL,\n                   `type` varchar(32) NOT NULL,\n                   `updated` int(9) default NULL,\n                   `view_count` int(9) default 0,\n                   `width` int(9) default NULL,\n                   PRIMARY KEY (`id`),\n                   KEY `parent_id` (`parent_id`),\n                   KEY `type` (`type`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `logs` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `category` varchar(64) default NULL,\n                   `html` varchar(255) default NULL,\n                   `message` text default NULL,\n                   `referer` varchar(255) default NULL,\n                   `severity` int(9) default 0,\n                   `timestamp` int(9) default 0,\n                   `url` varchar(255) default NULL,\n                   `user_id` int(9) default 0,\n                   PRIMARY KEY (`id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `messages` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `key` varchar(255) default NULL,\n                   `value` varchar(255) default NULL,\n                   `severity` varchar(32) default NULL,\n                   PRIMARY KEY (`id`),\n                   UNIQUE KEY(`key`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `modules` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `name` varchar(64) default NULL,\n                   `version` int(9) default NULL,\n                   PRIMARY KEY (`id`),\n                   UNIQUE KEY(`name`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `themes` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `name` varchar(64) default NULL,\n                   `version` int(9) default NULL,\n                   PRIMARY KEY (`id`),\n                   UNIQUE KEY(`name`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `permissions` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `name` varchar(64) default NULL,\n                   `display_name` varchar(64) default NULL,\n                   PRIMARY KEY (`id`),\n                   UNIQUE KEY(`name`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `incoming_translations` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `key` binary(16) NOT NULL,\n                   `locale` char(10) NOT NULL,\n                   `message` text NOT NULL,\n                   `translation` text,\n                   `revision` int(9) DEFAULT NULL,\n                   PRIMARY KEY (`id`),\n                   UNIQUE KEY(`key`, `locale`),\n                   KEY `locale_key` (`locale`, `key`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `sessions` (\n                  `session_id` varchar(127) NOT NULL,\n                  `last_activity` int(10) UNSIGNED NOT NULL,\n                  `data` text NOT NULL,\n                  PRIMARY KEY (`session_id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `tasks` (\n                  `callback` varchar(128) default NULL,\n                  `context` text NOT NULL,\n                  `done` boolean default 0,\n                  `id` int(9) NOT NULL auto_increment,\n                  `updated` int(9) default NULL,\n                  `name` varchar(128) default NULL,\n                  `percent_complete` int(9) default 0,\n                  `state` varchar(32) default NULL,\n                  `status` varchar(255) default NULL,\n                  PRIMARY KEY (`id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `vars` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `module_name` varchar(64) NOT NULL,\n                   `name` varchar(64) NOT NULL,\n                   `value` text,\n                   PRIMARY KEY (`id`),\n                   UNIQUE KEY(`module_name`, `name`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         foreach (array("albums", "resizes", "thumbs", "uploads", "modules") as $dir) {
             @mkdir(VARPATH . $dir);
         }
         access::register_permission("view", "View");
         access::register_permission("view_full", "View Full Size");
         access::register_permission("edit", "Edit");
         $root = ORM::factory("item");
         $root->type = 'album';
         $root->title = "Gallery";
         $root->description = "Welcome to your Gallery3";
         $root->left = 1;
         $root->right = 2;
         $root->parent_id = 0;
         $root->level = 1;
         $root->thumb_dirty = 1;
         $root->resize_dirty = 1;
         $root->save();
         access::add_item($root);
         module::set_var("core", "active_site_theme", "default");
         module::set_var("core", "active_admin_theme", "admin_default");
         module::set_var("core", "page_size", 9);
         module::set_var("core", "thumb_size", 200);
         module::set_var("core", "resize_size", 640);
         // Add rules for generating our thumbnails and resizes
         graphics::add_rule("core", "thumb", "resize", array("width" => 200, "height" => 200, "master" => Image::AUTO), 100);
         graphics::add_rule("core", "resize", "resize", array("width" => 640, "height" => 480, "master" => Image::AUTO), 100);
         // Detect a graphics toolkit
         $toolkits = graphics::detect_toolkits();
         foreach (array("imagemagick", "graphicsmagick", "gd") as $tk) {
             if ($toolkits[$tk]) {
                 module::set_var("core", "graphics_toolkit", $tk);
                 if ($tk != "gd") {
                     module::set_var("core", "graphics_toolkit_path", $toolkits[$tk]);
                 }
                 break;
             }
         }
         if (!module::get_var("core", "graphics_toolkit")) {
             site_status::warning(t("Graphics toolkit missing!  Please <a href=\"%url\">choose a toolkit</a>", array("url" => url::site("admin/graphics"))), "missing_graphics_toolkit");
         }
         // Instantiate default themes (site and admin)
         foreach (array("default", "admin_default") as $theme_name) {
             $theme_info = new ArrayObject(parse_ini_file(THEMEPATH . $theme_name . "/theme.info"), ArrayObject::ARRAY_AS_PROPS);
             $theme = ORM::factory("theme");
             $theme->name = $theme_name;
             $theme->version = $theme_info->version;
             $theme->save();
         }
         block_manager::add("dashboard_sidebar", "core", "block_adder");
         block_manager::add("dashboard_sidebar", "core", "stats");
         block_manager::add("dashboard_sidebar", "core", "platform_info");
         block_manager::add("dashboard_sidebar", "core", "project_news");
         block_manager::add("dashboard_center", "core", "welcome");
         block_manager::add("dashboard_center", "core", "photo_stream");
         block_manager::add("dashboard_center", "core", "log_entries");
         module::set_version("core", 1);
         module::set_var("core", "version", "3.0");
     }
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:85,代码来源:core_installer.php


注:本文中的access::register_permission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。