コード例 #1
0
ファイル: process.inc.php プロジェクト: GerHobbelt/CompactCMS
 * Change the page/file name inline.
 *
 * To make it a proper transaction, first try to change the filename, and only if that succeeds edit the database record.
 *
 */
if ($do_action == 'liverename' && $_SERVER['REQUEST_METHOD'] == 'POST' && checkAuth()) {
    $page_idcode = explode('-', getPOSTparam4IdOrNumber('id'), 2);
    $page_id = filterParam4Number(count($page_idcode) == 2 ? $page_idcode[1] : 0);
    if ($page_id > 0) {
        $row = $db->SelectSingleRow($cfg['db_prefix'] . 'pages', array('page_id' => MySQL::SQLValue($page_id, MySQL::SQLVALUE_NUMBER)));
        if (!$row) {
            $db->Kill();
        }
        $owner = explode('||', strval($row->user_ids));
        $oldname = $row->urlpage;
        if (checkSpecialPageName($row->urlpage, SPG_IS_NONREMOVABLE) || in_array($row->urlpage, $cfg['restrict']) && !in_array($_SESSION['ccms_userID'], $owner) && !$perm->is_level_okay('managePages', $_SESSION['ccms_userLevel']) || !$perm->is_level_okay('managePages', $_SESSION['ccms_userLevel'])) {
            die($ccms['lang']['system']['error_forged'] . ' (' . __FILE__ . ', ' . __LINE__ . ')');
            // feature not allowed, really...
        } else {
            $newname = getPOSTparam4Filename('newname');
            if (empty($newname) || strlen($newname) < 3 || strlen($newname) > 240) {
                die($ccms['lang']['system']['error_value']);
            }
            $old_filepath = BASE_PATH . '/content/' . $oldname . '.php';
            $new_filepath = BASE_PATH . '/content/' . $newname . '.php';
            if ($old_filepath == $new_filepath) {
                // no actual rename happening...
                die($ccms['lang']['backend']['success']);
            } else {
                if (!file_exists($old_filepath)) {
                    die($ccms['lang']['system']['error_deleted']);
コード例 #2
0
ファイル: sitemap.php プロジェクト: GerHobbelt/CompactCMS
<?xml version="1.0" encoding="UTF-8"?>
<urlset
\txmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
\txmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
\txsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
EOT42;
        // Select all published pages
        $rows = $db->SelectObjects($cfg['db_prefix'] . 'pages', array('published' => "'Y'"), array('urlpage', 'description', 'islink'));
        if ($rows === false) {
            $db->Kill();
        }
        foreach ($rows as $row) {
            // Do not include external links in sitemap
            if (!regexUrl($row->description)) {
                echo "<url>\n";
                if (($ssv = checkSpecialPageName($row->urlpage, SPG_GIVE_SITEMAP_SPECIAL)) !== null) {
                    if (!empty($ssv['loc'])) {
                        echo '<loc>' . $ssv['loc'] . "</loc>\n";
                        echo '<priority>' . $ssv['prio'] . "</priority>\n";
                    }
                } else {
                    if ($row->islink == 'N') {
                        // [i_a] put pages which are not accessible through the menus (and thus the home/index page, at a higher scan priority.
                        echo "<loc>http://" . $_SERVER['SERVER_NAME'] . '' . $dir . '' . $row->urlpage . ".html</loc>\n";
                        echo "<priority>0.70</priority>\n";
                    } else {
                        echo "<loc>http://" . $_SERVER['SERVER_NAME'] . '' . $dir . '' . $row->urlpage . ".html</loc>\n";
                        echo "<priority>0.50</priority>\n";
                    }
                }
                echo "<changefreq>weekly</changefreq>\n";