From f26545aee258d41ce4b4738e8ced87c070f4507e Mon Sep 17 00:00:00 2001 From: Mustafa Jibaly Date: Sat, 7 Apr 2012 12:52:11 -0400 Subject: [PATCH] bug fixes in installCodeMirror method --- README.md | 6 ++++++ pafm-files/js.js | 4 +++- pafm-files/style.css | 1 + pafm.php | 20 +++++++++++--------- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9330244..7543250 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # PHP AJAX File Manager +## About +PHP AJAX File Manager (PAFM) is a web file manager influenced by the [KISS Principle](http://en.wikipedia.org/wiki/KISS_principle "Keep it simple, stupid") + ## Installation Open pafm.php with your code editor of choice (note that you can change the password of pafm *using* pafm) @@ -31,6 +34,9 @@ then scroll down till you see `/** configuration **/` ## Recent Changes +### 1.5.2 + * Bug fixes + ### 1.5 * CodeMirror Added * Minor bug fixes diff --git a/pafm-files/js.js b/pafm-files/js.js index 22b6156..0f97bf6 100644 --- a/pafm-files/js.js +++ b/pafm-files/js.js @@ -12,9 +12,11 @@ function $(element) { var popup, fOp, edit, upload, __AJAX_ACTIVE, __CODEMIRROR, __CODEMIRROR_MODE, __LOAD_COUNT = 0, __CODEMIRROR_PATH = "_codemirror", __CODEMIRROR_MODES = { + "html": "htmlmixed", "js": "javascript", "py": "python", - "rb": "ruby" + "rb": "ruby", + "md": "markdown" //TODO: complete list }; diff --git a/pafm-files/style.css b/pafm-files/style.css index 31f4bed..b015832 100644 --- a/pafm-files/style.css +++ b/pafm-files/style.css @@ -199,6 +199,7 @@ a:hover.b, .b a:hover, #add a img:hover { .CodeMirror-scroll { width:800px; height:600px !important; + border: 1px solid black; } /*footer*/ #footer { diff --git a/pafm.php b/pafm.php index 6cf5816..90b87c0 100644 --- a/pafm.php +++ b/pafm.php @@ -2,8 +2,8 @@ /* @name: PHP AJAX File Manager (PAFM) @filename: pafm.php - @version: 1.5.1 - @date: April 6th, 2012 + @version: 1.5.2 + @date: April 7th, 2012 @author: mustafa @website: http://mus.tafa.us @@ -66,9 +66,9 @@ */ define('DEV', 1); -define('VERSION', '1.5.1'); +define('VERSION', '1.5.2'); -define('CODEMIRROR_PATH', '_codemirror'); +define('CODEMIRROR_PATH', realpath(ROOT) . '/_codemirror'); $pathRegEx = SanatizePath ? '/\.\.|\/\/|\/$|^\/|^$/' : '//'; @@ -79,7 +79,7 @@ $pafm = basename($_SERVER['SCRIPT_NAME']); $redir = $pafm . '?path=' . $pathURL; //$pafm is prefixed for safari (still relavent?) -$codeMirrorModes = array("js", "php", "css", "py", "rb"); //TODO: complete array +$codeMirrorModes = array('html', 'md', 'js', 'php', 'css', 'py', 'rb'); //TODO: complete array $maxUpload = min(return_bytes(ini_get('post_max_size')), return_bytes(ini_get('upload_max_filesize'))); $dirContents = array('folders' => array(), 'files' => array()); @@ -275,16 +275,18 @@ function pathCrumbs(){ return $crumb; } /* - * TODO: rewrite entire function + * TODO: rewrite entire function, use stable * * FIXME: pulling from remote server has risks */ function installCodeMirror(){ global $path; $name = 'codemirror2-latest.zip'; - copy('http://codemirror.net/'.$name, $name); - doExtract($name, $path, true); - rename($path . '/CodeMirror2', $path . '/' . CODEMIRROR_PATH); + $script_dir = dirname($_SERVER['SCRIPT_FILENAME']); + copy('http://codemirror.net/'.$name, $script_dir . '/' . $name); + doExtract($name, $script_dir, true); + unlink($script_dir . '/' . $name); + rename($script_dir . '/CodeMirror2', CODEMIRROR_PATH); } //authorize functions