1
0
This repository has been archived on 2021-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
gallery3-contrib/3.0/modules/register/helpers/register_installer.php
shadlaws ab0265b1c4 -proofsheet: updated to v7 (previously v4 on github)
-tag_cloud_html5: updated to v7 (previously v5 on github)
-short_search_fix: updated to v2 (previously v1 on github)
-register: updated to v2 (previously v1 on github)
-image_optimizer: v1
2012-12-12 22:51:42 +01:00

70 lines
2.9 KiB
PHP

<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2012 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class register_installer {
static function install() {
$db = Database::instance();
$db->query("CREATE TABLE IF NOT EXISTS {pending_users} (
`id` int(9) NOT NULL auto_increment,
`name` varchar(32) NOT NULL,
`state` int(9) NOT NULL DEFAULT 0,
`full_name` varchar(255) NOT NULL,
`email` varchar(64) default NULL,
`hash` char(32) default NULL,
`url` varchar(255) default NULL,
`request_date` int(9) not NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY(`hash`, `state`),
UNIQUE KEY(`name`))
DEFAULT CHARSET=utf8;");
module::set_var("registration", "policy", "admin_only");
module::set_var("registration", "default_group", "");
module::set_var("registration", "email_verification", false);
// added Shad Laws, v2
module::set_var("registration", "admin_notify", false);
module::set_var("registration", "subject_prefix", "");
$db->query("ALTER TABLE {pending_users} ADD `locale` varchar(32) default NULL;");
// changed Shad Laws, v2
module::set_version("register", 2);
}
// function added Shad Laws, v2
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 uninstall() {
Database::instance()->query("DROP TABLE IF EXISTS {pending_users};");
// added Shad Laws, v2
module::clear_all_vars("registration");
}
}