<?php
/////////////// VARIABLES //////////////////////////////// // RU comments
//------------------------ ??????? ------------------------
$debug = 0; // ???/???? ???? debug.
$debug2 = false; // ???/???? ???? debug2.
//------------------------- globals------------------------
$ver = '1.1.000';
$dir = "./"; // ?? ????????? ??????????? ????? ??????? ???????.
$scan = []; // ????? ??????????? $dir ? ????? $scan.
$html = "<div class='container'><div class='row'>"; // ????? ??????? ???? HTML
$dis_files = array(my_name(),"1"); // ?????? ??????????? ???????? ??????????. ??-????????? ????????? ??? ?????.
$disabled_extentions = []; // ????????? ?????.
$title = "Magic Stick Autopublisher version 1.1.000";
$dir = './'; // ?? ????????? ?????????? - ???????? ??????????
///////////// FUNCTIONS ///////////////////////////////////
function my_name() { //????????? ???? ? ????????? ?? ?????? ?????? ??? ??????????
GLOBAL $debug; // ???????????? ? ?????????? ??????????
return (basename(__FILE__)); // ?????????? ??????????? ??? ??? ????
}
//-------------------------------------------------//
function disabled($b) { // ???????? ??? ?????/????? ?????????? ?????? ???????? ??? ???
GLOBAL $dis_files,$debug; // ???????????? ? ?????????? ??????????
if($debug){echo("<pre>" . __LINE__ . ": ");print_r($dis_files);echo("</pre>");} // ??????? ?????????? ??????????
$c = false; // $c ?????????? false ??? ????????? ?? ?????????.
if(in_array($b, $dis_files)) return true; // ???? ??????????? ????/????? ??????? ? ?????????????? ??
if(in_array(get_extension($b), $dis_files)) return true; // ???? ?????????? ????????? ????????? ??
return $c; // ?????????? ???, ???? ?????? ??? ???????
}
//--------------------------------------------------
function get_extension($a='.htsccess'){ // ??????? ????????? ??? ?????/????? ?????????? ?????????? ??? ?????? ??????
GLOBAL $disabled_extensions; // ???????????? ? ?????????? ??????????
// extract($_REQUEST); // ??????????????? ?? ?????? ????????????? ?????????? ??????? ?????????? ? ???????
$posr = strrpos($a, ".")+1; // ??????? ????????? ????? ? ?????????? ?????
$posl = strpos($a,".")+1; // ??????? ?????? ????? ? ???????
$len_ = strlen($a); // ????? ????? ?????/?????
if($len_- $posr){ // ???? ????? ?????? ??????? ?????? ????? (???? ?? ????????? ?????? ??????? ???????)
if($posl){ // ???? ?????? ??????? ???? ?? ???? ????? ? ?????
return substr($a, ($posr - $len_)); // ?????????? ??????? ????? ????? ????????? ?????
}else{ // ????? ???? ????? ?????? ???
return substr($a, ($posr - $len_ + 1)); // ?????????? ??????? ????? ?????? ?? ??????? ?????? ??? ??????? ????????? ?????
}
}
return false; // ???? ?????? ??? ??????? ?????????? ?????
}
////////////////// MAIN //////////////////////////////////////
extract($_REQUEST); // ????????????? ?????? ? ??????????
$scan=scandir($dir) ; // ????????? ??????????
if($debug2) {echo("<pre>"); print_r($scan);echo("</pre>"); } // ??????????? ??? ????????.
$disabled_files = my_name(); // ????????? ???????? ? ?????? ?????.
for($i=0;$i<count($scan); $i++) { // ?????? ?????????? ???????? ??-??????.
switch ($scan[$i]) { // ???????? ?????? ???? ???????? ?????????? ????? ?????/????? ??? ??????????? ???????
case(".") : $nadpis = "????????? ????????????"; break; // ??? ?????????? "." ????? "????????? ????????????" ??? $nadpis.
case("..") : $nadpis = "????? ?? ??????????"; break; // ??? ?????????? ".." ????? "????? ?? ??????????" ??? $nadpis.
default : $nadpis = $scan[$i]; break; // ??-????????? ????? ??? ?????.
}
if($i===0) {$html .= ''; //"<a href='" . $scan[$i] . "'><div class='col-lg-6 place'>" . $nadpis . "</div></a>"; //?????????? ????????? ?????? ???? ??? "."
}elseif($i===1){$html .= "<a href='" . $scan[$i] . "'><div class='col-lg-12 place'>" . $nadpis . "</div></a>"; //?????????? ????????? ?????? ???? ??? ".."
}else{
if(!disabled($scan[$i])) $html .= "<a href='" . $scan[$i] . "'><div class='col-lg-1 col-md-2 col-sm-3 place'>" . $nadpis . "</div></a>" ; // ???????? html ?????? ?? ???????????.
}
}
$html .= "</div></div>";
?>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo($title)?></title>
<style>
h1,h2,h3{
color: #8ac;
}
.place{
padding:5px;
margin:0px;
border:thin solid #fff;
background:#dde;
color:#04a;
border-radius:3px;
text-align:center;
}
.place:hover{
background-color:#ccf;
}
.gray-black{
background-color: #666;
color:#fff;
font-family:Arial;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<h2><?php echo($title)?></h2>
<?php echo($html);?>
</div>
</div>
<div class="container">
<div class="row">
<footer class="gray-black">
<?php include("http://git.uk.tempcloudsite.com/publicator1.1/footer.txt")?>
</footer>
</div>
</div>
</body>
|