public function confirm($hash) { $pending_user = ORM::factory("pending_user")->where("hash", "=", $hash)->where("state", "=", 0)->find(); if ($pending_user->loaded()) { // @todo add a request date to the pending user table and check that it hasn't expired $policy = module::get_var("registration", "policy"); $pending_user->state = 1; $pending_user->save(); if ($policy == "vistor") { $user = register::create_new_user($pending_user->id); message::success(t("Your registration request has been approved")); auth::login($user); Session::instance()->set("registration_first_usage", true); $pending_user->delete(); } else { site_status::warning(t("There are pending user registration. <a href=\"%url\">Review now!</a>", array("url" => html::mark_clean(url::site("admin/register")), "locale" => module::get_var("gallery", "default_locale"))), "pending_user_registrations"); message::success(t("Your registration request is awaiting administrator approval")); // added by Shad Laws, v2 if (module::get_var("registration", "admin_notify") == 1) { register::send_admin_notify($pending_user); } } } else { message::error(t("Your registration request is no longer valid, Please re-register.")); } url::redirect(item::root()->abs_url()); }
static function upgrade($version) { log::info("aws_s3", "Commencing module upgrade (" . $version . ")"); switch ($version) { case 0: log::info("aws_s3", "Installing version 1"); @mkdir(VARPATH . "modules/aws_s3"); @mkdir(VARPATH . "modules/aws_s3/log"); // installation's unique identifier - allows multiple g3's pointing to the same s3 bucket. if (!module::get_var("aws_s3", "g3id")) { module::set_var("aws_s3", "g3id", md5(time())); } module::set_var("aws_s3", "synced", false); module::set_var("aws_s3", "enabled", false); module::set_var("aws_s3", "access_key", ""); module::set_var("aws_s3", "secret_key", ""); module::set_var("aws_s3", "bucket_name", ""); module::set_version("aws_s3", 1); case 1: log::info("aws_s3", "Upgrading to version 2"); $db = Database::instance(); $db->query("CREATE TABLE {aws_s3_meta} (\n `item_id` int(9) NOT NULL,\n `item_hash` varchar(32) NOT NULL DEFAULT '',\n `thumb_uploaded` smallint(1) NOT NULL DEFAULT 0,\n `resize_uploaded` smallint(1) NOT NULL DEFAULT 0,\n `fullsize_uploaded` smallint(1) NOT NULL DEFAULT 0,\n `local_deleted` smallint(1) NOT NULL DEFAULT 0,\n PRIMARY KEY (`item_id`)\n ) DEFAULT CHARSET=utf8;"); module::set_var("aws_s3", "upload_thumbs", true); module::set_var("aws_s3", "upload_resizes", true); module::set_var("aws_s3", "upload_fullsizes", true); module::set_var("aws_s3", "s3_storage_only", false); if (module::get_var("aws_s3", "synced")) { // v1 has already synced this installation to s3. mark all the items with the relevant meta data $items = ORM::factory("item")->find_all(); foreach ($items as $item) { aws_s3::log("Updating S3 meta for item ID: " . $item->id); $item->s3_thumb_uploaded = true; if (!$item->is_album()) { $item->s3_resize_uploaded = true; $item->s3_fullsize_uploaded = true; } $item->s3_local_deleted = false; $item->s3_item_hash = md5($item->relative_path()); $item->save_s3_meta(); } } else { // check various states after upgrade from v1.. if (module::get_var("aws_s3", "access_key") != "" && module::get_var("aws_s3", "secret_key") != "" && module::get_var("aws_s3", "bucket_name") != "" && aws_s3::validate_access_details(module::get_var("aws_s3", "access_key"), module::get_var("aws_s3", "secret_key"), module::get_var("aws_s3", "bucket_name"))) { // details are correct but hasn't been synced. if (aws_s3::can_schedule()) { // i can schedule this task aws_s3::schedule_full_sync2(); site_status::warning("Your site has been scheduled for full Amazon S3 re-synchronisation. This message will clear when this has been completed.", "aws_s3_not_synced"); } else { // i CAN'T schedule it.. site_status::warning(t('Your site has not been synchronised to Amazon S3. Until it has, your server will continue to serve image content to your visitors.<br />Click <a href="%url" class="g-dialog-link">here</a> to start the synchronisation task.', array("url" => html::mark_clean(url::site("admin/maintenance/start/aws_s3_task::manual_sync?csrf=__CSRF__")))), "aws_s3_not_synced"); } } else { site_status::warning(t('Amazon S3 module needs configuration. Click <a href="%url">here</a> to go to the configuration page.', array("url" => html::mark_clean(url::site("admin/aws_s3")))), "aws_s3_not_configured"); } } module::set_version("aws_s3", 2); } log::info("aws_s3", "Module upgrade complete"); }
/** * @return string An error message suitable for inclusion in the task log */ static function check_index() { list($remaining) = search::stats(); if ($remaining) { site_status::warning(t('Your search index needs to be updated. <a href="%url" class="g-dialog-link">Fix this now</a>', array("url" => html::mark_clean(url::site("admin/maintenance/start/search_task::update_index?csrf=__CSRF__")))), "search_index_out_of_date"); } }
public function index() { // require_once(MODPATH . "aws_s3/lib/s3.php"); $form = $this->_get_s3_form(); if (request::method() == "post") { access::verify_csrf(); if ($form->validate()) { module::set_var("aws_s3", "enabled", isset($_POST['enabled']) ? true : false); module::set_var("aws_s3", "access_key", $_POST['access_key']); module::set_var("aws_s3", "secret_key", $_POST['secret_key']); module::set_var("aws_s3", "bucket_name", $_POST['bucket_name']); module::set_var("aws_s3", "g3id", $_POST['g3id']); module::set_var("aws_s3", "url_str", $_POST['url_str']); module::set_var("aws_s3", "sig_exp", $_POST['sig_exp']); module::set_var("aws_s3", "use_ssl", isset($_POST['use_ssl']) ? true : false); if (module::get_var("aws_s3", "enabled") && !module::get_var("aws_s3", "synced", false)) { site_status::warning(t('Your site has not yet been syncronised with your Amazon S3 bucket. Content will not appear correctly until you perform syncronisation. <a href="%url" class="g-dialog-link">Fix this now</a>', array("url" => html::mark_clean(url::site("admin/maintenance/start/aws_s3_task::sync?csrf=__CSRF__")))), "aws_s3_not_synced"); } message::success(t("Settings have been saved")); url::redirect("admin/aws_s3"); } else { message::error(t("There was a problem with the submitted form. Please check your values and try again.")); } } $v = new Admin_View("admin.html"); $v->page_title = t("Amazon S3 Configuration"); $v->content = new View("admin_aws_s3.html"); $v->content->form = $form; $v->content->end = ""; echo $v; }
static function report_ppm_support($toolkit_id) { if (array_key_exists($toolkit_id, rawphoto_graphics::get_supported_toolkits())) { site_status::clear("rawphoto_needs_ppm_support"); } else { site_status::warning(t('The <em>Raw Photos</em> module requires a supporting graphics toolkit. ' . '<a href="%activate_url">Activate</a> either ImageMagick or GraphicsMagick.', array("activate_url" => url::site("admin/graphics"))), "rawphoto_needs_ppm_support"); } }
static function module_change($changes) { if (!module::is_active("rss") || in_array("rss", $changes->deactivate)) { site_status::warning(t("The Slideshow module requires the RSS module. <a href=\"%url\">Activate the RSS module now</a>", array("url" => html::mark_clean(url::site("admin/modules")))), "slideshow_needs_rss"); } else { site_status::clear("slideshow_needs_rss"); } }
static function module_change($changes) { if (!module::is_active("tag") || in_array("tag", $changes->deactivate)) { site_status::warning(t("The DisplayTags module requires the Tags module. <a href=\"%url\">Activate the Tags module now</a>", array("url" => html::mark_clean(url::site("admin/modules")))), "displaytags_needs_tag"); } else { site_status::clear("displaytags_needs_tag"); } }
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 module_change($changes) { // Display a warning message if the RSS module is not installed. if (!module::is_active("rss") || in_array("rss", $changes->deactivate)) { site_status::warning(t("The MiniSlide Show module requires the RSS module. " . "<a href=\"%url\">Activate the RSS module now</a>", array("url" => url::site("admin/modules"))), "minislideshow_needs_rss"); } else { site_status::clear("minislideshow_needs_rss"); } }
static function module_change($changes) { // If EXIF is deactivated, display a warning that it is required for this module to function properly. if (!module::is_active("exif") || in_array("exif", $changes->deactivate)) { site_status::warning(t("The EXIF_GPS module requires the EXIF module. " . "<a href=\"%url\">Activate the EXIF module now</a>", array("url" => html::mark_clean(url::site("admin/modules")))), "exif_gps_needs_exif"); } else { site_status::clear("exif_gps_needs_exif"); } }
static function module_change($changes) { // See if the Photo Annotation module is installed, // tell the user to install it if it isn't. if (!module::is_active("photoannotation") || in_array("photoannotation", $changes->deactivate)) { site_status::warning(t("The Picasa Faces module requires the Photo Annotation module. " . "<a href=\"%url\">Activate the Photo Annotation module now</a>", array("url" => url::site("admin/modules"))), "picasa_faces_needs_photoannotation"); } else { site_status::clear("picasa_faces_needs_photoannotation"); } }
static function check_config() { $public_key = module::get_var("recaptcha", "public_key"); $private_key = module::get_var("recaptcha", "private_key"); if (empty($public_key) || empty($private_key)) { site_status::warning(t("reCAPTCHA is not quite ready! Please configure the <a href=\"%url\">reCAPTCHA Keys</a>", array("url" => html::mark_clean(url::site("admin/recaptcha")))), "recaptcha_config"); } else { site_status::clear("recaptcha_config"); } }
static function module_change($changes) { // See if the Tags module is installed, // tell the user to install it if it isn't. if (!module::is_active("tag") || in_array("tag", $changes->deactivate)) { site_status::warning(t("The TagsMap module requires the Tags module. " . "<a href=\"%url\">Activate the Tags module now</a>", array("url" => url::site("admin/modules"))), "tagsmap_needs_tag"); } else { site_status::clear("tagsmap_needs_tag"); } }
static function check_config($paths = null) { if ($paths === null) { $paths = unserialize(module::get_var("videos", "authorized_paths")); } if (empty($paths)) { site_status::warning(t("Videos needs configuration. <a href=\"%url\">Configure it now!</a>", array("url" => html::mark_clean(url::site("admin/videos")))), "videos_configuration"); } else { site_status::clear("videos_configuration"); } }
static function check_config($paths = null) { if ($paths === null) { $paths = unserialize(module::get_var("server_add", "authorized_paths")); } if (empty($paths)) { site_status::warning(t("Server Add needs configuration. <a href=\"%url\">Configure it now!</a>", array("url" => url::site("admin/server_add"))), "server_add_configuration"); } else { site_status::clear("server_add_configuration"); } }
static function activate() { site_status::warning(t("Activate."), "gd_init_configuration"); if (module::get_var("gallery", "resize_size") != 800) { module::set_var("gallery", "resize_size", 800); } if (module::get_var("gallery", "thumb_size") != 200) { module::set_var("gallery", "thumb_size", 200); } if (module::get_var("gallery", "page_size") != 50) { module::set_var("gallery", "page_size", 50); } }
static function module_change($changes) { // See if the Tags module is installed, // tell the user to install it if it isn't. if (!module::is_active("tag") || in_array("tag", $changes->deactivate)) { site_status::warning(t("The Photo Annotation module requires the Tags module. " . "<a href=\"%url\">Activate the Tags module now</a>", array("url" => url::site("admin/modules"))), "photoannotation_needs_tag"); } else { site_status::clear("photoannotation_needs_tag"); } if (module::is_active("tagfaces") || in_array("tagfaces", $changes->activate)) { site_status::warning(t("The Photo Annotation module cannot be used together with the TagFaces module. " . "<a href=\"%url\">Dectivate the TagFaces module now</a>", array("url" => url::site("admin/modules"))), "photoannotation_incompatibility_tagfaces"); } else { site_status::clear("photoannotation_incompatibility_tagfaces"); } }
static function report_item_conversion_support() { if (gallery::RELEASE_CHANNEL == "release") { if (version_compare(gallery::VERSION, rawphoto_version::MIN_RELEASE_VERSION, ">=")) { site_status::clear("rawphoto_needs_item_conversion_support"); } else { site_status::warning(t("The <em>Raw Photos</em> module requires Gallery %version or higher.", array("version" => rawphoto_version::MIN_RELEASE_VERSION)), "rawphoto_needs_item_conversion_support"); } } else { if (version_compare(gallery::build_number(), rawphoto_version::MIN_BUILD_NUMBER, ">=")) { site_status::clear("rawphoto_needs_item_conversion_support"); } else { site_status::warning(t("The <em>Raw Photos</em> module requires Gallery %version, build %build_number or higher.", array("version" => gallery::VERSION, "build_number" => rawphoto_version::MIN_BUILD_NUMBER)), "rawphoto_needs_item_conversion_support"); } } }
/** * Check whether the module's configured correctly * @return boolean */ static function check_config() { $login = module::get_var("bitly", "login"); $api_key = module::get_var("bitly", "api_key"); if (empty($login) || empty($api_key)) { site_status::warning(t("bit.ly is not quite ready! Please provide a <a href=\"%url\">login and API Key</a>", array("url" => html::mark_clean(url::site("admin/bitly")))), "bitly_config"); } else { if (!self::validate_config($login, $api_key)) { site_status::warning(t("bit.ly is not properly configured! URLs will not be shortened until its <a href=\"%url\">configuration</a> is updated.", array("url" => html::mark_clean(url::site("admin/bitly")))), "bitly_config"); } else { site_status::clear("bitly_config"); return true; } } return false; }
static function check_config() { $api_key = module::get_var("akismet", "api_key"); if (empty($api_key)) { site_status::warning(t("Akismet is not quite ready! Please provide an <a href=\"%url\">API Key</a>", array("url" => html::mark_clean(url::site("admin/akismet")))), "akismet_config"); } else { site_status::clear("akismet_config"); } }
static function schedule_full_sync($this_task) { if (!self::can_schedule()) { throw new Exception("Unable to initialize schedule"); } try { self::schedule_full_sync2(); $this_task->status = "Scheduled re-sync task"; $this_task->done = true; $this_task->state = "success"; $this_task->percent_complete = 100; } catch (Exception $err) { $task->done = true; $thisSynchronise_task->state = "error"; $this_task->status = $err->getMessage(); $this_task->log((string) $err); } $this_task->save(); if (!module::get_var("aws_s3", "synced", false)) { site_status::warning("Your site has been scheduled for full Amazon S3 re-synchronisation. This message will clear when this has been completed.", "aws_s3_not_synced"); } return true; }
/** * Return the list of available modules, including uninstalled modules. */ static function available() { if (empty(self::$available)) { $modules = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS); foreach (glob(MODPATH . "*/module.info") as $file) { $module_name = basename(dirname($file)); $modules->{$module_name} = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS); foreach ($modules->{$module_name} as &$value) { $value = html::purify($value); } $m =& $modules->{$module_name}; $m->installed = module::is_installed($module_name); $m->active = module::is_active($module_name); $m->code_version = $m->version; $m->version = module::get_version($module_name); $m->locked = false; if ($m->active && $m->version != $m->code_version) { site_status::warning(t("Some of your modules are out of date. <a href=\"%upgrader_url\">Upgrade now!</a>", array("upgrader_url" => url::abs_site("upgrader"))), "upgrade_now"); } } // Lock certain modules $modules->gallery->locked = true; $identity_module = module::get_var("gallery", "identity_provider", "user"); $modules->{$identity_module}->locked = true; $modules->uasort(array("module", "module_comparator")); self::$available = $modules; } return self::$available; }
static function activate_update_mode($target) { // find all currently active non-image-optimizer rules $rules = db::build()->from("graphics_rules")->select("id")->where("active", "=", true)->where("target", "=", $target)->where("module_name", "!=", "image_optimizer")->execute(); // use found rules to build ids array and deactivate rules $ids = array(); foreach ($rules as $rule) { $ids[] = $rule->id; db::build()->update("graphics_rules")->where("id", "=", $rule->id)->set("active", false)->execute(); } // set module variable as deactivated rule ids module::set_var("image_optimizer", "update_mode_" . $target, serialize($ids)); // display a warning that we're in update mode site_status::warning(t("Image optimizer is in thumb/resize update mode - remember to exit <a href=\"%url\">here</a> after rebuild!", array("url" => html::mark_clean(url::site("admin/image_optimizer")))), "image_optimizer_update_mode"); }
/** * Has this Gallery been registered at dev.twitter.com/app? * @return boolean */ static function is_registered() { $consumer_key = module::get_var("twitter", "consumer_key"); $consumer_secret = module::get_var("twitter", "consumer_secret"); if (empty($consumer_key) || empty($consumer_secret)) { site_status::warning(t("Twitter module requires attention! Set the <a href=\"%url\">consumer key and secret</a>.", array("url" => html::mark_clean(url::site("admin/twitter")))), "twitter_config"); return false; } else { site_status::clear("twitter_config"); return true; } }
static function install() { site_status::warning(t("Initial configuration for the theme may be required. Visit Admin\\Appearance\\Theme Options before continue."), "gd_init_configuration"); }
/** * Mark all thumbnails and resizes as dirty. They will have to be rebuilt. */ static function mark_all_dirty() { $db = Database::instance(); $db->query("UPDATE `items` SET `thumb_dirty` = 1, `resize_dirty` = 1"); $count = self::find_dirty_images_query()->count(); if ($count) { site_status::warning(t2("One of your photos is out of date. %link_startClick here to fix it%link_end", "%count of your photos are out of date. %link_startClick here to fix them%link_end", $count, array("link_start" => "<a href=\"" . url::site("admin/maintenance/start/core_task::rebuild_dirty_images?csrf=__CSRF__") . "\" class=\"gDialogLink\">", "link_end" => "</a>")), "graphics_dirty"); } }
static function check_index() { list($remaining) = exif::stats(); if ($remaining) { site_status::warning(t('Your EXIF index needs to be updated. <a href="%url" class="gDialogLink">Fix this now</a>', array("url" => url::site("admin/maintenance/start/exif_task::update_index?csrf=__CSRF__"))), "exif_index_out_of_date"); } }
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"); } }
/** * This needs to be run once, after the initial install, to choose a graphics toolkit. */ static function choose_default_toolkit() { // Detect a graphics toolkit $toolkits = graphics::detect_toolkits(); foreach (array("imagemagick", "graphicsmagick", "gd") as $tk) { if ($toolkits[$tk]) { module::set_var("gallery", "graphics_toolkit", $tk); module::set_var("gallery", "graphics_toolkit_path", $tk == "gd" ? "" : $toolkits[$tk]); break; } } if (!module::get_var("gallery", "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"); } }
static function check_for_dirty() { $q = emboss::find_dirty(); $n = $q->count(); if ($n > 0) { $url = url::site('admin/maintenance/start/emboss_task::update_overlays?csrf=__CSRF__'); site_status::warning(t2("One of your photos needs to be (re)embossed. <a %attrs>Click here to fix it</a>", "%count of your photos need to be (re)embossed. <a %attrs>Click here to fix them</a>", $n, array('attrs' => html::mark_clean(sprintf('href="%s" class="g-dialog-link"', $url)))), 'emboss_dirty'); } else { site_status::clear('emboss_dirty'); } }