Просмотр файла ISP4Mobile/xrex/diskusage.php

Размер файла: 6.5Kb
<?php
### Decoded IonCube by pimnik98 
### Декодировал Пиминов Никита 
### vk.com/piminov_remont
### Заказать декодирование: https://bymas.ru/forum/viewtopic.php?topic_id=131647

echo '<div class="head">' . "\n" . '<div class="logo"> Панель управления</div>' . "\n" . '</div><div class="menu" style="text-align:right"><img src="images/lv-server.png" alt="." />' . $server . ' | ' . "\n";
echo '<img src="images/lv-5.png" alt="." />' . htmlentities($_SESSION['username'], ENT_QUOTES, 'UTF-8') . ' | ' . "\n";
echo '<img src="images/sb-logout.gif" alt="." /><a href="?func=exit">Выйти</a>' . "\n";
echo '<hr /></div><div class="menu">' . "\n";

if (isset($_GET['plid']) && isset($_GET['elid'])) {
	$content = api_query('https://' . $server . '/manager/ispmgr?func=diskusage&elid=' . urlencode($_GET['elid']) . '&plid=' . urlencode($_GET['plid']) . '&out=xml&authinfo=' . urlencode($_SESSION['username']) . ':' . urlencode($_SESSION['password']));
}
else if (isset($_GET['elid'])) {
	$content = api_query('https://' . $server . '/manager/ispmgr?func=diskusage&elid=' . urlencode($_GET['elid']) . '&out=xml&authinfo=' . urlencode($_SESSION['username']) . ':' . urlencode($_SESSION['password']));
}
else {
	$content = api_query('https://' . $server . '/manager/ispmgr?func=diskusage&out=xml&authinfo=' . urlencode($_SESSION['username']) . ':' . urlencode($_SESSION['password']));
}

$parse_xml = simplexml_load_string($content);
echo '<b>Использование диска</b>' . "\n";
echo '<hr />' . "\n";
echo 'Путь: /';

if (isset($_GET['plid'])) {
	echo htmlentities($_GET['plid'], ENT_QUOTES, 'UTF-8');
}

if (isset($_GET['elid']) && isset($_GET['plid'])) {
	echo '/';
}

if (isset($_GET['elid'])) {
	echo htmlentities($_GET['elid'], ENT_QUOTES, 'UTF-8');
}

echo "\n" . '<hr />' . "\n";

if (isset($_GET['plid']) && isset($_GET['elid'])) {
	$elid = strrchr($_GET['plid'], '/');

	if ($elid !== false) {
		$elid = substr($elid, 1);
	}

	$plid = array_reverse(explode('/', $_GET['plid']));
	$count_plid = sizeof($plid);

	if (1 < $count_plid) {
		unset($plid[0]);
		$plid = implode('/', array_reverse($plid));
	}
	else {
		$plid = $plid[0];
	}

	echo '<a href="?func=diskusage';

	if ($elid !== false) {
		echo '&amp;elid=' . urlencode($elid) . '&amp;plid=' . urlencode($plid);
	}
	else {
		echo '&amp;elid=' . urlencode($_GET['plid']);
	}

	echo '"><img src="images/back.gif" alt=".." /></a><br />' . "\n";
}
else if (isset($_GET['elid'])) {
	echo '<a href="?func=diskusage"><img src="images/back.gif" alt=".." /></a><br />' . "\n";
}

$list_dir = array();
$list_file = array();

foreach ($parse_xml->elem as $var) {
	$dname_attributes = $var->name->attributes();

	if ($dname_attributes['xprop'] == '0') {
		$list_dir['\'.(string)' . $var->name . '.\''] = array((string) $var->name, '0', (string) $var->size);
	}
	else if ($dname_attributes['xprop'] == '100') {
		$list_file['\'.(string)' . $var->name . '.\''] = array((string) $var->name, '100', (string) $var->size);
	}
}

ksort($list_dir);
ksort($list_file);
$list_all = array_merge($list_dir, $list_file);

foreach ($list_all as $var) {
	$list_all_num[] = $var;
}

unset($list_all);

