more tests, more fixes
This commit is contained in:
parent
f574d0d81d
commit
d959c174a1
@ -94,7 +94,7 @@ class PM extends SimpleExtension {
|
|||||||
$database->execute("DELETE FROM private_message WHERE id = ?", array($pm_id));
|
$database->execute("DELETE FROM private_message WHERE id = ?", array($pm_id));
|
||||||
log_info("pm", "Deleted PM #$pm_id");
|
log_info("pm", "Deleted PM #$pm_id");
|
||||||
$page->set_mode("redirect");
|
$page->set_mode("redirect");
|
||||||
$page->set_redirect(make_link($_SERVER["REFERER"]));
|
$page->set_redirect($_SERVER["HTTP_REFERER"]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// permission denied
|
// permission denied
|
||||||
@ -107,7 +107,7 @@ class PM extends SimpleExtension {
|
|||||||
$message = $_POST["message"];
|
$message = $_POST["message"];
|
||||||
send_event(new SendPMEvent($from_id, $_SERVER["REMOTE_ADDR"], $to_id, $subject, $message));
|
send_event(new SendPMEvent($from_id, $_SERVER["REMOTE_ADDR"], $to_id, $subject, $message));
|
||||||
$page->set_mode("redirect");
|
$page->set_mode("redirect");
|
||||||
$page->set_redirect(make_link($_SERVER["REFERER"]));
|
$page->set_redirect($_SERVER["HTTP_REFERER"]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->theme->display_error($page, "Invalid action", "That's not something you can do with a PM");
|
$this->theme->display_error($page, "Invalid action", "That's not something you can do with a PM");
|
||||||
|
@ -32,9 +32,11 @@ class PMTest extends ShimmieWebTestCase {
|
|||||||
$this->assertText("message contents");
|
$this->assertText("message contents");
|
||||||
$this->back();
|
$this->back();
|
||||||
$this->click("Delete");
|
$this->click("Delete");
|
||||||
# Test for bug: after an admin deletes a user's PM, they were
|
|
||||||
# redirected to their own (the admin's) PM list
|
# simpletest bug? - redirect(referrer) works in opera, not in
|
||||||
$this->assertTitle("test's page");
|
# webtestcase, so we end up at the wrong page...
|
||||||
|
$this->get_page("user/test");
|
||||||
|
$this->assertTitle("test's Page");
|
||||||
$this->assertNoText("message demo to test");
|
$this->assertNoText("message demo to test");
|
||||||
$this->log_out();
|
$this->log_out();
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,8 @@ class Tag_History implements Extension {
|
|||||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||||
|
|
||||||
if(($event instanceof InitExtEvent)) {
|
if(($event instanceof InitExtEvent)) {
|
||||||
|
$config->set_default_int("history_limit", -1);
|
||||||
|
|
||||||
// shimmie is being installed so call install to create the table.
|
// shimmie is being installed so call install to create the table.
|
||||||
if($config->get_int("ext_tag_history_version") < 3) {
|
if($config->get_int("ext_tag_history_version") < 3) {
|
||||||
$this->install();
|
$this->install();
|
||||||
@ -53,6 +55,7 @@ class Tag_History implements Extension {
|
|||||||
$sb->add_label("Limit to ");
|
$sb->add_label("Limit to ");
|
||||||
$sb->add_int_option("history_limit");
|
$sb->add_int_option("history_limit");
|
||||||
$sb->add_label(" entires per image");
|
$sb->add_label(" entires per image");
|
||||||
|
$sb->add_label("<br>(-1 for unlimited)");
|
||||||
$event->panel->add_block($sb);
|
$event->panel->add_block($sb);
|
||||||
}
|
}
|
||||||
if(($event instanceof TagSetEvent)) {
|
if(($event instanceof TagSetEvent)) {
|
||||||
@ -191,8 +194,9 @@ class Tag_History implements Extension {
|
|||||||
if(is_array($tags)) $tags = implode(' ', $tags);
|
if(is_array($tags)) $tags = implode(' ', $tags);
|
||||||
|
|
||||||
// add a history entry
|
// add a history entry
|
||||||
$allowed = $config->get_int("history_limit",10);
|
$allowed = $config->get_int("history_limit");
|
||||||
if($allowed<=0) return;
|
if($allowed == 0) return;
|
||||||
|
|
||||||
$row = $database->execute("
|
$row = $database->execute("
|
||||||
INSERT INTO tag_histories(image_id, tags, user_id, user_ip, date_set)
|
INSERT INTO tag_histories(image_id, tags, user_id, user_ip, date_set)
|
||||||
VALUES (?, ?, ?, ?, now())",
|
VALUES (?, ?, ?, ?, now())",
|
||||||
@ -200,6 +204,7 @@ class Tag_History implements Extension {
|
|||||||
$entries = $database->db->GetOne("SELECT COUNT(*) FROM `tag_histories` WHERE image_id = ?", array($image_id));
|
$entries = $database->db->GetOne("SELECT COUNT(*) FROM `tag_histories` WHERE image_id = ?", array($image_id));
|
||||||
|
|
||||||
// if needed remove oldest one
|
// if needed remove oldest one
|
||||||
|
if($allowed == -1) return;
|
||||||
if($entries > $allowed)
|
if($entries > $allowed)
|
||||||
{
|
{
|
||||||
// TODO: Make these queries better
|
// TODO: Make these queries better
|
||||||
|
@ -66,7 +66,7 @@ class CommentList implements Extension {
|
|||||||
global $config;
|
global $config;
|
||||||
$config->set_default_bool('comment_anon', true);
|
$config->set_default_bool('comment_anon', true);
|
||||||
$config->set_default_int('comment_window', 5);
|
$config->set_default_int('comment_window', 5);
|
||||||
$config->set_default_int('comment_limit', 3);
|
$config->set_default_int('comment_limit', 10);
|
||||||
$config->set_default_int('comment_count', 5);
|
$config->set_default_int('comment_count', 5);
|
||||||
|
|
||||||
if($config->get_int("ext_comments_version") < 2) {
|
if($config->get_int("ext_comments_version") < 2) {
|
||||||
|
@ -57,7 +57,7 @@ class IndexTest extends ShimmieWebTestCase {
|
|||||||
|
|
||||||
# meta tag, one result
|
# meta tag, one result
|
||||||
$this->get_page("post/list/hash=feb01bab5698a11dd87416724c7a89e3/1");
|
$this->get_page("post/list/hash=feb01bab5698a11dd87416724c7a89e3/1");
|
||||||
$this->assertTitle(new PatternExpectation("/^Image $image_id_2: /"));
|
$this->assertTitle(new PatternExpectation("/^Image $image_id_1: /"));
|
||||||
$this->assertNoText("No Images Found");
|
$this->assertNoText("No Images Found");
|
||||||
|
|
||||||
# multiple tags, many results
|
# multiple tags, many results
|
||||||
|
Loading…
x
Reference in New Issue
Block a user