# подключаем ядро $NETCAT_FOLDER = join(strstr(__FILE__, "/") ? "/" : "\\", array_slice(preg_split("/[\\/\\\\]+/", __FILE__), 0, -4)) . (strstr(__FILE__, "/") ? "/" : "\\"); include_once $NETCAT_FOLDER . "vars.inc.php"; $passed_thru_404 = true; require $INCLUDE_FOLDER . "index.php"; # нужные переменные # идентификатор компонента в разделе должен передаваться с именем отличным от $cc, # например $needcc, иначе вместе с календарём система выдаст экран авторизации, # т.к. тут подключается вся система! $needcc = $_GET['needcc']; $needcc = explode(',', $needcc); if (!is_array($needcc)) { $needcc = array($needcc); } $needcc = array_map('intval', $needcc); $theme = (int) $_GET['theme']; $datefield = $db->escape($_GET['datefield']); $filled = (int) $_GET['filled']; $day = (int) $_GET['day']; $month = (int) $_GET['month']; $year = (int) $_GET['year']; $popup = (int) $_GET['popup']; $queryDate = preg_match("/\\d{4}(-\\d{2})?(-\\d{2})?/s", $_GET['querydate']) ? $_GET['querydate'] : ""; $cc_ignore = (int) $_GET['cc_ignore']; $field_day = htmlspecialchars($nc_core->input->fetch_get_post('field_day'), ENT_QUOTES); $field_month = htmlspecialchars($nc_core->input->fetch_get_post('field_month'), ENT_QUOTES); $field_year = htmlspecialchars($nc_core->input->fetch_get_post('field_year'), ENT_QUOTES); # генерируем календарь $calendar = nc_set_calendar($theme) . nc_show_calendar($theme, $needcc, $year . "-" . $month . "-" . $day, $datefield, (int) $filled, $queryDate, $popup, array($field_day, $field_month, $field_year), $cc_ignore); echo $calendar ? $calendar : ""; }
<?php /* $Id: showpreview.php 7863 2012-07-30 15:18:50Z lemonade $ */ $NETCAT_FOLDER = join(strstr(__FILE__, "/") ? "/" : "\\", array_slice(preg_split("/[\\/\\\\]+/", __FILE__), 0, -4)) . (strstr(__FILE__, "/") ? "/" : "\\"); include_once $NETCAT_FOLDER . "vars.inc.php"; require $INCLUDE_FOLDER . "index.php"; $error = false; $id = (int) $_GET['id']; # если пользователь не зарегистрирован или не объявлен $perm if (!$current_user || !class_exists("Permission") || !is_object($perm)) { $error = NETCAT_MODERATION_ERROR_NORIGHT; } else { # права администратора $AdmRights = $perm->isDirector() || $perm->isSupervisor(); # если есть какие либо из этих прав, доступ разрещён if (!$AdmRights) { $error = NETCAT_MODERATION_ERROR_NORIGHT; } } // if no auth module, object $perm not instantiated and error is true // try to authorize and unset error or error is really true if ($error && Authorize()) { if (is_object($perm) && ($perm->isDirector() || $perm->isSupervisor())) { unset($error); } } echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n<html>\n<head>\n<meta http-equiv='content-type' content='text/html; charset=" . $nc_core->NC_CHARSET . "'>\n<title>" . (!$error ? NETCAT_MODULE_CALENDAR_PREVIEW : $error) . "</title>\n" . (!$error ? nc_set_calendar($id) : "") . "\n</head>\n<body>\n" . (!$error ? "<table cellspacing='1' cellpadding='1' border='0' style='width:100%; height:100%'>\n<tr valign='middle'>\n<td align='center'>\n" . nc_show_calendar($id, 0, date('Y-m-d'), 'Created', true, false, true) . "\n</td>\n</tr>\n</table>" : $error) . "\n</body>\n</html>";
<?php $NETCAT_FOLDER = realpath(dirname(__FILE__) . '/../../../') . DIRECTORY_SEPARATOR; require_once $NETCAT_FOLDER . 'vars.inc.php'; require_once $ADMIN_FOLDER . 'function.inc.php'; // require_once $ADMIN_FOLDER . 'admin.inc.php'; require_once 'function.inc.php'; $route = !empty($_GET['route']) ? $_GET['route'] : 'index'; switch ($route) { //-------------------------------------------------------------------------- case 'index': $theme = !empty($_GET['theme']) ? (int) $_GET['theme'] : 0; $cc = !empty($_GET['cc']) ? (int) $_GET['cc'] : 0; echo nc_show_calendar($theme, $cc) . "<script>\$nc('#nc_calendar_block>table').css({width:'100%',height:'100%'})</script>"; break; //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- case 'settings': $form = $nc_core->ui->form(''); $result = $db->get_results("SELECT ID, ThemeName FROM Calendar_Settings ORDER BY ID", ARRAY_A); $themes = array(); foreach ($result as $row) { $themes[$row['ID']] = $row['ThemeName']; } $form->add_row('Theme')->select('theme', $themes, 3); $form->add_row('Cc')->string('cc', 0); echo $form->vertical(); break; //-------------------------------------------------------------------------- }
<?php /* $Id$ */ $NETCAT_FOLDER = join(strstr(__FILE__, "/") ? "/" : "\\", array_slice(preg_split("/[\\/\\\\]+/", __FILE__), 0, -4)) . (strstr(__FILE__, "/") ? "/" : "\\"); include_once $NETCAT_FOLDER . "vars.inc.php"; require $INCLUDE_FOLDER . "index.php"; $id = intval($nc_core->input->fetch_get_post('theme')); $day = intval($nc_core->input->fetch_get_post('day')); $month = intval($nc_core->input->fetch_get_post('month')); $year = intval($nc_core->input->fetch_get_post('year')); $field_day = htmlspecialchars($nc_core->input->fetch_get_post('field_day'), ENT_QUOTES); $field_month = htmlspecialchars($nc_core->input->fetch_get_post('field_month'), ENT_QUOTES); $field_year = htmlspecialchars($nc_core->input->fetch_get_post('field_year'), ENT_QUOTES); if (!$day) { $day = date("d"); } if (!$month) { $month = date("m"); } if (!$year) { $year = date("Y"); } echo nc_set_calendar($id) . nc_show_calendar($id, 0, $year . "-" . $month . "-" . $day, '', 1, $year . "-" . $month . "-" . $day, 1, array($field_day, $field_month, $field_year));
function nc_show_calendar_by_class($theme = 0, $classes = 0, $setDate = 0, $DateField = "Date", $filled = false, $queryDate = false) { global $db; if (!is_array($classes)) { $classes = array($classes); } $classes = array_map('intval', $classes); $cc_ids = $db->get_col("SELECT `Sub_Class_ID` FROM `Sub_Class` WHERE `Class_ID` IN (" . join(',', $classes) . ") "); return nc_show_calendar($theme, $cc_ids, $setDate, $DateField, $filled, $queryDate); }