Merge branch 'master' of github.com:gallery/gallery3-contrib
This commit is contained in:
commit
1d32548f8b
@ -37,9 +37,9 @@ alert("New title: <b>{$album->data->entity->title}</b>");
|
||||
|
||||
$photo = Gallery3::factory()
|
||||
->set("type", "photo")
|
||||
->set("name", "Sample Photo.jpg")
|
||||
->set("name", "Sample Photo.png")
|
||||
->set("title", "Sample Photo")
|
||||
->set_file("/tmp/foo.jpg")
|
||||
->set_file("gallery.png")
|
||||
->create($album->url, $auth);
|
||||
alert("Uploaded photo: <b>{$photo->url}</b>");
|
||||
alert("Album members: <b>" . join(", ", $album->data->members) . "</b>");
|
||||
|
BIN
client/gallery.png
Normal file
BIN
client/gallery.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
@ -126,6 +126,11 @@ class register_Controller extends Controller {
|
||||
print $v;
|
||||
}
|
||||
|
||||
public function change_password($id, $password) {
|
||||
$user = user::lookup($id);
|
||||
print $this->_get_change_password_form($user, $password);
|
||||
}
|
||||
|
||||
private function _get_form() {
|
||||
$minimum_length = module::get_var("user", "mininum_password_length", 5);
|
||||
$form = new Forge("register/handler", "", "post", array("id" => "g-register-form"));
|
||||
@ -146,4 +151,31 @@ class register_Controller extends Controller {
|
||||
$group->submit("")->value(t("Register"));
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the password change form. This code is copied from controllers/users.php. The
|
||||
* difference is that as this is the first time logging on, the user might not have
|
||||
* expected that they were going to have to enter the password displayed on the welcome
|
||||
* page, and didn't make note of it. If we were using the standard change password dialog, the
|
||||
* user would be screwed as there is no way to go back and get it. So with this dialog,
|
||||
* we will provide the old password as a hidden field.
|
||||
*/
|
||||
private function _get_change_password_form($user, $password) {
|
||||
$form = new Forge(
|
||||
"users/change_password/$user->id", "", "post", array("id" => "g-change-password-user-form"));
|
||||
$group = $form->group("change_password")->label(t("Change your password"));
|
||||
$group->hidden("old_password")->value($password);
|
||||
$group->password("password")->label(t("New password"))->id("g-password")
|
||||
->error_messages("min_length", t("Your new password is too short"));
|
||||
$group->script("")
|
||||
->text(
|
||||
'$("form").ready(function(){$(\'input[name="password"]\').user_password_strength();});');
|
||||
$group->password("password2")->label(t("Confirm new password"))->id("g-password2")
|
||||
->matches($group->password)
|
||||
->error_messages("matches", t("The passwords you entered do not match"));
|
||||
|
||||
module::event("user_change_password_form", $user, $form);
|
||||
$group->submit("")->value(t("Save"));
|
||||
return $form;
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@
|
||||
});
|
||||
</script>
|
||||
<div id="g-admin-register" class="g-block">
|
||||
<h1><?= t("User registration adminstration") ?></h1>
|
||||
<h1><?= t("User registration administration") ?></h1>
|
||||
<div id="g-registration-admin" class="g-block-content">
|
||||
<?= form::open($action, array("method" => "post"), $hidden) ?>
|
||||
<fieldset>
|
||||
|
@ -15,7 +15,7 @@
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="<?= url::site("form/edit/users/{$user->id}") ?>"
|
||||
<a href="<?= url::site("register/change_password/{$user->id}/$password") ?>"
|
||||
title="<?= t("Edit your profile")->for_html_attr() ?>"
|
||||
id="g-after-install-change-password-link"
|
||||
class="g-button ui-state-default ui-corners-all">
|
||||
|
@ -18,18 +18,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class rescue_task_Core {
|
||||
const LEFT = 0;
|
||||
const RIGHT = 1;
|
||||
|
||||
static function available_tasks() {
|
||||
return array(Task_Definition::factory()
|
||||
->callback("rescue_task::fix_mptt")
|
||||
->name(t("Fix Album/Photo hierarchy"))
|
||||
->description(t("Fix problems where your album/photo breadcrumbs are out of " .
|
||||
"sync with your actual hierarchy."))
|
||||
->severity(log::SUCCESS),
|
||||
|
||||
Task_Definition::factory()
|
||||
->callback("rescue_task::fix_internet_addresses")
|
||||
->name(t("Fix internet addresses"))
|
||||
->description(t("Fix internet addresses broken when upgrading to Beta 3"))
|
||||
@ -37,56 +27,6 @@ class rescue_task_Core {
|
||||
);
|
||||
}
|
||||
|
||||
static function fix_mptt($task) {
|
||||
$start = microtime(true);
|
||||
|
||||
$total = $task->get("total");
|
||||
if (empty($total)) {
|
||||
$task->set("total", $total = db::build()->count_records("items"));
|
||||
$task->set("stack", "1:" . self::LEFT);
|
||||
$task->set("ptr", 1);
|
||||
$task->set("completed", 0);
|
||||
}
|
||||
|
||||
$ptr = $task->get("ptr");
|
||||
$stack = explode(" ", $task->get("stack"));
|
||||
$completed = $task->get("completed");
|
||||
|
||||
// Implement a depth-first tree walk using a stack. Not the most efficient, but it's simple.
|
||||
while ($stack && microtime(true) - $start < 1.5) {
|
||||
list($id, $state) = explode(":", array_pop($stack));
|
||||
switch ($state) {
|
||||
case self::LEFT:
|
||||
self::set_left($id, $ptr++);
|
||||
$item = ORM::factory("item", $id);
|
||||
array_push($stack, $id . ":" . self::RIGHT);
|
||||
foreach (self::children($id) as $child) {
|
||||
array_push($stack, $child->id . ":" . self::LEFT);
|
||||
}
|
||||
break;
|
||||
|
||||
case self::RIGHT:
|
||||
self::set_right($id, $ptr++);
|
||||
$completed++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$task->set("stack", implode(" ", $stack));
|
||||
$task->set("ptr", $ptr);
|
||||
$task->set("completed", $completed);
|
||||
|
||||
if ($total == $completed) {
|
||||
$task->done = true;
|
||||
$task->state = "success";
|
||||
$task->percent_complete = 100;
|
||||
} else {
|
||||
$task->percent_complete = round(100 * $completed / $total);
|
||||
}
|
||||
$task->status = t2("One row updated", "%count / %total rows updated", $completed,
|
||||
array("total" => $total));
|
||||
}
|
||||
|
||||
static function fix_internet_addresses($task) {
|
||||
$start = microtime(true);
|
||||
|
||||
@ -131,29 +71,4 @@ class rescue_task_Core {
|
||||
$task->status = t2("One row updated", "%count / %total rows updated", $completed,
|
||||
array("total" => $total));
|
||||
}
|
||||
|
||||
static function children($parent_id) {
|
||||
return db::build()
|
||||
->select("id")
|
||||
->from("items")
|
||||
->where("parent_id", "=", $parent_id)
|
||||
->order_by("left_ptr", "ASC")
|
||||
->execute();
|
||||
}
|
||||
|
||||
static function set_left($id, $value) {
|
||||
db::build()
|
||||
->update("items")
|
||||
->set("left_ptr", $value)
|
||||
->where("id", "=", $id)
|
||||
->execute();
|
||||
}
|
||||
|
||||
static function set_right($id, $value) {
|
||||
db::build()
|
||||
->update("items")
|
||||
->set("right_ptr", $value)
|
||||
->where("id", "=", $id)
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
|
@ -29,4 +29,8 @@ class sso_event {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static function user_menu($menu, $theme) {
|
||||
$menu->remove("user_menu_logout");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user