Esempio n. 1
0
 if (substr($data[2], 0, 5) == '/news') {
     $news = file(ENGINE . 'newsdb.php');
     $newnum = (int) substr($data[2], 6);
     if ($newnum !== 0) {
         $new = unserialize($news[$newnum - 1]);
         $head = $new['head'];
         $startnews = $new['mess'];
         $pubdata_text = $new['pubdate'];
         echo '<div class="title"><h2><a href="' . cc_link($news_Glink . $newnum . '.html') . '">' . $head . '</a></h2></div><div class="entry">' . $startnews . '</div><br />';
         echo '<p class="links">' . $pubdata_text . '<a href="' . cc_link($news_Glink . $newnum . '.html#comment_begin') . '"> | ' . __('Комментарии') . ': ' . getcountcomments($new['id'], $commentsdbfilename, $moder_comments) . '</a> | <a href="' . cc_link($news_Glink . $newnum . '.html') . '" class="comments">' . __('Читать полностью') . '</a></p><br /><br />';
     }
 } elseif (file_exists(ARTICLES . $data[2] . '.dat')) {
     $artdata = file_get_contents(ARTICLES . $data[2] . '.dat');
     $hs_text = articlesparam('title', $artdata);
     $s_text = articlesparam('content', $artdata);
     $pubdata_text = articlesparam('pubdate', $artdata);
     if (!empty($pubdata_text)) {
         $pubdata_text = date('d.m.Y', $pubdata_text) . ' | ';
     }
     $pos = strpos($s_text, ' ', min(strlen($s_text), $saftertitle));
     if ($pos) {
         $s_text = substr($s_text, 0, $pos);
     }
     $s_text .= '....';
     $s_text = close_dangling_tags($s_text);
     if (substr($data[2], -4) == 'main') {
         $aname = fsubstr($data[2], 0, -4);
     } else {
         $aname = $data[2] . '.html';
     }
     echo '<div class="title"><h2>' . art_catalog($data[2], '->') . '<a href="' . cc_link($aname) . '" name="' . str_replace('/', '--', $aname) . '">' . $hs_text . '</a></h2></div><div class="entry">' . $s_text . '</div><br />';
Esempio n. 2
0
}
$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;
            }
        }
        $filecomments = ARTICLES . $linkinfo . '/' . $plink . '.dat.comment';
        $contentcenter .= '<tr class="' . $class . '"><td class="line3">' . $dumbcount . '</td><td  class="line3" width="40%">' . $text . '</td>';
        $contentcenter .= '<td class="line3">' . $linkinfo . '/' . $plink . '.html</td>';
        $contentcenter .= '<td class="line3"><a title="Редактровать" href="edit.php' . $editpage . $plink . '"><img alt="Редактровать" src="images/edit.png"></a></td>';
        $contentcenter .= '<td class="line3"><a title="Удалить" href="delete.php' . $editpage . $plink . '"><img alt="Удалить" src="images/delete.png"></a></td>';
