<commit_before><?php 
// $Id: tiki-edit_css.php,v 1.1 2003-06-25 04:03:52 mose Exp $
include_once("tiki-setup.php");
include_once("lib/csslib.php");
// remove soon..
#$feature_edit_css = 'y';
#$tiki_p_create_css = 'y';
if(!isset($feature_editcss)) $feature_editcss = 'n';
if(!isset($tiki_p_create_css)) $tiki_p_create_css = 'n';

if($feature_editcss != 'y') {
  $smarty->assign('msg',tra("Feature disabled"));
	$smarty->display("styles/$style_base/error.tpl");
	die;
}

if($tiki_p_create_css != 'y') {
  $smarty->assign('msg',tra("You dont have permission to use this feature"));
  $smarty->display("styles/$style_base/error.tpl");
  die;  
}
if (!isset($_REQUEST["editstyle"])) $_REQUEST["editstyle"] = '';
if (!isset($_REQUEST["sub"])) $_REQUEST["sub"] = '';
if (!isset($_REQUEST["try"])) $_REQUEST["try"] = '';

$editstyle = $_REQUEST["editstyle"];
$styledir = "/home/mose/var/tikicvs/styles";

if (isset($_REQUEST["edit"]) and $_REQUEST["edit"]) {
	$action = 'edit';
	$data = implode("",file("$styledir/$editstyle.css"));
} elseif (isset($_REQUEST["save"]) and $_REQUEST["save"]) {
	$action = 'display';
	$data = '';
	$file = str_replace("-$user","",$editstyle);
	$fp = fopen("$styledir/{$file}-$user.css","w");
	$editstyle = "{$file}-$user";
	if(!$fp) {
		$smarty->assign('msg',tra("You dont have permission to write the style sheet"));
    $smarty->display("styles/$style_base/error.tpl");
    die;
  }
  fwrite($fp,$_REQUEST["data"]);
  fclose($fp);
} else {
  $action = 'display';
	$data = '';
}	
$smarty->assign('action',$action);
$smarty->assign('data',$data);

$cssdata = $csslib->browse_css("$styledir/$editstyle.css");
if ((!$cssdata["error"]) and is_array($cssdata["content"])) {
	$parsedcss = $csslib->parse_css($cssdata["content"]);
} else {
	$parsedcss = $cssdata["error"];
}
$smarty->assign('css',$parsedcss);
$smarty->assign('editstyle',$editstyle);

if ($_REQUEST["try"]) {
	$style = "$editstyle.css";
	$smarty->assign('style',$style);
}

$list = $csslib->list_css($styledir);
$smarty->assign('list',$list);

$smarty->assign('mid','tiki-edit_css.tpl');
$smarty->display("styles/$style_base/tiki.tpl");
?>
<commit_msg>hrum. fixed harcoded value, sorry<commit_after><?php 
// $Id: tiki-edit_css.php,v 1.2 2003-07-04 17:35:32 mose Exp $
include_once("tiki-setup.php");
include_once("lib/csslib.php");
// remove soon..
#$feature_edit_css = 'y';
#$tiki_p_create_css = 'y';
if(!isset($feature_editcss)) $feature_editcss = 'n';
if(!isset($tiki_p_create_css)) $tiki_p_create_css = 'n';

if($feature_editcss != 'y') {
  $smarty->assign('msg',tra("Feature disabled"));
	$smarty->display("styles/$style_base/error.tpl");
	die;
}

if($tiki_p_create_css != 'y') {
  $smarty->assign('msg',tra("You dont have permission to use this feature"));
  $smarty->display("styles/$style_base/error.tpl");
  die;  
}
if (!isset($_REQUEST["editstyle"])) $_REQUEST["editstyle"] = '';
if (!isset($_REQUEST["sub"])) $_REQUEST["sub"] = '';
if (!isset($_REQUEST["try"])) $_REQUEST["try"] = '';

$editstyle = $_REQUEST["editstyle"];
$styledir = "styles";

if (isset($_REQUEST["edit"]) and $_REQUEST["edit"]) {
	$action = 'edit';
	$data = implode("",file("$styledir/$editstyle.css"));
} elseif (isset($_REQUEST["save"]) and $_REQUEST["save"]) {
	$action = 'display';
	$data = '';
	$file = str_replace("-$user","",$editstyle);
	$fp = fopen("$styledir/{$file}-$user.css","w");
	$editstyle = "{$file}-$user";
	if(!$fp) {
		$smarty->assign('msg',tra("You dont have permission to write the style sheet"));
    $smarty->display("styles/$style_base/error.tpl");
    die;
  }
  fwrite($fp,$_REQUEST["data"]);
  fclose($fp);
} else {
  $action = 'display';
	$data = '';
}	
$smarty->assign('action',$action);
$smarty->assign('data',$data);

$cssdata = $csslib->browse_css("$styledir/$editstyle.css");
if ((!$cssdata["error"]) and is_array($cssdata["content"])) {
	$parsedcss = $csslib->parse_css($cssdata["content"]);
} else {
	$parsedcss = $cssdata["error"];
}
$smarty->assign('css',$parsedcss);
$smarty->assign('editstyle',$editstyle);

if ($_REQUEST["try"]) {
	$style = "$editstyle.css";
	$smarty->assign('style',$style);
}

$list = $csslib->list_css($styledir);
$smarty->assign('list',$list);

$smarty->assign('mid','tiki-edit_css.tpl');
$smarty->display("styles/$style_base/tiki.tpl");
?>

{'fraction_non_alphanumeric': 0.2549754155935378, 'fraction_numerical': 0.007492390540856942, 'mean_word_length': 6.534391534391534, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, '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': '2083142', 'n_tokens_mistral': 1647, 'n_tokens_neox': 1640, 'n_words': 238}