| @@ 258-271 (lines=14) @@ | ||
| 255 | * @param int $msgid |
|
| 256 | * @return int |
|
| 257 | */ |
|
| 258 | public function HasVoted($userid, $type, $comid, $msgid) |
|
| 259 | { |
|
| 260 | global $xoopsUser, $xoopsDB; |
|
| 261 | if ('msg' === $type) { |
|
| 262 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_vote') . " WHERE com_id = '0' AND msg_id = '" . $msgid . "' AND user_id = '" . $userid . "'"; |
|
| 263 | $result = $xoopsDB->queryF($sql); |
|
| 264 | $i = $xoopsDB->getRowsNum($result); |
|
| 265 | } else { |
|
| 266 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_vote') . " WHERE com_id = '" . $comid . "' AND msg_id = '" . $msgid . "' AND user_id = '" . $userid . "'"; |
|
| 267 | $result = $xoopsDB->queryF($sql); |
|
| 268 | $i = $xoopsDB->getRowsNum($result); |
|
| 269 | } |
|
| 270 | return $i; |
|
| 271 | } |
|
| 272 | ||
| 273 | /** |
|
| 274 | * @count messages per user |
|
| @@ 320-333 (lines=14) @@ | ||
| 317 | * @param int $msgid |
|
| 318 | * @return int |
|
| 319 | */ |
|
| 320 | public function HasVoted($userid, $type, $comid, $msgid) |
|
| 321 | { |
|
| 322 | global $xoopsUser, $xoopsDB; |
|
| 323 | if ('msg' === $type) { |
|
| 324 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_vote') . " WHERE com_id = '0' AND msg_id = '" . $msgid . "' AND user_id = '" . $userid . "'"; |
|
| 325 | $result = $xoopsDB->queryF($sql); |
|
| 326 | $i = $xoopsDB->getRowsNum($result); |
|
| 327 | } else { |
|
| 328 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_vote') . " WHERE com_id = '" . $comid . "' AND msg_id = '" . $msgid . "' AND user_id = '" . $userid . "'"; |
|
| 329 | $result = $xoopsDB->queryF($sql); |
|
| 330 | $i = $xoopsDB->getRowsNum($result); |
|
| 331 | } |
|
| 332 | return $i; |
|
| 333 | } |
|
| 334 | ||
| 335 | /** |
|
| 336 | * @count messages per user |
|