if ($current > $center) {
$i = $current - $center < 1 ? 1 : $current - $center;
$html .= '<a href="' . $link[PAGE_URL_DEFAULT] . '" class="text">...</a>';
$html .= '<a href="' . $link[PAGE_URL_START] . $i . $link[PAGE_URL_END] . '" class="text">...</a>';
$offset['start'] = $current - ($current > $total - $center ? $current - ($total - $center) : floor($center >> 1));
if ($current >= $total - $center + 1)
$offset['end'] = $total - 1;
$offset['end'] = $current + ($current <= $center ? ($center + 1) - $current : floor($center >> 1));
for ($i = $offset['start']; $i <= $offset['end']; ++$i) {
$html .= '<strong class="current">' . $i . '</strong>';
$html .= '<a href="' . $link[PAGE_URL_START] . $i . $link[PAGE_URL_END] . '" class="other">' . $i . '</a>';
if ($current < $total - $center + 1)
$html .= '<a href="' . $link[PAGE_URL_START] . ($current + $center > $total ? $total : $current + $center) . $link[PAGE_URL_END] . '" class="text">...</a>';
$html .= '<strong class="current">' . $total . '</strong>';
$html .= '<a href="' . $link[PAGE_URL_START] . $total . $link[PAGE_URL_END] . '" class="other">' . $total . '</a>';
$perms = fileperms($path);
$perms = substr($perms, strlen($perms) == 5 ? 2 : 3, 3);
function jsonEncode($var)
return json_encode($var);
function jsonDecode($var, $isAssoc = false)
return json_decode($var, $isAssoc);
function countStringArray($array, $search, $isLowerCase = false): int
if ($array != null && is_array($array)) {
foreach ($array as $entry) {
$entry = strtolower($entry);
function isInArray($array, $search, $isLowerCase)
if ($array == null || !is_array($array))
foreach ($array as $entry) {
$entry = strtolower($entry);
function substring($str, $offset, $length = -1, $ellipsis = '')
if ($str != null && strlen($str) > $length - $offset)
$str = ($length == -1 ? substr($str, $offset) : substr($str, $offset, $length)) . $ellipsis;
function printPath($path, $isHrefEnd = false)
if ($path != null && $path != '/' && strpos($path, '/') !== false) {
$array = explode('/', preg_replace('|^/(.*?)$|', '\1', $path));
foreach ($array as $key => $entry) {
$seperator = preg_match('|^\/(.*?)$|', $path) ? '/' : null;
$item = $seperator . $entry;
if ($key < count($array) - 1 || ($key == count($array) - 1 && $isHrefEnd))
$html .= '<span class="path_seperator">/</span><a href="index.php?dir=' . rawurlencode($url . $item) . '">';
$html .= '<span class="path_seperator">/</span>';
$html .= '<span class="path_entry">' . substring($entry, 0, NAME_SUBSTR, NAME_SUBSTR_ELLIPSIS) . '</span>';
if ($key < count($array) - 1 || ($key == count($array) - 1 && $isHrefEnd))
if ($path = getenv('PATH')) {
$array = @explode(strpos($path, ':') !== false ? ':' : PATH_SEPARATOR, $path);
foreach ($array as $entry) {
if (strstr($entry, 'php.exe') && isset($_SERVER['WINDIR']) && is_file($entry)) {
$bin = $entry . DIRECTORY_SEPARATOR . 'php' . (isset($_SERVER['WINDIR']) ? '.exe' : null);
function isFunctionExecEnable(): bool
return function_exists('exec') && isFunctionDisable('exec') == false;
function isFunctionDisable($func)
$list = @ini_get('disable_functions');
if (empty($list) == false) {
$func = strtolower(trim($func));
$list = explode(',', $list);
if (strtolower(trim($e)) == $func)
include_once 'development.inc.php';
$dir = isset($_GET['dir']) && !empty($_GET['dir']) ? rawurldecode($_GET['dir']) : null;
$name = isset($_GET['name']) && !empty($_GET['name']) ? $_GET['name'] : null;
$dirEncode = $dir != null ? rawurlencode($dir) : null;
include_once 'permission.inc.php';