| 1554 |
} |
} |
| 1555 |
|
|
| 1556 |
function recordVote() { |
function recordVote() { |
| 1557 |
global $database, $mosConfig_live_site, $mosConfig_offset; |
global $database, $mosConfig_live_site, $mosConfig_offset, $acl, $gid; |
| 1558 |
|
|
| 1559 |
$user_rating = mosGetParam( $_REQUEST, 'user_rating', 0 ); |
$user_rating = mosGetParam( $_REQUEST, 'user_rating', 0 ); |
| 1560 |
$cid = mosGetParam( $_REQUEST, 'cid', 0 ); |
$cid = mosGetParam( $_REQUEST, 'cid', 0 ); |
| 1563 |
$Itemid = intval( $Itemid ); |
$Itemid = intval( $Itemid ); |
| 1564 |
$user_rating = intval( $user_rating ); |
$user_rating = intval( $user_rating ); |
| 1565 |
$now = date( 'Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60 ); |
$now = date( 'Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60 ); |
| 1566 |
|
$viewAccess = ($gid >= $acl->get_group_id( 'Registered', 'ARO' ) ? 1 : 0) + ($gid >= $acl->get_group_id( 'Author', 'ARO' ) ? 1 : 0); |
| 1567 |
|
|
| 1568 |
$url = sefReltoAbs("index.php?option=com_content&task=view&id={$cid}&Itemid={$Itemid}"); |
$url = sefReltoAbs("index.php?option=com_content&task=view&id={$cid}&Itemid={$Itemid}"); |
| 1569 |
if ( ( $user_rating >= 1 ) and ( $user_rating <= 5 ) ) { |
if ( ( $user_rating >= 1 ) and ( $user_rating <= 5 ) ) { |
| 1572 |
$query = "SELECT * FROM #__content as c WHERE id = $cid AND (c.state = '1' OR c.state = '-1')" |
$query = "SELECT * FROM #__content as c WHERE id = $cid AND (c.state = '1' OR c.state = '-1')" |
| 1573 |
. "\n AND (c.publish_up = '0000-00-00 00:00:00' OR c.publish_up <= '$now')" |
. "\n AND (c.publish_up = '0000-00-00 00:00:00' OR c.publish_up <= '$now')" |
| 1574 |
. "\n AND (c.publish_down = '0000-00-00 00:00:00' OR c.publish_down >= '$now')" |
. "\n AND (c.publish_down = '0000-00-00 00:00:00' OR c.publish_down >= '$now')" |
| 1575 |
|
. "\n AND access <= ". $viewAccess; |
| 1576 |
; |
; |
| 1577 |
$database->setQuery( $query ); |
$database->setQuery( $query ); |
| 1578 |
$database->loadObject( $row ); |
$database->loadObject( $row ); |