Example #1
0
     if (!empty($cmtx_country)) {
         //if country value is selected
         cmtx_is_injected($cmtx_country);
         //check for injection attempt
         cmtx_validate_country($cmtx_country);
         //validate country
         $cmtx_country = cmtx_sanitize($cmtx_country, true, true);
         //sanitize country
     } else {
         $cmtx_country = "";
     }
 } else {
     $cmtx_country = "";
 }
 /* Rating */
 if (cmtx_setting('repeat_ratings') != 'allow' && cmtx_has_rated_form()) {
     $cmtx_rating = 0;
 } else {
     if (!isset($_POST['cmtx_rating'])) {
         //if rating not submitted
         $_POST['cmtx_rating'] = '';
         //set it with an empty value
     }
     if (cmtx_setting('enabled_rating')) {
         //if rating field is enabled
         $cmtx_rating = trim($_POST['cmtx_rating']);
         //remove any space at beginning and end
         if (cmtx_setting('required_rating') && empty($cmtx_rating)) {
             //if field is required but value is empty
             cmtx_error(CMTX_ERROR_MESSAGE_NO_RATING);
             //reject user for selecting no rating
Example #2
0
function cmtx_output_rating()
{
    global $cmtx_default_rating, $cmtx_path;
    if (cmtx_setting('enabled_rating')) {
        if (cmtx_setting('repeat_ratings') == 'hide' && cmtx_has_rated_form()) {
        } else {
            ?>
<div class="cmtx_height_between_fields"></div>
<label class="cmtx_label">
<?php 
            echo CMTX_LABEL_RATING;
            if (cmtx_setting('required_rating') && cmtx_setting('display_required_symbol')) {
                ?>
<span class="cmtx_required_symbol"><?php 
                echo ' ' . CMTX_REQUIRED_SYMBOL;
                ?>
</span><?php 
            }
            ?>
</label>
<?php 
            require_once $cmtx_path . 'includes/template/ratings.php';
            if (cmtx_setting('repeat_ratings') == 'disable' && cmtx_has_rated_form()) {
                $cmtx_ratings = $cmtx_rated;
            } else {
                if (!empty($cmtx_default_rating)) {
                    $cmtx_ratings = str_ireplace('"' . $cmtx_default_rating . '"', '"' . $cmtx_default_rating . '" selected="selected"', $cmtx_ratings);
                }
            }
            echo $cmtx_ratings;
        }
    }
}