Skip to content

Commit

Permalink
bug fixes in installCodeMirror method
Browse files Browse the repository at this point in the history
mustafa0x committed Apr 7, 2012
1 parent a7e4ac6 commit f26545a
Showing 4 changed files with 21 additions and 10 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion pafm-files/js.js
Original file line number Diff line number Diff line change
@@ -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
};

1 change: 1 addition & 0 deletions pafm-files/style.css
Original file line number Diff line number Diff line change
@@ -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 {
20 changes: 11 additions & 9 deletions pafm.php
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f26545a

Please sign in to comment.