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);
|
$item = ORM::factory("item", $item_id);
|
||||||
access::required("view", $item);
|
access::required("view", $item);
|
||||||
|
|
||||||
$children = $item->children(null, 0, $where);
|
$children = $item->children(null, null, $where);
|
||||||
$encoded = array();
|
$encoded = array();
|
||||||
foreach ($children as $id => $child){
|
foreach ($children as $id => $child){
|
||||||
$encoded[$id] = self::child_json_encode($child);
|
$encoded[$id] = self::child_json_encode($child);
|
||||||
@ -44,7 +44,7 @@ class Json_Album_Controller extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function is_admin() {
|
function is_admin() {
|
||||||
if (user::active()->admin) {
|
if (identity::active_user()->admin) {
|
||||||
print json_encode(array("result" => "success", "csrf" => access::csrf_token()));
|
print json_encode(array("result" => "success", "csrf" => access::csrf_token()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ class Json_Album_Controller extends Controller {
|
|||||||
|
|
||||||
function albums($item_id) {
|
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){
|
function children($item_id){
|
||||||
|
@ -32,6 +32,9 @@ class Admin_register_Controller extends Admin_Controller {
|
|||||||
access::verify_csrf();
|
access::verify_csrf();
|
||||||
|
|
||||||
$post = new Validation($_POST);
|
$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();
|
$group_list = array();
|
||||||
if ($post->validate()) {
|
if ($post->validate()) {
|
||||||
module::set_var("registration", "policy", $post->policy);
|
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() {
|
public function activate() {
|
||||||
access::verify_csrf();
|
access::verify_csrf();
|
||||||
|
|
||||||
|
@ -37,13 +37,13 @@ class register_Controller extends Controller {
|
|||||||
$policy = module::get_var("registration", "policy");
|
$policy = module::get_var("registration", "policy");
|
||||||
if ($policy == "visitor") {
|
if ($policy == "visitor") {
|
||||||
if ($pending_user->state == 1) {
|
if ($pending_user->state == 1) {
|
||||||
Session::instance()->set("registration_first_usage");
|
|
||||||
$user = register::create_new_user($pending_user->id);
|
$user = register::create_new_user($pending_user->id);
|
||||||
|
Session::instance()->set("registration_first_usage");
|
||||||
auth::login($user);
|
auth::login($user);
|
||||||
Session::instance()->set("registration_first_usage", true);
|
Session::instance()->set("registration_first_usage", true);
|
||||||
$pending_user->delete();
|
$pending_user->delete();
|
||||||
} else {
|
} 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."));
|
message::success(t("A confirmation email has been sent to your email address."));
|
||||||
}
|
}
|
||||||
} else if ($pending_user->state == 1) {
|
} else if ($pending_user->state == 1) {
|
||||||
|
@ -21,8 +21,13 @@ class register_Core {
|
|||||||
private static $_states;
|
private static $_states;
|
||||||
|
|
||||||
static function format_registration_state($state) {
|
static function format_registration_state($state) {
|
||||||
if (empty(self::$_state)) {
|
if (empty(self::$_states)) {
|
||||||
self::$_states = array(t("Unconfirmed"), t("Confirmed"), t("Activated"));
|
$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];
|
return self::$_states[$state];
|
||||||
}
|
}
|
||||||
@ -37,10 +42,11 @@ class register_Core {
|
|||||||
return $user->loaded();
|
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 = new View("register_welcome.html");
|
||||||
$message->user = $user;
|
$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);
|
self::_sendemail($user->email, t("Your userid has been created"), $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
<? if (!empty($group_list)): ?>
|
<? if (!empty($group_list)): ?>
|
||||||
<label for="group" class="g-left"> <?= t("Default group: ") ?></label>
|
<label for="group" class="g-left"> <?= t("Default group: ") ?></label>
|
||||||
<?= form::dropdown(array("name" => "group"), $group_list, $form["group"]) ?></label>
|
<?= form::dropdown(array("name" => "group"), $group_list, $form["group"]) ?></label>
|
||||||
|
<? else: ?>
|
||||||
|
<?= form::hidden("group", $form["group"]) ?></label>
|
||||||
<? endif ?>
|
<? endif ?>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
Reference in New Issue
Block a user