Exemple #1
0
        if ($result == null) {
            $result = $this->createNewKey($ratableKey);
        }
        return $result;
    }
    function createNewKey($key)
    {
        if (is_numeric($key)) {
            return false;
        }
        $SQL_INSERT_KEY = "INSERT INTO {$this->ratables}(ratableKey) " . "VALUES ('{$key}');";
        mysql_query($SQL_INSERT_KEY);
        $SQL_GET_NEW_KEY = "SELECT id AS keyID FROM {$this->ratables} WHERE " . "ratableKey = '{$key}';";
        $newKey = mysql_fetch_array(mysql_query($SQL_GET_NEW_KEY), MYSQL_ASSOC);
        $newKey['rating'] = 50;
        $newKey['totalRatings'] = 1;
        $SQL_INSERT_VOTE = 'INSERT INTO rabid_ratings (ratable_id, ip_address, rating) VALUES (\'' . $newKey['keyID'] . '\', \'0.0.0.0\', \'50\');';
        mysql_query($SQL_INSERT_VOTE);
        return $newKey;
    }
    function percentToStars($percent)
    {
        $modifier = 100 / $this->stars;
        return round($percent / $modifier, 1);
    }
}
/* The code below handles ratings sent if the $_POST variables are set. */
if ($_POST['vote'] && $_POST['id']) {
    $r = new RabidRatings();
    $r->doVote($_POST['id'], $_POST['vote']);
}
echo module::get_var("ratings", "textcolor");
?>
;
}
.rabidRating .ratingText.loading {
	background: url('<?php 
echo url::file("modules/ratings/vendor/img/ajax-loading.gif");
?>
') no-repeat;
	text-indent: -999em;
}
</style>

<?php 
require_once MODPATH . "ratings/vendor/ratings.php";
$rr = new RabidRatings();
?>

<script type="text/javascript">
<?php 
include_once MODPATH . "ratings/js/ratings.js";
?>
</script>

<div class="ratings-sb ">
<?php 
if (module::get_var("ratings", "regonly") == 1 && identity::active_user()->guest) {
} else {
    echo module::get_var("ratings", "castyourvotestring");
}
$ratingid = "rate" . $item->id;
Exemple #3
0
<?php

error_reporting(0);
require_once "ratings.php";
$rr = new RabidRatings();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head>
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
<meta http-equiv="Pragma" content="no-cache">
<script type="text/javascript" src="/cydia/js/mootools-1.2b1.js"></script>
<script type="text/javascript" src="/cydia/js/ratings.js"></script>
<link rel="stylesheet" type="text/css" href="/cydia/css/ratings.css" />
</head><body>

<?php 
$rr->showStars($_GET['pid']);
?>

</body></html>