Fixes errors noted in #144.

Also includes a change in the Post\TagMethods::save_post_history() method, but I don't remember why I changed that.
This commit is contained in:
Parziphal 2015-02-08 23:09:05 -05:00
parent a49c9548fd
commit b50fdbcc18
2 changed files with 6 additions and 6 deletions

View File

@ -84,7 +84,7 @@ trait PostTagMethods
# * :tag<String>:: the tag to search for
public function has_tag($tag)
{
return isset($this->tags[$tag]);
return array_search($tag, $this->tags) !== false;
}
# Returns the tags in a URL suitable string
@ -379,8 +379,8 @@ trait PostTagMethods
PostTagHistory::create([
'post_id' => $this->id,
'tags' => $new_cached_tags,
'user_id' => current_user()->id,
'ip_addr' => current_user()->ip_addr ?: "127.0.0.1"
'user_id' => $this->user_id,
'ip_addr' => current_user() && current_user()->ip_addr ? current_user()->ip_addr : "127.0.0.1"
]);
}
}

View File

@ -171,10 +171,10 @@ abstract class DefaultConfig
# Some examples:
#
# Hide post if user isn't privileged and post is not safe:
# if($post->rating == 'e' && $user->is('>=20')) return true;
# if ($post->rating == 'e' && $user->is_privileged_or_higher()) return true;
#
# Hide post if user isn't a mod and post has the loli tag:
# if($post->has_tag('loli') && $user->is('>=40')) return true;
# if ($post->has_tag('loli') && $user->is_mod_or_higher()) return true;
}
# Determines who can see ads.