· 9 years ago · Apr 22, 2017, 10:34 AM
1<?php
2//SCRIPT SOURCE https://github.com/tazotodua/useful-php-scripts/blob/master/Simple-PHP-file-browser-manager.php
3$Password = '1234'; //SET your password
4$Allowed_IPs= array( '10.10.100.100','90.00.90.90'); //insert your correct IP (YOUR IP here: https://goo.gl/2cfpaa )
5/* // based on pafm(https://github.com/mustafa0x/pafm), added ZIP functionality and minor changes..
6 // https://github.com/tazotodua/useful-php-scripts/blob/master/Simple-PHP-file-browser-manager.php
7 @name: PHP AJAX File Manager (PAFM)
8 @filename: pafm.php
9 @version: 1.8 RC1 (TT modification)
10 @date: October 1, 2014
11 @author: mustafa
12 @website: http://mus.tafa.us
13 @email: mustafa.0x@gmail.com
14 @server requirements: PHP 5
15 @browser requirements: modern browser
16 Copyright (C) 2007-2013 mustafa
17 This program is free software; you can redistribute it and/or modify it under the terms of the
18 GNU General Public License as published by the Free Software Foundation. See COPYING
19*/
20function separator__WFMB($input){return str_replace('\\',DIRECTORY_SEPARATOR, str_replace('/',DIRECTORY_SEPARATOR, $input)) ; } $avoid_authrz = false;
21//set memory limits
22define('PASSWORD__WFMB', $Password);
23$GLOBALS['ALLOWED_IP__WFMB']= $Allowed_IPs;
24$result=ini_set('max_execution_time', 3000);
25$result=ini_set('memory_limit','100M');
26$result=ini_set('mysql.connect_timeout', 300);
27$result=ini_set('default_socket_timeout', 300);
28//================================= useful addition for WORDPRESS users=============================
29 //if included in wordpress plugin folder
30 if (file_exists('readme.txt') && strstr(file_get_contents('readme.txt'),'Tested up to:') ){
31 $w1=dirname(dirname(__file__)).'/wp-load.php';
32 $w2=dirname(dirname(dirname(__file__))).'/wp-load.php';
33 $w3=dirname(dirname(dirname(dirname(__file__)))).'/wp-load.php';
34 $w4=dirname(dirname(dirname(dirname(dirname(__file__))))).'/wp-load.php';
35 $w5=dirname(dirname(dirname(dirname(dirname(dirname(__file__)))))).'/wp-load.php';
36 if (file_exists($w1)) {$wordpress_found=true;$wpc=$w1;}
37 elseif(file_exists($w2)) {$wordpress_found=true;$wpc=$w2;}
38 elseif(file_exists($w3)) {$wordpress_found=true;$wpc=$w3;}
39 elseif(file_exists($w4)) {$wordpress_found=true;$wpc=$w4;}
40 elseif(file_exists($w5)) {$wordpress_found=true;$wpc=$w5;}
41 else { die('no_access_error24144. cant find wp-load.php'); }
42 //=====wp bug====== avoid redirection when not installed
43 //in /wp-includes/load.php --------> "WP_INSTALLING" constant..
44 //if (substr($_SERVER['REQUEST_URI'],-21) == '/wp-admin/install.php') {}
45 //if (!defined('WP_INSTALLING')){define( 'WP_INSTALLING',true ); } <----------- causes Plugins Not-Load.
46 if (!defined('WP_REPAIRING')){define( 'WP_REPAIRING',true ); }
47
48 $coredir=dirname($wpc); require_once($coredir.'/wp-load.php');
49 //if not disabled from Wordpress
50 if (defined('DISALLOW_FILE_EDIT') || defined('DISALLOW_FILE_MODS') || defined('WFMB__DISABLERUN')){exit("This plugin is defined as disabled. error_21241");}
51 if (is_blog_installed()) {
52 $startdir=dirname($_SERVER['DOCUMENT_ROOT'].home_url('','relative'));
53 // ========================== CHECK IF ADMIN
54 //$randomnum=get_option('myfmg_random_numb'); if (!$randomnum) {update_option('myfmg_random_numb',rand(1,111111)*rand(1,1111111)); header("location:" . $_SERVER['REQUES_URI']); exit;}
55 global $current_user;
56 $user_info= get_userdata( $current_user->ID ); //http://codex.wordpress.org/Function_Reference/get_userdata
57 $lvl=$user_info->user_level;
58 if ($lvl == '10' ) {$avoid_authrz = true; define('is_WP', true); }
59 else { die('you are not logged in as Wordpress ADMIN.. At first, <a href="'.home_url().'/wp-login.php?redirect_to='.urlencode($_SERVER['PHP_SELF']).'&reauth=1">LOGIN</a> and then come back here.<br/><br/><br/>'); }
60 //else { echo 'you are not logged in as Wordpress ADMIN.. however, I will display typical authorization.<br/><br/><br/>'; }
61 }
62 else{
63 $wp_not_installed=true; $noinst_message= 'seems wordpress not correctly installed....However I will allow a basic authorization..<br/><br/>';
64 }
65 }
66//================================= ### WORDPRESS addition=============================
67/*
68configuration
69*/
70if (!$avoid_authrz){
71 if (isset($wp_not_installed)) {echo $noinst_message;}
72 if(!in_array($_SERVER['REMOTE_ADDR'] ,$GLOBALS['ALLOWED_IP__WFMB'])){die("Incorect ip: <b>".$_SERVER['REMOTE_ADDR'].'</b> (in FTP, open <b>'.$_SERVER['PHP_SELF'].'</b> and insert your IP in the ALLOWED list).');}
73 if ('xxxxxx' == PASSWORD__WFMB) { die('please, open this file('.$_SERVER['REQUEST_URI'].') and SET your password');}
74}
75define('PASSWORD_SALT', 'P5`SU2"6]NALYR}');
76/**
77 * Local (absolute or relative) path of folder to manage.
78 *
79 * By default, the directory pafm is in is what is used.
80 *
81 * Setting this to a path outside of webroot works,
82 * but will break URIs.
83 *
84 * This directive will be ignored if set to an
85 * invalid directory.
86 *
87 */
88define('ROOT', (isset($startdir) ? $startdir : $_SERVER['DOCUMENT_ROOT'])); //or '..' or '../..' or etc...
89/*
90 * /configuration
91 */
92/*
93 * bruteforce prevention options
94 */
95define('BRUTEFORCE_FILE', __DIR__ . '/_pafm_bruteforce');
96define('BRUTEFORCE_ATTEMPTS', 5);
97/**
98 * Attempt limit lockout time
99 *
100 * @var int unit: Seconds
101 */
102define('BRUTEFORCE_TIME_LOCK', 15 * 60);
103define('AUTHORIZE', (!$avoid_authrz ? true : false) );
104/**
105 * files larger than this are not editable
106 *
107 * @var int unit: MegaBytes
108 */
109define('MaxEditableSize', 1);
110/*
111 * Makefile
112 * 1 -> 0
113 */
114define('DEV', 0);
115define('VERSION', '1.8 RC1');
116define('CODEMIRROR_PATH', __DIR__ . '/_cm');
117$path = isset($_GET['path']) ? $_GET['path'] : '.';
118$pathURL = escape($path);
119$pathHTML = htmlspecialchars($path);
120$redir = '?path=' . $pathURL;
121$codeMirrorModes = array('html', 'md', 'js', 'php', 'css', 'py', 'rb'); //TODO: complete array
122$maxUpload = min(return_bytes(ini_get('post_max_size')), return_bytes(ini_get('upload_max_filesize')));
123$dirContents = array('folders' => array(), 'files' => array());
124$dirCount = array('folders' => 0, 'files' => 0);
125$footer = '<a href="http://github.com/mustafa0x/pafm">pafm v'.VERSION.'</a> '
126 . 'by <a href="http://mus.tafa.us">mustafa</a> and selnomeria';
127/*
128 * resource retrieval
129 */
130$_R_HEADERS = array('js' => 'text/javascript', 'css' => 'text/css', 'png' => 'image/png', 'gif' => 'image/gif');
131$_R = array();
132$_R['images/ajax.gif'] = 'data:image/gif;base64,R0lGODlhJAAkAMQaAGNjY7GxsX19fYWFhe/v7/Pz82lpaXR0dMLCwpmZmaOjo6urq3Jycry8vGpqapKSko6OjoGBgXV1dYiIiIqKioODg+jo6IKCgpSUlIaGhv///wAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAAAaACwAAAAAJAAkAAAF/6AmjmRpnmiqrmzrvnAszyURCEJA0GoA/IAALyUAAgRDjQ2n0xSByGVu9/IBhdYf1ih8PX/R29RpRHrLqO8Rlg2i2l2XtHmaU5NDwoLhkFAaBS4FDRQSDgwLdyNtBwMILggDB1wmagYDCS4JAwZoJZaYmpyeJIyOkJKUNXt9f4Etg4WHiXhJBQgJCQivJhYKExMKFi8FCgPHpyfGyBi8KgQPBgYHEaEnEwMRB9IPim9GjZm3ubsa2JNXLKCPDcgDDRrGnVDqRgYKgRDuEBoWGPNgWLR58CqDuwwiCjxQ9UwMHQ3ujo2ww+PCtmkXapVA9+OARhIOjDj4OIKBEQYkRQssMLIgpRKH3lSEAAAh+QQJAAAaACwAAAAAJAAkAAAF+qAmjmRpnmiqrmzrvnAszyURCEJA0GoA/IAAT2PD6UQCIEAw9AEfBU0SyCzmdq7pz4DQOH/Cb/ClBRgSxNtVqmS6xAf0qexuER4GwyHSPYmFLwUICQkIUSdWR0OLBAsMDgcVEA2HLIlYJXADA30sf3NKBptyLHSgQKIDpCumJpqcb0qANY6QkpQul4u7IoKEhii+hZUsBQqbm50lCBEHeQ+YKsbIoygJB7LFx9SqGsLACQZtK3d5e8hdDdQNGgjiVCuvClEQ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Nj5GTlYkygoSGKL6Fh34PegcRCHabmwrELHQHCW/Mzc8qbQbTwsCq1c4s2coN1Q0asQN4enwrdA+HENUQGgUKm51dK7WQxxUi9atQycAH4MCIeqxCwXBgxAEJKrNiMDDCoMaNJzMWGFnAy+KSXR1DitQQAgA7';
133$_R['js'] = 'function $(a){return document.getElementById(a)}var popup,fOp,edit,upload,shell,__AJAX_ACTIVE,__CODEMIRROR,__CODEMIRROR_MODE,__CODEMIRROR_LOADED,__CODEMIRROR_PATH="_cm",__CODEMIRROR_MODES={html:"htmlmixed",js:"javascript",py:"python",rb:"ruby",md:"markdown"};function ajax(b,g,e,c,a,d){__AJAX_ACTIVE=true;if(!a){json2markup(["div",{attributes:{id:"ajaxOverlay"}},"img",{attributes:{src:"'.$_R['images/ajax.gif'].'",id:"ajaxImg",title:"Loading",alt:"Loading"}}],document.body);$("ajaxOverlay").style.height=document.body.offsetHeight+"px";fade($("ajaxOverlay"),0,6,25,"in")}var f=window.ActiveXObject?new ActiveXObject("MSXML2.XMLHTTP.3.0"):new XMLHttpRequest();d&&f.upload.addEventListener("progress",d,false);f.open(g,b,true);f.onreadystatechange=function(){if(f.readyState!=4){return}__AJAX_ACTIVE=false;a||fade($("ajaxOverlay"),6,0,25,"out",function(){document.body.removeChild($("ajaxOverlay"));document.body.removeChild($("ajaxImg"))});if(f.status==200||f.statusText=="OK"){if(f.responseText=="Please refresh the page and login"){alert(f.responseText)}else{c(f.responseText)}}else{alert("AJAX request unsuccessful.\nStatus Code: "+f.status+"\nStatus Text: "+f.statusText+"\nParameters: "+b)}f=null};if(g.toLowerCase()=="post"&&!a){f.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8")}f.send(e)}function json2markup(c,g){var b=0,a=c.length,d,f,e;for(;b<a;b++){if(c[b].constructor==Array){json2markup(c[b],d)}else{if(c[b].constructor==Object){if(c[b].attributes){for(f in c[b].attributes){switch(f.toLowerCase()){case"class":d.className=c[b].attributes[f];break;case"style":d.style.cssText=c[b].attributes[f];break;case"for":d.htmlFor=c[b].attributes[f];break;default:d.setAttribute(f,c[b].attributes[f])}}}if(c[b].events){for(e in c[b].events){d.addEventListener(e,c[b].events[e],false)}}if(c[b].preText){g.appendChild(document.createTextNode(c[b].preText))}if(c[b].text){d.appendChild(document.createTextNode(c[b].text))}switch(c[b].insert){case"before":g.parentNode.insertBefore(d,g);break;case"after":g.parentNode.insertBefore(d,g.nextSibling);break;case"under":default:g.appendChild(d)}if(c[b].postText){g.appendChild(document.createTextNode(c[b].postText))}}else{d=document.createElement(c[b])}}}}function fade(e,f,g,c,h,i){var d=e.style.opacity!=undefined,b,a;e.style[d?"opacity":"filter"]=d?f/10:"alpha(opacity="+f*10+")";a=setInterval(function(){if(h=="in"){f++;b=f<=g}else{if(h=="out"){f--;b=f>=g}}if(b){e.style[d?"opacity":"filter"]=d?f/10:"alpha(opacity="+f*10+")"}else{clearInterval(a);if(i){i()}}},c)}popup={init:function(d,a){json2markup(["div",{attributes:{id:"popOverlay"},events:{click:popup.close}}],document.body);json2markup(["div",{attributes:{id:"popup"}},["div",{attributes:{id:"head"}},["a",{attributes:{id:"x",href:"#"},events:{click:function(f){popup.close();f.preventDefault?f.preventDefault():f.returnValue=false}},text:"[x]"},"span",{text:d}],"div",{attributes:{id:"body"}}]],document.body);var e=$("popup"),c=$("popOverlay"),b;json2markup(a,$("body"));if(b=$("moveListUL")){if(b.offsetHeight>(document.body.offsetHeight-150)){b.style.height=document.body.offsetHeight-150+"px"}}e.style.marginTop="-"+parseInt(e.offsetHeight)/2+"px";e.style.marginLeft="-"+parseInt(e.offsetWidth)/2+"px";fade(c,0,6,25,"in");document.onkeydown=function(f){if((f||window.event).keyCode==27){popup.close();return false}}},close:function(){if(__AJAX_ACTIVE){return}if($("popup")){var a=$("popOverlay");fade(a,6,0,25,"out",function(){document.body.removeChild(a)});document.body.removeChild($("popup"))}document.onkeydown=null}};fOp={rename:function(a,b){popup.init("Rename:",["form",{attributes:{action:"?do=rename&subject="+a+"&path="+b+"&nonce="+nonce,method:"post"}},["input",{attributes:{title:"Rename To",type:"text",name:"rename",value:a}},"input",{attributes:{title:"Ok",type:"submit",value:"\u2713"}}]])},create:function(a,b){popup.init("Create "+a+":",["form",{attributes:{method:"post",action:"?do=create&path="+b+"&f_type="+a+"&nonce="+nonce}},["input",{attributes:{title:"Filename",type:"text",name:"f_name"}},"input",{attributes:{title:"Ok",type:"submit",value:"\u2713"}}]])},chmod:function(c,b,a){popup.init("Chmod "+unescape(b)+":",["form",{attributes:{method:"post",action:"?do=chmod&subject="+b+"&path="+c+"&nonce="+nonce}},["input",{attributes:{title:"chmod",type:"text",name:"mod",value:a}},"input",{attributes:{title:"Ok",type:"submit",value:"\u2713"}}]])},copy:function(a,b){popup.init("Copy "+unescape(a)+":",["form",{attributes:{method:"post",action:"?do=copy&subject="+a+"&path="+b+"&nonce="+nonce}},["input",{attributes:{title:"copy to",type:"text",name:"to",value:"copy-"+a}},"input",{attributes:{title:"Ok",type:"submit",value:"\u2713"}}]])},moveList:function(a,b,c){ajax(("?do=moveList&subject="+a+"&path="+b+"&to="+c),"get",null,function(d){if(!$("popup")){popup.init("Move "+unescape(a)+" to:",Function("return "+d)())}else{var f=$("popup"),e;$("body").innerHTML="";json2markup(Function("return "+d)(),$("body"));if((e=$("moveListUL")).offsetHeight>(document.body.offsetHeight-150)){e.style.height=document.body.offsetHeight-150+"px"}f.style.marginTop="-"+parseInt(f.offsetHeight)/2+"px";f.style.marginLeft="-"+parseInt(f.offsetWidth)/2+"px"}})},remoteCopy:function(a){popup.init("Remote Copy:",["form",{attributes:{method:"post",action:"?do=remoteCopy&path="+a+"&nonce="+nonce,id:"remote-copy"}},["legend",{text:"Location: "},["br",{},"input",{attributes:{title:"Remote Copy",type:"text",name:"location"},events:{change:function(b){$("remoteCopyName").value=this.value.substring(this.value.lastIndexOf("/")+1)}}}],"legend",{text:"Name: "},["br",{},"input",{attributes:{id:"remoteCopyName",title:"Name",type:"text",name:"to"}}],"input",{attributes:{title:"Ok",type:"submit",value:"\u2713"}}]])}};edit={init:function(b,c,d,a){__CODEMIRROR_MODE=d;json2markup(["div",{attributes:{id:"editOverlay"}}],document.body);$("editOverlay").style.height="100%";json2markup(["div",{attributes:{id:"ea"}},["textarea",{attributes:{id:"ta",rows:"30",cols:"90"},events:{change:function(){window.__FILECHANGED=true}}},"br",{},"input",{attributes:{type:"text",value:unescape(b),readonly:""}},"input",{attributes:{type:"button",value:"CodeMirror"},events:{click:function(){if(a){edit.codeMirrorLoad()}else{if(confirm("Install CodeMirror?")){ajax("?do=installCodeMirror","get",null,function(e){if(e==""){edit.codeMirrorLoad()}else{alert("Install failed. Manually upload CodeMirrorand place it in _codemirror, in the same directory as pafm")}})}}this.disabled=true}}},"input",{attributes:{type:"button",value:"Save",id:"save"},events:{click:function(){edit.save(b,c)}}},"input",{attributes:{type:"button",value:"Exit",id:"exit"},events:{click:function(){edit.exit(b,c)}}},"span",{attributes:{id:"editMsg"}}]],document.body);document.onkeydown=function(f){if((f||window.event).keyCode==27){edit.exit(b,c);return false}};ajax("?do=readFile&path="+c+"&subject="+b,"get",null,function(e){$("ta").value=e});location="#header"},codeMirrorLoad:function(){if(!__CODEMIRROR_LOADED){json2markup(["script",{attributes:{src:__CODEMIRROR_PATH+"/cm.js",type:"text/javascript"},events:{load:function(){__CODEMIRROR_LOADED=true;edit.codeMirrorLoad()}}},"link",{attributes:{rel:"stylesheet",href:__CODEMIRROR_PATH+"/cm.css"}},],document.getElementsByTagName("head")[0])}else{var a=__CODEMIRROR_MODES[__CODEMIRROR_MODE]||__CODEMIRROR_MODE;__CODEMIRROR=CodeMirror.fromTextArea($("ta"),{onChange:function(){window.__FILECHANGED=true},lineNumbers:true});__CODEMIRROR.setOption("mode",a)}},save:function(b,c){__CODEMIRROR&&__CODEMIRROR.save();$("editMsg").innerHTML=null;var a="data="+encodeURIComponent($("ta").value);ajax("?do=saveEdit&subject="+b+"&path="+c+"&nonce="+nonce,"post",a,function(d){$("editMsg").className=d.indexOf("saved")==-1?"failed":"succeeded";$("editMsg").innerHTML=d});window.__FILESAVED=true;window.__FILECHANGED=false},exit:function(a,b){if(window.__FILECHANGED&&!confirm("Leave without saving?")){return}if(window.__FILESAVED){ajax("?do=getfs&path="+b+"&subject="+a,"get",null,function(e){var g=$("dirList").getElementsByTagName("li"),d=unescape(a),f=0,c=g.length;for(;f<c;f++){if(g[f].title==d){g[f].getElementsByTagName("span")[0].innerHTML=e;break}}})}__CODEMIRROR=null;document.body.removeChild($("ea"));document.body.removeChild($("editOverlay"));window.__FILESAVED=null;document.onkeydown=null}};shell={init:function(b,a){popup.init("Shell:",["textarea",{attributes:{id:"shell-history"},text:""},"form",{attributes:{id:"shell",action:"?do=shell&nonce="+nonce,method:"post"},events:{submit:shell.submit}},["input",{attributes:{type:"text",name:"cmd",id:"cmd","data-bash":"["+b+" "+a+"]"}},"input",{attributes:{title:"Ok",type:"submit",value:"\u2713"}}]])},submit:function(a){a.preventDefault();$("shell-history").innerHTML+=$("cmd").getAttribute("data-bash")+"> "+$("cmd").value;ajax($("shell").getAttribute("action"),"POST","cmd="+encodeURIComponent($("cmd").value),function(b){$("shell-history").innerHTML+="\n"+b;$("shell-history").scrollTop=$("shell-history").scrollHeight});$("cmd").value="";return false}};upload={init:function(b,a){popup.init("Upload:",["form",{attributes:{id:"upload",action:"?do=upload&path="+b,method:"post",enctype:"multipart/form-data",encoding:"multipart/form-data"}},["input",{attributes:{type:"hidden",name:"MAX_FILE_SIZE",value:a}},"input",{attributes:{type:"file",id:"file_input",name:"file"},events:{change:function(c){upload.chk(c.target.files[0].name,b)}}}],"div",{attributes:{id:"upload-drag"},events:{dragover:function(c){this.className="upload-dragover";c.preventDefault()},dragleave:function(){this.className=""},drop:function(c){c.preventDefault();upload.chk(c.dataTransfer.files[0].name,b,c.dataTransfer.files[0])},},text:"drag here"},"div",{attributes:{id:"response"},text:"php.ini upload limit: "+Math.floor(a/1048576)+" MB"}])},chk:function(a,d,b){var c=new FormData();c.append("file",b||$("file_input").files[0]);ajax("?do=fileExists&path="+d+"&subject="+a,"GET",null,function(e){if(e=="1"){json2markup(["input",{insert:"after",attributes:{type:"button",value:"Replace?"},events:{click:function(f){upload.submit(d,c)}}}],$("file_input"))}else{upload.submit(d,c)}})},submit:function(b,a){ajax("?do=upload&path="+b+"&nonce="+nonce,"POST",a,function(c){$("response").innerHTML=c;location.reload(true)},true,function(d){if(d.lengthComputable){var c=Math.round((d.loaded*100)/d.total);$("response").innerHTML="uploaded: "+c+"%"}})}};';
134$_R['images/copy.png'] = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAW0lEQVR42mNkgIKGhob/DEQCoFpGGJsR2YD6+nqCmhsbG+lgAEgRsQCnAcS6hvYGYPMOstxIcwG6odR3ATZ/YtOEDBixKcKXrGGugyVpsgyAqmHE6wJ8fkfOTACWlX8HDBsg/gAAAABJRU5ErkJggg==';
135$_R['images/cp.png'] = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABZUlEQVR4nKWTsYoaURhGz+hoJdqmFIvgiGyVZ4i1xbZbJ7W1jxBIlyyCJLAvYLVvYSVYGBCrweY6w8w49473zr/FblgtVk32g6/8DufncuGd8QCCIOgBX4E7oHlho4CfwLflcqkA6Pf797PZTLbbrex2u7MNw1Cm06kEQfADoNrtdj8PBoPvw+EQay1aa4wxb1ZE6HQ6LBaLT9baRx/42Gq1SNP0n26v1WqIyAdfRCp5npNl2dXjPM9JkgQRqfgAWmuSJAFgPp+fHfd6PeI4pigKAHyA/X5PHMcAjEajs4DJZMLhcKAsy1dAFEWEYYjv+xf1/5o6514BxhiUUhfH8Hw/cGrgnENrDcB4PL4KdGJwDLg2xwaltRZjzP8BnHPz42e5JiJClmWUZfmnqpQKG41GR2t943keRVGgtX6zaZqyXq+Jomi6Wq1+eS/QZrvd/lKv1289zzv7G0VEGWN+bzabByB9AqD9D+RrBi73AAAAAElFTkSuQmCC';
136$_R['images/del.png'] = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsSAAALEgHS3X78AAACYElEQVQ4jW1TTWtTURA9M/c+Hz6pidYKbU0LduWy2K4LXQiCP8Ot/8h/0K0guCiNQkTj3lUFE0lL0xYj9Zm5HzMukpcqOqthuOfMuWdmyMzQhJkREdlgMGgPh8OnRVHsAECM8VOn03m9sbHxvXnTYKghqOu6ZGbq9/sPu93uS2auzOwzABDRI1Wt9/b2nu/u7n5RVauqShYEdV3j8PDw1dbW1hMRSap60zn3HcDlvNHdnHObmX+VZemPj4/f7O/vP6uqCh4ARKQajUaP19fXixCCc85pTrlNRO3510BMGmMszYxHo9FjEamqqqo9AN9ut2sAB71e78XS0lIWkcJ7D1U1g8Gxo5QSl2UZr66u2Ht/MMd4r6rEzNjZ2bnc3NyEasbKyn2cnZ2hdfs2ETMmPyZYubeC8XgMABgOh5dEBFUlbtyMMdLJyQmOjro4Pz9Hr9fD18EAg8EAHz98xMXFBd6+e4fT01PEGKnBLQhU1WIIYGaIBDh2SCkh5zyvCRwzUkpQ1cUYfZOklCBEgBmCCEBATAmqBiKa1WaGI6WE/xJozjADpjKd1WKEsQIApiJQNchUoKbXBM0ipXk3w1wBCCllKCsMQJgKAIPIFMTcbO7fClKcSZMQQABSimB2IADTEObqAorCXytokpyzSRBozhZETKGIIYJdhs19sYXR9K+JIkKFL7C2ukreF7R8ZxneexAIhS/gnMPa+hqNz8YQEfqToHHkff9T/7zzoOMkiBGakzMQCAaz8kZJw2/DvL29/b6Z/uIaY4yYTCa3zMwDuL7xJmjGRUSp1Wr9LIoCAPAbCVuIcRUZG9UAAAAASUVORK5CYII=';
137$_R['images/dir.png'] = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsSAAALEgHS3X78AAACX0lEQVQ4jZ2Su2tUQRSHf2fuje5uQswa4wNFBTW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BSAoYoRHRc3G46ZY1+Bnr5dKmBoouCCIyqgs6Q/62NSiqjAzoWCMUCRw984qTE9NXdc6l6iqVFVFnuV0O12S5IIAAVRAlDrUICnTf57ZigsOlHJUcnx8jHNu/mEWEcF7z9bWFqCXCwB85cmyjE6nQ5IkXJe6rsmyDO+r+VsKEGNEo1KWJb1eD+csSwCIgPcV29vbqEZijJcJQghkWcZ6Z53UJMzn5cJFDOcEVVgimDkYn54y6PdxrnHFASjee0ySgHLVQQiBRpaxtrZ+rQNrLTFGms0WVbVEAGBMEibjMScng+Cck0UCEUN3o4tG1VjXVkTClYLRqEz39nbZ2dlNjTHzY5ovoEqUqAiMx+P0UkG73fZFUbw6OjrKRSQuDy9mOByaoiim7XbbA/wHxj0gO9NbVa4AAAAASUVORK5CYII=';
141$_R['images/odir.png'] = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsSAAALEgHS3X78AAADBElEQVQ4jW2TS29bVRSFv33O9SNuYtLEKUmaRyUQjeQOECoVaiWU3wASjBigDpjBL+iIX4DoH0GCEQipEi/RolRJaNqkedwkrRPbsR2/rq/vPWczcAIT1mjvrbW119rSElXlAqKqVkQU8KoIoCIowKgfcS84AJjLQhVEJAVcmjr16j2CeK92tIOKiIoIFzMAAhhdigZxfuN5+CBJXHkQJwugW3dvr9wvjOVigCRN7Xm7fzUIbDJZvHKuIAIq3vtARNK1jd0vq43eN7lc1qn3JkmdVOutR0evz05Pas2lOE6moziZm54sVD//ZPWL8s0bPxkjiKqaNHX+5982f8lms/e80+EgHtpfn+wQHtfse7eWWJ6/hgSCihLHTtc39+Wzj+7dLa8s/x5waVDVd3sDchljsxlj568V+fDOO27l7QU9aFRFmyKd81hq9XNvJGONFf/vD6w1oDSjKGb5+jy5XI4bi7P046F9ddTix8ZTHukWc50pveKztpDJ9GYm3wgBjKoKKF59U1VRFT1v96k12oTHdbaPKpQqU2Qms3x/c13DUo0ZLVYK47napQJA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0tPPz9f+/Pf/Zk/+6Mf+wNbmje/jUgtnMtPrUhKenqdSlQ96tRMaYQdm6hvbWjuTGke7QgefKlPfJW9TU1P/UV9TU1sGib+/v8dGxf9bX1s+5kP/cevbVlru7u9nX2fHMddS+mNG6kf+8VP+vLNnY2f/DQf/FQP/HRN3c3N/f39XV1fT09P///////yH5BAEAAH8ALAAAAAAQABAAAAeogH+Cg4SFhHYbiYlwSIaCMX6RkSksjn8yHZmZATA2DYYuASwNLy8aDRorhQFSDEdnSyciLggIBoREUTEzRwwxJyEaGmWDTD9sPC0tOll9zn16g0NxERFuFmAOGdsZC4NhOQUKCkoAXSDoICqDQFgXGOUDUB/0Hy6DXwIEA3d5ZkEiAopYM+iBmDYHJLTZ4YWDQw6qCK1A8axiHz6FIPDZyJEjBEsg/wQCADs=';
147$_R['images/move.gif'] = 'data:image/gif;base64,R0lGODlhEAAQANU/AD+0OnvbSEG2OrW2tk7BO0y/O0S5O+7u8rGxsVHDPPr7+/z8/Pb2+Pj4+vX197GysbKxsj6yOvP687Kysr29vfn5+b72du3t8MbFxZriZonbbJTmW0/BPFvPMVDCPEfFJ4vgULj7Zfz/k4jcXMnJyZrrh0i8O+jo7Ui8PE2/PJvqfcr6hLGxsqPmgrGysnbhOrKxsbm5ucLBwpjjeJnpWszNzc/Pz4bcbWLQS/Dw8/Ly9fT09v39/dHR0f///////yH5BAEAAD8ALAAAAAAQABAAAAaLwJ9wSCwOe8hksmLs+Z5QH7JRdB6uh9wpWfXlvuCLtKsrm3WJXtHm27nfu0SiWPM57oUUgcApeRRDJD4MhCY4NxozLSocEkIYPg2SBh8BGzQgAS8pQjI+CqACHSMZKxYhKI4/FD4LrgCwAgIiBoBCMT48urs8sEUDUVERA0UsDzATLhAICMsPRtBGQQA7';
148$_R['images/movehere.gif'] = 'data:image/gif;base64,R0lGODlhEAAQANU/APn5+VHDPE7BOz+0OnvbSLm6uUK3O7W2tky/O0S5O/39/fT09u7u8vz8/PX197Gxsc/Pz/b2+Pr6+7GysbKxsvj4+kC2Ovz/k+ry60i8O0i8PO3t8LGyspTmW+/v83bhOpriZojcZ4vgUPDz8rj7ZcnJybKxsejo7Zrrh6Pmgr6+vc/P0F/QPk2/PJvqffb595jjeO718LGxssr6hEHIE772drKysszNzMHCwsbFxZnpWvLy9fDw89HR0f///////yH5BAEAAD8ALAAAAAAQABAAAAaMwJ9wSCwOe70VctkDGHu+qNSHrBShjCzDc1pefbyweEP9BnbodJkI8QUCi3jcBxkiWoI8KjBy+H03QxosISEwKS4CGBERPiVDCTQEHToiBB8tFRU+OUMWhCAzNSQaMRISPjhDA6wWBhcJLw2zPipFBT6sCru7PgVFB7lTUgdFMhMmNhwUDw/ME0bRRkEAOw==';
149$_R['images/ren.gif'] = 'data:image/gif;base64,R0lGODlhEAAQANU/APHy8/zbmqyVYyEhIV5eXsPDw5ucnKqrq/7BZ7Kysuu1SoKCgnx8fPzShS8wMejo6NfX2fz67vj4+ERERL29ve7v7//Zc4uLi+Xl5f79+lRUU2BPL7mtlfT19//IWd7h5ZKSknR0dP3+/vf4+9avtf7rx1lZWXpnQ/rcqElNVGhbQMOvhP+gtu/Mdv/PYZKUmZ6fora3uNvTwtelRNrCjeS9YPXO3VJVXOzs6//kkVBQUPn5+ff392ZmZv///////yH5BAEAAD8ALAAAAAAQABAAAAbAwN9OwuPtjkeJZNexsX4GBoFwKFASh4MhxIGQfqCew1Hw4SCLQ0LQ4FR+F8KYsntATC+aZXYa/RZyZCJ2MCsWChs3PD8hPRo6DBcLIQKHGw4mi409PSYaKSo1HidjGoudIBgfHzItLgEfDAM6pzowPj4ROa+4F7OLBBMGPhkBHg0ZIzsLvz8mwj4lCA0RHRUAzLTO0AEoPAA4Dw/Mpj+cwxkiI+DiDCYEHeYTCwUxMQlYWSETPRI//wADChxIMGAQADs=';
150$_R['images/upload.gif'] = 'data:image/gif;base64,R0lGODlhGAAYAOZ/AOrNmf398v/rmPj4+OfJk9z5Yv/heuzs7vbdrv/igqLfJv/ebbbWVaa8Ne7ToezQnKLcLPHWpXC6DP/njaniLunp69zc3P/wqf/Xa/zcd+fIlOXl5vLYqP/yu//tpfT09Nb3W87yVP/plqzkMbTmOejLlsfwTLnqP/P09P/51/79+6PYRf/75b3rQf/APv/vof/wpffju/Hx8f7+/qW3L//64pDYFP/WX5DXFf/bZYTTCJzdIevr7LrdaP/deP/2zqrFPNzeu7PtK9f5V8HvVOv22P/ISvz8/Pn5+fvac6/PUf/lhbXPTprcHvn6+druuJXQHJbaGv/ojL/lgozWEfTz87rgef/Zav/nkNLGR4bJGf/QXNjgmJHQIJvXJrLmN//wrvTaqvTbrKThKavpMP/urv/SW+bm5//rnsTyQP/kiOLi4uPj5M7es5fRO3vCEtf1n+/w7f/OU63nKv/76Pj979Dyk9j2Xv/RV//NUf+/PP/ISf/DQ3zPAP///////yH5BAEAAH8ALAAAAAAYABgAAAf/gH+Cg4SFhoeIiYRIPAeOjwc8SIMBZHCHPH6am5sVg0RDQkWGBzOmp6Z+nn92aXcFZHWFFUdItre2Z2dtcwUkLSAraxsHgmdOKB8fKChVyh9FECAjFBQnLVNIFoJsAzLf4N9xKyZjO+c7LQpP238x7/DxTCQmFDj3OCchUEGCCAF0aggcWKNHDwhfdCjUEcKNFS7+WFyYSLGiFwp9MvYxwYAFAkFiUsAYSbJkFwUa+5xgkEKMoDA/XsicSVNLk5QjlPwII4jDDwFAgwIVIeWNjZQKgHTgIChChwlQoy4xsGCBBCopozQAE0GQgw4JwiagmqNsDgk20qpt4MGB1zI+ZOJeuUG3Lo27eGlkQeP2zwMPGDCYwUO4sOHDIh4IAiBii5w8kCNLnpwHi+I/ACYY2cO5s+fPnNUAEFQiAZ/TqFOrRp2gBOkkLvTInk27th4XGVz/UUFAA4HfwIMLB65CkXFCgQAAOw==';
151$_R['css'] = 'html,body{height:100%;width:100%}body{margin:0;font-family:Calibri,Consolas,Trebuchet,sans-serif}a{text-decoration:none;color:#b22424}a:visited{color:#ff2f00}a:hover{color:#dd836f}img{border:0}a:hover.b,.b a:hover,#add a img:hover{border:1px dotted #b22424} #header{padding:.2em;background-color:#e8e8e8} #logout{float:right}.pathCrumbs a:hover{background-color:white}#dir-count{color:grey;font-size:small;margin:0 0 3px 10px}#dirList ul{list-style:none;margin:.5em 0 0 1.5em;padding:0}#dirList li{margin:.05em 0;padding:.1em 0 .1em .1em;width:98%}#dirList li:hover{background:#ebebeb;border-radius:5px}#body .pathCrumbs a:hover{background-color:#e8e8e8}#info li:hover{background:0} #file{padding-left:.3em;font-size:.7em;bottom:.10em} #fileop{position:absolute;right:3em;font-size:.7em;margin-top:.30em} .dir,.file{position:relative;bottom:.05em;right:.11em;font:bold 14px verdana,arial;color:black} .dir{background:url('.$_R['images/dir.png'].') no-repeat bottom left;padding-left:1.45em;padding-top:2px}.file{padding-left:.30em}.mode, .fs,.extension, .filemtime{position:absolute;right:15em;font-family:Calibri,sans-serif; font-size:.7em;margin-top:.30em}.fs{margin-right:5%}.extension{margin-right:13%} .filemtime{margin-right:20%}.del,.edit,.rename,.move,.copy,.chmod, .extract{position:absolute;margin-top:.11em;min-width:1em;min-height:1em}.del{background:url('.$_R['images/del.png'].') no-repeat top right;right:2.22em}.rename{background:url('.$_R['images/ren.gif'].') no-repeat top right;right:3.33em}.move{background:url('.$_R['images/move.gif'].') no-repeat top right;right:4.44em}.chmod{background:url('.$_R['images/chmod.gif'].') no-repeat top right;right:6.55em}.copy{background:url('.$_R['images/copy.png'].') no-repeat top right;right:5.56em}.extract{background:url('.$_R['images/extract.png'].') no-repeat top right;right:8.92em}.edit{background:url('.$_R['images/edit.png'].') no-repeat top right;right:7.65em} .backRestor{margin: 20px 0px 0px 20%;} .backRestor div{padding: 5px;display: inline-block; border-radius: 20px;} .backRestor .backupp{background-color: rgb(96, 219, 10);} .backRestor .restoree{background-color: pink;} .backRestor .db_backResto{float:right; background-color: yellow;} .my_zip{font-size:0.8em;background-color:yellow;color:black;position: absolute;right:9.55em;} .cp{background:url('.$_R['images/cp.png'].') no-repeat top right;padding:0 0 1px 1px}#add{float:right;position:relative;right:2em;top:1em}#add a:hover,#add a:focus{border:0}#movelist{text-align:left;margin-left:.5em}#moveListUL{margin-top:.75em;margin-bottom:.5em;list-style:none;overflow:auto}#movelist a img{vertical-align:-15%}#movehere{margin-left:.5em;background:url('.$_R['images/movehere.gif'].') no-repeat center left;padding-left:.90em;font-family:Calibri,sans-serif} #ea{position:absolute;top:0;left:0;z-index:125}#editMsg{margin-left:2px}.failed,.succeeded{color:red;font-weight:bold}.succeeded{color:green}.CodeMirror-scroll{width:800px;height:600px!important;border:1px solid black}#footer{position:relative;top:3em;padding-bottom:1em;clear:both; text-align:center;font-size:.85em}#footer a{font-style:italic}#popup{position:fixed;left:50%;top:50%;min-width:15em;min-height:3em;border:2px solid #525252;background:white;z-index:150;padding-bottom:10px} #head{background-color:#e8e8e8;font-family:Calibri,sans-serif} #x{float:right}#body{text-align:center;margin:.5em 0;padding:0 15px 5px;white-space:nowrap}#response{font-weight:bold;font-size:small;margin-top:10px}#shell-history{width:400px;height:300px}#upload-drag{border:2px dashed;color:grey;height:20px;margin-top:7px;padding:7px 0 10px;width:97%}#upload-drag.upload-dragover{border:2px dashed blue}#remote-copy{text-align:left}#remote-copy input[type="text"]{width:300px}#remote-copy input[type="submit"]{float:right;margin-top:8px} #popOverlay,#editOverlay, #ajaxOverlay{width:100%;height:100%;position:fixed;left:0;top:0; z-index:105;background-color:#fff!important}#editOverlay{opacity:1;filter:alpha(opacity = 100);z-index:115}#ajaxOverlay{z-index:150}#ajaxImg{position:fixed;left:50%;top:50%;margin-left:-1.5em;margin-top:-1em;z-index:160}';
152if (!DEV && isset($_GET['r'])){
153 $r = $_GET['r'];
154 $is_image = strpos($r, '.') !== false;
155 //TODO: cache headers
156 header('Content-Type: ' . $_R_HEADERS[$is_image ? getExt($r) : $r]);
157 exit($is_image ? base64_decode($_R[$r]) : $_R[$r]);
158}
159/*
160 * init
161 */
162$do = isset($_GET['do']) ? $_GET['do'] : null;
163if (AUTHORIZE) {
164 session_start();
165 doAuth();
166}
167$nonce = isset($_SESSION['nonce']) ? $_SESSION['nonce'] : '';
168/*
169 * A warning is issued when the timezone is not set.
170 */
171if (function_exists('date_default_timezone_set'))
172 date_default_timezone_set('UTC');
173$tz_offset = isset($_SESSION['tz_offset']) ? $_SESSION['tz_offset'] : 0;
174/**
175 * directory checks and chdir
176 */
177if (!isNull(ROOT) && is_dir(ROOT))
178 chdir(ROOT);
179if (!is_dir($path)) {
180 if ($path != '.')
181 exit(header('Location: ?path=.'));
182 else
183 echo 'The current directory '.getcwd().' can\'t be read';
184}
185if (!is_readable($path)) {
186 chmod($path, 0755);
187 if (!is_readable($path))
188 echo 'path (' . $pathHTML . ') can\'t be read';
189}
190/**
191 * perform requested action
192 */
193if ($do) {
194 if (isset($_GET['subject']) && !isNull($_GET['subject'])) {
195 $subject = str_replace('/', null, $_GET['subject']);
196 $subjectURL = escape($subject);
197 $subjectHTML = htmlspecialchars($subject);
198 }
199 switch ($do) {
200 case 'login': exit(doLogin());
201 case 'logout': exit(doLogout());
202 case 'shell': nonce_check();exit(shell_exec($_POST['cmd']));
203 case 'create': nonce_check();exit(doCreate($_POST['f_name'], $_GET['f_type'], $path));
204 case 'upload': nonce_check();exit(doUpload($path));
205 case 'chmod': nonce_check();exit(doChmod($subject, $path, $_POST['mod']));
206 case 'extract': nonce_check();exit(doExtract($subject, $path));
207 case 'readFile': exit(doReadFile($subject, $path));
208 case 'rename': nonce_check();exit(doRename($subject, $path));
209 case 'delete': nonce_check();exit(doDelete($subject, $path));
210 case 'saveEdit': nonce_check();exit(doSaveEdit($subject, $path));
211 case 'copy': nonce_check();exit(doCopy($subject, $path));
212 case 'move': nonce_check();exit(doMove($subject, $path));
213 case 'moveList': exit(moveList($subject, $path));
214 case 'installCodeMirror':exit(installCodeMirror());
215 case 'fileExists': exit(file_exists($path .'/'. $subject));
216 case 'getfs': exit(getFs($path .'/'. $subject));
217 case 'remoteCopy': nonce_check();exit(doRemoteCopy($path));
218 }
219}
220/**
221 * no action; list current directory
222 */
223getDirContents($path);
224/**
225 * helper functions
226 */
227/**
228 * @return bool returns true if any empty values are passed
229 */
230function isNull() {
231 foreach (func_get_args() as $value)
232 if (!strlen($value))
233 return true;
234 return false;
235}
236function zipSupport(){
237 if (function_exists('zip_open'))
238 return 'function';
239 if (class_exists('ZipArchive'))
240 return 'class';
241 if (strpos(PHP_OS, 'WIN') === false && @shell_exec('unzip'))
242 return 'exec';
243 return false;
244}
245function escape($uri){
246 return str_replace('%2F', '/', rawurlencode($uri));
247}
248function removeQuotes($subject, $single = true, $double = true) {
249 if ($single)
250 $subject = str_replace('\'', null, $subject);
251 if ($double)
252 $subject = str_replace('"', null, $subject);
253 return $subject;
254}
255function return_bytes($val) { //for upload. http://php.net/ini_get
256 $val = trim($val);
257 $last = strtolower($val{strlen($val)-1});
258 switch($last) {
259 case 'g': $val *= 1024;
260 case 'm': $val *= 1024;
261 case 'k': $val *= 1024;
262 }
263 return $val;
264}
265function getExt($file){
266 return strrpos($file, '.') ? strtolower(substr($file, strrpos($file, '.') + 1)) : '<>';
267}
268function getMod($subject){
269 return substr(sprintf('%o', fileperms($subject)), -4);
270}
271function redirect(){
272 global $redir;
273 @header('Location: ' . $redir);
274}
275function refresh($message, $speed = 2){
276 global $redir;
277 return '<meta http-equiv="refresh" content="'.$speed.';url='.$redir.'">'.$message;
278}
279function getFs($file){
280 if (filesize($file) <= 1024)
281 return filesize($file).' <b title="Bytes" style="background-color: #B9D4B8">B</b>';
282 elseif (filesize($file) <= 1024000)
283 return round(filesize($file)/1024, 2).' <b title="KiloBytes" style="background-color: yellow">KB</b>';
284 else
285 return round(filesize($file)/1024000, 2).' <b title="MegaBytes" style="background-color: red">MB</b>';
286}
287function rrd($dir){
288 $handle = opendir($dir);
289 while (($dirItem = readdir($handle)) !== false) {
290 if ($dirItem == '.' || $dirItem == '..')
291 continue;
292 $path = $dir.'/'.$dirItem;
293 is_dir($path) ? rrd($path) : unlink($path);
294 }
295 closedir($handle);
296 return rmdir($dir);
297}
298function pathCrumbs(){
299 global $pathHTML, $pathURL;
300 $crumbs = explode('/', $pathHTML);
301 $crumbsLink = explode('/', $pathURL);
302 $pathSplit = '';
303 $crumb = str_replace('/', ' / ', dirname(getcwd())) . ' / ';
304 for ($i = 0; $i < count($crumbs); $i++) {
305 $slash = $i ? '/' : '';
306 $pathSplit .= $slash . $crumbsLink[$i];
307 $crumb .= '<a href="?path=' . $pathSplit . '" title="Go to ' . $crumbs[$i] . '">'
308 . ($i ? $crumbs[$i] : '<em>'.basename(getcwd()).'</em>') . "</a> /\n";
309 }
310 return $crumb;
311}
312//authorize functions
313function doAuth(){
314 global $do, $pathURL, $footer;
315 $pwd = isset($_SESSION['pwd']) ? $_SESSION['pwd'] : '';
316 if ($do == 'login' || $do == 'logout')
317 return; //TODO: login/logout take place here
318 if ($pwd != crypt(PASSWORD__WFMB, PASSWORD_SALT))
319 if ($do)
320 exit('Please refresh the page and login');
321 else
322 exit('<!DOCTYPE html>
323<html>
324<head>
325 <meta charset="UTF-8">
326 <title>Log In | pafm</title>
327 <style type="text/css">
328 body {margin:auto; max-width:20em; text-align:center;}
329 form {width:20em; position:fixed; top:30%;}
330 a {text-decoration:none; color:#B22424;}
331 a:visited {color: #FF2F00; }
332 a:hover {color: #DD836F;}
333 p {margin-top: 7.5em;font: italic 12px verdana,arial;}
334 </style>
335</head>
336<body>
337 <form action="?do=login&path='.$pathURL.'" method="post">
338 <fieldset>
339 <legend style="text-align: left;">Log in</legend>
340 <input type="password" name="pwd" title="Password" autofocus>
341 <input type="hidden" value="" id="tz_offset" name="tz_offset">
342 <input type="submit" value="✓" title="Log In">
343 </fieldset>
344 <p>'.$footer.'</p>
345 </form>
346 <script type="text/javascript">
347 document.getElementById("tz_offset").value = (new Date()).getTimezoneOffset() * -60;
348 </script>
349</body>
350</html>');
351}
352function doLogin(){
353 $pwd = isset($_POST['pwd']) ? $_POST['pwd'] : '';
354 $bruteforce_file_exists = file_exists(BRUTEFORCE_FILE);
355 if ($bruteforce_file_exists){
356 $bruteforce_contents = explode('|', file_get_contents(BRUTEFORCE_FILE));
357 if ((time() - $bruteforce_contents[0]) < BRUTEFORCE_TIME_LOCK && $bruteforce_contents[1] >= BRUTEFORCE_ATTEMPTS)
358 return refresh('Attempt limit reached, please wait: '
359 . ($bruteforce_contents[0] + BRUTEFORCE_TIME_LOCK - time()) . ' seconds');
360 }
361 if ($pwd == PASSWORD__WFMB){
362 $_SESSION['tz_offset'] = intval($_POST['tz_offset']);
363 $_SESSION['pwd'] = crypt(PASSWORD__WFMB, PASSWORD_SALT);
364 $_SESSION['nonce'] = crypt(uniqid(), rand());
365 $bruteforce_file_exists && unlink(BRUTEFORCE_FILE);
366 return redirect();
367 }
368 $bruteforce_data = time() . '|';
369 /**
370 * The second condition, if reached, implies an expired bruteforce lock
371 */
372 if (!$bruteforce_file_exists || $bruteforce_contents[1] >= BRUTEFORCE_ATTEMPTS)
373 $bruteforce_data .= 1;
374 else
375 $bruteforce_data .= ++$bruteforce_contents[1];
376 file_put_contents(BRUTEFORCE_FILE, $bruteforce_data);
377 chmod(BRUTEFORCE_FILE, 0700); //prevent others from viewing
378 return refresh('Password is incorrect');
379}
380function doLogout(){
381 session_destroy();
382 redirect();
383}
384function nonce_check(){
385 if (AUTHORIZE && $_GET['nonce'] != $_SESSION['nonce'])
386 exit(refresh('Invalid nonce, try again.'));
387}
388//fOp functions
389function doCreate($f_name, $f_type, $path){
390 if (isNull($f_name))
391 return refresh('A filename has not been entered');
392 $invalidChars = strpos(PHP_OS, 'WIN') !== false ? '/\\|\/|:|\*|\?|\"|\<|\>|\|/' : '/\//';
393 if (preg_match($invalidChars, $f_name))
394 return refresh('Filename contains invalid characters');
395 if ($f_type == 'file' && !file_exists($path.'/'.$f_name))
396 fclose(fopen($path.'/'.$f_name, 'w'));
397 elseif ($f_type == 'folder' && !file_exists($path.'/'.$f_name))
398 mkdir($path.'/'.$f_name);
399 else
400 return refresh(htmlspecialchars($f_name).' already exists');
401 redirect();
402}
403function installCodeMirror(){
404 mkdir(CODEMIRROR_PATH);
405 $cmjs = CODEMIRROR_PATH . '/cm.js';
406 $cmcss = CODEMIRROR_PATH . '/cm.css';
407 $out = null;
408 copy('http://cloud.github.com/downloads/mustafa0x/pafm/_codemirror.js', $cmjs);
409 copy('http://cloud.github.com/downloads/mustafa0x/pafm/_codemirror.css', $cmcss);
410 /**
411 * avoid using modified CodeMirror files
412 */
413 if (md5_file($cmjs) != '65f5ba3c8d38bb08544717fc93c14024')
414 $out = unlink($cmjs);
415 if (md5_file($cmcss) != '23d441d9125538e3c5d69448f8741bfe')
416 $out = unlink($cmcss);
417 return $out ? '-' : '';
418}
419function doUpload($path){
420 if (!$_FILES)
421 return refresh('$_FILES array can not be read. Check file size limits and the max execution time limit.');
422 $uploadErrors = array(null,
423 'The uploaded file exceeds the upload_max_filesize directive in php.ini.',
424 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.',
425 'The uploaded file was only partially uploaded.',
426 'No file was uploaded.',
427 'Missing a temporary folder.',
428 'Failed to write file to disk.',
429 'File upload stopped by extension.'
430 );
431 $error_message = ' Please see <a href="http://www.php.net/file-upload.errors">File Upload Error Messages</a>';
432 $fail = false;
433 if ($_FILES['file']['error']) {
434 if ($uploadErrors[$_FILES['file']['error']])
435 return refresh($uploadErrors[$_FILES['file']['error']] . $error_message);
436 else
437 return refresh('Unknown error occurred.' . $error_message);
438 }
439 if (!is_file($_FILES['file']['tmp_name']))
440 return refresh($_FILES['file']['name'] . ' could not be uploaded.'
441 . 'Possible causes could be the <b>post_max_size</b> and <b>memory_limit</b> directives in php.ini.');
442 if (!is_uploaded_file($_FILES['file']['tmp_name']))
443 return refresh(basename($_FILES['file']['name']) . ' is not a POST-uploaded file');
444 if (!move_uploaded_file($_FILES['file']['tmp_name'], $path . '/' . basename($_FILES['file']['name'])))
445 $fail = true;
446 return $fail ? 'One or more files could not be moved.' : $_FILES['file']['name'] . ' uploaded';
447}
448function doChmod($subject, $path, $mod){
449 if (isNull($mod))
450 return refresh('chmod field is empty');
451 chmod($path . '/' . $subject, octdec(strlen($mod) == 3 ? 0 . $mod : $mod));
452 redirect();
453}
454function doExtract($subject, $path){
455 global $subjectHTML;
456 switch (zipSupport()) {
457 case 'function':
458 if (!is_resource($zip = zip_open($path.'/'.$subject)))
459 return refresh($subjectHTML . ' could not be read for extracting');
460 while ($zip_entry = zip_read($zip)){
461 zip_entry_open($zip, $zip_entry);
462 if (substr(zip_entry_name($zip_entry), -1) == '/') {
463 $zdir = substr(zip_entry_name($zip_entry), 0, -1);
464 if (file_exists($path.'/'.$zdir))
465 return refresh(htmlspecialchars($zdir) . ' exists!');
466 mkdir($path.'/'.$zdir);
467 }
468 else {
469 if (file_exists($path.'/'.zip_entry_name($zip_entry)))
470 return refresh(htmlspecialchars($path.'/'.zip_entry_name($zip_entry)) . ' exists!');
471 $fopen = fopen($path.'/'.zip_entry_name($zip_entry), 'w');
472 $ze_fs = zip_entry_filesize($zip_entry);
473 fwrite($fopen, zip_entry_read($zip_entry, $ze_fs), $ze_fs);
474 }
475 zip_entry_close($zip_entry);
476 }
477 zip_close($zip);
478 break;
479 case 'class':
480 $zip = new ZipArchive();
481 if ($zip->open($path.'/'.$subject) !== true)
482 return refresh($subjectHTML . ' could not be read for extracting');
483 $zip->extractTo($path);
484 $zip->close();
485 break;
486 case 'exec':
487 shell_exec('unzip ' . escapeshellarg($path.'/'.$subject));
488 }
489 redirect();
490}
491function doReadFile($subject, $path){
492 return file_get_contents($path.'/'.$subject);
493}
494function doCopy($subject, $path){
495 $to = isset($_POST['to']) ? $_POST['to'] : '';
496 $dest = $path.'/'.$to;
497 if (isNull($subject, $path, $to))
498 return refresh('Values could not be read');
499 if (is_dir($path.'/'.$subject)) {
500 copyDir($path.'/'.$subject, $dest);
501 redirect();
502 }
503 if (file_exists($dest))
504 return refresh('Destination ('.$dest.') exists');
505 if(!copy($path.'/'.$subject, $dest))
506 return refresh($subject . ' could not be copied to ' . $to);
507 redirect();
508}
509function copyDir($subject, $to){
510 if (file_exists($to) || !mkdir($to))
511 return refresh('Destination exists or creation of destination failed.');
512 $handle = opendir($subject);
513 while(($dirItem = readdir($handle)) !== false) {
514 if ($dirItem == '.' || $dirItem == '..')
515 continue;
516 $path = $subject.'/'.$dirItem;
517 if (is_dir($path))
518 copyDir($path, $to.'/'.$dirItem);
519 else
520 copy($path, $to.'/'.$dirItem);
521 }
522 closedir($handle);
523}
524function doRemoteCopy($path){
525 $location = isset($_POST['location']) ? $_POST['location'] : '';
526 $to = isset($_POST['to']) ? $_POST['to'] : '';
527 $dest = $path.'/'.$to;
528 if (isNull($path, $location, $to))
529 return refresh('Values could not be read');
530 if (file_exists($dest))
531 return refresh('Destination ('.$dest.') exists');
532 if(!copy($location, $dest))
533 return refresh($location . ' could not be copied to '. ($dest));
534 redirect();
535}
536function doRename($subject, $path){
537 $rename = isset($_POST['rename']) ? $_POST['rename'] : '';
538 if (isNull($subject, $rename))
539 return refresh('Values could not be read');
540 if (file_exists($path.'/'.$rename))
541 return refresh(htmlspecialchars($rename) . ' exists, please choose another name');
542 rename($path.'/'.$subject, $path.'/'.$rename);
543 redirect();
544}
545function doDelete($subject, $path){
546 global $subjectHTML;
547 $fullPath = $path .'/'. $subject;
548 if (isNull($subject, $path))
549 return refresh('Values could not be read');
550 if (!file_exists($fullPath))
551 return refresh($subjectHTML . ' doesn\'t exist');
552 if (is_file($fullPath))
553 if (!unlink($fullPath))
554 return refresh($subjectHTML . ' could not be removed');
555 if (is_dir($fullPath))
556 if (!rrd($fullPath))
557 return refresh($subjectHTML . ' could not be removed');
558 redirect();
559}
560function doSaveEdit($subject, $path){
561 global $subjectHTML, $tz_offset;
562 $data = get_magic_quotes_gpc() ? stripslashes($_POST['data']) : $_POST['data'];
563 if (!is_file($path .'/'. $subject))
564 return 'Error: ' . $subjectHTML . ' is not a valid file';
565 if (file_put_contents($path .'/'. $subject, $data) === false)
566 return $subject . ' could not be saved';
567 else
568 return 'saved at ' . date('H:i:s', time() + $tz_offset);
569}
570function doMove($subject, $path){
571 global $pathHTML, $subjectHTML;
572 if (isset($_GET['to']) && !isNull($_GET['to'])) {
573 $to = $_GET['to'];
574 $toHTML = htmlspecialchars($to);
575 $toURL = escape($to);
576 }
577 if (isNull($subject, $path, $to))
578 return refresh('Values could not be read');
579 if ($path == $to)
580 return refresh('The source and destination are the same');
581 if (array_search($subject, explode('/', $to)) == array_search($subject, explode('/', $path . '/' . $subject)))
582 return refresh($toHTML . ' is a subfolder of ' . $pathHTML);
583 if (file_exists($to.'/'.$subject))
584 return refresh($subjectHTML . ' exists in ' . $toHTML);
585 rename($path . '/' . $subject, $to.'/'.$subject);
586 redirect();
587}
588function moveList($subject, $path){
589 global $pathURL, $pathHTML, $subjectURL, $subjectHTML, $nonce;
590 if (isset($_GET['to']) && !isNull($_GET['to'])) {
591 $to = $_GET['to'];
592 $toHTML = htmlspecialchars($to);
593 $toURL = escape($to);
594 }
595 if (isNull($subject, $path, $to))
596 return refresh('Values could not be read');
597 $return = '["div",
598 {attributes: {"id": "movelist"}},
599 [
600 "span",
601 {attributes: {"class": "pathCrumbs"}},
602 [
603 ';
604 $crumbs = explode('/', $toHTML);
605 $crumbsLink = explode('/', $toURL);
606 $pathSplit = '';
607 for ($i = 0; $i < count($crumbs); $i++) {
608 $slash = $i ? '/' : null;
609 $pathSplit .= $slash . $crumbsLink[$i];
610 $return .= ($i ? ',' : null) . '"a",
611 {
612 attributes : {
613 "href" : "#",
614 "title" : "Go to ' . $crumbs[$i] . '"
615 },
616 events : {
617 click : function(e){
618 fOp.moveList("'.$subjectURL.'", "'.$pathURL.'", "'.$pathSplit.'");
619 e.preventDefault ? e.preventDefault() : e.returnValue = false;
620 }
621 },
622 text : "' . ($i ? $crumbs[$i] : 'root') . '",
623 postText : " / "
624 }';
625 }
626 $return .= '
627 ],
628 "ul",
629 {attributes: {"id": "moveListUL"}}';
630 $j = 0;
631 //TODO: sort output
632 $handle = opendir($to);
633 while (($dirItem = readdir($handle)) !== false) {
634 $fullPath = $to.'/'.$dirItem;
635 if (!is_dir($fullPath) || $dirItem == '.' || $dirItem == '..')
636 continue;
637 $fullPathURL = escape($fullPath);
638 $dirItemHTML = htmlspecialchars($dirItem);
639 $return .= ',
640 [
641 "li",
642 {},
643 [
644 "a",
645 {
646 attributes : {"href" : "#"},
647 events : {
648 click : function(e){
649 fOp.moveList("'.$subjectURL.'", "'.$pathURL.'", "'.$fullPathURL.'");
650 e.preventDefault ? e.preventDefault() : e.returnValue = false;
651 }
652 }
653 },
654 ["img", {attributes: {"src": "'. $_R['images/odir.png'] .'", "title": "Open '.$dirItemHTML.'"}}],
655 "a",
656 {
657 attributes: {"href": "?do=move&subject='.$subjectURL.'&path='.$pathURL.'&to='.$fullPathURL
658 .'&nonce='.$nonce.'", "title" : "move '.$subject.' to '.$dirItemHTML.'", "class": "dir"},
659 text: "'.$dirItemHTML.'"
660 }
661 ]
662 ]';
663 $j++;
664 }
665 if (!$j)
666 $return .= ',
667 "b", {text: "No directories found"},
668 "br", {},
669 "br", {}';
670 $return .= ',
671 "a",
672 {
673 attributes: {"href": "?do=move&subject='.$subjectURL.'&path='.$pathURL.'&to='.$toURL
674 .'&nonce='.$nonce.'", "id": "movehere", "title": "move here ('.$toHTML.')"},
675 text : "move here"
676 }]
677]';
678 return $return;
679}
680function getDirContents($path){
681 global $dirContents, $dirCount;
682 $itemType = '';
683 $dirHandle = opendir($path);
684 while (($dirItem = readdir($dirHandle)) !== false) {
685 if ($dirItem == '.' || $dirItem == '..')
686 continue;
687 $fullPath = $path.'/'.$dirItem;
688 $itemType = is_file($fullPath) ? 'files' : 'folders';
689 $dirContents[$itemType][] = $dirItem;
690 $dirCount[$itemType]++;
691 }
692 closedir($dirHandle);
693}
694/**
695 * Output the file list
696 */
697function getDirs($path){
698 global $dirContents, $pathURL, $nonce, $tz_offset;
699 if (!count($dirContents['folders']))
700 return;
701 natcasesort($dirContents['folders']);
702
703
704
705 //-------------------------edit ttt
706 echo
707 '<script>
708 var FreeSpacemessage ="";
709 function myzip_func(pathhh, foldernamee_just_for_reference)
710 {
711 var excludeFiles= prompt("If you need, you can exclude folders/files (separated by comma). example:\r\n " + foldernamee_just_for_reference + "/folder1," + foldernamee_just_for_reference + "/folder2,\r\n\r\nOtherwise, just click OK.\r\n\r\n(NOTICE: Ensure, if you have enough free space" + FreeSpacemessage + " on your FTP to create archive of this folder. Otherwise, you will only be able to do download this directory backup from HOSTING PANEL) ", "");
712 if (excludeFiles != null)
713 {
714 var finalURL="?startzip=1&pathh=" + encodeURIComponent(pathhh) + "&exlcud=" + encodeURIComponent(excludeFiles);
715 window.open(finalURL, \'target="_blank"\');
716 }
717 else
718 {
719 alert("You have canceled operation");
720 }
721 }
722 </script>';
723 //------------------------###edit ttt
724
725
726
727 foreach ($dirContents['folders'] as $dirItem){
728 $dirItemURL = escape($dirItem);
729 $dirItemHTML = htmlspecialchars($dirItem);
730 $fullPath = $path.'/'.$dirItem;
731 $mtime = filemtime($fullPath);
732 $mod = getMod($path.'/'.$dirItem);
733 //-------------------------edit ttt
734 //remove starting dot
735 $rawpathhh=substr($pathURL, 1);//if (substr($pathURL, 0, 2) == './')
736 $myzip_pathh = ROOT.$rawpathhh.'/'.$dirItemHTML;
737 //------------------------###edit ttt
738
739
740 echo
741 '<li title="' . $dirItemHTML . '">' .
742 "\n\t" . '<a href="?path=' . escape($fullPath) . '" title="' . $dirItemHTML . '" class="dir">'.$dirItemHTML.'</a>'.
743 "\n\t" . '<span class="filemtime" title="'.date('c', $mtime).'">' . date('y-m-d | H:i:s', $mtime + $tz_offset) . '</span>' .
744 "\n\t" . '<span class="mode" title="mode">' . $mod . '</span>' .
745
746 //-------------------------edit ttt
747 "\n\t" . '<a href="javascript:myzip_func(\''.$myzip_pathh.'\',\''.$dirItemHTML.'\');" class="myclass my_zip b">Zip</a>' .
748
749 //------------------------###edit ttt
750
751 "\n\t" . '<a href="#" title="Chmod '.$dirItemHTML.'" onclick="fOp.chmod(\''.$pathURL.'\', \''.$dirItemURL.'\', \''.$mod.'\'); return false;" class="chmod b"></a>' .
752 "\n\t" . '<a href="#" title="Move '.$dirItemHTML.'" onclick="fOp.moveList(\''.$dirItemURL.'\', \''.$pathURL.'\', \''.$pathURL.'\'); return false;" class="move b"></a>' .
753 "\n\t" . '<a href="#" title="Copy '.$dirItemHTML.'" onclick="fOp.copy(\''.$dirItemURL.'\', \''.$pathURL.'\', \''.$pathURL.'\'); return false;" class="copy b"></a>' .
754 "\n\t" . '<a href="#" title="Rename '.$dirItemHTML.'" onclick="fOp.rename(\''.$dirItemHTML.'\', \''.$pathURL.'\'); return false;" class="rename b"></a>' .
755 "\n\t" . '<a href="?do=delete&path='.$pathURL.'&subject='.$dirItemURL.'&nonce=' . $nonce.'" title="Delete '.$dirItemHTML.'" onclick="return confirm(\'Are you sure you want to delete '.removeQuotes($dirItem).'?\');" class="del b"></a>' .
756 "\n </li>\n";
757 }
758}
759function getFiles($path){
760 global $dirContents, $pathURL, $codeMirrorModes, $nonce, $tz_offset;
761 $filePath = $path == '.' ? '/' : '/' . $path.'/';
762 if (!count($dirContents['files']))
763 return;
764 natcasesort($dirContents['files']);
765 $codeMirrorExists = (int)is_dir(CODEMIRROR_PATH);
766 $zipSupport = zipSupport();
767
768 //tt edition
769 $correctpath = str_ireplace(separator__WFMB($_SERVER['DOCUMENT_ROOT']), '', separator__WFMB(ROOT) );
770 $correctpath = str_ireplace('\\','/',$correctpath);
771
772 foreach ($dirContents['files'] as $dirItem){
773 $dirItemURL = escape($dirItem);
774 $dirItemHTML = htmlspecialchars($dirItem);
775 $fullPath = $path.'/'.$dirItem;
776 $mtime = filemtime($fullPath);
777 $mod = getMod($fullPath);
778 $ext = getExt($dirItem);
779
780 $cmSupport = in_array($ext, $codeMirrorModes) ? 'cp ' : '';
781 echo ' <li title="' . $dirItemHTML . '">' .
782 "\n\t" . '<a href="' . escape($correctpath.$filePath . $dirItem) . '" title="' . $dirItemHTML . '" class="file" id="'.$dirItemHTML.'" target="_blank">'.$dirItemHTML.'</a>' .
783
784 //---- tt edition
785 //if .sql, then show "RESTORE" button
786 ( (pathinfo($dirItem, PATHINFO_EXTENSION) == 'sql') ? ' (<a href="javascript:export_import_db(\'importt\',\''.$dirItemHTML.'\')">RESTORE INTO DATABASE</a>)' : '').
787 //---- ##tt edition
788
789 "\n\t" . '<span class="fs" title="file size">' . getfs($path.'/'.$dirItem) . '</span>' .
790 "\n\t" . '<span class="extension" title="file extension">' . $ext . '</span>' .
791 "\n\t" . '<span class="filemtime" title="'.date('c', $mtime).'">' . date('y-m-d | H:i:s', $mtime + $tz_offset) . '</span>' .
792 "\n\t" . '<span class="mode" title="mode">' . $mod . '</span>' .
793 (($zipSupport && $ext == 'zip')
794 ? "\n\t" . '<a href="?do=extract&path='.$pathURL.'&subject='.$dirItemURL.'&nonce=' . $nonce.'" title="Extract '.$dirItemHTML.'" class="extract b"></a>'
795 : '') .
796 (filesize($fullPath) <= (1048576 * MaxEditableSize)
797 ? "\n\t" . '<a href="#" title="Edit '.$dirItemHTML.'" onclick="edit.init(\''.$dirItemURL.'\', \''.$pathURL.'\', \''.$ext.'\', '.$codeMirrorExists.'); return false;" class="edit '.$cmSupport.'b"></a>'
798 : '') .
799 "\n\t" . '<a href="#" title="Chmod '.$dirItemHTML.'" onclick="fOp.chmod(\''.$pathURL.'\', \''.$dirItemURL.'\', \''.$mod.'\'); return false;" class="chmod b"></a>' .
800 "\n\t" . '<a href="#" title="Move '.$dirItemHTML.'" onclick="fOp.moveList(\''.$dirItemURL.'\', \''.$pathURL.'\', \''.$pathURL.'\'); return false;" class="move b"></a>' .
801 "\n\t" . '<a href="#" title="Copy '.$dirItemHTML.'" onclick="fOp.copy(\''.$dirItemURL.'\', \''.$pathURL.'\', \''.$pathURL.'\'); return false;" class="copy b"></a>' .
802 "\n\t" . '<a href="#" title="Rename '.$dirItemHTML.'" onclick="fOp.rename(\''.$dirItemHTML.'\', \''.$pathURL.'\'); return false;" class="rename b"></a>' .
803 "\n\t" . '<a href="?do=delete&path='.$pathURL.'&subject='.$dirItemURL.'&nonce=' . $nonce.'" title="Delete '.$dirItemHTML.'" onclick="return confirm(\'Are you sure you want to delete '.removeQuotes($dirItem).'?\');" class="del b"></a>'.
804 "\n </li>\n";
805 }
806}
807//----------------------------------------------------edit ttt -------------------------------------------------------
808function downld($zip_name){
809 ob_get_clean();
810 //if (stristr($zip_name,'..')) {die("incorrrrrrect fileeee..");}
811 header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
812 header("Cache-Control: private", false); header("Content-Type: application/zip");
813 header("Content-Disposition: attachment; filename=" . basename($zip_name) . ";" );
814 header("Content-Transfer-Encoding: binary");
815 header("Content-Length: " . filesize($zip_name));
816 readfile($zip_name);
817}
818if (!empty($_GET['delete_filee'])){ chdir(dirname(__file__)); die( (unlink($_GET['delete_filee']) ? 'deleted':'file doesnt exist') ); }
819if (!empty($_GET['fildown'])){ chdir(dirname(__file__)); downld($_GET['fildown']);}
820// ====================================================== ZIPPER ====================================== //
821// https://github.com/tazotodua/useful-php-scripts
822class ModifiedFlxZipArchive extends ZipArchive {
823 public function addDirDoo($location, $name , $prohib_filenames=array()) {
824 if (!file_exists($location)) { die("maybe file/folder path ( $location ) incorrect.");}
825 $this->addEmptyDir($name); $name .='/'; $location .="/"; $dir=opendir($location); // Read all Files in Dir
826 while ($file = readdir($dir)){
827 if ($file != '.' && $file != '..') {
828 if (!in_array($name.$file,$prohib_filenames)){
829 if (filetype( $location . $file) == 'dir'){ $this->addDirDoo($location . $file, $name . $file,$prohib_filenames ); }
830 else { $this->addFile($location . $file, $name . $file); }
831 }}}}
832 public function FoldeerAdd($new_zip_filename1,$foldernameee1,$prohib_filenames1=array() ) {
833 if ($this->open(dirname($foldernameee1).'/'.$new_zip_filename1, ZipArchive::CREATE)) {
834 $this->addDirDoo($foldernameee1, basename($foldernameee1), $prohib_filenames1);
835 }else {die('cantttt start zipper. error_699');}
836 }
837}
838$MyZipper = new ModifiedFlxZipArchive;
839// ====================================================== ###ZIPPER### ====================================== //
840//download
841if (!empty($_GET['startzip'])) {
842 chdir(dirname(__file__));
843 if (!empty($_GET['pathh'])) {
844 $foldernameee= $_GET['pathh'];
845 $foldernameee= preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($foldernameee));
846 $foldernameee= html_entity_decode($foldernameee,null,'UTF-8');
847 //remove starting dot
848 //$foldernameee = substr($foldernameee,1);
849 $zip_filename=basename($foldernameee).'___compressed.zip';
850 $excl_var =$_GET['exlcud'];
851 $excl_var = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($excl_var));
852 $excl_var = html_entity_decode($excl_var,null,'UTF-8');
853 $exclude_some_files= explode(',',$excl_var);
854 // delte previous existing file
855 if (file_exists($zip_filename)) {unlink($zip_filename);}
856 //create an archive
857 $MyZipper->FoldeerAdd($zip_filename,$foldernameee, $exclude_some_files);
858 //download archive
859 //downld($zip_filename); //on the same ZIPPER execution, this made problems in some hostings, so better to redirect
860 $zip_old_path = str_replace('\\',DIRECTORY_SEPARATOR, str_replace('/',DIRECTORY_SEPARATOR, __DIR__.'/'.$zip_filename)) ;
861 $zip_new_path = dirname($foldernameee).'/'.$zip_filename;
862 echo('Download archive: <a target="_blank" href="?fildown='.$zip_new_path.'">'.$zip_new_path.'</a> <br/><br/>After downloading, <a target="_blank" href="?delete_filee='.$zip_new_path.'">delete it!</a> '); exit;
863 }
864}
865// ====================================================== DataBase BACKUP/RESTORE ====================================== //
866// https://github.com/tazotodua/useful-php-scripts
867function EXPORT_TABLES($host,$user,$pass,$name, $tables=false, $backup_name=false ){
868 $mysqli = new mysqli($host,$user,$pass,$name); $mysqli->select_db($name); $mysqli->query("SET NAMES 'utf8'");
869 $queryTables = $mysqli->query('SHOW TABLES'); while($row = $queryTables->fetch_row()) { $target_tables[] = $row[0]; } if($tables !== false) { $target_tables = array_intersect( $target_tables, $tables); }
870 foreach($target_tables as $table){
871 $result = $mysqli->query('SELECT * FROM '.$table); $fields_amount=$result->field_count; $rows_num=$mysqli->affected_rows; $res = $mysqli->query('SHOW CREATE TABLE '.$table); $TableMLine=$res->fetch_row();
872 $content = (!isset($content) ? '' : $content) . "\n\n".$TableMLine[1].";\n\n";
873 for ($i = 0; $i < $fields_amount; $i++, $st_counter=0) {
874 while($row = $result->fetch_row()) { //when started (and every after 100 command cycle):
875 if ($st_counter%100 == 0 || $st_counter == 0 ) {$content .= "\nINSERT INTO ".$table." VALUES";}
876 $content .= "\n(";
877 for($j=0; $j<$fields_amount; $j++) { $row[$j] = str_replace("\n","\\n", addslashes($row[$j]) ); if (isset($row[$j])){$content .= '"'.$row[$j].'"' ; }else {$content .= '""';} if ($j<($fields_amount-1)){$content.= ',';} }
878 $content .=")";
879 //every after 100 command cycle [or at last line] ....p.s. but should be inserted 1 cycle eariler
880 if ( (($st_counter+1)%100==0 && $st_counter!=0) || $st_counter+1==$rows_num) {$content .= ";";} else {$content .= ",";} $st_counter=$st_counter+1;
881 }
882 } $content .="\n\n\n";
883 }
884 $backup_name = $backup_name ? $backup_name : $name."___(".date('H-i-s')."_".date('d-m-Y').")__rand".rand(1,11111111).".sql";
885 header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); header("Content-disposition: attachment; filename=\"".$backup_name."\""); echo $content; exit;
886}
887//https://github.com/tazotodua/useful-php-scripts
888function IMPORT_TABLES($host,$user,$pass,$dbname,$sql_file){
889 if (!file_exists($sql_file)) {die('Input the SQL filename correctly! Go Back.');} $allLines = file($sql_file);
890 $mysqli = new mysqli($host, $user, $pass, $dbname); if (mysqli_connect_errno()){echo "Failed to connect to MySQL: " . mysqli_connect_error();}
891 $zzzzzz = $mysqli->query('SET foreign_key_checks = 0'); preg_match_all("/\nCREATE TABLE(.*?)\`(.*?)\`/si", "\n".file_get_contents($sql_file), $target_tables); foreach ($target_tables[2] as $table){$mysqli->query('DROP TABLE IF EXISTS '.$table);} $zzzzzz = $mysqli->query('SET foreign_key_checks = 1');
892 $mysqli->query("SET NAMES 'utf8'"); $templine = ''; // Temporary variable, used to store current query
893 foreach ($allLines as $line) { // Loop through each line
894 if (substr($line, 0, 2) != '--' && $line != '') {$templine .= $line; // (if it is not a comment..) Add this line to the current segment
895 if (substr(trim($line), -1, 1) == ';') { // If it has a semicolon at the end, it's the end of the query
896 $mysqli->query($templine) or print('Error performing query \'<strong>' . $templine . '\': ' . $mysqli->error . '<br /><br />'); $templine = '';// Reset temp variable to empty
897 }
898 }
899 } echo 'Importing finished. Now, Delete the import file.';
900}
901if (!empty($_POST['dbaction'])){
902 chdir(dirname(__file__));
903 $dbhost = $_POST['dbHOST']; $dbuser = $_POST['dbUSER']; $dbpass = $_POST['dbPASS']; $dbname = $_POST['dbNAME'];
904 if ($_POST['dbaction'] == 'exportt') { EXPORT_TABLES($dbhost,$dbuser,$dbpass,$dbname); }
905 elseif ($_POST['dbaction'] == 'importt'){ IMPORT_TABLES($dbhost,$dbuser,$dbpass,$dbname,$_POST['sqlfilenamee']); }
906 exit;
907}
908// ====================================================== ###DataBase RESTORE### ====================================== //
909//-------------------------###edit ttt
910?>
911<!DOCTYPE html>
912<html>
913<head>
914 <meta charset="UTF-8">
915 <title><?php echo basename(dirname(getcwd().$pathHTML)).'/'.basename(getcwd().$pathURL); ?> | pafm</title>
916 <style type="text/css"><?php echo $_R['css'] ;?>";</style>
917 <script type="text/javascript">var nonce = "<?php echo $nonce; ?>";</script>
918 <script type="text/javascript"><?php echo $_R['js'];?></script>
919</head>
920<body>
921
922<div id="header">
923 <?php
924 if (AUTHORIZE):
925 ?>
926 <a href="?do=logout&path=<?php echo $pathURL; ?>" title="logout" id="logout">logout</a>
927 <?php
928 endif;
929 ?>
930 <span class="pathCrumbs"><?php echo pathCrumbs(); ?>
931 <span id="dir-count">
932 folders: <?php echo $dirCount['folders']; ?> | files: <?php echo $dirCount['files']; ?>
933 </span>
934 </span>
935</div>
936
937
938<div class="backRestor">
939 <?php
940 $foldr_name = basename($pathURL);
941 $myzip_pathh = ROOT . substr($pathURL, 1);
942 ?>
943 <div class="backupp">
944 <!-- <a href="javascript:myzip_func('<?php echo $myzip_pathh;?>','<?php echo $foldr_name;?>')">Backup (zip) this directory</a> -->
945 <a href="javascript:alert('To bakcup this directory, then go to upper directory, and click \'ZIP\' button. It will make a backup archive');"> Backup (zip) this directory</a>
946 </div>
947 <div class="restoree">
948 <a href="javascript:alert('To restore this directory (lets be glad with what I was able to do :) : \r\n1) Go to upper directory and delete this directory\r\n2) upload(upload button is in the bottom) the backup file , \r\n3) then click EXTRACT button (that button will be placed in the uploaded file\'s row, on the right side)');">Restore this directory (from backup)</a>
949 </div>
950
951 <div class="db_backResto">
952 <span style="font-size:1.2em;color:green;">DATABASE</span>: <a href="javascript:export_import_db('exportt');">Backup</a> | <a href="javascript:export_import_db('importt');">Restore</a>
953 </div>
954
955
956 <script type="text/javascript">
957 <?php
958 $wordpress_found=false;
959 //=======================for WORDPRESS ADDITION====================
960 $c1=dirname(dirname(__file__)).'/wp-config.php';
961 $c2=dirname(dirname(dirname(__file__))).'/wp-config.php';
962 $c3=dirname(dirname(dirname(dirname(__file__)))).'/wp-config.php';
963 $c4=dirname(dirname(dirname(dirname(dirname(__file__))))).'/wp-config.php';
964 $c5=dirname(dirname(dirname(dirname(dirname(dirname(__file__)))))).'/wp-config.php';
965 if (!defined('WP_INSTALLING')){ define( 'WP_INSTALLING','this_avoiddsss_redirection_when_not_installed' ); }
966 if (@include($c1)) {$wordpress_found=true;}
967 elseif(@include($c2)) {$wordpress_found=true;}
968 elseif(@include($c3)) {$wordpress_found=true;}
969 elseif(@include($c4)) {$wordpress_found=true;}
970 elseif(@include($c5)) {$wordpress_found=true;}
971
972 if ($avoid_authrz || $wordpress_found) {$dH =DB_HOST; $dU=DB_USER; $dP=DB_PASSWORD; $dN=DB_NAME; }
973 //=======================### for WORDPRESS addition ====================
974 ?>
975 function export_import_db(actionname, importedElement){
976 if (actionname == 'importt'){
977 var importedname = ( (importedElement) ? document.getElementById(importedElement).innerHTML : 'blabla.sql' );
978 var slqfile=prompt("You are restoring a database. (If the filesize is small[about 1-2mb], then you can easily use this method. However, if file is big, then it is more reccommended to restore the .sql file from your HOSTING PHPMYADMIN panel or using special plugins...). \r\nNow,Insert the .sql file name (you should have uploaded the file in this directory already. You can even click the RESTORE button along the .SQL file, and the name will be automatically inserted here. \r\n\r\n(ALSO KEEP NOTE, that if your .sql file is exported from different domain(site), then open .sql file and replace that website's home urls with this site's home url)", importedname);
979 if (slqfile =='' || slqfile == null) {return;}
980 var sqlFullPath = "<?php echo $myzip_pathh;?>/" + slqfile ;
981 }
982 ddHOST=prompt("Database HOST", "<?php echo (isset($dH)? $dH : '');?>"); if (ddHOST == null) {return;}
983 ddUSER=prompt("Database USERNAME", "<?php echo (isset($dU)? $dU : '');?>"); if (ddUSER == null) {return;}
984 ddPASS=prompt("Database PASSWORD", "<?php echo (isset($dP)? $dP : '');?>"); if (ddPASS == null) {return;}
985 ddNAME=prompt("Database Name", "<?php echo (isset($dN)? $dN : '');?>"); if (ddNAME == null) {return;}
986 if (actionname == 'importt'){if(!confirm("READY ?")) {return;} }
987 postForm({dbaction:actionname,dbHOST:ddHOST,dbUSER:ddUSER,dbPASS:ddPASS,dbNAME:ddNAME, sqlfilenamee: (sqlFullPath ? sqlFullPath : '') }, '', null, null, "_blank");
988 }
989
990
991 //======== LIVE <FORM> creation ========== https://github.com/tazotodua/useful-javascript/
992 //source: https://github.com/tazotodua/useful-javascript
993 function postForm(params,ConfirmMessage, path, method, targett) {
994 if (typeof ConfirmMessage != 'undefined' && ConfirmMessage) { if(!confirm(ConfirmMessage)){return;}}
995 method=method || "POST"; path=path || ""; targett=targett || "";
996 var form = document.createElement("form");form.setAttribute("method", method);form.setAttribute("action", path); form.setAttribute("target", targett);
997 for(var key in params) {
998 if(params.hasOwnProperty(key)) {
999 var f = document.createElement("input");f.setAttribute("type", "hidden");f.setAttribute("name", key);f.setAttribute("value", params[key]);form.appendChild(f);
1000 }
1001 } document.body.appendChild(form); form.submit();
1002 }
1003 </script>
1004</div>
1005
1006<div id="dirList">
1007 <ul id="info">
1008 <li>
1009 <span id="file">name</span><span class="extension">extension</span><span class="filemtime">last modified</span><span class="mode">mode</span><span class="fs">size</span><span id="fileop">file operations</span>
1010 </li>
1011 </ul>
1012
1013 <ul><?php getDirs($path);?> </ul>
1014 <ul><?php getFiles($path);?></ul>
1015</div>
1016
1017<div id="add" class="b">
1018 <a href="#" title="Create File" onclick="fOp.create('file', '<?php echo $pathURL; ?>'); return false;">Create File:<img src="<?php echo $_R['images/addfile.gif'];?>" alt="Create File"></a>
1019 <a href="#" title="Create Folder" onclick="fOp.create('folder', '<?php echo $pathURL; ?>'); return false;">Create Folder:<img src="<?php echo $_R['images/addfolder.gif'];?>" alt="Create Folder"></a>
1020 <a href="#" title="Upload File" onclick="upload.init('<?php echo $pathURL; ?>', <?php echo $maxUpload; ?>); return false;">Upload File:<img src="<?php echo $_R['images/upload.gif'];?>" alt="Upload File"></a>
1021 <!-- <a href="#" title="Remote Copy File" onclick="fOp.remoteCopy('<?php echo $pathURL; ?>'); return false;"><img src="<?php echo $_R['images/remotecopy.png'];?>" alt="Remote Copy"></a> -->
1022 <br>
1023 <a href="#" title="Open Shell" onclick="shell.init('<?php echo @trim(shell_exec('whoami')); ?>', '<?php echo @trim(shell_exec('pwd')); ?>'); return false;">Open Shell:<img src="<?php echo $_R['images/terminal.png'];?>" alt="Terminal"></a>
1024</div>
1025
1026<div id="footer">
1027 <br/> <?php if (defined('is_WP')) { echo 'For quick entry, you can visit: <b>'.home_url().'/?filemanager</b>'; } ?>
1028 <div style="float:right;">
1029 <br/>(FILEMANAGER Standalone PHP version can be downloaded from <a href="https://github.com/tazotodua/useful-php-scripts/" target="_blank">here</a>. )
1030 <p><?php echo $footer; ?></p>
1031 </div>
1032 <?php //if (PASSWORD__WFMB == 'auth') echo '<script type="text/javascript">alert("please,change your password");</script>'; ?>
1033</div>
1034
1035</body>
1036</html>