Beispiel #1
0
}
// Restore loading functions
if ($core == "true") {
    $content .= "tinyMCE_GZ.end();";
}
// Generate GZIP'd content
if ($supportsGzip && is_writable(dirname($cacheFile))) {
    if ($compress) {
        header("Content-Encoding: " . $enc);
        $cacheData = gzencode($content, 9, FORCE_GZIP);
    } else {
        $cacheData = $content;
    }
    // Write gz file
    if ($diskCache && $cacheKey != "") {
        putFileContents($cacheFile, $cacheData);
    }
    // Stream to client
    echo $cacheData;
} else {
    // Stream uncompressed content
    echo $content;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
function getParam($name, $def = false)
{
    if (!isset($_GET[$name])) {
        return $def;
    }
    return preg_replace("/[^0-9a-z\\-_,]+/i", "", $_GET[$name]);
    // Remove anything but 0-9,a-z,-_
Beispiel #2
0
//
$filename = null;
$isWritable = null;
if (isset($_POST['stylesheet']) && in_array($_POST['stylesheet'], $stylesheets)) {
    $filename = $pathToStyles . $_POST['stylesheet'];
    if (is_writable($filename)) {
        $isWritable = true;
    } else {
        $isWritable = false;
    }
}
//
// Check if Save-button was pressed, save the file if true.
//
if (isset($_POST['doSave'])) {
    $resFromSave = putFileContents($filename, strip_tags($_POST['styleContent']));
}
//
// Create a select/option-list based on the content of the array $stylesheets
//
// http://php.net/manual/en/control-structures.foreach.php
// Look up select/option in Cheatsheet
//
$select = "<select id='input1' name='stylesheet' onchange='form.submit();'>";
$select .= "<option value='-1'>Välj Stylesheet</option>";
foreach ($stylesheets as $val) {
    $selected = "";
    if (isset($_POST['stylesheet']) && $_POST['stylesheet'] == $val) {
        $selected = "selected";
    }
    $select .= "<option value='{$val}' {$selected}>{$val}</option>";
if ( '.gz' == $cache_ext ) {
	header('Content-Encoding: gzip');
	$content = gzencode( $content, 9, FORCE_GZIP );
}

// Stream to client
echo $content;

// Write file
if ( '' != $cacheKey && is_dir($cache_path) && is_readable($cache_path) ) {	

	$old_cache = array();
	$handle = opendir($cache_path);
	while ( false !== ( $file = readdir($handle) ) ) {
		if ( $file == '.' || $file == '..' ) continue;
        $saved = filectime("$cache_path/$file");
		if ( strpos($file, 'tinymce_') !== false && substr($file, -3) == $cache_ext ) $old_cache["$saved"] = $file;
	}
	closedir($handle);
			
	krsort($old_cache);
	if ( 1 >= $old_cache_max ) $del_cache = $old_cache;
	else $del_cache = array_slice( $old_cache, ($old_cache_max - 1) );

	foreach ( $del_cache as $key )
		@unlink("$cache_path/$key");

	putFileContents( $cache_file, $content );
}

?>
Beispiel #4
0
//
$filename = null;
$isWritable = null;
if (isset($_POST['file']) && in_array($_POST['file'], $files)) {
    $filename = $path . $_POST['file'];
    if (is_writable($filename)) {
        $isWritable = true;
    } else {
        $isWritable = false;
    }
}
//
// Check if Save-button was pressed, save the file if true.
//
if (isset($_POST['doSave'])) {
    $res = putFileContents($filename, strip_tags($_POST['content'], "<b><i><p><img>"));
}
//
// Create a select/option-list based on the content of the array $files
//
$select = "<select id='input1' name='file' onchange='form.submit();'>";
$select .= "<option value='-1'>Välj Annons</option>";
foreach ($files as $val) {
    $selected = "";
    if (isset($_POST['file']) && $_POST['file'] == $val) {
        $selected = "selected";
    }
    $select .= "<option value='{$val}' {$selected}>{$val}</option>";
}
$select .= "</select>";
?>