function convert_dir($directory) { $dir = opendir($directory); while ($file = readdir($dir)) { if (is_file($directory . "/" . $file)) { $ext = getftype($file); if ($file == 'namedb.dat') { if (file_exists($directory . "/" . $file)) { $gbs = file($directory . "/" . $file); $open = fopen($directory . "/" . $file, "w"); $result = 0; for ($i = 0; $i < sizeof($gbs); $i++) { $data = unserialize($gbs[$i]); if (!preg_match('//u', $data['opisanie'])) { $data['opisanie'] = iconv('cp1251', 'utf-8', $data['opisanie']); } fwrite($open, serialize($data) . "\n"); $result++; } fclose($open); } } elseif ($ext == 'dat') { $txt = file_get_contents($directory . "/" . $file); if (!preg_match('//u', $txt)) { $txt = iconv('cp1251', 'utf8', $txt); } save($directory . "/" . $file, $txt, 'w'); $result++; } elseif ($ext == 'comment') { if (file_exists($directory . "/" . $file)) { $gbs = file($directory . "/" . $file); $open = fopen($directory . "/" . $file, "w"); $result = 0; for ($i = 0; $i < sizeof($gbs); $i++) { $data = unserialize($gbs[$i]); if (!preg_match('//u', $data['content'])) { $data['content'] = iconv('cp1251', 'utf-8', $data['content']); } if (!preg_match('//u', $data['name'])) { $data['name'] = iconv('cp1251', 'utf-8', $data['name']); } fwrite($open, serialize($data) . "\n"); $result++; } fclose($open); } } } else { if (is_dir($directory . "/" . $file) && $file != "." && $file != "..") { $result += convert_dir($directory . "/" . $file); } } } closedir($dir); return $result; }
function select_pic($cat_rotate = '') { if (!file_exists(PICTURES . $cat_rotate)) { return ''; } $types_pic = array('jpg'); if ($handle = opendir(PICTURES . $cat_rotate)) { $a = 1; while (false !== ($file = readdir($handle))) { if ($file[0] == '.' || !in_array(getftype($file), $types_pic)) { continue; } $f_name[$a] = $file; $a++; } closedir($handle); } $number = rand(1, $a - 1); $image = $f_name[$number]; return $image; }
#Дата модификации... $fName = $kanfile . '/' . $file_name; $fTime = filemtime($fName); $fileArr[$file_name] = $fTime; } } $dumbcount = 0; $class = 'cline' . $dumbcount % 2; if ($cat == '') { $contentcenter .= '<tr class="' . $class . '" ><td class="line3">' . $dumbcount . '</td><td class="line3">Главная страница</td><td class="line3">/ </td><td class="line3"><a title="Редактровать" href="edit.php?what=main"><img src="images/edit.png"></a></td><td class="line3"><img title="Удаление запрещено" alt="Удаление запрещено" src="images/disable.png" /></td><td class="line3">0</td><td class="line3"><img title="Комментарии запрещены" alt="Комментарии запрещены" src="images/disable.png" /></td></tr>'; } arsort($fileArr); $numberOfFiles = sizeOf($fileArr); foreach ($fileArr as $thisName => $thisTime) { $thisTime = date("F j, Y, g:i a", $thisTime); if ('dat' == getftype($thisName) && 'main.dat' !== basename($thisName)) { $data = file_get_contents($kanfile . '/' . $thisName); $filecomments = $localpath . $linkinfo . '/' . $plink . '.dat.comment'; @$dumbcount++; $class = 'cline' . $dumbcount % 2; $text = articlesparam('title', $data); $plink = menulink($thisName); if ($cat == '') { $linkinfo = ''; } else { if ($subcat == '') { $linkinfo = '/' . $cat; } else { $linkinfo = '/' . $cat . '/' . $subcat; } }
$data = iconv('windows-1251', 'UTF-8', $data); $data = str_ireplace("charset=windows-1251", "charset=UTF-8", $data); } } $directory = "{$localpath}/templates/{$template}"; $dir = opendir($directory); while ($file = readdir($dir)) { if (is_file($directory . "/" . $file)) { if ($file != $fedit) { @($all_files .= "| <a href=\"?file={$file}\"> {$file}</a> |"); } } } closedir($dir); $url = $_SERVER['PHP_SELF']; $ext = getftype($fedit); $ext = preg_match("/php|html|htm|css|js/i", $ext) ? $ext : "php"; @($contentcenter .= <<<EOT t<script language="Javascript" type="text/javascript" src="edit_area/edit_area_full.js"></script> t<script language="Javascript" type="text/javascript"> t // initialisation t editAreaLoader.init({ t\tid: "code"// id of the textarea to transform t\t,start_highlight: true// if start with highlight t\t,allow_resize: "both" t\t,allow_toggle: true t\t,word_wrap: true t\t,language: "ru" t\t,syntax: "{$ext}" t\t,toolbar: "search, go_to_line, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, word_wrap, help" t\t,syntax_selection_allow: "css,html,js,php,perl"
$page = 1; } if (file_exists(PICTURES . $cat . '/info.dat')) { $title_cat = loadsimple(PICTURES . $cat . '/info.dat'); } else { $title_cat = __('Без имени'); } $contentcenter .= '<table cellspacing=1 cellpadding=2 width="100%" align=center border=0>'; $contentcenter .= '</div><p>' . __('Раздел') . ': <b>' . $title_cat . '</b> (' . __('всего') . ': ' . $npr . ' ' . __('фото') . ').</p>'; $contentcenter .= navigatepages($npr); $contentcenter .= '<br />'; $i = $ii = 1; $start = ($page - 1) * $f + 1; $end = $page * $f; foreach ($arrpict as $image) { $ext = getftype($image); if ($image != '.' && $image != '..' && in_array($ext, $types) && filetype($piccat . $image) == 'file') { if ($ii >= $start && $ii <= $end) { if ($i == 1) { $contentcenter .= '<tr>'; } $info_img = getimagesize($piccat . $image); $contentcenter .= '<td class=alt2 valign=middle align=center><strong>- ' . $ii . ' -</strong><br /> <a href="' . $link . $image . '" target="_blank" rel="prettyPhoto[gallery-' . $cat . ']"> <img src="' . $link . 'thumb/t' . $image . '" border=1 /></a> <br />имя: ' . str_replace(".{$end}", "", $image) . '<br /> <i>размер: ' . $info_img[0] . 'x' . $info_img[1] . '</i><br /> <i>описание: ' . getopisanie($cat, $image) . '</i><br /> <a href="' . $prefflp . '/admin/photo.php?edit=' . $image . '&cat=' . $cat . '&page=' . $page . '"><img title="Редактирование" src="images/edit.png" border="0" /></a> <a href="' . $prefflp . '/admin/photo.php?del=' . $image . '&cat=' . $cat . '&page=' . $page . '"><img title="Удалить" src="images/delete.png" border="0" /></a></td>'; if ($i == $x) {
@($data = unserialize($log[$present - 1])); @($count = $data['count']); } } return $count; } $extension = ''; $files_array = array(); $dir_handle = @opendir($directory) or die('There is an error with your file directory!'); while ($file = readdir($dir_handle)) { /* Skipping the system files: */ if ($file[0] == '.') { continue; } /* end() returns the last element of the array generated by the explode() function: */ $extension = getftype($file); /* Skipping the php files: */ if ($extension == 'php') { continue; } $files_array[] = array('files' => $file, 'size' => convert_fsize(filesize($directory . DIRECTORY_SEPARATOR . "{$file}"))); } sort($files_array, SORT_STRING); ?> <link rel="stylesheet" href="<?php echo $prefflp; ?> /css/sorttable.css" /> <script type="text/javascript"> $(document).ready(function(){ /* Код выполняется после загрузки страницы */
if ($disableURL == 1) { $is_checked_disableURL = 'checked="checked"'; } $arrtmpl = array(); $d = dir('../templates'); while ($entry = $d->read()) { if ($entry[0] != '.' && is_dir(LOCALPATH . 'templates/' . $entry)) { $arrtmpl[$entry] = $entry; } } $d->close(); $templatedrop = make_droplist($arrtmpl, 'template', $template); $arrlng = array(); $d = dir('../lang'); while ($entry = $d->read()) { if (getftype($entry) == 'php') { $entry = basename($entry, '.php'); if ($entry[0] != '.') { $arrlng[$entry] = $entry; } } } $d->close(); $languagedrop = make_droplist($arrlng, 'language', $language); $rss_contentdrop = '<select name="rss_content" id="rss_content">'; $rss_contentdrop .= '<option ' . ($rss_content == '1' ? 'selected="selected"' : '') . ' value="1">Только новости</option>'; $rss_contentdrop .= '<option ' . ($rss_content == '2' ? 'selected="selected"' : '') . ' value="2">Только статьи</option>'; $rss_contentdrop .= '<option ' . ($rss_content == '3' ? 'selected="selected"' : '') . ' value="3">Все</option>'; $rss_contentdrop .= '</select>'; $captchainf = __('Возможно хостинг не совместим с модулем "графическая каптча"'); $gdinfo = getgdinfo();
$pxsize = (int) $_REQUEST['pxsize']; $bgcolor = trim($_REQUEST['bgcolor']); $color = trim($_REQUEST['color']); $color2 = trim($_REQUEST['color2']); $colorh = trim($_REQUEST['colorh']); $speed = (int) $_REQUEST['speed']; $sdata = '%' . $pxsize . '%' . $x . '%' . $y . '%' . $bgcolor . '%' . $color . '%' . $speed . '%' . $color2 . '%' . $colorh . '%'; if ((int) $_REQUEST['maketags'] == 1) { $cloud[0] = $sdata; $cat_st = get_articlessubdir(); $cat_st[] = ''; $count_files = sizeof($cat_st); for ($i = 0; $i < $count_files; $i++) { $dd = opendir(ARTICLES . $cat_st[$i]); while ($pfile = readdir($dd)) { $ext = getftype($pfile); if ($pfile != '.' && $pfile != '..' && $ext == 'dat' && $pfile != '404.dat' && !is_dir(ARTICLES . $pfile)) { $data = file_get_contents(ARTICLES . $cat_st[$i] . '/' . $pfile); $title = articlesparam('title', $data); $tags = articlesparam('tags', $data); if (!empty($tags)) { $tags = explode(' ', $tags); if (is_array($tags)) { foreach ($tags as $point) { $cllink = $cat_st[$i] == '' ? '' : $cat_st[$i] . '/'; $cllink .= basename($pfile, '.dat'); $cloud[] = $point . '%%' . $title . '%%' . $cllink . '%%'; } } } }
function get_kan_phpfile($currentvalue) { $count_files = sizeof($dir = scandir(MYCODE, 1)) - 2; for ($i = 0; $i < $count_files; $i++) { if (getftype($dir[$i]) !== 'php') { continue; } $data = file(MYCODE . $dir[$i]); if (trim($data[1]) == '//phpfile') { if ($data[2][0] == '#') { $title = $data[2]; } else { $title = ''; } $arr[basename($dir[$i], '.php')] = basename($dir[$i], '.php') . $title; } } return make_droplist($arr, 'selectName', $currentvalue, 'onchange="parentNode.getElementsByTagName(\'input\')[0].value=value"'); }
} if ($cat == $dir[$i]) { echo ' | ' . $title_cat . ' '; } else { echo ' | <a href="' . cc_link('/photo-cat-' . $dir[$i] . '.html') . '">' . $title_cat . '</a> '; } } } echo '</div><div>'; //$cat=urldecode($cat); if (file_exists(PICTURES . $cat)) { $dir = scandir(PICTURES . $cat, 1); $count_files = sizeof($dir) - 2; $arrpict = array(); for ($i = 0; $i < $count_files; $i++) { if (in_array(getftype($dir[$i]), $types)) { $arrpict[] = $dir[$i]; } } $pages = ceil(($npr = sizeof($arrpict)) / $f); if ($page == 0 || $page > $pages) { $page = 1; } if (file_exists(PICTURES . $cat . '/info.dat')) { $title_cat = loadsimple(PICTURES . $cat . '/info.dat'); } else { $title_cat = __('Без имени'); } echo '</div><p>' . __('Раздел') . ': <b>' . $title_cat . '</b> (' . __('всего') . ': ' . $npr . ' ' . __('фото') . ').</p>'; $sitetitle .= ' - ' . $title_cat; echo navigatepages($npr);