| @@ 210-223 (lines=14) @@ | ||
| 207 | * @param int $msgid |
|
| 208 | * @return int |
|
| 209 | */ |
|
| 210 | public function countVotes($type, $val, $msgid) |
|
| 211 | { |
|
| 212 | global $xoopsUser, $xoopsDB; |
|
| 213 | $sum = 0; |
|
| 214 | $query = 'Select SUM(' . $val . ') as sum from ' . $xoopsDB->prefix('smallworld_vote') . " where msg_id = '" . $msgid . "' and com_id = '0'"; |
|
| 215 | $result = $xoopsDB->queryF($query); |
|
| 216 | while (false !== ($row = $xoopsDB->fetchArray($result))) { |
|
| 217 | $sum = $row['sum']; |
|
| 218 | } |
|
| 219 | if ('' == $sum) { |
|
| 220 | $sum = 0; |
|
| 221 | } |
|
| 222 | ||
| 223 | return $sum; |
|
| 224 | } |
|
| 225 | ||
| 226 | /** |
|
| @@ 236-249 (lines=14) @@ | ||
| 233 | * @return int|mixed |
|
| 234 | * @return int|mixed |
|
| 235 | */ |
|
| 236 | public function countVotesCom($type, $val, $comid, $msgid) |
|
| 237 | { |
|
| 238 | global $xoopsUser, $xoopsDB; |
|
| 239 | $sum = 0; |
|
| 240 | $query = 'Select SUM(' . $val . ') as sum from ' . $xoopsDB->prefix('smallworld_vote') . " where com_id = '" . $comid . "' AND msg_id = '" . $msgid . "'"; |
|
| 241 | $result = $xoopsDB->queryF($query); |
|
| 242 | while (false !== ($row = $xoopsDB->fetchArray($result))) { |
|
| 243 | $sum = $row['sum']; |
|
| 244 | } |
|
| 245 | if ('' == $sum) { |
|
| 246 | $sum = 0; |
|
| 247 | } |
|
| 248 | ||
| 249 | return $sum; |
|
| 250 | } |
|
| 251 | ||
| 252 | /** |
|
| @@ 277-289 (lines=13) @@ | ||
| 274 | * @param int $msgid |
|
| 275 | * @return int |
|
| 276 | */ |
|
| 277 | public function countVotes($type, $val, $msgid) |
|
| 278 | { |
|
| 279 | global $xoopsUser, $xoopsDB; |
|
| 280 | $query = 'Select SUM(' . $val . ') as sum from ' . $xoopsDB->prefix('smallworld_vote') . " where msg_id = '" . $msgid . "' and com_id = '0'"; |
|
| 281 | $result = $xoopsDB->queryF($query); |
|
| 282 | while (false !== ($row = $xoopsDB->fetchArray($result))) { |
|
| 283 | $sum = $row['sum']; |
|
| 284 | } |
|
| 285 | if ('' == $sum) { |
|
| 286 | $sum = '0'; |
|
| 287 | } |
|
| 288 | ||
| 289 | return $sum; |
|
| 290 | } |
|
| 291 | ||
| 292 | /** |
|
| @@ 302-314 (lines=13) @@ | ||
| 299 | * @return mixed|string |
|
| 300 | * @return mixed|string |
|
| 301 | */ |
|
| 302 | public function countVotesCom($type, $val, $comid, $msgid) |
|
| 303 | { |
|
| 304 | global $xoopsUser, $xoopsDB; |
|
| 305 | $query = 'Select SUM(' . $val . ') as sum from ' . $xoopsDB->prefix('smallworld_vote') . " where com_id = '" . $comid . "' AND msg_id = '" . $msgid . "'"; |
|
| 306 | $result = $xoopsDB->queryF($query); |
|
| 307 | while (false !== ($row = $xoopsDB->fetchArray($result))) { |
|
| 308 | $sum = $row['sum']; |
|
| 309 | } |
|
| 310 | if ('' == $sum) { |
|
| 311 | $sum = '0'; |
|
| 312 | } |
|
| 313 | ||
| 314 | return $sum; |
|
| 315 | } |
|
| 316 | ||
| 317 | /** |
|
| @@ 494-506 (lines=13) @@ | ||
| 491 | * @param string $val |
|
| 492 | * @return int |
|
| 493 | */ |
|
| 494 | public function countUsersRates($userid, $val) |
|
| 495 | { |
|
| 496 | global $xoopsUser, $xoopsDB; |
|
| 497 | $query = 'Select SUM(' . $val . ') as sum from ' . $xoopsDB->prefix('smallworld_vote') . " where owner = '" . $userid . "'"; |
|
| 498 | $result = $xoopsDB->queryF($query); |
|
| 499 | while (false !== ($row = $xoopsDB->fetchArray($result))) { |
|
| 500 | $sum = $row['sum']; |
|
| 501 | } |
|
| 502 | if ('' == $sum) { |
|
| 503 | $sum = '0'; |
|
| 504 | } |
|
| 505 | ||
| 506 | return $sum; |
|
| 507 | } |
|
| 508 | ||
| 509 | /** |
|