Пример #1
0
 function writefile($klikit, $fn, $_l_cssfilter, $cfg, $parser = "")
 {
     if (isset($GLOBALS['current_ext'])) {
         global $current_ext;
     } else {
         $current_ext = "";
     }
     if (!isset($_l_cssfilter)) {
         $_l_cssfilter = array();
     }
     # PERFORM PHP ARRAY TO CSS CONVERSION
     # PERFORM MACHINE-LANGUAGE TRANSLATION
     # PERFORM WRITE FILE
     if (isset($klikit)) {
         #echo $parser;die();
         if (strlen($parser) > 0 && file_exists($parser)) {
             include $parser;
         } else {
             $strklikit = "";
         }
         if (!is_array($klikit)) {
             $strklikit = $klikit;
             if (!isset($_GET['get_css_from_html']) && isset($_REQUEST['ele']) && strlen($_REQUEST['ele']) > 0) {
                 $fn = filesystemcode($_REQUEST['ele'], "b", "c");
             }
         } else {
             $strklikit = prepare_write($klikit, $_l_cssfilter);
         }
     } else {
         $strklikit = "";
     }
     # PERFORM RAW TEXT WRITEBACK METHOD AND MACHINELANGUAGE TRANSLATION
     if (is_string($strklikit) && strlen($strklikit) > 0) {
         if (isset($fn) && strlen($fn) > 0) {
             if (isset($_POST['trlback']) && $_POST['trlback'] == "on" && $_l_cssfilter != false && count($_l_cssfilter) > 0 && function_exists("machine_lang")) {
                 $strklikit = machine_lang($strklikit, $_l_cssfilter, $cfg, true);
             }
             return file_put_contents(html_entity_decode($fn), $strklikit);
         }
     }
 }
Пример #2
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;
    }
}
Пример #3
0
 function linkfldrarr($klikit, $extlink, $fd = '', $retcwd = false)
 {
     global $__lang;
     $klikit = array();
     $klikit[$__lang['folders']] = array();
     #echo html_entity_decode($_GET['fd']);die();
     #echo getcwd()." ".str_replace("//", "/", html_entity_decode($_GET['fd']))."<hr />";
     #if (isset($_GET['fd']) &&strlen($_GET['fd'])>0 && is_Dir(str_replace("//", "/", html_entity_decode($_GET['fd'])))){
     #	echo $_GET['fd'];die();
     if ($fd == '') {
         $fd = str_replace("//", "/", str_replace("%2F", "/", html_entity_decode(html_entity_decode($_GET['fd']))));
     }
     #}
     if ($retcwd == true) {
         chdir($fd);
         return getcwd();
     }
     if (isset($_GET['newfoldername'])) {
         $newname = filesystemcode($_GET['newfoldername'], 'b', 'c');
         $chdir = getcwd();
         chdir($fd);
         mkdir($newname, 755);
         chdir($chdir);
         unset($chdir);
     } elseif (isset($_GET['newfilename'])) {
         $newname = filesystemcode($_GET['newfilename'], 'b', 'c');
         $chdir = getcwd();
         chdir($fd);
         file_put_contents($newname, "");
         chdir($chdir);
         unset($chdir);
     } elseif (isset($_GET['newname'])) {
         $chdir = getcwd();
         chdir($fd);
         rename(rawurldecode($_GET['fn']), filesystemcode(rawurldecode($_GET['newname']), 'b', 'c'));
         chdir($chdir);
     } elseif (isset($_GET['cutcopy'])) {
         $chdir = getcwd();
         chdir($fd);
         if ($_GET['cutcopy'] == 'cut') {
             rename(str_replace("+", " ", $_GET['pastefromlocation']), filesystemcode(str_replace("+", " ", $_GET['ccitemname']), 'b', 'c'));
         } elseif ($_GET['cutcopy'] == 'copy') {
             rcopy(str_replace("+", " ", $_GET['pastefromlocation']), filesystemcode(str_replace("+", " ", $_GET['ccitemname']), 'b', 'c'));
         }
         chdir($chdir);
     }
     #if ($fd=='' || $fd==$GLOBALS['_cfg']['global']['default_request_folder']){
     #}else{}
     #if ($fd=='.'){$fd=$GLOBALS['_cfg']['global']['default_request_folder'];}
     #Prepare folder display selection with current userinput
     #echo "<pre>";print_r($__lang);die();
     $filecont = '/*cat=' . $__lang['files'] . '_*/';
     #    $_GET['cat']=$__lang['files'];
     if (!isset($fd) || $fd == '') {
         $fd = $GLOBALS['_cfg']['global']['default_request_folder'];
     }
     if (!isset($fd) || $fd == '') {
         $fd = '.';
     }
     #load defaults ;/
     #	echo $fd;die();
     #	echo $extlink;die();
     $dircont = dir_ls($fd . "/", $extlink);
     #echo "<pre>";print_r($dircont);
     if (is_array($dircont)) {
         foreach ($extlink as $d => $test) {
             #echo "<pre>";print_r($dircont);die();
             if (isset($dircont['fn'][$d]) && is_array($dircont['fn'][$d])) {
                 foreach ($dircont['fn'][$d] as $b) {
                     if (!isset($klikit[$__lang['files']][$b])) {
                         if (isset($_GET) && isset($_GET['ele']) && $b == html_entity_decode($_GET['ele'])) {
                             $klikit[$__lang['files']][$b] = file_get_contents(str_replace("//", "/", html_entity_decode($fd)) . "/" . $b);
                             $klikit[$__lang['files']][$b] = mb_convert_encoding($klikit[$__lang['files']][$b], 'UTF-8', mb_detect_encoding($klikit[$__lang['files']][$b], 'UTF-8, ISO-8859-1', true));
                             #echo
                             #strlen(
                             #$klikit[$__lang['files']][$b]
                             #)
                             #."<br />";
                         } else {
                             #	if ($d=="no_ext" && $GLOBALS['_cfg']['global']['universal_unlinked_ext_files']!="none" || $d!="no_ext"){
                             if (!isset($klikit[$__lang['files']][$b])) {
                                 $klikit[$__lang['files']][$b] = '';
                             }
                             #	}
                         }
                     }
                 }
             }
         }
         if (isset($dircont['fd']) && is_array($dircont['fd'])) {
             $klikit[$__lang['folders']] = array_flip($dircont['fd']);
         }
     } elseif (isset($_GET['cat']) && $dircont == "nf") {
         $klikit[html_entity_decode($_GET['cat'])]['LANGempty_folderIANG'] = "";
         $_GET['ele'] = '';
     } elseif (isset($_GET['cat']) && $dircont == "na") {
         $klikit[html_entity_decode($_GET['cat'])]['LANGaccess_deniedIANG'] = "";
         $_GET['ele'] = '';
     }
     $klikity['fd'] = $fd;
     $klikity['klikit'] = $klikit;
     #   print_r($klikity);die();
     #die();
     return $klikity;
 }
Пример #4
0
include "fc/globals/filesystemcode.php";
$fd = html_entity_decode($_GET['fd']);
if ($fd[strlen($fd)] != "/") {
    $fd .= "/";
}
if (!is_dir($fd)) {
    if (is_dir("fc/" . $fd)) {
        chdir("fc/");
    } else {
        chdir("../");
    }
}
chdir($fd);
$dh = opendir("./");
while (false !== ($filename = readdir($dh))) {
    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) {