static function install() { $version = module::get_version("organize"); if ($version == 0) { module::set_version("organize", 1); } }
static function install() { $version = module::get_version("moduleupdates"); if ($version == 0) { module::set_version("moduleupdates", 1); } }
static function install() { $version = module::get_version("akismet"); if ($version == 0) { module::set_version("akismet", 1); } }
static function install() { $version = module::get_version("info"); if ($version == 0) { module::set_version("info", 1); } }
static function install() { $db = Database::instance(); $version = module::get_version("user"); if ($version == 0) { $db->query("CREATE TABLE IF NOT EXISTS {users} (\n `id` int(9) NOT NULL auto_increment,\n `name` varchar(32) NOT NULL,\n `full_name` varchar(255) NOT NULL,\n `password` varchar(64) NOT NULL,\n `login_count` int(10) unsigned NOT NULL DEFAULT 0,\n `last_login` int(10) unsigned NOT NULL DEFAULT 0,\n `email` varchar(64) default NULL,\n `admin` BOOLEAN default 0,\n `guest` BOOLEAN default 0,\n `hash` char(32) default NULL,\n `url` varchar(255) default NULL,\n `locale` char(10) default NULL,\n PRIMARY KEY (`id`),\n UNIQUE KEY(`hash`),\n UNIQUE KEY(`name`))\n ENGINE=InnoDB DEFAULT CHARSET=utf8;"); $db->query("CREATE TABLE IF NOT EXISTS {groups} (\n `id` int(9) NOT NULL auto_increment,\n `name` char(64) default NULL,\n `special` BOOLEAN default 0,\n PRIMARY KEY (`id`),\n UNIQUE KEY(`name`))\n ENGINE=InnoDB DEFAULT CHARSET=utf8;"); $db->query("CREATE TABLE IF NOT EXISTS {groups_users} (\n `group_id` int(9) NOT NULL,\n `user_id` int(9) NOT NULL,\n PRIMARY KEY (`group_id`, `user_id`),\n UNIQUE KEY(`user_id`, `group_id`))\n ENGINE=InnoDB DEFAULT CHARSET=utf8;"); $everybody = group::create("Everybody"); $everybody->special = true; $everybody->save(); $registered = group::create("Registered Users"); $registered->special = true; $registered->save(); $guest = user::create("guest", "Guest User", ""); $guest->guest = true; $guest->remove($registered); $guest->save(); $admin = user::create("admin", "Gallery Administrator", "admin"); $admin->admin = true; $admin->save(); // Let the admin own everything $db->update("items", array("owner_id" => $admin->id), array("owner_id" => "IS NULL")); module::set_version("user", 1); $root = ORM::factory("item", 1); access::allow($everybody, "view", $root); access::allow($everybody, "view_full", $root); access::allow($registered, "view", $root); access::allow($registered, "view_full", $root); } }
static function install() { $version = module::get_version("slideshow"); if ($version == 0) { module::set_version("slideshow", 1); } }
static function install() { $version = module::get_version("media_rss"); if ($version == 0) { module::set_version("media_rss", 1); } }
static function install() { $version = module::get_version("recaptcha"); if ($version == 0) { module::set_version("recaptcha", 1); } }
static function install() { $version = module::get_version("recaptcha"); if ($version == 0) { module::set_version("recaptcha", 1); } recaptcha::check_config(); }
static function install() { $db = Database::instance(); $version = module::get_version("polar_rose"); if ($version == 0) { module::set_version("polar_rose", 1); } }
static function install() { $version = module::get_version("themeroller"); if ($version == 0) { /* @todo Put database creation here */ module::set_version("themeroller", 1); } }
static function install() { $version = module::get_version("akismet"); if ($version == 0) { module::set_version("akismet", 1); } akismet::check_config(); }
static function can_activate() { $messages = array(); if (module::get_version("gallery") < 56) { $messages["warn"][] = t("Movie Tools requires Gallery v3.0.5 or newer."); } return $messages; }
static function install() { $version = module::get_version("exif"); if ($version == 0) { $db = Database::instance(); $db->query("CREATE TABLE IF NOT EXISTS {exif_records} (\n `id` int(9) NOT NULL auto_increment,\n `item_id` INTEGER(9) NOT NULL,\n `key_count` INTEGER(9) default 0,\n `data` TEXT,\n `dirty` BOOLEAN default 1,\n PRIMARY KEY (`id`),\n KEY(`item_id`))\n ENGINE=InnoDB DEFAULT CHARSET=utf8;"); module::set_version("exif", 1); } }
static function install() { $version = module::get_version("search"); $db = Database::instance(); if ($version == 0) { $db->query("CREATE TABLE {search_records} (\n `id` int(9) NOT NULL auto_increment,\n `item_id` int(9),\n `dirty` boolean default 1,\n `data` LONGTEXT default NULL,\n PRIMARY KEY (`id`),\n KEY(`item_id`),\n FULLTEXT INDEX (`data`))\n ENGINE=MyISAM DEFAULT CHARSET=utf8;"); module::set_version("search", 1); } }
static function install() { $db = Database::instance(); $version = module::get_version("notification"); if ($version == 0) { $db->query("CREATE TABLE IF NOT EXISTS `subscriptions` (\n `id` int(9) NOT NULL auto_increment,\n `item_id` int(9) NOT NULL,\n `user_id` int(9) NOT NULL,\n PRIMARY KEY (`id`),\n UNIQUE KEY (`item_id`, `user_id`),\n UNIQUE KEY (`user_id`, `item_id`))\n ENGINE=InnoDB DEFAULT CHARSET=utf8;"); module::set_version("notification", 1); } }
static function module_change($changes) { // Gallery version must be >= 32 if (module::get_version("gallery") < 32) { site_status::warning(t("The module 'Module Order' requires Gallery core version of 32 or higher."), "moduleorder_needs_higherversion"); } else { site_status::clear("moduleorder_needs_higherversion"); } }
static function install() { $version = module::get_version("dynamic"); if ($version == 0) { module::set_var("dynamic", "popular", serialize((object) array("enabled" => false, "limit" => null, "description" => "", "key_field" => "view_count", "title" => t("Most viewed")))); module::set_var("dynamic", "updates", serialize((object) array("enabled" => false, "limit" => null, "description" => "", "key_field" => "created", "title" => t("Recent changes")))); module::set_version("dynamic", 1); } }
static function install() { $db = Database::instance(); $version = module::get_version("server_add"); if ($version == 0) { module::set_version("server_add", 1); } server_add::check_config(); }
static function install() { $db = Database::instance(); $version = module::get_version("tag"); if ($version == 0) { $db->query("CREATE TABLE IF NOT EXISTS {tags} (\n `id` int(9) NOT NULL auto_increment,\n `name` varchar(64) NOT NULL,\n `count` int(10) unsigned NOT NULL DEFAULT 0,\n PRIMARY KEY (`id`),\n UNIQUE KEY(`name`))\n ENGINE=InnoDB DEFAULT CHARSET=utf8;"); $db->query("CREATE TABLE IF NOT EXISTS {items_tags} (\n `id` int(9) NOT NULL auto_increment,\n `item_id` int(9) NOT NULL,\n `tag_id` int(9) NOT NULL,\n PRIMARY KEY (`id`),\n KEY(`tag_id`, `id`),\n KEY(`item_id`, `id`))\n ENGINE=InnoDB DEFAULT CHARSET=utf8;"); module::set_version("tag", 1); } }
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(); }
static function install() { $db = Database::instance(); $version = module::get_version("watermark"); if ($version == 0) { $db->query("CREATE TABLE IF NOT EXISTS `watermarks` (\n `id` int(9) NOT NULL auto_increment,\n `name` varchar(32) NOT NULL,\n `width` int(9) NOT NULL,\n `height` int(9) NOT NULL,\n `active` boolean default 0,\n `position` boolean default 0,\n `mime_type` varchar(64) default NULL,\n PRIMARY KEY (`id`),\n UNIQUE KEY(`name`))\n ENGINE=InnoDB DEFAULT CHARSET=utf8;"); @mkdir(VARPATH . "modules/watermark"); module::set_version("watermark", 1); } }
static function install() { $db = Database::instance(); $version = module::get_version("g2_import"); if ($version == 0) { $db->query("CREATE TABLE IF NOT EXISTS {g2_maps} (\n `id` int(9) NOT NULL auto_increment,\n `g2_id` int(9) NOT NULL,\n `g3_id` int(9) NOT NULL,\n PRIMARY KEY (`id`),\n KEY (`g2_id`))\n ENGINE=InnoDB DEFAULT CHARSET=utf8;"); module::set_version("g2_import", 1); mkdir(VARPATH . "modules/g2_import"); } }
static function install() { $db = Database::instance(); $version = module::get_version("comment"); if ($version == 0) { $db->query("CREATE TABLE IF NOT EXISTS {comments} (\n `author_id` int(9) default NULL,\n `created` int(9) NOT NULL,\n `guest_email` varchar(128) default NULL,\n `guest_name` varchar(128) default NULL,\n `guest_url` varchar(255) default NULL,\n `id` int(9) NOT NULL auto_increment,\n `item_id` int(9) NOT NULL,\n `server_http_accept_charset` varchar(64) default NULL,\n `server_http_accept_encoding` varchar(64) default NULL,\n `server_http_accept_language` varchar(64) default NULL,\n `server_http_accept` varchar(128) default NULL,\n `server_http_connection` varchar(64) default NULL,\n `server_http_host` varchar(64) default NULL,\n `server_http_referer` varchar(255) default NULL,\n `server_http_user_agent` varchar(128) default NULL,\n `server_query_string` varchar(64) default NULL,\n `server_remote_addr` varchar(32) default NULL,\n `server_remote_host` varchar(64) default NULL,\n `server_remote_port` varchar(16) default NULL,\n `state` char(15) default 'unpublished',\n `text` text,\n `updated` int(9) NOT NULL,\n PRIMARY KEY (`id`))\n ENGINE=InnoDB DEFAULT CHARSET=utf8;"); block_manager::add("dashboard_center", "comment", "recent_comments"); module::set_var("comment", "spam_caught", 0); module::set_version("comment", 1); } }
static function install() { $version = module::get_version("moduleupdates"); if ($version == 0) { module::set_version("moduleupdates", 2); //Remove the ModuleUpdates cache entry 'JIC' Cache::instance()->delete("ModuleUpdates"); //create the blank ModuleUpdates cache entry with an expiration of 0 days Cache::instance()->set("moduleupdates_cache", "", array("ModuleUpdates"), null); Cache::instance()->set("moduleupdates_cache_updates", "", array("ModuleUpdates"), null); } }
private function _get_view() { $view = new Admin_View("admin.html"); $view->page_title = t("Manage module order"); $view->content = new View("admin_moduleorder.html"); $view->content->csrf = access::csrf_token(); $view->content->available = new View("admin_moduleorder_blocks.html"); $view->content->active = new View("admin_moduleorder_blocks.html"); if (module::get_version("gallery") > 31) { $view->content->available->modules = $this->_get_modules(); } return $view; }
static function upgrade() { if (module::get_version("register") < 1) { module::install("register"); } if (is_null(module::get_var("registration", "admin_notify")) || is_null(module::get_var("registration", "subject_prefix")) || module::get_version("register") < 2) { module::set_var("registration", "admin_notify", false); module::set_var("registration", "subject_prefix", ""); $db = Database::instance(); $db->query("ALTER TABLE {pending_users} ADD `locale` varchar(32) default NULL;"); } module::set_version("register", 2); }
static function install() { $version = module::get_version("search"); $db = Database::instance(); if ($version == 0) { $db->query("CREATE TABLE `search_records` (\n `id` int(9) NOT NULL auto_increment,\n `item_id` int(9),\n `dirty` boolean default 1,\n `data` LONGTEXT default NULL,\n PRIMARY KEY (`id`),\n FULLTEXT INDEX (`data`))\n ENGINE=MyISAM DEFAULT CHARSET=utf8;"); // populate the index with dirty records $db->query("insert into `search_records` (`item_id`) SELECT `id` FROM `items`"); module::set_version("search", 1); if (ORM::factory("search_record")->count_all() < 10) { foreach (ORM::factory("search_record")->where("dirty", 1)->find_all() as $record) { search::update_record($record); } } else { search::check_index(); } } }
static function _build_request($function, $comment) { $comment_data = array(); $comment_data["HTTP_ACCEPT"] = $comment->server_http_accept; $comment_data["HTTP_ACCEPT_ENCODING"] = $comment->server_http_accept_encoding; $comment_data["HTTP_ACCEPT_LANGUAGE"] = $comment->server_http_accept_language; $comment_data["HTTP_CONNECTION"] = $comment->server_http_connection; $comment_data["HTTP_HOST"] = $comment->server_http_host; $comment_data["HTTP_USER_AGENT"] = $comment->server_http_user_agent; $comment_data["QUERY_STRING"] = $comment->server_query_string; $comment_data["REMOTE_ADDR"] = $comment->server_remote_addr; $comment_data["REMOTE_HOST"] = $comment->server_remote_host; $comment_data["REMOTE_PORT"] = $comment->server_remote_port; $comment_data["SERVER_HTTP_ACCEPT_CHARSET"] = $comment->server_http_accept_charset; $comment_data["blog"] = url::base(false, "http"); $comment_data["comment_author"] = $comment->author_name(); $comment_data["comment_author_email"] = $comment->author_email(); $comment_data["comment_author_url"] = $comment->author_url(); $comment_data["comment_content"] = $comment->text; $comment_data["comment_type"] = "comment"; $comment_data["permalink"] = url::site("comments/{$comment->id}"); $comment_data["referrer"] = $comment->server_http_referer; $comment_data["user_agent"] = $comment->server_http_user_agent; $comment_data["user_ip"] = $comment->server_remote_addr; $query_string = array(); foreach ($comment_data as $key => $data) { $query_string[] = "{$key}=" . urlencode($data); } $query_string = join("&", $query_string); $version = module::get_version("akismet"); $http_request = "POST /1.1/{$function} HTTP/1.0\r\n"; $http_request .= "Host: " . module::get_var("akismet", "api_key") . ".rest.akismet.com\r\n"; $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=UTF-8\r\n"; $http_request .= "Content-Length: " . strlen($query_string) . "\r\n"; $http_request .= "User-Agent: Gallery/3 | Akismet/{$version}\r\n"; $http_request .= "\r\n"; $http_request .= $query_string; return $http_request; }
/** * Check if obsolete modules are active and, if so, return a warning message. * If none are found, return null. */ static function get_obsolete_modules_message() { // This is the obsolete modules list. Any active module that's on the list // with version number at or below the one given will be considered obsolete. // It is hard-coded here, and may be updated with future releases of Gallery. $obsolete_modules = array("videos" => 4, "noffmpeg" => 1, "videodimensions" => 1, "digibug" => 2); // Before we check the active modules, deactivate any that are missing. module::deactivate_missing_modules(); $modules_found = array(); foreach ($obsolete_modules as $module => $version) { if (module::is_active($module) && module::get_version($module) <= $version) { $modules_found[] = $module; } } if ($modules_found) { // Need this to be on one super-long line or else the localization scanner may not work. // (ref: http://sourceforge.net/apps/trac/gallery/ticket/1321) return t("Recent upgrades to Gallery have made the following modules obsolete: %modules. We recommend that you <a href=\"%url_mod\">deactivate</a> the module(s). For more information, please see the <a href=\"%url_doc\">documentation page</a>.", array("modules" => implode(", ", $modules_found), "url_mod" => url::site("admin/modules"), "url_doc" => "http://codex.galleryproject.org/Gallery3:User_guide:Obsolete_modules")); } return null; }