| @@ 498-510 (lines=13) @@ | ||
| 495 | * @param string $val |
|
| 496 | * @return int |
|
| 497 | */ |
|
| 498 | public function CountUsersRates($userid, $val) |
|
| 499 | { |
|
| 500 | global $xoopsUser, $xoopsDB; |
|
| 501 | $query = 'Select SUM(' . $val . ') as sum from ' . $xoopsDB->prefix('smallworld_vote') . " where owner = '" . $userid . "'"; |
|
| 502 | $result = $xoopsDB->queryF($query); |
|
| 503 | while ($row = $xoopsDB->fetchArray($result)) { |
|
| 504 | $sum = $row['sum']; |
|
| 505 | } |
|
| 506 | if ('' == $sum) { |
|
| 507 | $sum = '0'; |
|
| 508 | } |
|
| 509 | return $sum; |
|
| 510 | } |
|
| 511 | ||
| 512 | /** |
|
| 513 | * deleteAccount function |
|
| @@ 209-221 (lines=13) @@ | ||
| 206 | * @param int $msgid |
|
| 207 | * @return int |
|
| 208 | */ |
|
| 209 | public function countVotes($type, $val, $msgid) |
|
| 210 | { |
|
| 211 | global $xoopsUser, $xoopsDB; |
|
| 212 | $query = 'Select SUM(' . $val . ') as sum from ' . $xoopsDB->prefix('smallworld_vote') . " where msg_id = '" . $msgid . "' and com_id = '0'"; |
|
| 213 | $result = $xoopsDB->queryF($query); |
|
| 214 | while ($row = $xoopsDB->fetchArray($result)) { |
|
| 215 | $sum = $row['sum']; |
|
| 216 | } |
|
| 217 | if ('' == $sum) { |
|
| 218 | $sum = '0'; |
|
| 219 | } |
|
| 220 | return $sum; |
|
| 221 | } |
|
| 222 | ||
| 223 | /** |
|
| 224 | * @Count comments votes |
|
| @@ 231-243 (lines=13) @@ | ||
| 228 | * @param int $msgid |
|
| 229 | * @returns int |
|
| 230 | */ |
|
| 231 | public function countVotesCom($type, $val, $comid, $msgid) |
|
| 232 | { |
|
| 233 | global $xoopsUser, $xoopsDB; |
|
| 234 | $query = 'Select SUM(' . $val . ') as sum from ' . $xoopsDB->prefix('smallworld_vote') . " where com_id = '" . $comid . "' AND msg_id = '" . $msgid . "'"; |
|
| 235 | $result = $xoopsDB->queryF($query); |
|
| 236 | while ($row = $xoopsDB->fetchArray($result)) { |
|
| 237 | $sum = $row['sum']; |
|
| 238 | } |
|
| 239 | if ('' == $sum) { |
|
| 240 | $sum = '0'; |
|
| 241 | } |
|
| 242 | return $sum; |
|
| 243 | } |
|
| 244 | ||
| 245 | /** |
|
| 246 | * @Check is user is friend |
|
| @@ 501-513 (lines=13) @@ | ||
| 498 | * @param string $val |
|
| 499 | * @return int |
|
| 500 | */ |
|
| 501 | public function CountUsersRates($userid, $val) |
|
| 502 | { |
|
| 503 | global $xoopsUser, $xoopsDB; |
|
| 504 | $query = 'Select SUM(' . $val . ') as sum from ' . $xoopsDB->prefix('smallworld_vote') . " where owner = '" . $userid . "'"; |
|
| 505 | $result = $xoopsDB->queryF($query); |
|
| 506 | while ($row = $xoopsDB->fetchArray($result)) { |
|
| 507 | $sum = $row['sum']; |
|
| 508 | } |
|
| 509 | if ('' == $sum) { |
|
| 510 | $sum = '0'; |
|
| 511 | } |
|
| 512 | return $sum; |
|
| 513 | } |
|
| 514 | ||
| 515 | /** |
|
| 516 | * deleteAccount function |
|
| @@ 268-280 (lines=13) @@ | ||
| 265 | * @param int $msgid |
|
| 266 | * @return int |
|
| 267 | */ |
|
| 268 | public function countVotes($type, $val, $msgid) |
|
| 269 | { |
|
| 270 | global $xoopsUser, $xoopsDB; |
|
| 271 | $query = 'Select SUM(' . $val . ') as sum from ' . $xoopsDB->prefix('smallworld_vote') . " where msg_id = '" . $msgid . "' and com_id = '0'"; |
|
| 272 | $result = $xoopsDB->queryF($query); |
|
| 273 | while ($row = $xoopsDB->fetchArray($result)) { |
|
| 274 | $sum = $row['sum']; |
|
| 275 | } |
|
| 276 | if ('' == $sum) { |
|
| 277 | $sum = '0'; |
|
| 278 | } |
|
| 279 | return $sum; |
|
| 280 | } |
|
| 281 | ||
| 282 | /** |
|
| 283 | * @Count comments votes |
|
| @@ 290-302 (lines=13) @@ | ||
| 287 | * @param int $msgid |
|
| 288 | * @returns int |
|
| 289 | */ |
|
| 290 | public function countVotesCom($type, $val, $comid, $msgid) |
|
| 291 | { |
|
| 292 | global $xoopsUser, $xoopsDB; |
|
| 293 | $query = 'Select SUM(' . $val . ') as sum from ' . $xoopsDB->prefix('smallworld_vote') . " where com_id = '" . $comid . "' AND msg_id = '" . $msgid . "'"; |
|
| 294 | $result = $xoopsDB->queryF($query); |
|
| 295 | while ($row = $xoopsDB->fetchArray($result)) { |
|
| 296 | $sum = $row['sum']; |
|
| 297 | } |
|
| 298 | if ('' == $sum) { |
|
| 299 | $sum = '0'; |
|
| 300 | } |
|
| 301 | return $sum; |
|
| 302 | } |
|
| 303 | ||
| 304 | /** |
|
| 305 | * @Check if user is friend |
|