check for permissions
This commit is contained in:
parent
629f9940c3
commit
6e54580f56
@ -262,7 +262,9 @@ class NumericScore extends Extension {
|
|||||||
if(preg_match("/^vote[=|:](up|down|remove)$/", $event->term, $matches)) {
|
if(preg_match("/^vote[=|:](up|down|remove)$/", $event->term, $matches)) {
|
||||||
global $user;
|
global $user;
|
||||||
$score = ($matches[1] == "up" ? 1 : ($matches[1] == "down" ? -1 : 0));
|
$score = ($matches[1] == "up" ? 1 : ($matches[1] == "down" ? -1 : 0));
|
||||||
send_event(new NumericScoreSetEvent($event->id, $user, $score));
|
if(!$user->is_anonymous()) {
|
||||||
|
send_event(new NumericScoreSetEvent($event->id, $user, $score));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($matches)) $event->metatag = true;
|
if(!empty($matches)) $event->metatag = true;
|
||||||
|
@ -319,16 +319,18 @@ class Pools extends Extension {
|
|||||||
$matches = array();
|
$matches = array();
|
||||||
|
|
||||||
if(preg_match("/^pool[=|:](.*)$/i", $event->term, $matches)) {
|
if(preg_match("/^pool[=|:](.*)$/i", $event->term, $matches)) {
|
||||||
|
global $user;
|
||||||
$poolTag = (string) str_replace("_", " ", $matches[1]);
|
$poolTag = (string) str_replace("_", " ", $matches[1]);
|
||||||
|
|
||||||
if(ctype_digit($poolTag)){ //Assume tag is poolID
|
$pool = null;
|
||||||
if($this->get_single_pool($poolTag)){
|
if(ctype_digit($poolTag)){ //If only digits, assume PoolID
|
||||||
$this->add_post($poolTag, $event->id, true);
|
$pool = $this->get_single_pool($poolTag);
|
||||||
}
|
}else{ //assume PoolTitle
|
||||||
}else{ //Assume tag is poolTitle
|
$pool = $this->get_single_pool_from_title($poolTag);
|
||||||
if($pool = $this->get_single_pool_from_title($poolTag)){
|
}
|
||||||
$this->add_post($pool['id'], $event->id, true);
|
|
||||||
}
|
if($pool ? $this->have_permission($user, $pool) : FALSE){
|
||||||
|
$this->add_post($pool['id'], $event->id, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,10 +22,8 @@ class Relationships extends Extension {
|
|||||||
|
|
||||||
public function onImageInfoSet(ImageInfoSetEvent $event) {
|
public function onImageInfoSet(ImageInfoSetEvent $event) {
|
||||||
global $user;
|
global $user;
|
||||||
if (isset($_POST["tag_edit__parent"])) {
|
if (isset($_POST["tag_edit__parent"]) ? ctype_digit($_POST["tag_edit__parent"]) : FALSE) {
|
||||||
if(ctype_digit($_POST["tag_edit__parent"])){
|
$this->set_parent($event->image->id, (int) $_POST["tag_edit__parent"]);
|
||||||
$this->set_parent($event->image->id, (int) $_POST["tag_edit__parent"]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,16 +24,21 @@ class RelationshipsTheme extends Themelet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function get_parent_editor_html(Image $image) {
|
public function get_parent_editor_html(Image $image) {
|
||||||
|
global $user;
|
||||||
$h_parent_id = $image->parent_id;
|
$h_parent_id = $image->parent_id;
|
||||||
$s_parent_id = $h_parent_id ?: "None.";
|
$s_parent_id = $h_parent_id ?: "None.";
|
||||||
|
|
||||||
$html = "<tr>\n".
|
$html = "<tr>\n".
|
||||||
" <th>Parent</th>\n".
|
" <th>Parent</th>\n".
|
||||||
" <td>\n".
|
" <td>\n".
|
||||||
" <span class='view' style='overflow: hidden; white-space: nowrap;'>{$s_parent_id}</span>\n".
|
(!$user->is_anonymous() ?
|
||||||
" <input class='edit' type='text' name='tag_edit__parent' type='number' value='{$h_parent_id}'>\n".
|
" <span class='view' style='overflow: hidden; white-space: nowrap;'>{$s_parent_id}</span>\n".
|
||||||
" <td>\n".
|
" <input class='edit' type='text' name='tag_edit__parent' type='number' value='{$h_parent_id}'>\n"
|
||||||
"</tr>\n";
|
:
|
||||||
|
$s_parent_id
|
||||||
|
).
|
||||||
|
" <td>\n".
|
||||||
|
"</tr>\n";
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user