| @@ 210-237 (lines=28) @@ | ||
| 207 | * @param string $comment |
|
| 208 | * @return string / void |
|
| 209 | */ |
|
| 210 | public function Insert_Comment($uid, $msg_id, $comment) |
|
| 211 | { |
|
| 212 | global $xoopsUser, $xoopsDB; |
|
| 213 | $comment = Smallworld_sanitize(htmlentities($comment, ENT_QUOTES, 'UTF-8')); |
|
| 214 | $time = time(); |
|
| 215 | $query = 'SELECT com_id,comment FROM ' . $xoopsDB->prefix('smallworld_comments') . " WHERE uid_fk='" . $uid . "' AND msg_id_fk='" . $msg_id . "' ORDER BY com_id DESC LIMIT 1 "; |
|
| 216 | $result = $xoopsDB->fetchArray($query); |
|
| 217 | if ($comment != $result['comment']) { |
|
| 218 | $query = 'INSERT INTO ' . $xoopsDB->prefix('smallworld_comments') . " (comment, uid_fk,msg_id_fk,created) VALUES ('" . $comment . "', '" . $uid . "','" . $msg_id . "', '" . $time . "')"; |
|
| 219 | $result = $xoopsDB->queryF($query); |
|
| 220 | $newquery = 'SELECT C.com_id, C.uid_fk, C.comment, C.msg_id_fk, C.created, U.username FROM ' |
|
| 221 | . $xoopsDB->prefix('smallworld_comments') |
|
| 222 | . ' C, ' |
|
| 223 | . $xoopsDB->prefix('smallworld_user') |
|
| 224 | . " U WHERE C.uid_fk=U.userid AND C.uid_fk='" |
|
| 225 | . $uid |
|
| 226 | . "' AND C.msg_id_fk='" |
|
| 227 | . $msg_id |
|
| 228 | . "' ORDER BY C.com_id DESC LIMIT 1 "; |
|
| 229 | $result2 = $xoopsDB->queryF($newquery); |
|
| 230 | while ($row = $xoopsDB->fetchArray($result2)) { |
|
| 231 | $data[0] = $row; |
|
| 232 | } |
|
| 233 | return $data[0]; |
|
| 234 | } else { |
|
| 235 | return false; |
|
| 236 | } |
|
| 237 | } |
|
| 238 | ||
| 239 | /** |
|
| 240 | * @Get array of users followers |
|
| @@ 215-242 (lines=28) @@ | ||
| 212 | * @param string|array $comment |
|
| 213 | * @return string / void |
|
| 214 | */ |
|
| 215 | public function Insert_Comment($uid, $msg_id, $comment) |
|
| 216 | { |
|
| 217 | global $xoopsUser, $xoopsDB; |
|
| 218 | $comment = Smallworld_sanitize(htmlentities($comment, ENT_QUOTES, 'UTF-8')); |
|
| 219 | $time = time(); |
|
| 220 | $query = 'SELECT com_id,comment FROM ' . $xoopsDB->prefix('smallworld_comments') . " WHERE uid_fk='" . $uid . "' AND msg_id_fk='" . $msg_id . "' ORDER BY com_id DESC LIMIT 1 "; |
|
| 221 | $result = $xoopsDB->fetchArray($query); |
|
| 222 | if ($comment != $result['comment']) { |
|
| 223 | $query = 'INSERT INTO ' . $xoopsDB->prefix('smallworld_comments') . " (comment, uid_fk,msg_id_fk,created) VALUES ('" . $comment . "', '" . $uid . "','" . $msg_id . "', '" . $time . "')"; |
|
| 224 | $result = $xoopsDB->queryF($query); |
|
| 225 | $newquery = 'SELECT C.com_id, C.uid_fk, C.comment, C.msg_id_fk, C.created, U.username FROM ' |
|
| 226 | . $xoopsDB->prefix('smallworld_comments') |
|
| 227 | . ' C, ' |
|
| 228 | . $xoopsDB->prefix('smallworld_user') |
|
| 229 | . " U WHERE C.uid_fk=U.userid AND C.uid_fk='" |
|
| 230 | . $uid |
|
| 231 | . "' AND C.msg_id_fk='" |
|
| 232 | . $msg_id |
|
| 233 | . "' ORDER BY C.com_id DESC LIMIT 1 "; |
|
| 234 | $result2 = $xoopsDB->queryF($newquery); |
|
| 235 | while ($row = $xoopsDB->fetchArray($result2)) { |
|
| 236 | $data[0] = $row; |
|
| 237 | } |
|
| 238 | return $data[0]; |
|
| 239 | } else { |
|
| 240 | return false; |
|
| 241 | } |
|
| 242 | } |
|
| 243 | ||
| 244 | /** |
|
| 245 | * @Get array of users followers |
|