| @@ 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 ($row = $xoopsDB->fetchArray($result)) { |
|
| 217 | $sum = $row['sum']; |
|
| 218 | } |
|
| 219 | if ('' == $sum) { |
|
| 220 | $sum = 0; |
|
| 221 | } |
|
| 222 | return $sum; |
|
| 223 | } |
|
| 224 | ||
| 225 | /** |
|
| 226 | * @Count comments votes |
|
| @@ 235-248 (lines=14) @@ | ||
| 232 | * @return int|mixed |
|
| 233 | * @return int|mixed |
|
| 234 | */ |
|
| 235 | public function countVotesCom($type, $val, $comid, $msgid) |
|
| 236 | { |
|
| 237 | global $xoopsUser, $xoopsDB; |
|
| 238 | $sum = 0; |
|
| 239 | $query = 'Select SUM(' . $val . ') as sum from ' . $xoopsDB->prefix('smallworld_vote') . " where com_id = '" . $comid . "' AND msg_id = '" . $msgid . "'"; |
|
| 240 | $result = $xoopsDB->queryF($query); |
|
| 241 | while ($row = $xoopsDB->fetchArray($result)) { |
|
| 242 | $sum = $row['sum']; |
|
| 243 | } |
|
| 244 | if ('' == $sum) { |
|
| 245 | $sum = 0; |
|
| 246 | } |
|
| 247 | return $sum; |
|
| 248 | } |
|
| 249 | ||
| 250 | /** |
|
| 251 | * @Check is user is friend |
|
| @@ 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 |
|
| @@ 274-286 (lines=13) @@ | ||
| 271 | * @param int $msgid |
|
| 272 | * @return int |
|
| 273 | */ |
|
| 274 | public function countVotes($type, $val, $msgid) |
|
| 275 | { |
|
| 276 | global $xoopsUser, $xoopsDB; |
|
| 277 | $query = 'Select SUM(' . $val . ') as sum from ' . $xoopsDB->prefix('smallworld_vote') . " where msg_id = '" . $msgid . "' and com_id = '0'"; |
|
| 278 | $result = $xoopsDB->queryF($query); |
|
| 279 | while ($row = $xoopsDB->fetchArray($result)) { |
|
| 280 | $sum = $row['sum']; |
|
| 281 | } |
|
| 282 | if ('' == $sum) { |
|
| 283 | $sum = '0'; |
|
| 284 | } |
|
| 285 | return $sum; |
|
| 286 | } |
|
| 287 | ||
| 288 | /** |
|
| 289 | * @Count comments votes |
|
| @@ 298-310 (lines=13) @@ | ||
| 295 | * @return mixed|string |
|
| 296 | * @return mixed|string |
|
| 297 | */ |
|
| 298 | public function countVotesCom($type, $val, $comid, $msgid) |
|
| 299 | { |
|
| 300 | global $xoopsUser, $xoopsDB; |
|
| 301 | $query = 'Select SUM(' . $val . ') as sum from ' . $xoopsDB->prefix('smallworld_vote') . " where com_id = '" . $comid . "' AND msg_id = '" . $msgid . "'"; |
|
| 302 | $result = $xoopsDB->queryF($query); |
|
| 303 | while ($row = $xoopsDB->fetchArray($result)) { |
|
| 304 | $sum = $row['sum']; |
|
| 305 | } |
|
| 306 | if ('' == $sum) { |
|
| 307 | $sum = '0'; |
|
| 308 | } |
|
| 309 | return $sum; |
|
| 310 | } |
|
| 311 | ||
| 312 | /** |
|
| 313 | * @Check if user is friend |
|