<?php
header('Content-Type: application/json');

echo json_encode(array("is_feedback_shown" => isFeedbackShown()));

function isFeedbackShown(){

    $checkFeb = isFeedbackAllowedByMonth("02");
    $checkSep = isFeedbackAllowedByMonth("09");

    if ($checkFeb == 1 || $checkSep == 1){
        return 1;
    }else{
        return 0;
    }

}

function isFeedbackAllowedByMonth($monthNumber){

    $current_year = date("Y");

    $today_date = date('Y-m-d', strtotime(date('Y-m-d')));
    $weekBegin = date('Y-m-d', strtotime("$current_year-$monthNumber-01"));
    $weekEnd   = date('Y-m-d', strtotime("$current_year-$monthNumber-07"));

    if (($today_date >= $weekBegin) && ($today_date <= $weekEnd)){
        return 1;
    }else{
        return 0;
    }

}