Exemplo n.º 1
0
    $itemsClass = new items();
    $item = $itemsClass->get($itemID);
    if (!is_array($item) || check_login_bool() && $item['status'] == 'unapproved' && $item['user_id'] != $_SESSION['user']['user_id'] || $item['status'] == 'queue') {
        header("HTTP/1.0 404 Not Found");
        header("Location: http://" . DOMAIN . "/" . $languageURL . "error");
    }
    if (isset($_POST['rating'])) {
        $_GET['rating'] = $_POST['rating'];
    }
    if (isset($_GET['rating'])) {
        if (!isset($_GET['rating']) || !is_numeric($_GET['rating']) || $_GET['rating'] > 5) {
            $_GET['rating'] = 5;
        } elseif ($_GET['rating'] < 1) {
            $_GET['rating'] = 1;
        }
        $item = $itemsClass->rate($itemID, $_GET['rating']);
        $stars = '';
        for ($i = 1; $i < 6; $i++) {
            if ($item['rating'] >= $i) {
                $stars .= '<img src="{$template_data}img/star-on.png" alt="" />';
            } else {
                $stars .= '<img src="{$template_data}img/star-off.png" alt="" />';
            }
        }
        die('
				jQuery("#stars_div_' . $itemID . '").html(\'' . $stars . '\');
			');
    } elseif (isset($_GET['certificate'])) {
        if ($ordersClass->isBuyed($item['id'])) {
            header('Content-Type: text/plain; charset=UTF-8');
            header('Content-Disposition: attachment; filename="item_licence.txt"');