Пример #1
0
 function loadextcfg($item)
 {
     if (file_exists($item)) {
         $arr = parse_css(file_get_contents($item), true);
         if (isset($arr) && is_array($arr)) {
             foreach ($arr['1'] as $a => $b) {
                 $_cfg[$a] = piecele($arr['1'], $a);
             }
         } else {
             die("config (" . $item . ") invalid.");
         }
     }
     # end config load
     if (isset($_cfg) && is_array($_cfg)) {
         return $_cfg;
     } else {
         die("error loading " . $item);
     }
 }
Пример #2
0
 $_SESSION['rdmstring'] = 'ulvl';
 $_SESSION[$_SESSION['rdmstring']] = 0;
 if (is_dir($__the_cwd . "/core_clients/" . $_cfg['global']['current_client'] . "/cfgs/gui/" . $_cfg['global']['default_gui']) && file_exists($__the_cwd . "/core_clients/" . $_cfg['global']['current_client'] . "/cfgs/gui/" . $_cfg['global']['default_gui'] . "/gui.css")) {
     $getguicss = $__the_cwd . "/core_clients/" . $_cfg['global']['current_client'] . "cfgs/gui/" . $_cfg['global']['default_gui'] . "/gui.css";
 } else {
     $getguicss = $__the_cwd . "/core_clients/" . $_cfg['global']['current_client'] . "/cfgs/gui/default/gui.css";
 }
 if ($_cfg['global']['var_dump'] == "on") {
     echo "{<br />get gui configuration in \$getguicss for make_object function from " . $getguicss . " and using the parser/css on file contents string<br /><span style=\"color:navy\">";
 }
 #vardump
 if (file_exists($getguicss)) {
     $arr = parse_css(file_get_contents($getguicss), true);
     if (is_array($arr)) {
         foreach ($arr['1'] as $a => $b) {
             $_cfg[$a] = piecele($arr['1'], $a);
         }
     } else {
         die("config invalid.");
     }
 }
 # end config load
 #select corresponding make object vars
 $aa = initcfg($_cfg);
 if (isset($_cfg[$aa]['exact_userlevels'])) {
     $exacts = explode("-", $_cfg[$aa]['exact_userlevels']);
 } else {
     $exacts = false;
 }
 $__the_cwd2 = getcwd();
 if ($_cfg['global']['var_dump'] == "on") {
Пример #3
0
function edit_content($content)
{
    @($doc = DOMDocument::loadHTML($content));
    @($se = simplexml_import_dom($doc));
    ob_start();
    echo "<br />" . getcwd() . "<br />";
    #fetch style tags from $se ((x?)html string)
    # output:
    # $searchos & $replaceos
    $dullcounter = 0;
    $ret = loophtmlobj($se, "style", "id", "class");
    #echo "<pre>";print($ret[$dullcounter]["style"][0]);die();
    if (is_object($ret[$dullcounter]["style"])) {
        echo "Style attributes located, generating css stylesheet..<br />";
        # LOOP TROUGH NEW STYLE TAG(S)
        foreach ($ret as $bla => $blaa) {
            foreach ($blaa as $rd) {
                # <tag id=""> ALREADY EXISTS FOR TAG WITH NEW STYLE ATTRIBUTE
                if (isset($ret[$dullcounter]["style"]["id"])) {
                    $klikit["automoved"]["#" . $ret[$dullcounter]["style"]["id"]] = $rd[0];
                    $csclass = "";
                    $searchos[] = "style=\"" . $rd[0] . "\"";
                } elseif (isset($ret[$dullcounter]["style"]["class"])) {
                    if ($GLOBALS['_cfg']['global']['increment_new_css_class_tags'] == "off") {
                        #any new found style tag will be written back to the relevant class in the css file
                        $klikit["automoved"]["." . $ret[$dullcounter]["style"]["class"]] = $rd[0];
                        $csclass = "";
                        $searchos[] = "style=\"" . $rd[0] . "\"";
                    } else {
                        #any new found style tag will be written back to incremented class name and added to the main edited html file class="mult iple" tag
                    }
                } else {
                    # NO ID OR CLASS ATTRIBUTE FOUND, CREATE NEW
                    $csclass = "class=\"cl" . $dullcounter . "\"";
                    $klikit["automoved"][".cl" . $dullcounter] = $rd[0];
                    $searchos[] = "style=\"" . $rd[0] . "\"";
                }
                $replaceos[] = $csclass;
                $dullcounter++;
            }
        }
        #END FRUITY LOOPCSS
        # END FILLING SEARCH & REPLACE ARRAY
        echo "Replacing html style attributes with id attributes...<br />";
        $content = str_replace($searchos, $replaceos, $content);
        $dullcounter = 0;
        if ($GLOBALS['_cfg']['global']['readonly'] == "off") {
            echo "readonly disabled, prearing to write files...<br />";
            #write fetched inline style tags to extern css file
            global $current_ext, $langcss, $_cfg, $__the_cwd, $_l_cssfilter;
            $extracurry = $current_ext;
            $current_ext = "css";
            #echo "<pre>";print_r($GLOBALS);die();
            #echo $GLOBALS['__the_cwd']."/".$GLOBALS['_cfg']['global']['default_request_folder'];die();
            #chdir ($GLOBALS['__the_cwd']."/".$GLOBALS['_cfg']['global']['default_request_folder']."/");
            chdir($_GET['fd']);
            $getname = createsuffix(filesystemcode($_GET['fn'], "b", "c"), $current_ext);
            if (!isset($_l_cssfilter)) {
                $_l_cssfilter = '';
            }
            $klikit = prepare_write($klikit, $_l_cssfilter);
            echo "Writing " . $getname . "...<br />";
            writefile($klikit, $getname, piecele($langcss["1"], $current_ext), $_cfg['global']);
            $current_ext = $extracurry;
            $getname = createsuffix(filesystemcode(str_replace("." . $current_ext, "", $_GET['fn']), "b", "c"), $current_ext);
            if (!isset($_l_cssfilter)) {
                $_l_cssfilter = '';
            }
            echo "Writing " . $getname . "...<br />";
            writefile($content, $getname, piecele($langcss["1"], $current_ext), $_cfg['global']);
            chdir($__the_cwd);
            echo "Modifying tinymce CSS stylesheet cookie...<br />";
            if (!isset($_COOKIE['tinymcecooker'])) {
                $_COOKIE['tinymcecooker'] = '';
            }
            setcookie($_COOKIE["tinymcecooker"], $_COOKIE[$_COOKIE['tinymcecooker']] . ", " . rawurldecode($_GET['fd'] . "/" . $getname), $_cfg['global']['ckitime']);
        }
    } else {
        echo $GLOBALS['__lang']['no style attributes found'] . "</br >";
    }
    //return $content;
    if ($GLOBALS['prematurend'] == 1) {
        die;
    }
}
Пример #4
0
}
$____urlx .= $____urlxs . '://' . $_SERVER['HTTP_HOST'] . "";
if (isset($_SERVER['SCRIPT_NAME'])) {
    $____urlx .= dirname($_SERVER['SCRIPT_NAME']);
}
$WIMPY_BASE['path']['www'] = $____urlx;
$_urli_ = htmlentities($____urlx);
# default {www}_
if (isset($_SERVER['QUERY_STRING'])) {
    $____urlx .= "?" . $_SERVER['QUERY_STRING'];
}
#####################
# load LANGUAGE VARS
$langcss = parse_css(file_get_contents($__the_cwd . "/" . $_cfg['folders']['language'] . "/" . $__tssf . "/" . $__tssf . ".css"), true);
#echo "<pre>";print_r($langcss);die();
$__lang = piecele($langcss["1"], $_cfg['global']['default_gui_lang']);
$__lang["current_template"] = $_cfg["global"]["default_template"];
$__lang["ele"] = "&ele=";
$__lang["tmpl_folder"] = $_cfg["folders"]["templates"];
# added for backwards compatibility with older freedomeditor (<0.2.5) html code, mayb be changed into a extension or something in the future
$langcss["1"][$_cfg['global']['default_gui_lang']] .= "current_template:" . $_cfg["global"]["default_template"] . ";\nele:&ele=;\ntmpl_folder:" . $_cfg["folders"]["templates"] . ";";
#LOAD CORE CLIENT VARS
$oldir = getcwd();
if (is_dir($__the_cwd . "/core_clients/" . $_cfg['global']['current_client'] . "/")) {
    chdir($__the_cwd . "/core_clients/" . $_cfg['global']['current_client'] . "/");
    if (file_exists("vars" . $scrext)) {
        include "vars" . $scrext;
    }
    chdir($___workpath . "/");
}
#$path['inputhandler']=getcwd()."/fc/inputhandler/";
Пример #5
0
    if ($filename != ".." && $filename != "." && is_file($filename) && $filename != "" && stristr($filename, filesystemcode($_GET['filename'], "b", "c")) !== FALSE) {
        $arr[] = $filename;
    }
}
closedir($dh);
if (is_array($arr) && count($arr) > 0) {
    if (count($arr) > 1) {
        $arr = natsort($arr);
    }
    foreach ($arr as $lal) {
        $arrx[] = parse_css(file_get_contents($lal), true);
    }
    $dullcounter = 0;
    if (is_array($arrx) && count($arrx) > 0) {
        foreach ($arrx as $lal) {
            if ($dullcounter == 0) {
                $array1 = $lal;
            } else {
                $array2 = $lal;
                $array1 = mergecss($array1, $array2);
            }
            $dullcounter++;
        }
    }
    $current_ext = "css";
    $getname = createsuffix("merged_", $current_ext);
    writefile($array1, $getname, piecele($langcss["1"], $current_ext), $_cfg['global'], $__the_cwd . "/fc/parser/css/write/css.php");
    echo "wrote " . getcwd() . "/" . $getname;
} else {
    echo "no input (looking in " . getcwd() . ")";
}
Пример #6
0
 function extension($source, $scrext, $_cfg, $langcss, $js = false, $donethatoncearray = array())
 {
     $returnjs = '';
     $cfg_gl = $_cfg;
     $resultingarray345 = repl_between($source, "", $_cfg['extension']['string_open'], $_cfg['extension']['string_close'], false, "sm", true);
     $amnt = count($resultingarray345[2]);
     $noloop = false;
     if (is_array($resultingarray345) && is_array($resultingarray345[2])) {
         foreach ($resultingarray345[2] as $boelieboelie) {
             if (strlen($boelieboelie) > 0) {
                 if (file_exists("cfg/custom/" . $boelieboelie . ".css")) {
                     $_cfgt = loadextcfg("cfg/custom/" . $boelieboelie . ".css");
                     if (isset($_cfgt)) {
                         $_cfg = mergecss($_cfg, $_cfgt);
                     }
                 }
                 $tmpl = "";
                 $emptytmpl = true;
                 $next = false;
                 if (isset($_cfg['extension_req_val']) && is_array($_cfg['extension_req_val']) && count($_cfg['extension_req_val']) > 0) {
                     foreach ($_cfg['extension_req_val'] as $var => $val) {
                         if (strlen($var) > 0) {
                             if (!isset($_REQUEST[$var])) {
                                 $next = true;
                             } else {
                                 if ($_cfg['extension']['ext_req_val'] == "matchvar") {
                                     if ($_cfg['extension']['ext_req_val_Casesens'] != "on") {
                                         if ($_REQUEST[strtolower($var)] != strtolower($val)) {
                                             $next = true;
                                         }
                                     } elseif ($_REQUEST[$var] != $val) {
                                         $next = true;
                                     }
                                 }
                             }
                         }
                     }
                 }
                 if ($js != false) {
                     $next = false;
                 }
                 if ($next == false && $_cfg['extension']['launch'] == "enabled") {
                     if (strtolower($_cfg["extension"]["core_client"]) != "any") {
                         $coreclients = explode(",", $_cfg["extension"]["core_client"]);
                         if (isset($_cfg['global']['select_client_by_urlvar']) && isset($_GET[$_cfg['global']['select_client_by_urlvar']]) && isset($coreclients[$_GET[$_cfg['global']['select_client_by_urlvar']]]) || !isset($_cfg['global']['select_client_by_urlvar']) && !isset($_GET[$_cfg['global']['select_client_by_urlvar']]) && !isset($coreclients[$_GET[$_cfg['global']['select_client_by_urlvar']]]) && isset($_cfg['global']['current_client']) && isset($coreclients[$_cfg['global']['current_client']])) {
                             $emptytmpl = false;
                         }
                     } elseif (strtolower($_cfg["extension"]["core_client"]) == "any") {
                         $emptytmpl = false;
                     }
                     if ($_cfg['extension']['languageload'] == "enabled") {
                         $__tssf = $GLOBALS['__tssf'];
                         if (file_exists($_cfg['folders']['language'] . "/" . $__tssf . "/custom/" . $boelieboelie . "/" . $__tssf . ".css")) {
                             $lang_t = loadextcfg($_cfg['folders']['language'] . "/" . $__tssf . "/custom/" . $boelieboelie . "/" . $__tssf . ".css");
                         }
                     }
                     if (isset($lang_t) && is_array($lang_t) && $_cfg['extension']['globallanguageload'] == "enabled") {
                         if (is_array($langcss)) {
                             $langcss = mergecss($langcss, $lang_t);
                         }
                     } else {
                         if ($_cfg['extension']['globallanguageload'] == "enabled") {
                         } else {
                             $langcss = parse_css($lang_t);
                         }
                     }
                     if (is_array($langcss["1"])) {
                         $__lang = piecele($langcss["1"], $_cfg['global']['default_gui_lang']);
                     }
                     #print_r($__lang);
                     if ($emptytmpl == false && $_cfg['extension']['tmplload'] == "enabled") {
                         $tmpl = gethatmpl(0, $boelieboelie);
                     }
                     if ($_cfg['extension']['phplaunch'] == "enabled" && file_exists("fc/customcallback/" . $boelieboelie . $scrext)) {
                         ob_start();
                         $tmpl = (include "fc/customcallback/" . $boelieboelie . $scrext);
                         if (strlen($tmpl) == 0 || $emptytmpl == false) {
                             if ($_cfg['extension']['phplaunch_output'] == "enabled") {
                                 if (strlen($tmpl) < 1) {
                                     $tmpl = ob_get_contents();
                                 }
                             } else {
                                 ob_clean();
                             }
                         }
                     }
                     if ($_cfg['extension']['srch_ext'] != "disabled" && strlen($tmpl) > 0 && isset($srch_ext) && is_array($srch_ext) && count($srch_ext) > 0) {
                         $tmpl = str_replace(array_keys(${$_cfg['extension']['srch_ext']}), array_values(${$_cfg['extension']['srch_ext']}), $tmpl);
                     }
                     #if (strlen($tmpl)>0){
                     if ($_cfg['extension']['languagereplace'] == "enabled") {
                         if (!in_array($boelieboelie, $donethatoncearray)) {
                             $return[$_cfg['extension']['level']][$_cfg['extension']['string_open'] . $boelieboelie . $_cfg['extension']['string_close']] = guilang($tmpl, $__lang);
                             #$source=str_replace("{ext:".$boelieboelie.":ension}", guilang($tmpl, $__lang), $source);
                         }
                     } else {
                         if (!in_array($boelieboelie, $donethatoncearray)) {
                             $return[$_cfg['extension']['level']][$_cfg['extension']['string_open'] . $boelieboelie . $_cfg['extension']['string_close']] = $tmpl;
                             #$source=str_replace("{ext:".$boelieboelie.":ension}", $tmpl, $source);
                         }
                     }
                     #		}
                     #		echo "<pre>";
                     #		print_r($source);
                     if (isset($_cfg['always_block_ext_scan_inside'][$boelieboelie])) {
                         $donethatoncearray[] = $boelieboelie;
                     }
                     /*
                     loop result for generating output cmd
                       {
                     load "cfg/custom/named*.css"; if found
                     load "lang/custom/named*.css"; if found
                     load tmpl/named*.html if found;
                     load tmpl/js/named*.js if found;
                     ob_start();
                     load "fc/customcallback/named*.php"; < 
                     repl {DEFAULTTAG} in html result if any, with ob_end_Clean() or what comes from return function;  result
                     result repl guilang
                     $rep[$cfgdepth]["named*"]=result
                     }
                     #gen output cmd exe
                     */
                     $_cfg = $cfg_gl;
                 }
             }
         }
     } else {
         $noloop = true;
     }
     # end prepare loop
     #start output gen loop
     if (isset($return) && is_array($return) && count($return) > 0) {
         if ($js != false) {
             $extensionjs = "";
         }
         //$source2=$source;
         foreach ($return as $ret) {
             $source = str_replace(array_keys($ret), array_values($ret), $source);
             foreach ($ret as $re => $turn) {
                 if ($js == 'print') {
                     if (file_exists($GLOBALS['__the_cwd'] . "/" . $_cfg['folders']['templates'] . "js/" . str_replace(array($_cfg['extension']['string_open'], $_cfg['extension']['string_close']), "", $re) . ".js")) {
                         $extensionjs .= "//" . $_cfg['folders']['templates'] . "js/" . str_replace(array($_cfg['extension']['string_open'], $_cfg['extension']['string_close']), "", $re) . ".js\n";
                         $extensionjs .= file_get_contents($GLOBALS['__the_cwd'] . "/" . $_cfg['folders']['templates'] . "js/" . str_replace(array($_cfg['extension']['string_open'], $_cfg['extension']['string_close']), "", $re) . ".js");
                         $extensionjs .= "\n\n//------------------------------//\n\n\n\n";
                     }
                 }
             }
         }
         ############## moved to this place @ 0.2.6
         if ($_cfg['extension']['loop_srch_ext'] != "disabled" && $js == false) {
             $source = extension($source, $scrext, $_cfg, $langcss, $js, $donethatoncearray);
         }
         ##############
         if ($js == "print") {
             @ob_end_clean();
             @ob_end_clean();
             @ob_end_clean();
             @ob_end_clean();
             if (strlen($extensionjs) == 0) {
                 die("Unable to determine javascript source files, no " . $_cfg['extension']['string_open'] . "*" . $_cfg['extension']['string_close'] . " tags found for the current coreclient or no corresponding js files.");
             }
             $returnjs .= $extensionjs;
         }
     } elseif ($js != false) {
         die("Unable to determine javascript source files, no " . $_cfg['extension']['string_open'] . "*" . $_cfg['extension']['string_close'] . " tags found for the current coreclient or no corresponding js files.");
     }
     if ($js != false) {
         return $returnjs;
     } else {
         return $source;
     }
 }
