<commit_before><?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

//this script may only be included - so its better to die if called directly.
$access->check_script($_SERVER['SCRIPT_NAME'], basename(__FILE__));

if ( isset($_SESSION['tiki_cookie_jar']) ) {
	$cookielist = array();

	if (is_array($_SESSION['tiki_cookie_jar'])) {
		$smarty->loadPlugin('smarty_modifier_escape');
		foreach ( $_SESSION['tiki_cookie_jar'] as $nn => $vv ) {
			$cookielist[] = "'" . smarty_modifier_escape($nn, 'javascript') . "': '" . smarty_modifier_escape($vv, 'javascript') . "'";
		}
	}

	if ( count($cookielist) ) {		
		$headerlib->add_js('tiki_cookie_jar={'. implode(',', $cookielist).'};');
	}
} else {
	$headerlib->add_js('tiki_cookie_jar=new Object();');
}

$smarty->assign_by_ref('cookie', $_SESSION['tiki_cookie_jar']);

// fix margins for hidden columns - css (still) doesn't work as it needs to know the "normal" margins FIXME
if (getCookie('show_col2') == 'n') {
	$headerlib->add_css('#c1c2 #wrapper #col1.marginleft { margin-left: 0; }', 100);
}
if (getCookie('show_col3') == 'n') {
	$headerlib->add_css('#c1c2 #wrapper #col1.marginright { margin-right: 0; }', 100);
}

function getCookie($name, $section = null, $default = null)
{
	global $feature_no_cookie;

	if ($feature_no_cookie || (empty($section) && isset($_SESSION['tiki_cookie_jar'][$name]))) {
		if (isset($_SESSION['tiki_cookie_jar'])) {// if cookie jar doesn't work
			if (isset($_SESSION['tiki_cookie_jar'][$name]))
				return $_SESSION['tiki_cookie_jar'][$name];
			else
				return $default;
		}
	} else if ($section) {<commit_msg>[FIX] cookies: Merge tiki_cookie_jar with real cookies (for left/right col hiding)<commit_after><?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

//this script may only be included - so its better to die if called directly.
$access->check_script($_SERVER['SCRIPT_NAME'], basename(__FILE__));

if ( isset($_SESSION['tiki_cookie_jar']) ) {
	$cookielist = array();

	if (is_array($_SESSION['tiki_cookie_jar'])) {
		$smarty->loadPlugin('smarty_modifier_escape');
		foreach ( $_SESSION['tiki_cookie_jar'] as $nn => $vv ) {
			$cookielist[] = "'" . smarty_modifier_escape($nn, 'javascript') . "': '" . smarty_modifier_escape($vv, 'javascript') . "'";
		}
	}

	if ( count($cookielist) ) {		
		$headerlib->add_js('tiki_cookie_jar={'. implode(',', $cookielist).'};');
	}
	$_COOKIE = array_merge($_SESSION['tiki_cookie_jar'], $_COOKIE);
} else {
	$headerlib->add_js('tiki_cookie_jar=new Object();');
}

$smarty->assign_by_ref('cookie', $_COOKIE);

// fix margins for hidden columns - css (still) doesn't work as it needs to know the "normal" margins FIXME
if (getCookie('show_col2') == 'n') {
	$headerlib->add_css('#c1c2 #wrapper #col1.marginleft { margin-left: 0; }', 100);
}
if (getCookie('show_col3') == 'n') {
	$headerlib->add_css('#c1c2 #wrapper #col1.marginright { margin-right: 0; }', 100);
}

function getCookie($name, $section = null, $default = null)
{
	global $feature_no_cookie;

	if ($feature_no_cookie || (empty($section) && isset($_SESSION['tiki_cookie_jar'][$name]))) {
		if (isset($_SESSION['tiki_cookie_jar'])) {// if cookie jar doesn't work
			if (isset($_SESSION['tiki_cookie_jar'][$name]))
				return $_SESSION['tiki_cookie_jar'][$name];
			else
				return $default;
		}
	} else if ($section) {
{'fraction_non_alphanumeric': 0.1789924973204716, 'fraction_numerical': 0.012861736334405145, 'mean_word_length': 5.149917627677101, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '4784640', 'n_tokens_mistral': 1376, 'n_tokens_neox': 1285, 'n_words': 307}