Merge branch 'master' of github.com:shish/shimmie2

This commit is contained in:
Shish 2012-03-13 06:04:57 +00:00
commit ba46af2045
5 changed files with 20 additions and 11 deletions

View File

@ -10,8 +10,10 @@ class LinkImageTest extends ShimmieWebTestCase {
$matches = array(); $matches = array();
preg_match("#value='(http://.*(/|%2F)post(/|%2F)view(/|%2F)[0-9]+)'#", $raw, $matches); preg_match("#value='(http://.*(/|%2F)post(/|%2F)view(/|%2F)[0-9]+)'#", $raw, $matches);
$this->assertTrue(count($matches) > 0); $this->assertTrue(count($matches) > 0);
$this->get($matches[1]); if($matches) {
$this->assert_title("Image $image_id: pie"); $this->get($matches[1]);
$this->assert_title("Image $image_id: pie");
}
$this->log_out(); $this->log_out();

View File

@ -245,7 +245,7 @@ class Image {
global $database; global $database;
if($owner->id != $this->owner_id) { 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)); $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}");
} }
} }

View File

@ -251,28 +251,28 @@ class Page {
// caching failed, add all files to html_headers. // caching failed, add all files to html_headers.
foreach(glob("lib/*.css") as $css) { foreach(glob("lib/*.css") as $css) {
$this->add_html_header('<link rel="stylesheet" href="'.$data_href.'/'.$css.'" type="text/css">'); $this->add_html_header('<link rel="stylesheet" href="'.mtimefile($css).'" type="text/css">');
} }
$css_files = glob("ext/*/style.css"); $css_files = glob("ext/*/style.css");
if($css_files) { if($css_files) {
foreach($css_files as $css_file) { foreach($css_files as $css_file) {
$this->add_html_header('<link rel="stylesheet" href="'.$data_href.'/'.$css_file.'" type="text/css">'); $this->add_html_header('<link rel="stylesheet" href="'.mtimefile($css_file).'" type="text/css">');
} }
} }
$css_files = glob("themes/$theme_name/style.css"); $css_files = glob("themes/$theme_name/style.css");
if($css_files) { if($css_files) {
foreach($css_files as $css_file) { foreach($css_files as $css_file) {
$this->add_html_header('<link rel="stylesheet" href="'.$data_href.'/'.$css_file.'" type="text/css">'); $this->add_html_header('<link rel="stylesheet" href="'.mtimefile($css_file).'" type="text/css">');
} }
} }
foreach(glob("lib/*.js") as $js) { foreach(glob("lib/*.js") as $js) {
$this->add_html_header('<script src="'.$data_href.'/'.$js.'" type="text/javascript"></script>'); $this->add_html_header('<script src="'.mtimefile($js).'" type="text/javascript"></script>');
} }
$js_files = glob("ext/*/script.js"); $js_files = glob("ext/*/script.js");
if($js_files) { if($js_files) {
foreach($js_files as $js_file) { foreach($js_files as $js_file) {
$this->add_html_header('<script src="'.$data_href.'/'.$js_file.'" type="text/javascript"></script>'); $this->add_html_header('<script src="'.mtimefile($js_file).'" type="text/javascript"></script>');
} }
} }
} }

View File

@ -339,6 +339,13 @@ function make_form($target, $method="POST", $multipart=False, $form_id="", $onsu
return '<form action="'.$target.'" method="'.$method.'" '.$extra.'>'.$auth; return '<form action="'.$target.'" method="'.$method.'" '.$extra.'>'.$auth;
} }
function mtimefile($file) {
$data_href = get_base_href();
$mtime = filemtime($file);
return "$data_href/$file?$mtime";
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
* CAPTCHA abstraction * * CAPTCHA abstraction *

View File

@ -108,21 +108,21 @@ class TagEdit extends Extension {
public function onOwnerSet(OwnerSetEvent $event) { public function onOwnerSet(OwnerSetEvent $event) {
global $user; 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); $event->image->set_owner($event->owner);
} }
} }
public function onTagSet(TagSetEvent $event) { public function onTagSet(TagSetEvent $event) {
global $user; 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); $event->image->set_tags($event->tags);
} }
} }
public function onSourceSet(SourceSetEvent $event) { public function onSourceSet(SourceSetEvent $event) {
global $user; 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); $event->image->set_source($event->source);
} }
} }