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

View File

@ -167,14 +167,14 @@ abstract class DefaultConfig
{ {
# By default, no posts are hidden. # By default, no posts are hidden.
return true; return true;
# Some examples: # Some examples:
# #
# Hide post if user isn't privileged and post is not safe: # 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: # 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. # Determines who can see ads.