Skip to content

Commit

Permalink
changes to ROOT, added version number to footer
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafa0x committed Mar 29, 2012
1 parent 6840c4c commit a50e2ac
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
6 changes: 3 additions & 3 deletions pafm-files/js.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
/*
@filename: js.js
@date: February 16th, 2012
Copyright (C) 2007-2012 mustafa
This program is free software; you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation. See gpl-3.0.txt
**/
GNU General Public License as published by the Free Software Foundation.
*/
function $(element) {
return document.getElementById(element);
}
Expand Down
38 changes: 25 additions & 13 deletions pafm.php
Original file line number Diff line number Diff line change
@@ -1,42 +1,52 @@
<?php
/**
/*
@name: PHP AJAX File Manager (PAFM)
@filename: pafm.php
@version: 1.0.4
@date: February 16th, 2012
@version: 1.0.5
@date: March 12th, 2012
@author: mustafa
@website: http://mus.tafa.us
@email: mmj048@gmail.com
@email: mustafa.0x@gmail.com
@server requirements: PHP 4.4+
@browser requirements: modern browser
Copyright (C) 2007-2012 mustafa
This program is free software; you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation. See COPYING
**/
*/


/** configuration **/

define('PASSWORD', 'auth'); // password
//@string : auth

define('ROOT', '.'); // _relative_ path of root folder to manage
/*
* _relative_ path of root folder to manage.
*
* Setting this to a path outside of webroot works,
* but your URIs will be broken.
*
* If set to an invalid directory, will do nothing.
*/
define('ROOT', '.');
//@string : .

/** end configuration **/
/** /configuration **/

define('AUTHORIZE', true);
//@bool : true

define('SanatizePath', true); //Allow path injection? e.g. ../, /, etc.
define('SanatizePath', true); //Sanitize Path? i.e. remove ../, /, etc.
//@bool : false

define('MaxEditableSize', 1); //Max file size for Editing. In mega-bytes
define('MaxEditableSize', 1); //Max file size for Editing (in mega-bytes)
//@int : 1

define('VERSION', '1.0.5');

$pathRegEx = SanatizePath ? '/\.\.|\/\/|\/$|^\/|^$/' : '//';

$path = preg_match($pathRegEx, $_GET['path']) ? '.' : $_GET['path'];
Expand All @@ -49,7 +59,7 @@
$maxUpload = min(return_bytes(ini_get('post_max_size')), return_bytes(ini_get('upload_max_filesize')));
$dirContents = array('folders' => array(), 'files' => array());
$cpExts = array('asp', 'css', 'htm', 'html', 'js', 'java', 'pl', 'php', 'rb', 'sql', 'xsl'); //For CP Editing
$footer = 'pafm by <a href="http://mus.tafa.us" title="mus.tafa.us">mustafa</a>';
$footer = '<a href="http://github.com/mustafa0x/pafm" title="pafm @ github">pafm v'.VERSION.'</a> by <a href="http://mus.tafa.us" title="mus.tafa.us">mustafa</a>';

$do = $_GET['do'];

Expand All @@ -60,9 +70,9 @@

/** directory checks and chdir **/

if (!is_dir(ROOT))
exit('ROOT (' . htmlspecialchars(ROOT) . ') is not a valid directory');
chdir(ROOT);
if (is_dir(ROOT))
chdir(ROOT);
//exit('ROOT (' . htmlspecialchars(ROOT) . ') is not a valid directory');

if (!is_dir($path))
exit('path (' . $pathHTML . ') is not a valid directory');
Expand Down Expand Up @@ -207,6 +217,7 @@ function pathCrumbs(){
}
return $crumb;
}

//authorize functions
function doAuth(){
global $do, $pathURL, $footer;
Expand Down Expand Up @@ -277,6 +288,7 @@ function doLogout(){
session_destroy();
redirect();
}

//fOp functions
function doCreate($file, $folder, $path){
if (isNull($file) && isNull($folder))
Expand Down

0 comments on commit a50e2ac

Please sign in to comment.