No longer using PHP LZ Compressor

Was too problematic one some characters so dropping use of this idea.
Too little benefit and many issues arising.
This commit is contained in:
Matt Pass
2016-04-02 11:46:15 +01:00
parent 5cde633847
commit a406abd610
2 changed files with 3 additions and 29 deletions

View File

@@ -4,15 +4,6 @@ include("settings.php");
include("ftp-control.php");
$t = $text['file-control'];
// Load the LZ String PHP libs and define using LZString
include(dirname(__FILE__)."/../LZCompressor/LZContext.php");
include(dirname(__FILE__)."/../LZCompressor/LZData.php");
include(dirname(__FILE__)."/../LZCompressor/LZReverseDictionary.php");
include(dirname(__FILE__)."/../LZCompressor/LZString.php");
include(dirname(__FILE__)."/../LZCompressor/LZUtil.php");
include(dirname(__FILE__)."/../LZCompressor/LZUtil16.php");
use LZCompressor\LZString as LZString;
// ===============================
// SET OUR ERROR INFO TO A DEFAULT
// ===============================
@@ -42,14 +33,6 @@ if (isset($_POST['newFileName']) && $_POST['newFileName']!="") {
$errorMsg = $t['Sorry, bad filename...'];
};
// If we have changes or whole content, we need to LZ decompress them
if (isset($_POST['changes'])) {
$_POST['changes'] = LZString::decompressFromBase64($_POST['changes']);
}
if (isset($_POST['contents'])) {
$_POST['contents'] = LZString::decompressFromBase64($_POST['contents']);
}
// If we have file(s) to work with...
if (!$error) {
// Replace pipes with slashes, after cleaning the chars
@@ -245,7 +228,7 @@ if (!$error && $_GET['action']=="save") {
/* console.log(\'Calling \'+saveURL+\' via XHR\'); */
xhr.open("POST",saveURL,true);
xhr.setRequestHeader(\'Content-type\', \'application/x-www-form-urlencoded\');
xhr.send(\'timeStart='.$_POST["timeStart"].'&file='.$fileURL.'&newFileName=\'+newFileName.replace(/\\\+/g,"%2B")+\'&contents=\'+encodeURIComponent(top.LZString.compressToBase64(top.ICEcoder.saveAsContent)));
xhr.send(\'timeStart='.$_POST["timeStart"].'&file='.$fileURL.'&newFileName=\'+newFileName.replace(/\\\+/g,"%2B")+\'&contents=\'+encodeURIComponent(top.ICEcoder.saveAsContent));
top.ICEcoder.serverMessage("<b>'.$t['Saving'].'</b><br>" + "'.($finalAction == "Save" ? "newFileName" : "'".$fileName."'").'");
}
}

View File

@@ -3,15 +3,6 @@ include("headers.php");
include("settings.php");
include("ftp-control.php");
$t = $text['file-control'];
// Load the LZ String PHP libs and define using LZString
include(dirname(__FILE__)."/../LZCompressor/LZContext.php");
include(dirname(__FILE__)."/../LZCompressor/LZData.php");
include(dirname(__FILE__)."/../LZCompressor/LZReverseDictionary.php");
include(dirname(__FILE__)."/../LZCompressor/LZString.php");
include(dirname(__FILE__)."/../LZCompressor/LZUtil.php");
include(dirname(__FILE__)."/../LZCompressor/LZUtil16.php");
use LZCompressor\LZString as LZString;
?>
<?php if ($_SESSION['githubDiff']) { ?>
<script src="github.js?microtime=<?php echo microtime(true);?>"></script>
@@ -111,7 +102,7 @@ if ($_GET['action']=="load") {
$encoding=ini_get("default_charset");
if($encoding=="")
$encoding="UTF-8";
echo '</script><textarea name="loadedFile" id="loadedFile">'.htmlentities(LZString::compressToBase64($loadedFile),ENT_COMPAT,$encoding).'</textarea><script>';
echo '</script><textarea name="loadedFile" id="loadedFile">'.htmlentities($loadedFile,ENT_COMPAT,$encoding).'</textarea><script>';
// Run our custom processes
include_once("../processes/on-file-load.php");
} else if (strpos($finfo,"image")===0) {
@@ -182,7 +173,7 @@ if (action=="load") {
// Set the value & innerHTML of the code textarea to that of our loaded file plus make it visible (it's hidden on ICEcoder's load)
top.ICEcoder.switchMode();
cM = top.ICEcoder.getcMInstance();
cM.setValue(top.LZString.decompressFromBase64(document.getElementById('loadedFile').value));
cM.setValue(document.getElementById('loadedFile').value);
top.ICEcoder.savedPoints[top.ICEcoder.selectedTab-1] = cM.changeGeneration();
top.ICEcoder.savedContents[top.ICEcoder.selectedTab-1] = cM.getValue();
top.document.getElementById('content').style.visibility='visible';