Файл: public_html/ex/dirs.php
Строк: 183
<?php
require('config.php');
require_once('functions.php');
include('simple_html_dom.php');
$id = intval($_GET['id']);
$page = intval($_GET['page']);
$pages=$page*10-10;
$top2dir=isset($_GET['top']) ? 'top' : 'dir';
$top2dirf=isset($_GET['top']) ? 'top' : 'catalog';
if(isset($_GET['page'])){
$html = file_get_html('http://7ba.ru/ex/'.$top2dirf.'/'.$id.'/'.$pages.'/');
}
elseif(isset($_GET['id'])){
$html = file_get_html('http://7ba.ru/ex/'.$top2dirf.'/'.$id);
}else{
$html = file_get_html('http://7ba.ru/ex');
}
foreach($html->find('div[class=title]') as $tithdd){
foreach($tithdd->find('a') as $tithadd){
$titha[]=$tithadd->href;
$tithi[]=$tithadd->innertext;
}
foreach($tithdd->find('strong') as $strong){
$strongs[]=$strong->innertext;
}
}
$d_f = files_or_dirs($html);
switch($d_f){
case 'files':
foreach($html->find('div[class=contentbox]') as $s) {
foreach($s->find('div[class=linkes]') as $mn) {
$ddd[]=$mn->innertext;
preg_match('#<span class="white">(.*)</span>((.*))<br/><span#si', $mn, $nma);
$nm[]=$nma[1];
}
foreach($s->find('div[class=str]') as $pager){
foreach($pager->find('a') as $pagest){
$pagesr[]=$pagest->innertext;
}
}
foreach($s->find('div[class=linkes]') as $dspan){
$siz[]=str_replace(' ', '', $dspan->innertext);
$nams[]=$dspan->innertext;
foreach($dspan->find('span[class=white]') as $span){
$spans[]=$span->innertext;
}
}
foreach($s->find('img[class=fileimg]') as $img){
$imgss=preg_replace('#<img(.*)" src="(.*)"/>#si', '$2', $img);
$imgs[]=$imgss;
}
foreach($s->find('a') as $sd){
preg_match_all('#/ex/showfile/(.*).html#si', $sd, $lia);
preg_match_all('#.html">(.*)</a>#si', $sd, $lin);
$linksad=$lia[1];
if($linksad==!NULL){
$linksa[]=$linksad;
}
$linksn[]=$lin;
}
}
break;
case 'dirs':
foreach($html->find('div[class=contentbox]') as $sdir) {
foreach($sdir->find('a') as $dirss) {
$dir_a[] = $dirss->href;
$dir_i[] = $dirss->innertext;
}
}
break;
}
$title = 'Загрузки!';
require_once('head.php');
$c=count($titha);
echo '<div class="phdr">';
echo '<a href="/ex/">Загрузки</a>';
for($i=0; $i<$c; $i++){
$name = preg_replace('#<div class="linkes">(.*)</div>#si', '', $tithi[$i]);
$name = preg_replace('#<img(.*)"">#si', '', $name);
$ssilka = str_replace('/ex/', '/', $titha[$i]);
$ssilka = str_replace('catalog/', 'dir/', $ssilka);
if($name == !NULL and $ssilka!='/'){
echo ' | <a href="/'.$papka.$ssilka.'">'.$name.'</a>';
}
}
if($strongs[0] == !NULL){
echo ' | '.$strongs[0];
}
echo '</div>';
$f_d = files_or_dirs($html);
switch($f_d){
case 'files':
if(isset($_GET['top'])){
echo '<div class="menu">
<table style="width:100%" cellspacing="0" cellpadding="0"><tr>
<td style="width:50%;border-right:solid; border-width:1px">
<center><a href="/'.$papka.'/dir/'.intval($_GET['id']).'/"><b>Новые</b></a></center>
</td>
<td style="width:50%; border-width:1px">
<center><b>Популярные</b></center>
</td>
</tr></table>
</div>';
}else{
echo '<div class="menu">
<table style="width:100%" cellspacing="0" cellpadding="0"><tr>
<td style="width:50%;border-right:solid; border-width:1px">
<center><b>Новые</b></center>
</td>
<td style="width:50%; border-width:1px">
<center><a href="/'.$papka.'/top/'.intval($_GET['id']).'"><b>Популярные</b></a></center>
</td>
</tr></table>
</div>';
}
$aas = strip_tags($siz[1], '<br>');
$c=count($nm);
if($c==NULL){
echo '<div class="rmenu">Нет популярные файлы!</div>';
require ('foot.php');
exit();
}
for($i=0; $i<$c; $i++){;
$ssa=preg_match('#</span>((.*))<br/><spanclass="white">Разместил#si', $siz[$i], $sizes);
$ds = preg_replace('#<span class="white">Разме(.*)</div>#si', '', $nams[$i]);
$ds = preg_replace('#<img(.*)class="white">#si', '', $ds);
$name = preg_replace('#(.*)</span>((.*))#si', '$1', $ds);
$size = preg_replace('#((.*))#si', '$1', $ssa);
if(img_is_no_file($nams[$i])==false){
$screen[2] = NULL;
}
else
{
preg_match('#<imgclass="fileimg"alt="(.*)"src="(.*)"/><img#si', str_replace(' ', '', $nams[$i]), $screen);
}
if($screen[2]=='http://7ba.ru/includes/img/noimage.gif'){
//$screen[2] = NULL;
$screen[2] = '/'.$papka.'/no_image.png';
}
if($screen[2] == !NULL){
$screen[2] = '<img src="'.$screen[2].'" /><br />';
}
$id = preg_replace('#(.*)/(.*)#si', '$1', $linksa[$i][0]);
if(file_exists('ext/'.get2ext($name).'.png')){
$ext = '<img src="/'.$papka.'/ext/'.get2ext($name).'.png" />';
}
else
{
$ext = '<img src="/'.$papka.'/ext/file.png" />';
}
$count_ = '('.str_replace(')', '', str_replace('(', '', preg_replace('#((.*))#si', '$1', $sizes[1]))).')';
echo '<a href="/'.$papka.'/file/'.$id.'"><div class="menu">'.$screen[2].' '.$ext.'<a href="/'.$papka.'/file/'.$id.'">'.$name.'</a> '.$count_.'</div>';
}
$paget=max($pagesr);
$kmess = 10;
$start = isset($_GET['page'])?intval($_GET['page'])*$kmess-$kmess: 0;
echo '<div class="menu"><table width="100%"><tr>';
$total = end($pagesr)*10;
echo '<center>'.pagenav('/'.$papka.'/'.$top2dir.'/'.intval($_GET['id']).'/', $start, $total, $kmess).'
</center>';
echo '</tr></table></div>';
break;
case 'dirs':
$c=count($dir_a);
for($i=0; $i<$c; $i++){
$dir_href = preg_replace('#/ex/catalog/(.*)/#si', '$1', $dir_a[$i]);
$dir_name01 = preg_replace('#<div(.*)alt="">(.*)</div>#si', '$2', $dir_i[$i]);
if($dir_href == '13' || $dir_href == '64'){
preg_match('#(([0-9]+))#si', str_replace('Эротика(18+)','', str_replace(' ', '', $dir_name01)), $dir_count);
}elseif($dir_href == '16'){
preg_match('#(([0-9]+))#si', str_replace('3gpфильмы','', str_replace(' ', '', $dir_name01)), $dir_count);
}elseif($dir_href == '18'){
preg_match('#(([0-9]+))#si', str_replace('mp4/mpg/mpegфильмы','', str_replace(' ', '', $dir_name01)), $dir_count);
}else{
$dir_nae = preg_match('#(([0-9]+))#si', $dir_name01, $dir_count);
}
if($dir_href == '13' || $dir_href == '64'){
$dir_name = str_replace('('.$dir_count[0].')', '', $dir_name01);
}else{
$dir_name = str_replace('('.$dir_count[0].')', '', $dir_name01);
}
if($dir_href == '13' and $dir_href == '64'){
$new = str_replace('</span>', '', str_replace(' сегодня!', '', strstr($dir_name, '+')));
}
else
{
$dir_namea = str_replace('(18+)', '', $dir_name01);
$new = str_replace('</span>', '', str_replace(' сегодня!', '', strstr($dir_namea, '+')));
}
if($new == !NULL){
$dir_new = '<font color="red">'.$new.'</font>';
}else{
$dir_new = NULL;
}
if($dir_href != '7' and $dir_href != '78'){
echo '<a href="/'.$papka.'/dir/'.$dir_href.'"><div class="menu"><img src="/'.$papka.'/dir.png" alt="dir" /> <a href="/'.$papka.'/dir/'.$dir_href.'">'.preg_replace('#<span(.*)</span>#si', '', $dir_name).'</a> ('.$dir_count[0].')'.$dir_new.'</div>';
}
}
break;
}
require_once('foot.php');
?>