$row['username'])); } return $users; } static function getUsers() { if (null == self::$s_user_list) { // Init user list self::$s_user_list = self::updateUsers(); } return self::$s_user_list; } function CE_Comment($comment_id) { $this->id = $comment_id; $this->query = ' SELECT com.id AS comment_id , com.image_id , com.author , com.date , com.content , com.validated FROM '.COMMENTS_TABLE.' AS com WHERE com.id = ' . $comment_id; $result = pwg_query($this->query); $this->infos = mysql_fetch_array($result, MYSQL_ASSOC); } function validateAuthor($author) { $user_list = self::getUsers(); if (array_key_exists( strtolower($author), array_change_key_case($user_list, CASE_LOWER))) { // Look in user list to have right case ! foreach ($user_list as $user) { if (0 == strcasecmp($author, $user)) { return $user; } } } return $author; } function isKnownAuthor() { if (in_array($this->infos['author'], self::getUsers())) { return true; } return false; } function setInfo($key, $value) { if (null == $key) { return; } $this->infos[$key] = $value; } function getInfo($key = null) { if (null == $key) { return $this->infos; } return $this->infos[$key]; } function isAuthor($user) { if (!isset ($this->infos['author'])) { return false; } return (0 == strcmp($this->infos['author'], $user))?true:false; } function __toString() { return print_r($this->infos, true); } } ?>