2009-10-30 02:21:22 +00:00
|
|
|
<?php defined("SYSPATH") or die("No direct script access.");
|
|
|
|
/**
|
|
|
|
* Gallery - a web based photo album viewer and editor
|
2013-01-21 06:24:24 +00:00
|
|
|
* Copyright (C) 2000-2013 Bharat Mediratta
|
2009-10-30 02:21:22 +00:00
|
|
|
*
|
|
|
|
* 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,
|
2009-11-03 22:45:52 +00:00
|
|
|
`state` int(9) NOT NULL DEFAULT 0,
|
2009-10-30 02:21:22 +00:00
|
|
|
`full_name` varchar(255) NOT NULL,
|
|
|
|
`email` varchar(64) default NULL,
|
|
|
|
`hash` char(32) default NULL,
|
|
|
|
`url` varchar(255) default NULL,
|
2009-11-03 22:45:52 +00:00
|
|
|
`request_date` int(9) not NULL DEFAULT 0,
|
2009-10-30 02:21:22 +00:00
|
|
|
PRIMARY KEY (`id`),
|
2009-11-03 22:45:52 +00:00
|
|
|
UNIQUE KEY(`hash`, `state`),
|
2009-10-30 02:21:22 +00:00
|
|
|
UNIQUE KEY(`name`))
|
|
|
|
DEFAULT CHARSET=utf8;");
|
|
|
|
|
2009-10-30 20:19:57 +00:00
|
|
|
module::set_var("registration", "policy", "admin_only");
|
2009-10-30 02:21:22 +00:00
|
|
|
module::set_var("registration", "default_group", "");
|
2009-11-03 22:45:52 +00:00
|
|
|
module::set_var("registration", "email_verification", false);
|
2012-12-12 21:51:42 +00:00
|
|
|
// 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);
|
|
|
|
}
|
2009-10-30 02:21:22 +00:00
|
|
|
|
2012-12-12 21:51:42 +00:00
|
|
|
// 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);
|
2009-10-30 02:21:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static function uninstall() {
|
|
|
|
Database::instance()->query("DROP TABLE IF EXISTS {pending_users};");
|
2012-12-12 21:51:42 +00:00
|
|
|
// added Shad Laws, v2
|
|
|
|
module::clear_all_vars("registration");
|
2009-10-30 02:21:22 +00:00
|
|
|
}
|
|
|
|
}
|