if ($p_rate < 1 || $p_rate > 5) {
        $success = false;
        array_push($errors, "Please provide a valid rate.");
    }
    if ($p_comment == '') {
        $success = false;
        array_push($errors, "The comment field is required!");
    }
    if ($p_comment != '' && !preg_match('/^[\\s\\S]{0,500}$/u', $p_comment)) {
        $success = false;
        array_push($errors, "The comment must be no more than 500 character long.");
    }
    if ($success) {
        $update = array('rate' => $p_rate, 'comment' => $p_comment);
        UserReview::update($id, $update);
        $review = UserReview::get_one($id);
    }
}
include "page-header.php";
?>

<div id="wrapper">

	<?php 
include "page-left.php";
?>

	<div id="content">
			
		<form name="form_adreview_edit" id="form_adreview_edit" method="post" enctype='application/x-www-form-urlencoded' accept-charset="UTF-8" class="form">
Exemple #2
0
        exit;
    }
    $review_user = $review->getUser();
    echo '<tr><td>';
    echo '<img src="img/badges/' . $rating->getInitial() . '_tiny.jpg" alt="' . $rating->getTitle() . '" height="20"></td>';
    echo '<td >' . htmlspecialchars($review->getReview()) . '</td>';
    echo '<td><a href="https://www.reddit.com/user/' . $review_user->getUsername() . '/">/u/' . $review_user->getUsername() . '</a></td></tr>';
}
?>
        </table>
        <?php 
if (Auth::checkIfAuthenticated()) {
    ?>
            <form action="" method="POST">
                <?php 
    $review = UserReview::getUserReview($game, $platform, $user);
    ?>
                <div class="form-group">
                    <?php 
    if ($review == null) {
        ?>
                        Submit
                    <?php 
    } else {
        ?>
                        Update
                    <?php 
    }
    ?>
                    User Review
                    <select name="submit_game_rating" class="form-control">
/**
 * Classified-users-script
 * 
 * @copyright  Copyright (c) Szilard Szabo
 * @license    GPL v3
 * @package    Frontend
 */
include "./admin/include/common.php";
$r_id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
$exists = User::exists($r_id, array("active" => 1));
if ($exists) {
    $user = User::get_one($r_id);
    if (isset($_POST['send']) && User::is_logged_in()) {
        $success = true;
        $errors = array();
        $p_rate = isset($_POST['rate']) ? (int) $_POST['rate'] : 0;
        $p_comment = strip_tags($_POST['comment']);
        if ($p_rate < 1 || $p_rate > 5) {
            $success = false;
            array_push($errors, "Please provide a valid rate.");
        }
        if ($p_comment != '' && !preg_match('/^[\\s\\S]{0,200}$/u', $p_comment)) {
            $success = false;
            array_push($errors, "The comment can't be more than 200 character long.");
        }
        if ($success) {
            UserReview::create(array('reviewed_user' => $r_id, 'user_id' => User::get_id(), 'rate' => $p_rate, 'comment' => $p_comment));
        }
    }
}
include "./templates/user-review.php";
Exemple #4
0
 public function run()
 {
     $reviews = UserReview::model()->findAll();
     $this->render("reviews", ['reviews' => $reviews]);
 }
<?php

/**
 * Classified-ads-script
 * 
 * @copyright  Copyright (c) Szilard Szabo
 * @license    GPL v3
 * @package    Frontend
 */
include "./admin/include/common.php";
$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
$exists = User::exists($id, array("active  " => 1));
if ($exists) {
    $user = User::get_one($id);
    $reviews = UserReview::get_all(array('reviewed_user' => $id));
}
include "./templates/user-view.php";