Esempio n. 3
0
                array_splice($filepp, $key, 1);
                savearray($file_menu, $filepp, 'w', '');
                $about_menu = 'Также была удалена и ссылка на эту страницу из меню!<br /><br />';
                break;
            }
        }
        if (empty($about_menu)) {
            $about_menu = 'Ссылки на эту страницу в меню не было!<br /><br />';
        }
        $about_menu .= 'Проверьте требуется ли редактировать шаблон, т.к. в коде шаблона ссылка могла быть тоже прописана!<br /><br />
			Проверьте требуется ли редактировать страницу категории, в которой размещалась эта страница, т.к. ссылка могла быть тоже прописана!<br /><br />
			<a href="../admin/index.php' . $delwhat . '"><B>Вернуться в категорию</B></a><br /><br />
			<a href="../admin/index.php"><B>Вернуться в каталог</B></a>';
        $sitetitle = 'Страница удалена';
        $contentcenter = '<br /><br /><div class="message_warn_ok">Страница <strong>' . $linkinfo . '/' . $whatpage . '.html</strong> была успешно удалена!</div><br><br>' . $about_menu . '</b><br />';
        include $localpath . 'admin/admintemplate.php';
        exit;
    }
} else {
    if (file_exists($myFile)) {
        $data = file_get_contents($myFile);
        $title = articlesparam('title', $data);
        $sitetitle = 'Удаление страницы: ' . $title;
        $contentcenter = '<h3>Удаление страницы</h3><br />';
        $contentcenter .= '<div class="message_quest">Вы хотите удалить страницу: <strong>' . $title . '</strong> из папки <strong>' . $linkinfo . '/</strong>?</div>';
        $contentcenter .= '<br /><a href="delete.php' . $delwhat . $whatpage . '&action=delpage">ДА</a> | ';
        $contentcenter .= '<a href="index.php">НET</a>';
        $contentcenter .= '<br /><br /><a href=\'javascript:history.back(1)\'><B>Вернуться назад</B></a>';
    }
}
include $localpath . 'admin/admintemplate.php';
Esempio n. 4
0
    }
} else {
    if (file_exists($myFile)) {
        $data = file_get_contents($myFile);
        $title = articlesparam('title', $data);
        $content = articlesparam('content', $data);
        $myinclude = articlesparam('myinclude', $data);
        $description = articlesparam('description', $data);
        $keywords = articlesparam('keywords', $data);
        $templatepage = articlesparam('templatepage', $data);
        $commentpage = articlesparam('comment', $data);
        $pubdate = articlesparam('pubdate', $data);
        if ($pubdate !== '') {
            $pubdate = date("d.m.Y", $pubdate);
        }
        $tags = articlesparam('tags', $data);
    } else {
        $errormessage = '<li>Файл ' . $myFile . ' отсутствует</li>';
    }
}
if ('' != $errormessage) {
    $contentcenter = '<h3>Ошибки</h3><ul>' . $errormessage . '</b><br /><br />';
} elseif ($_REQUEST['action'] == 'go') {
    $url = $_SERVER['PHP_SELF'] . $editpage . $whatpage;
    @($contentcenter .= '<h3>Успешно изменена</h3> Страница: <b>' . $title . '</b><br /><br />
	Ссылка для сайта: <b>' . $linkinfo . '/' . $whatpage . '.html</b><br />
	Если изменяли заголовок страницы, то отредактируйте также меню ссылок!</b><br /><br />
	<a href="' . $url . '">Возвратиться к редактированию страницы</a><br /><br />
	<a href="index.php' . $editpage . '">Вернуться в категорию страницы</a><br /><br />
	<a href="menueditor.php">Перейти в раздел Редактирование меню</a>');
} else {
Esempio n. 5
0
}
$contentcenter .= ob_get_contents();
ob_end_clean();
$contentcenter .= '</div>';
//локальный шаблон
$what_templatepage = articlesparam('templatepage', $data);
if (!empty($catpage)) {
    $myFile = ARTICLES . $catpage . '/main.dat';
    if (file_exists($myFile)) {
        $cat_templatepage = articlesparam('templatepage', file_get_contents($myFile));
    }
}
if (!empty($subcatpage)) {
    $myFile = ARTICLES . $catpage . '/' . $subcatpage . '/main.dat';
    if (file_exists($myFile)) {
        $subcat_templatepage = articlesparam('templatepage', file_get_contents($myFile));
    }
}
$templatepage = 'template';
if ($what_templatepage == '') {
    if ($subcat_templatepage == '') {
        if ($cat_templatepage == '') {
            $templatepage .= $what_templatepage;
        } else {
            $templatepage .= $cat_templatepage;
        }
    } else {
        $templatepage .= $subcat_templatepage;
    }
} else {
    $templatepage .= $what_templatepage;
Esempio n. 6
0
 $j = $countallstati - 1 - ($_REQUEST['spage'] - 1) * $sperpage;
 $i = $j - $sperpage;
 for ($j; $i < $j && $j >= 0; $j--) {
     $p = $j + 1;
     if (file_exists(ARTICLES . $fullcatpage . '/' . $arfiles[$j])) {
         $aname = basename($arfiles[$j], '.dat');
         $data = file_get_contents(ARTICLES . $fullcatpage . '/' . $arfiles[$j]);
         $hs_text = articlesparam('title', $data);
         $pubdata_text = articlesparam('pubdate', $data);
         if (!empty($pubdata_text)) {
             $pubdata_text = date('d.m.Y', $pubdata_text) . ' | ';
         }
         echo '<div class="title"><h2><a href="' . cc_link($fullcatpage . '/' . $aname . '.html') . '">' . $hs_text . '</a></h2></div>';
         if ($sonlytitle !== "1") {
             if ($saftertitle !== 0) {
                 $s_text = articlesparam('content', $data);
                 $pos = min(strlen($s_text), $saftertitle);
                 $pos = strpos($s_text, ' ', $pos);
                 if ($pos) {
                     $s_text = substr($s_text, 0, $pos);
                 }
                 $s_text .= '....';
                 $s_text = close_dangling_tags($s_text);
                 echo '<div class="entry">' . $s_text . '</div><br />';
             }
             $commentsfilename = ARTICLES . $fullcatpage . '/' . $aname . '.dat.comment';
             echo '<p class="links">' . $pubdata_text . '<a href="' . cc_link($fullcatpage . '/' . $aname . '.html#comment_begin') . '">' . __('Комментарии') . ': ' . getcountcomments(0, $commentsfilename, $moder_comments) . '</a> | ';
             echo '<a href="' . cc_link($fullcatpage . '/' . $aname . '.html') . '" class="comments">' . __('Читать полностью') . '</a></p><br />';
         }
     }
 }
Esempio n. 7
0
function dirlist($arr)
{
    $dir = scandir($arr, 1);
    $arr2 = str_replace(ARTICLES, '', $arr);
    for ($i = 0; $i < count($dir) - 2; $i++) {
        $title = "";
        $submenu = "";
        if (preg_match('/\\.dat$/i', $dir[$i])) {
            if (preg_match('/(^main)|(^404)\\.dat/iu', $dir[$i])) {
                continue;
            }
            if (file_exists($arr . '/' . $dir[$i])) {
                $data = file_get_contents($arr . '/' . $dir[$i]);
                $head = articlesparam('title', $data);
                $descr = articlesparam('description', $data);
                $incl = articlesparam('myinclude', $data);
                $page = cc_link($arr2 . '/' . preg_replace('/\\.dat$/i', '.html', $dir[$i]));
                $fsize = convert_fsize(filesize($arr . '/' . $dir[$i]));
                if ($incl == 'photo') {
                    $tempdir = scandir(PICTURES, 1);
                    $temparr = array_filter($tempdir, 'onlycat');
                    $countdir = count($temparr);
                    $countdir = $countdir > 0 ? ': ' . $countdir . ' ' . __('каталога') : '';
                    $temparr = array_filter($tempdir, 'onlypic');
                    $countpic = count($temparr);
                    $countdir .= $countpic > 0 ? ' ' . $countpic . ' ' . __('картинок') : '';
                    echo '<li class="photo"><a href="' . $page . '" title="' . $descr . '">' . $head . '</a> (' . __('Каталог') . $countdir . ")\n";
                    echo "<ul>";
                    listpict(PICTURES);
                    echo '</ul></li>';
                } else {
                    echo '<li  class="file"><a href="' . $page . '" title="' . $descr . '">' . $head . '</a> (' . __('размер') . ': ' . $fsize . ")</li>\n";
                }
            }
        } else {
            if (preg_match('/(^\\.)|(\\.[a-z]*)/iu', $dir[$i])) {
                continue;
            }
            $submenu = "";
            if (file_exists($arr . '/' . $dir[$i] . '/main.dat')) {
                $fh = @fopen($arr . '/' . $dir[$i] . '/main.dat', 'r');
                $data = fread($fh, filesize($arr . '/' . $dir[$i] . '/main.dat'));
                fclose($fh);
                $head = str_replace("\n", '', articlesparam('title', $data));
                $descr = str_replace("\n", '', articlesparam('description', $data));
                $incl = str_replace("\n", '', articlesparam('myinclude', $data));
                $page = cc_link($arr2 . '/' . $dir[$i] . '/');
                $tempdir = scandir($arr . '/' . $dir[$i], 1);
                $tempdir = array_filter($tempdir, 'onlydat');
                $countindir = count($tempdir);
                $countindir = $countindir > 0 ? ': ' . $countindir . ' ' . __('файла/каталога') : '';
                echo '<li class="folder"><a href="' . $page . '" title="' . $descr . '">' . $head . '</a> (' . __('Каталог') . $countindir . ')';
                if ($countindir !== '') {
                    echo '<ul>';
                    dirlist($arr . '/' . $dir[$i]);
                    echo '</ul>';
                }
                echo '</li>';
            }
        }
    }
}
Esempio n. 8
0
    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);
                $pubdate = articlesparam("pubdate", $data);
                if ($pubdate !== "") {
                    $s_text = articlesparam("content", $data);
                    $pos = @strpos($s_text, ' ', 1000);
                    if ($pos) {
                        $s_text = substr($s_text, 0, $pos);
                    }
                    $s_text .= "....";
                    $s_text = close_dangling_tags($s_text);
                    $return[] = array('datatime' => $pubdate, 'head' => articlesparam("title", $data), 'pubdate' => date("D, d M Y H:i:s O", $pubdate), 'mess' => $s_text, 'link' => $sitehost . cc_link('/' . $cat_st[$i] . '/' . substr($pfile, 0, -4) . '.html'));
                }
                $arfiles[$cat_st[$i] . "/" . $pfile] = articlesparam("pubdate", $data);
            }
        }
    }
}
reset($return);
usort($return, "compare_arr");
$now = date("D, d M Y H:i:s O");
$output = "<?xml version=\"1.0\" encoding=\"utf8\"?>\n<rss version=\"2.0\">\n                <!-- Generated Kandidat-CMS -->\n                <channel>\n                    <title><![CDATA[Последние новости " . $sitename . "]]></title>\n                    <link>" . $sitehost . "/rss.html</link>\n                    <description><![CDATA[Последние новости с сайта " . $sitehost . "]]></description>\n                    <lastBuildDate>" . $now . "</lastBuildDate>\n                    <docs>" . $sitehost . "</docs>\n                    <generator>Kadidat-CMS</generator>\n                    ";
foreach ($return as $line) {
    $output .= "<item>\n                        <title><![CDATA[" . strip_tags($line['head']) . "]]></title>\n                        <link>" . htmlentities(strip_tags($line['link']), ENT_COMPAT, cp1251) . "</link>\n                        <description><![CDATA[" . strip_tags($line['mess']) . "]]></description>\n                        <author><![CDATA[example@example.com (porese)]]></author>\n                        <pubDate>" . $line['pubdate'] . "</pubDate>\n                        <guid>" . htmlentities(strip_tags($line['link']), ENT_COMPAT, cp1251) . "</guid>\n                    </item>";
}
$output .= "\n                </channel>\n</rss>";
echo $output;
Esempio n. 9
0
function menudirlist($result, $arr, $prevcat = "")
{
    $dir = scandir($arr, 1);
    $arr2 = str_replace(ARTICLES, '', $arr);
    $countdir = count($dir) - 2;
    for ($i = 0; $i < $countdir; $i++) {
        $title = "";
        $submenu = "";
        if (preg_match('/\\.dat$/iu', $dir[$i])) {
            if (preg_match('/(^main)|(^404)\\.dat/iu', $dir[$i])) {
                continue;
            }
            if (file_exists($arr . '/' . $dir[$i])) {
                $data = file_get_contents($arr . '/' . $dir[$i]);
                $head = str_replace("\n", '', articlesparam('title', $data));
                $page = $arr2 . '/' . preg_replace('/\\.dat$/i', '.html', $dir[$i]);
                $result[] = array('page' => $page, 'head' => $head, 'title' => $title);
            }
        } else {
            if (preg_match('/(^\\.)|(\\.[a-z]*)/iu', $dir[$i])) {
                continue;
            }
            if (file_exists($arr . '/' . $dir[$i] . '/main.dat')) {
                $data = file_get_contents($arr . '/' . $dir[$i] . '/main.dat');
                $head = str_replace("\n", '', articlesparam('title', $data));
                $page = $arr2 . '/' . $dir[$i] . '/';
                $dir2 = scandir($arr . '/' . $dir[$i], 1);
                foreach ($dir2 as $curcat) {
                    if (!preg_match('/(^main\\.dat)|(^404\\.dat)|(^\\.)|(\\.php$)/iu', $curcat)) {
                        $submenu = '1';
                        break;
                    }
                }
                $result[] = array('page' => $page, 'head' => $head, 'title' => $title, 'submenu' => $submenu);
                $data2 = array('page' => $page, 'head' => $head, 'title' => $title, 'submenu' => $submenu);
            }
            $result = menudirlist($result, $arr . '/' . $dir[$i], $data2);
            if ($submenu == '1') {
                $result[] = array('submenu' => '-1');
            }
        }
    }
    return $result;
}