Пример #7
0
            $_cfg['global']['default_' . substr($a, 8)] = $_cfg[$a][$current_extlink];
        }
    }
}
################
# END EXTLINK (final  vars creation in a uninteresting chaotic way)
#####################
# MEMORIZE COLOR COLLECTION COOKIE NAME
/*
if (isset($_POST['ckinm'])){ $ckinm=$_POST['ckinm'];}else{ if (isset($_COOKIE['ckinm'])){
    $ckinm=$_COOKIE['ckinm'];}if (!isset($ckinm)){if ($_cfg['global']['clrck_def']!==false || !isset($_GET) || isset($_GET['fn']) && strlen($_GET['fn'])< 1){$ckinm=$_cfg['global']['clrck_def'];}else{$ckinm=$_GET['fn']; }}}
setcookie("ckinm", $ckinm, $_cfg['global']['ckitime']);
if (!isset($_COOKIE[$ckinm])){$_COOKIE[$ckinm]='';}else{$_COOKIE[$ckinm].=",";$_COOKIE[$ckinm]=str_replace(',,', ',', $_COOKIE[$ckinm]);}
*/
# default {urlstr}
if (!isset($_GET['fd'])) {
    $_GET['fd'] = '';
}
if (!isset($_GET['fn'])) {
    $_GET['fn'] = '';
}
$urlt = "&fd=" . urlencode(htmlentities(str_replace(array("%2F/", "\\"), array('%2F', "/"), html_entity_decode($_GET['fd'])))) . "&fn=" . urlencode(htmlentities($_GET['fn']));
# default {urlstr}
#echo html_entity_decode($_GET['fd']);
#load machinelanguage translation set from quirks css file
if (isset($_POST['trlback']) && $_POST['trlback'] == "on" || isset($_COOKIE['translate_editfield']) && $_COOKIE['translate_editfield'] == "on") {
    $_l_cssfilter = piecele($langcss["1"], $_cfg['global']['default_lang']);
}
if (!isset($_l_cssfilter)) {
    $_l_cssfilter = array();
}