| 1 |
<?php |
<?php |
| 2 |
|
|
| 3 |
//$Id: nodevote.module,v 1.28.2.2 2007/08/22 11:15:09 kbahey Exp $ |
//$Id: nodevote.module,v 1.28.2.3 2008/06/22 16:11:59 kbahey Exp $ |
| 4 |
|
|
| 5 |
// Copyright 2005 Khalid Baheyeldin http://2bits.com |
// Copyright 2005 Khalid Baheyeldin http://2bits.com |
| 6 |
|
|
| 270 |
|
|
| 271 |
if (_nodevote_validate_vote($vote)) { |
if (_nodevote_validate_vote($vote)) { |
| 272 |
if (_nodevote_user_voted($user->uid, $nid)){ |
if (_nodevote_user_voted($user->uid, $nid)){ |
| 273 |
$result = db_query("UPDATE {nodevote} SET vote = $vote WHERE uid = %d AND nid = %d" , $user->uid , $nid); |
$result = db_query("UPDATE {nodevote} SET vote = %d WHERE uid = %d AND nid = %d", $vote, $user->uid , $nid); |
| 274 |
} |
} |
| 275 |
else { |
else { |
| 276 |
// check to see if the user has voted too many times today |
// check to see if the user has voted too many times today |
| 521 |
} |
} |
| 522 |
|
|
| 523 |
function _nodevote_validate_vote($vote) { |
function _nodevote_validate_vote($vote) { |
| 524 |
if (($vote < NODEVOTE_MIN_SCORE) || ($vote > NODEVOTE_MAX_SCORE)) { |
if (!is_numeric($vote)) { |
| 525 |
return FALSE; |
return FALSE; |
| 526 |
} |
} |
| 527 |
return TRUE; |
|
| 528 |
|
if ($vote >= NODEVOTE_MIN_SCORE && $vote <= NODEVOTE_MAX_SCORE) { |
| 529 |
|
return TRUE; |
| 530 |
|
} |
| 531 |
|
|
| 532 |
|
return FALSE; |
| 533 |
} |
} |
| 534 |
|
|
| 535 |
function nodevote_userpoints($op, $points = 0, $uid = 0, $event = '') { |
function nodevote_userpoints($op, $points = 0, $uid = 0, $event = '') { |