separate source_edit_anon from tag_edit_anon
git-svn-id: file:///home/shish/svn/shimmie2/trunk@598 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
0245870868
commit
3a78f3f451
@ -14,7 +14,9 @@ class TagEdit extends Extension {
|
||||
$i_image_id = int_escape($_POST['image_id']);
|
||||
$query = $_POST['query'];
|
||||
send_event(new TagSetEvent($i_image_id, $_POST['tags']));
|
||||
send_event(new SourceSetEvent($i_image_id, $_POST['source']));
|
||||
if($this->can_source()) {
|
||||
send_event(new SourceSetEvent($i_image_id, $_POST['source']));
|
||||
}
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("post/view/$i_image_id", $query));
|
||||
}
|
||||
@ -67,7 +69,8 @@ class TagEdit extends Extension {
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
$sb = new SetupBlock("Tag Editing");
|
||||
$sb->add_bool_option("tag_edit_anon", "Allow anonymous editing: ");
|
||||
$sb->add_bool_option("tag_edit_anon", "Allow anonymous tag editing: ");
|
||||
$sb->add_bool_option("source_edit_anon", "<br>Allow anonymous source editing: ");
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
}
|
||||
@ -78,6 +81,11 @@ class TagEdit extends Extension {
|
||||
return $config->get_bool("tag_edit_anon") || !$user->is_anonymous();
|
||||
}
|
||||
|
||||
private function can_source() {
|
||||
global $config, $user;
|
||||
return $config->get_bool("source_edit_anon") || !$user->is_anonymous();
|
||||
}
|
||||
|
||||
private function mass_tag_edit($search, $replace) {
|
||||
global $database;
|
||||
$search_id = $database->db->GetOne("SELECT id FROM tags WHERE tag=?", array($search));
|
||||
|
@ -85,7 +85,7 @@ class ViewTheme extends Themelet {
|
||||
|
||||
global $config;
|
||||
global $user;
|
||||
if($config->get_bool("tag_edit_anon") || ($user->id != $config->get_int("anon_id"))) {
|
||||
if($config->get_bool("tag_edit_anon") || !$user->is_anonymous()) {
|
||||
$html .= " (<a href=\"javascript: toggle('imgdata')\">edit</a>)";
|
||||
|
||||
if(isset($_GET['search'])) {$h_query = "search=".url_escape($_GET['search']);}
|
||||
@ -94,13 +94,18 @@ class ViewTheme extends Themelet {
|
||||
$h_tags = html_escape($image->get_tag_list());
|
||||
$i_image_id = int_escape($image->id);
|
||||
|
||||
$source_edit = "";
|
||||
if($config->get_bool("source_edit_anon") || !$user->is_anonymous()) {
|
||||
$source_edit = "<tr><td>Source</td><td><input type='text' name='source' value='$h_source'></td></tr>";
|
||||
}
|
||||
|
||||
$html .= "
|
||||
<div id='imgdata'><form action='".make_link("tag_edit/set")."' method='POST'>
|
||||
<input type='hidden' name='image_id' value='$i_image_id'>
|
||||
<input type='hidden' name='query' value='$h_query'>
|
||||
<table style='width: 500px;'>
|
||||
<tr><td width='50px'>Tags</td><td width='300px'><input type='text' name='tags' value='$h_tags'></td></tr>
|
||||
<tr><td>Source</td><td><input type='text' name='source' value='$h_source'></td></tr>
|
||||
$source_edit
|
||||
<tr><td> </td><td><input type='submit' value='Set'></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
|
Loading…
x
Reference in New Issue
Block a user