<commit_before><?php

//this script may only be included - so its better to die if called directly.
if (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !== false) {
	header("location: index.php");
	exit;
}

global $prefs, $tiki_p_view_calendar;
if ( $prefs['feature_calendar'] == 'y' && $tiki_p_view_calendar == 'y' ) {

	global $calendarlib; include_once('lib/calendar/calendarlib.php');
	global $headerlib; $headerlib->add_cssfile('css/calendar.css',20);
	global $calendarViewMode;

	$calendarViewMode = 'month';
	$group_by = 'day';

	if (empty($module_params['calIds'])) {
		$module_params['calIds'] = array();
	}

	include('tiki-calendar_setup.php');

	$tc_infos = $calendarlib->getCalendar($module_params['calIds'], $viewstart, $viewend, $group_by);

	foreach ( $tc_infos as $tc_key => $tc_val ) {
        	$smarty->assign($tc_key, $tc_val);
	}

	$module_params['name'] = 'calendar';
	if ( ! isset($module_params['title']) ) $module_params['title'] = tra('Calendar');

	$smarty->assign('daformat2', $tikilib->get_long_date_format());
	$smarty->assign('var', '');
	$smarty->assign('myurl', 'tiki-calendar.php');<commit_msg>[FIX]calendar_new module: use the session calendar or def calendars if not param calIds specified->TODO: fix the display if mulitple calendars are selected<commit_after><?php

//this script may only be included - so its better to die if called directly.
if (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !== false) {
	header("location: index.php");
	exit;
}

global $prefs, $tiki_p_view_calendar, $tiki_p_admin_calendars;
if ( $prefs['feature_calendar'] == 'y' ) {

	global $calendarlib; include_once('lib/calendar/calendarlib.php');
	global $userlib; include_once('lib/userslib.php');
	global $headerlib; $headerlib->add_cssfile('css/calendar.css',20);
	global $calendarViewMode;

	$calendarViewMode = 'month';
	$group_by = 'day';
	if (empty($module_params['calIds'])) {
		if (!empty($_SESSION['CalendarViewGroups'])) {
			$module_params['calIds'] = $_SESSION['CalendarViewGroups'];
		} elseif (!empty($prefs['default_calendars'])) {
			$module_params['calIds'] = $_SESSION['CalendarViewGroups'] = is_array($prefs['default_calendars']) ? $prefs['default_calendars'] : unserialize($prefs['default_calendars']);
		} else {
			$module_params['calIds'] = array();
		}
	}
	foreach ($module_params['calIds'] as $i=>$cal_id) {
		if ($tiki_p_admin_calendars != 'y' && !$userlib->user_has_perm_on_object($user, $cal_id, 'calendar', 'tiki_p_view_calendar')) {
			unset($module_params['calIds'][$i]);
		}
	}
	include('tiki-calendar_setup.php');

	$tc_infos = $calendarlib->getCalendar($module_params['calIds'], $viewstart, $viewend, $group_by);

	foreach ( $tc_infos as $tc_key => $tc_val ) {
        	$smarty->assign($tc_key, $tc_val);
	}

	$module_params['name'] = 'calendar';
	if ( ! isset($module_params['title']) ) $module_params['title'] = tra('Calendar');

	$smarty->assign('daformat2', $tikilib->get_long_date_format());
	$smarty->assign('var', '');
	$smarty->assign('myurl', 'tiki-calendar.php');
{'fraction_non_alphanumeric': 0.19141914191419143, 'fraction_numerical': 0.0019801980198019802, 'mean_word_length': 6.5775, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1755076', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1069, 'n_words': 184}