Merge commit 'gallery3-contrib/master'
This commit is contained in:
commit
18c71cbb1e
@ -34,7 +34,7 @@ class Json_Album_Controller extends Controller {
|
||||
$item = ORM::factory("item", $item_id);
|
||||
access::required("view", $item);
|
||||
|
||||
$children = $item->children(null, 0, $where);
|
||||
$children = $item->children(null, null, $where);
|
||||
$encoded = array();
|
||||
foreach ($children as $id => $child){
|
||||
$encoded[$id] = self::child_json_encode($child);
|
||||
@ -44,7 +44,7 @@ class Json_Album_Controller extends Controller {
|
||||
}
|
||||
|
||||
function is_admin() {
|
||||
if (user::active()->admin) {
|
||||
if (identity::active_user()->admin) {
|
||||
print json_encode(array("result" => "success", "csrf" => access::csrf_token()));
|
||||
return;
|
||||
}
|
||||
@ -54,7 +54,7 @@ class Json_Album_Controller extends Controller {
|
||||
|
||||
function albums($item_id) {
|
||||
|
||||
print $this->child_elements($item_id,array("type" => "album"));
|
||||
print $this->child_elements($item_id, array(array("type", "=", "album")));
|
||||
}
|
||||
|
||||
function children($item_id){
|
||||
|
@ -32,6 +32,9 @@ class Admin_register_Controller extends Admin_Controller {
|
||||
access::verify_csrf();
|
||||
|
||||
$post = new Validation($_POST);
|
||||
$post->add_rules("policy", "required");
|
||||
$post->add_rules("group", array($this, "passthru"));
|
||||
$post->add_rules("email_verification", array($this, "passthru"));
|
||||
$group_list = array();
|
||||
if ($post->validate()) {
|
||||
module::set_var("registration", "policy", $post->policy);
|
||||
@ -49,6 +52,12 @@ class Admin_register_Controller extends Admin_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
// We need this validation callback in order to have the optional fields copied to
|
||||
// validation array.
|
||||
public function passthru($field) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function activate() {
|
||||
access::verify_csrf();
|
||||
|
||||
|
@ -37,13 +37,13 @@ class register_Controller extends Controller {
|
||||
$policy = module::get_var("registration", "policy");
|
||||
if ($policy == "visitor") {
|
||||
if ($pending_user->state == 1) {
|
||||
Session::instance()->set("registration_first_usage");
|
||||
$user = register::create_new_user($pending_user->id);
|
||||
Session::instance()->set("registration_first_usage");
|
||||
auth::login($user);
|
||||
Session::instance()->set("registration_first_usage", true);
|
||||
$pending_user->delete();
|
||||
} else {
|
||||
register::send_confirmation($pending_user);
|
||||
$user = register::create_new_user($pending_user->id, true);
|
||||
message::success(t("A confirmation email has been sent to your email address."));
|
||||
}
|
||||
} else if ($pending_user->state == 1) {
|
||||
|
@ -21,8 +21,13 @@ class register_Core {
|
||||
private static $_states;
|
||||
|
||||
static function format_registration_state($state) {
|
||||
if (empty(self::$_state)) {
|
||||
self::$_states = array(t("Unconfirmed"), t("Confirmed"), t("Activated"));
|
||||
if (empty(self::$_states)) {
|
||||
$policy = module::get_var("registration", "policy");
|
||||
$email_verification = module::get_var("registration", "email_verification");
|
||||
$pending = $policy == "admin_only" || ($policy == "admin_approval" && !$email_verification);
|
||||
self::$_states = array(t("Unconfirmed"),
|
||||
$pending ? t("Pending") : t("Confirmed"),
|
||||
t("Activated"));
|
||||
}
|
||||
return self::$_states[$state];
|
||||
}
|
||||
@ -37,10 +42,11 @@ class register_Core {
|
||||
return $user->loaded();
|
||||
}
|
||||
|
||||
static function send_user_created_confirmation($user) {
|
||||
static function send_user_created_confirmation($user, $requires_first=false) {
|
||||
$message = new View("register_welcome.html");
|
||||
$message->user = $user;
|
||||
$message->site_url = url::abs_site("register/first/{$user->hash}");
|
||||
$message->site_url = $requires_first ? url::abs_site("register/first/{$user->hash}") :
|
||||
url::abs_site("");
|
||||
self::_sendemail($user->email, t("Your userid has been created"), $message);
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,8 @@
|
||||
<? if (!empty($group_list)): ?>
|
||||
<label for="group" class="g-left"> <?= t("Default group: ") ?></label>
|
||||
<?= form::dropdown(array("name" => "group"), $group_list, $form["group"]) ?></label>
|
||||
<? else: ?>
|
||||
<?= form::hidden("group", $form["group"]) ?></label>
|
||||
<? endif ?>
|
||||
</li>
|
||||
<li>
|
||||
|
Reference in New Issue
Block a user