if (isset($list_all_num)) {
	$count_all_num = sizeof($list_all_num);
	$s_max = ceil($count_all_num / $_SESSION['rows']);

	if (isset($_GET['s'])) {
		$s = (int) $_GET['s'];

		if ($s_max < $s) {
			$s = $s_max;
		}
		else if ($s < 1) {
			$s = 1;
		}
	}
	else {
		$s = 1;
	}

	$rows_max = ($s * $_SESSION['rows']) - 1;
	$rows_min = ($rows_max - $_SESSION['rows']) + 1;

	if (($count_all_num - 1) < $rows_max) {
		$rows_max = $count_all_num - 1;
	}

	$i = $rows_min;

	while ($i <= $rows_max) {
		if ($list_all_num[$i][1] == '0') {
			echo '<img src="images/p-file-0.png" alt="d" /> <a href="?func=diskusage&amp;elid=' . urlencode($list_all_num[$i][0]);

			if (isset($_GET['elid']) && isset($_GET['plid'])) {
				echo '&amp;plid=' . urlencode($_GET['plid'] . '/' . $_GET['elid']);
			}
			else if (isset($_GET['elid'])) {
				echo '&amp;plid=' . urlencode($_GET['elid']);
			}

			echo '">' . htmlentities((string) $list_all_num[$i][0], ENT_QUOTES, 'UTF-8') . '</a> ' . $list_all_num[$i][2] . 'Mb<br />' . "\n";
		}
		else if ($list_all_num[$i][1] == '100') {
			echo '<img src="images/p-file-100.png" alt="f" /> ' . htmlentities($list_all_num[$i][0], ENT_QUOTES, 'UTF-8') . ' ' . $list_all_num[$i][2] . 'Mb<br />' . "\n";
		}

		++$i;
	}
}
else {
	echo '<br />' . "\n";
	echo 'Папка пуста<br />' . "\n";
}

if (isset($list_all_num)) {
	if (1 < $s_max) {
		echo '<hr />' . "\n";
		echo 'Страницы:<br />' . "\n";
		$s_prev = $s - 2;
		$s_next = $s + 2;

		if ($s_prev < 1) {
			$s_prev = 1;
		}

		if ($s_max < $s_next) {
			$s_next = $s_max;
		}

		if (2 < $s_prev) {
			echo '<a href="?func=diskusage&amp;';

			if (isset($_GET['elid'])) {
				echo 'elid=' . urlencode($_GET['elid']) . '&amp;';
			}

			if (isset($_GET['plid'])) {
				echo 'plid=' . urlencode($_GET['plid']) . '&amp;';
			}

			echo 's=1">1</a> ... ';
		}
		else if ($s_prev == 2) {
			echo '<a href="?func=diskusage&amp;';

			if (isset($_GET['elid'])) {
				echo 'elid=' . urlencode($_GET['elid']) . '&amp;';
			}

			if (isset($_GET['plid'])) {
				echo 'plid=' . urlencode($_GET['plid']) . '&amp;';
			}

			echo 's=1">1</a> ';
		}

		$i = $s_prev;

		while ($i <= $s_next) {
			if ($i == $s) {
				echo $i . ' ';
			}
			else {
				echo '<a href="?func=diskusage&amp;';

				if (isset($_GET['elid'])) {
					echo 'elid=' . urlencode($_GET['elid']) . '&amp;';
				}

				if (isset($_GET['plid'])) {
					echo 'plid=' . urlencode($_GET['plid']) . '&amp;';
				}

				echo 's=' . $i . '">' . $i . '</a> ';
			}

			++$i;
		}

		if ($s_next < ($s_max - 1)) {
			echo '... <a href="?func=diskusage&amp;';

			if (isset($_GET['elid'])) {
				echo 'elid=' . urlencode($_GET['elid']) . '&amp;';
			}

			if (isset($_GET['plid'])) {
				echo 'plid=' . urlencode($_GET['plid']) . '&amp;';
			}

			echo 's=' . $s_max . '">' . $s_max . '</a>';
		}
		else if ($s_next == $s_max - 1) {
			echo '<a href="?func=diskusage&amp;';

			if (isset($_GET['elid'])) {
				echo 'elid=' . urlencode($_GET['elid']) . '&amp;';
			}

			if (isset($_GET['plid'])) {
				echo 'plid=' . urlencode($_GET['plid']) . '&amp;';
			}

			echo 's=' . $s_max . '">' . $s_max . '</a>';
		}

		echo "\n";
	}
}

echo '<img src="images/sb-menu.png" alt="." /><a href="?func=menu">Вернуться в меню</a>' . "\n";
echo '</div>';

?>