// parse params $year = $_GET["y"]; $month = $_GET["m"]; $linkNumber = $_GET["n"]; $VIEW_MODE_MAIN = 'vm_main'; // display articles for all years $VIEW_MODE_YEAR = 'vm_year'; // display articles for defined year and for all months $VIEW_MODE_MONTH = 'vm_month'; // display articles for defined year and month $viewMode; // define viewMode if (!isValidYear($year)) { $viewMode = $VIEW_MODE_MAIN; } else { if (!isValidMonth($month)) { $viewMode = $VIEW_MODE_YEAR; } else { $viewMode = $VIEW_MODE_MONTH; } } // define max number of links to display if (!isValidLinksNumber($linkNumber)) { switch ($viewMode) { case $VIEW_MODE_MAIN: $linkNumber = 5; break; case $VIEW_MODE_YEAR: $linkNumber = 10; $archieveTitle = "{$archieveTitle} за {$year} год"; break;
$selectedDate = mktime(0, 0, 0, $selectedMonth, $selectedDay, $selectedYear); // Cannot edit income expense date if the selected date is in the future if ($selectedDate > time()) { $canEdit = false; } else { $canEdit = true; } $daysInSelectedMonth = cal_days_in_month(CAL_GREGORIAN, $selectedMonth, $selectedYear); $mySqlFormatedDate = $selectedYear . "-" . $selectedMonth . "-" . $selectedDay; $selectedMonthName = getMonthsArray()[$selectedMonth - 1]; } else { if ($view === "monthly") { // Check if a specified date was entered. If not then set the month as the current month if (isset($_GET["month"]) && isset($_GET["year"])) { // Check if the specified date entered is a valid date if (isValidMonth(intval($_GET["month"])) && isValidYear(intval($_GET["year"]))) { $selectedMonth = intval($_GET["month"]); $selectedYear = intval($_GET["year"]); } else { $invalidDate = true; require_once ROOT_PATH . "includes/layouts/output.html.php"; exit; } } else { $selectedMonth = date("n", time()); $selectedYear = date("Y", time()); } $selectedDate = mktime(0, 0, 0, $selectedMonth, 1, $selectedYear); $daysInSelectedMonth = cal_days_in_month(CAL_GREGORIAN, $selectedMonth, $selectedYear); $mySqlFormatedDateStart = $selectedYear . "-" . $selectedMonth . "-1"; $mySqlFormatedDateEnd = $selectedYear . "-" . $selectedMonth . "-" . $daysInSelectedMonth;