function parse_css($filecont, $custom = false) { $cssoperators[] = "/*cat="; $cssoperators[] = "_*/"; $cssoperators[] = ";"; $cssoperators[] = "{"; $cssoperators[] = "}"; #$filecont=preg_replace('(\t)', "", $filecont); $filecont = trim(nl2br(str_replace(array("\t", ";*/", "/*cat=", "_*/", "{", "}"), array('', "*/;", "\n\r /*cat=", "_*/ \n\r", "\n\r { \n\r", "\n\r } \n\r"), $filecont))); $filecontar = explode("<br />", $filecont); if (isset($filecontar) && is_array($filecontar)) { foreach ($filecontar as $bb) { if (strlen($bb) >= 3 || in_array($bb, $cssoperators)) { $newcssar[] = $bb; } } } #echo "<pre>"; #print_r($newcssar); $status = ''; if (isset($newcssar) && is_array($newcssar)) { foreach ($newcssar as $aa => $bb) { if (!isset($nummerik)) { $nummerik = 0; } if (strlen($bb) > 0) { $bbo = $bb; foreach ($cssoperators as $csoperator) { if (stristr($bb, $csoperator)) { # if ($csoperator=="/*"){ $status=5;} if ($csoperator == '_*/' || $csoperator == '/*cat=') { $status = 1; } elseif ($csoperator == ";") { $status = 3; } elseif ($csoperator == "{") { $status = 2; } elseif ($csoperator == "}") { $status = 4; } break; } } $do = ''; if ($status == 1 || $status == 2) { if ($status == 1) { $do = $bb; } else { $do = $newcssar[$aa - 1]; } $parselink = str_replace($cssoperators, "", $do); if ($status == 1) { $parselink = preg_replace('[\\s]', '', $parselink); } $do = str_replace(array("\n", "\r"), '', $parselink); $do = str_replace(array("<br />", "<br>"), "", nl2br($do)); } if ($status == 1) { $status = 2; if (strlen($do) > 0) { $klikit[$do] = ''; $cat = $do; $do = ''; } } elseif ($status == 2) { if (!isset($cat)) { $nummerik++; $cat = $nummerik; } $ele = $do; $do = ''; if (strlen(preg_replace('[\\s]', '', $ele)) > 0) { #$klikit[$cat][$ele]=''; } $status = 3; } elseif ($status == 3) { if (!isset($cat)) { $nummerik++; $cat = $nummerik; } if (strlen(preg_replace('[\\s]', '', $bb)) > 0 && isset($ele) && strlen($ele) > 0) { if (!isset($ele) || !isset($cat) || !isset($klikit[$cat][$ele])) { $klikit[$cat][$ele] = ''; } $spaceoutdude = str_replace(array(" ", " "), "{spaceoutdude}", trim($bb)); if (isset($_SESSION['res_space']) && $_SESSION['res_space'] == 1) { $spaceoutdude = preg_replace('[\\n]', ';', $spaceoutdude); } else { } $spaceoutdude = preg_replace('[\\s]', '', $spaceoutdude); $spaceoutdude = trim(str_replace(";;", ";", $spaceoutdude)); if (isset($_SESSION['res_space']) && $_SESSION['res_space'] == 0) { if ($custom == true || is_substr($_GET['fd'], "edit_area") || is_substr(html_entity_decode($_GET['fd']), $GLOBALS['_cfg']['folders']['language']) != false) { $rep = " "; } else { $rep = ""; } } else { $rep = " "; } $spaceoutdude = str_replace("{spaceoutdude}", $rep, $spaceoutdude); } else { $spaceoutdude = $bb; } $spaceoutdude = unesccss($spaceoutdude); $spaceoutdude = trim($spaceoutdude); if (isset($ele) && isset($cat) && isset($klikit[$cat][$ele])) { $klikit[$cat][$ele] .= $spaceoutdude; } } elseif ($status == 4) { # if (isset($newcssar[$aa+1])){ # $ele=$newcssar[$aa+1];}else{$ele='';} if (isset($newcssar[$aa + 1]) && strstr($newcssar[$aa + 1], "/*cat=")) { $status = 1; } else { $status = 2; } } } } } #echo "TEST";die(); if (!isset($klikit) || count($klikit) < 1) { $klikit = ''; } return $klikit; }
function parse_init($aa2 = false) { global $donememo, $_cfg, $fd, $current_ext, $readonly, $skip_css_specific; $skip_css_specific = false; if ($aa2 != false && is_array($aa2)) { $skip_css_specific = true; if (isset($_POST['editelecont'])) { $readonly = false; } } #prepare file query if (isset($_GET) && isset($_GET['fn']) && strlen($_GET['fn']) > 0) { if (strlen($current_ext) > 0) { if ($current_ext != "" && $current_ext != "no_ext") { $temp_1 = "." . $current_ext; } else { $temp_1 = ""; } } $_GET['fn'] = str_replace(array("..", "/", "." . $current_ext), "", $_GET['fn']) . $temp_1; } $temp_1 = ''; if (!isset($donememo)) { $donememo = ''; } if (!isset($_cfg['global']['memorize'])) { $_cfg['global']['memorize'] = ''; } $_cfg['max'] = $_cfg['global']['memorize'] * $_cfg['global']['memorize']; if (isset($_GET['mode']) && is_numeric($_GET['mode'])) { $_SESSION['res_space'] = addslashes($_GET['mode']); } if (!isset($_SESSION['res_space'])) { $_SESSION['res_space'] = 1; } if (!isset($_GET) || !isset($_GET['fd']) || $_GET['fd'] == '') { $_GET['fd'] = 'nonexistent'; } else { # $_GET['fd']= str_replace('..', '', addslashes($_GET['fd'])); } if (!isset($_cfg['ddir'])) { $_cfg['ddir'] = ''; } if (isset($_GET) && isset($_GET['fd']) && strlen($_GET['fd']) > 0 && is_dir($_cfg['ddir'] . html_entity_decode($_GET['fd']) . '/')) { chdir($_cfg['ddir'] . html_entity_decode($_GET['fd']) . '/'); } elseif (is_dir($_cfg['ddir'] . "css") && isset($_GET) && $_GET['fd'] == '') { chdir("css"); $fd = 'css'; if (strlen($_GET['fd']) == 0) { $_GET['fd'] = ''; } } elseif (isset($_GET) && isset($_GET['fd']) && $_GET['fd'] == 'nonexistent') { if (is_dir('css')) { $fd = 'css'; chdir('css'); } $_GET['fd'] = ''; } if (!isset($fd)) { $fd = ''; } if (is_array($aa2) || isset($_GET) && isset($_GET['fn']) && file_exists(html_entity_decode($_GET['fn']))) { if (!is_array($aa2)) { $filecont = file_get_contents(html_entity_decode($_GET['fn'])); } if (is_array($aa2) || isset($filecont) && strlen($filecont) > 0) { if (!is_array($aa2)) { $klikit = parse_css($filecont, $aa2); # make 3d array of existing data } else { $klikit = $aa2; } #change it with other userinput: if (isset($_GET['rmcat'])) { #remove category/comment: $klikit[html_entity_decode($_GET['rmcat'])] = ''; unset($klikit[html_entity_decode($_GET['rmcat'])]); } elseif (isset($_GET['rmele'])) { $klikit[html_entity_decode($_GET['cat'])][html_entity_decode($_GET['rmele'])] = ''; unset($klikit[html_entity_decode($_GET['cat'])][html_entity_decode($_GET['rmele'])]); } elseif (isset($_POST) && is_array($_POST)) { if (isset($_POST['attach'])) { $ohwmg = explode(":", $_POST['brw']); $ohwmg = trim($ohwmg[0]); $_POST['ele'] = trim($_POST['ele']); $_POST['ele'] .= $ohwmg; unset($ohwmg); } if (isset($_POST['ele']) && strlen($_POST['ele']) > 0 && html_entity_decode($_GET['ele']) != $_POST['ele'] or isset($_POST['attach'])) { #remove old (get) ele and set get to new posted if (!isset($_POST['attach'])) { $klikit[html_entity_decode($_GET['cat'])][html_entity_decode($_GET['ele'])] = ''; unset($klikit[html_entity_decode($_GET['cat'])][html_entity_decode($_GET['ele'])]); } $_GET['ele'] = urlencode(htmlentities($_POST['ele'])); $readonly = false; } # edit elem contents if ($skip_css_specific == true) { if (isset($_POST['editelecont'])) { $spaceoutdude = $_POST['editelecont']; } #return $spaceoutdude; } else { if (isset($_POST['editelecont'])) { $spaceoutdude = str_replace(array(" ", " "), "{spaceoutdude}", trim($_POST['editelecont'])); if (isset($_SESSION['res_space']) && $_SESSION['res_space'] == 1) { $spaceoutdude = preg_replace('[\\n]', ';', $spaceoutdude); } else { } $spaceoutdude = preg_replace('[\\s]', '', $spaceoutdude); $spaceoutdude = trim(str_replace(";;", ";", $spaceoutdude)); if (isset($_SESSION['res_space']) && $_SESSION['res_space'] == 0) { if (is_substr($_GET['fd'], "edit_area") || is_substr(html_entity_decode($_GET['fd']), $GLOBALS['_cfg']['folders']['language'])) { $rep = " "; } else { $rep = ""; } } else { $rep = " "; } $spaceoutdude = str_replace("{spaceoutdude}", $rep, $spaceoutdude); } } if (isset($spaceoutdude)) { $klikit[html_entity_decode($_GET['cat'])][$_POST['ele']] = html_entity_decode($spaceoutdude); #echo $klikit[html_entity_decode($_GET['cat'])][$_POST['ele']]; unset($spaceoutdude); } # add categ if (isset($_POST['addcat']) && strlen($_POST['addcat']) > 0) { $klikit[$_POST['addcat']] = ''; $_GET['cat'] = urlencode(htmlentities($_POST['addcat'])); } elseif (isset($_POST['addele']) && isset($_POST['addele']) && strlen($_POST['addele']) > 0) { $klikit[$_POST['cat']][$_POST['addele']] = ''; if (isset($_POST['addele']) && strlen($_POST['addele']) > 0) { $_GET['cat'] = urlencode(htmlentities($_POST['cat'])); $_GET['ele'] = urlencode(htmlentities($_POST['addele'])); } } if (isset($_POST['clr_hex']) && isset($_POST['addcolor']) && $_POST['addcolor'] == "addcolor") { // if (strlen($_COOKIE[$ckinm])>0){$_COOKIE[$ckinm]=$_POST['clr_hex'].",".$_COOKIE[$ckinm];}else{$_COOKIE[$ckinm]=$_POST['clr_hex'];} //setcookie ($ckinm, $_COOKIE[$ckinm],$_cfg['global']['ckitime']); } } } } if (!isset($klikit)) { $klikit = array(); } return $klikit; }