From a5ba9279c4b4fa4752f174ba2afbba970e72274c Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 12 Mar 2012 23:17:20 +0000 Subject: [PATCH 1/4] modification dates on CSS/JS links --- core/page.class.php | 10 +++++----- core/util.inc.php | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/core/page.class.php b/core/page.class.php index 3761f4b2..48719ef1 100644 --- a/core/page.class.php +++ b/core/page.class.php @@ -251,28 +251,28 @@ class Page { // caching failed, add all files to html_headers. foreach(glob("lib/*.css") as $css) { - $this->add_html_header(''); + $this->add_html_header(''); } $css_files = glob("ext/*/style.css"); if($css_files) { foreach($css_files as $css_file) { - $this->add_html_header(''); + $this->add_html_header(''); } } $css_files = glob("themes/$theme_name/style.css"); if($css_files) { foreach($css_files as $css_file) { - $this->add_html_header(''); + $this->add_html_header(''); } } foreach(glob("lib/*.js") as $js) { - $this->add_html_header(''); + $this->add_html_header(''); } $js_files = glob("ext/*/script.js"); if($js_files) { foreach($js_files as $js_file) { - $this->add_html_header(''); + $this->add_html_header(''); } } } diff --git a/core/util.inc.php b/core/util.inc.php index e9a8583d..552266be 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -339,6 +339,13 @@ function make_form($target, $method="POST", $multipart=False, $form_id="", $onsu return '
'.$auth; } +function mtimefile($file) { + $data_href = get_base_href(); + $mtime = filemtime($file); + return "$data_href/$file?$mtime"; +} + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ * CAPTCHA abstraction * From 4b59c79fed66537ba62d3c0a64e83274525c34a8 Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 12 Mar 2012 23:27:24 +0000 Subject: [PATCH 2/4] handle test error --- contrib/link_image/test.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/link_image/test.php b/contrib/link_image/test.php index e0f8cb52..83f641f7 100644 --- a/contrib/link_image/test.php +++ b/contrib/link_image/test.php @@ -10,8 +10,10 @@ class LinkImageTest extends ShimmieWebTestCase { $matches = array(); preg_match("#value='(http://.*(/|%2F)post(/|%2F)view(/|%2F)[0-9]+)'#", $raw, $matches); $this->assertTrue(count($matches) > 0); - $this->get($matches[1]); - $this->assert_title("Image $image_id: pie"); + if($matches) { + $this->get($matches[1]); + $this->assert_title("Image $image_id: pie"); + } $this->log_out(); From 16b232c857994506d775066753b2cba4ee035774 Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 13 Mar 2012 04:48:18 +0000 Subject: [PATCH 3/4] user needs perm /and/ the image needs to be unlocked --- ext/tag_edit/main.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/tag_edit/main.php b/ext/tag_edit/main.php index 8e485f19..9907d5e1 100644 --- a/ext/tag_edit/main.php +++ b/ext/tag_edit/main.php @@ -108,21 +108,21 @@ class TagEdit extends Extension { public function onOwnerSet(OwnerSetEvent $event) { global $user; - if($user->can("edit_image_owner") || !$event->image->is_locked()) { + if($user->can("edit_image_owner") && (!$event->image->is_locked() || $user->can("lock_image"))) { $event->image->set_owner($event->owner); } } public function onTagSet(TagSetEvent $event) { global $user; - if($user->can("edit_image_tag") || !$event->image->is_locked()) { + if($user->can("edit_image_tag") && (!$event->image->is_locked() || $user->can("lock_image"))) { $event->image->set_tags($event->tags); } } public function onSourceSet(SourceSetEvent $event) { global $user; - if($user->can("edit_image_source") || !$event->image->is_locked()) { + if($user->can("edit_image_source") && (!$event->image->is_locked() || $user->can("lock_image"))) { $event->image->set_source($event->source); } } From efd05179f32ed4e2f7b965f954c19e812b2f9fd2 Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 13 Mar 2012 04:54:38 +0000 Subject: [PATCH 4/4] better log for owner change --- core/imageboard.pack.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index de64291a..ea5815c9 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -245,7 +245,7 @@ class Image { global $database; if($owner->id != $this->owner_id) { $database->execute("UPDATE images SET owner_id=:owner_id WHERE id=:id", array("owner_id"=>$owner->id, "id"=>$this->id)); - log_info("core-image", "Owner for Image #{$this->id} set to: ".$owner->username); + log_info("core-image", "Owner for Image #{$this->id} set to {$owner->name}"); } }