function setCalendar($inYear, $inMonth) { $dayofmonth = date('t', mktime(0, 0, 0, $inMonth, 1, $inYear)); $day_count = 1; $num = 0; for ($i = 0; $i < 7; $i++) { $dayofweek = date('w', mktime(0, 0, 0, $inMonth, $day_count, $inYear)); $dayofweek = $dayofweek - 1; if ($dayofweek == -1) { $dayofweek = 6; } if ($dayofweek == $i) { $week[$num][$i] = $day_count; $day_count++; } else { $week[$num][$i] = ""; } } while (true) { $num++; for ($i = 0; $i < 7; $i++) { $week[$num][$i] = $day_count; $day_count++; if ($day_count > $dayofmonth) { break; } } if ($day_count > $dayofmonth) { break; } } setView($week); }
function denied($reason = 0) { global $sess; $status = 403; switch ($reason) { case 0: $rtext = 'Permission denied.'; break; case 'login': $rtext = 'You must be logged in to view this page.'; $status = 401; break; case 'rights': $rtext = 'You have insufficient rights for this action.'; break; default: $rtext = 'Permission denied: ' . $reason; } $sess['messages'][] = array('warn', $rtexto); if ($reason == 'login') { $sess['messages'][] = array('info', '<a href="?login">Log in</a> or <a href= "' . ADMIN_BASE_URL . '/docs/">visit the help pages</a> to learn more.'); } setView('frontpage', 'denied'); }