Esempio n. 1
0
function content()
{
    global $HTTP_POST_VARS, $HTTP_GET_VARS, $list_prefix;
    $MAIN = loadadmintmplate("main");
    $LINKS = loadadmintmplate("links");
    $WORK = $LINKS;
    if (0 == strcmp($HTTP_GET_VARS['mode'], "select")) {
        //if we are to edit a link
        //lets get the links from the db
        $sql = "SELECT * FROM `" . $list_prefix . "links` WHERE `id` = '" . $HTTP_POST_VARS['links'] . "';";
        $result = db_query($sql);
        if ($result) {
            $rows = db_num_rows($result);
        } else {
            $rows = 0;
        }
        if ($rows == 0) {
            //lets make sure that the news exists
            $WORK = insert_into_template($WORK, "{NEWCHECK}", "checked");
            $WORK = insert_into_template($WORK, "{CATLIST}", catlist(0));
        } else {
            //if it does we will read it from the db and add it to our output.
            $row = db_fetch_array($result);
            $WORK = insert_into_template($WORK, "{LINKID}", $row['id']);
            $WORK = insert_into_template($WORK, "{CATLIST}", catlist($row['category']));
            $WORK = insert_into_template($WORK, "{LINKTITLE}", $row['title']);
            $WORK = insert_into_template($WORK, "{LINKURL}", $row['url']);
        }
    } else {
        //if we are not editing an news lets prepare the form for a new news.
        $WORK = insert_into_template($WORK, "{NEWCHECK}", "checked");
        $WORK = insert_into_template($WORK, "{CATLIST}", catlist(0));
    }
    //lets delete a link if its selected
    if (0 == strcmp($HTTP_GET_VARS['mode'], "delete") && isset($HTTP_POST_VARS['delete_yes'])) {
        $sql = "DELETE FROM `" . $list_prefix . "links` WHERE `id` = '" . $HTTP_POST_VARS['links'] . "';";
        $result = db_query($sql);
    } elseif (0 == strcmp($HTTP_GET_VARS['mode'], "delete")) {
        $WORK = "You must check the confirmation box to delete a link.<br>\r\n" . $WORK;
    }
    //lets edit/add a link if thats our job.
    if (0 == strcmp($HTTP_GET_VARS['mode'], "edit")) {
        if (isset($HTTP_POST_VARS['newlink'])) {
            //we are adding a new link
            $sql = "SELECT * FROM `" . $list_prefix . "links` WHERE `category` = '" . $HTTP_POST_VARS['category'] . "' ORDER BY `order` DESC limit 1;";
            $result = db_query($sql);
            if ($result) {
                $rows = db_num_rows($result);
            } else {
                $rows = 0;
            }
            if ($rows > 0) {
                $row = db_fetch_array($result);
                $order = $row['order'] + 1;
            } else {
                $order = 1;
            }
            if (isset($HTTP_POST_VARS['linktitle']) && isset($HTTP_POST_VARS['linkurl'])) {
                $sql = "INSERT INTO " . $list_prefix . "links VALUES ('', '" . $HTTP_POST_VARS['category'] . "', '" . $HTTP_POST_VARS['linktitle'] . "', '" . $HTTP_POST_VARS['linkurl'] . "', '" . $order . "');";
                $result = db_query($sql);
            }
        } else {
            //we are editing an existing link
            if (isset($HTTP_POST_VARS['linkid'])) {
                //we must know the links linkid to work on it.
                //lets get our existing db entry
                $sql = "SELECT * FROM `" . $list_prefix . "links` WHERE `id` = '" . $HTTP_POST_VARS['linkid'] . "' ORDER BY `order` DESC limit 1;";
                $result = db_query($sql);
                $row = db_fetch_array($result);
                //lets figure out our order
                $order = 1;
                if (0 == strcmp($HTTP_POST_VARS['position'], "same")) {
                    //no change to the order.
                    $order = $row['order'];
                } elseif (0 == strcmp($HTTP_POST_VARS['position'], "up")) {
                    //it needs to move up
                    $sql = "SELECT * FROM `" . $list_prefix . "links` WHERE `order` < '" . $row['order'] . "' ORDER BY `order` DESC;";
                    $result = db_query($sql);
                    if ($result) {
                        $rows = db_num_rows($result);
                    } else {
                        $rows = 0;
                    }
                    if ($rows > 0) {
                        $row2 = db_fetch_array($result);
                        $sql = "UPDATE `" . $list_prefix . "links` SET `order` = '" . $row['order'] . "' WHERE `id` = '" . $row2['id'] . "';";
                        $result = db_query($sql);
                        $order = $row2['order'];
                    }
                } elseif (0 == strcmp($HTTP_POST_VARS['position'], "down")) {
                    // it needs to move down
                    $sql = "SELECT * FROM " . $list_prefix . "links WHERE `order` > '" . $row['order'] . "' ORDER BY `order`;";
                    $result = db_query($sql);
                    if ($result) {
                        $rows = db_num_rows($result);
                    } else {
                        $rows = 0;
                    }
                    if ($rows > 0) {
                        $row2 = db_fetch_array($result);
                        $sql = "UPDATE " . $list_prefix . "links SET `order` = '" . $row['order'] . "' WHERE `id` = '" . $row2['id'] . "';";
                        $result = db_query($sql);
                        $order = $row2['order'];
                    }
                }
                //now we have the correct order, category, name, and url lets update the db
                if ($row['category'] != $HTTP_POST_VARS['category']) {
                    //if we are moving to a NEW category lets make this the last link present.
                    $sql = "SELECT * FROM " . $list_prefix . "links WHERE `category` = '" . $HTTP_POST_VARS['category'] . "' ORDER BY `order` DESC;";
                    $result = db_query($sql);
                    if ($result) {
                        $rows = db_num_rows($result);
                    } else {
                        $rows = 0;
                    }
                    if ($rows > 0) {
                        $row = db_fetch_array($result);
                        $order = $row['order'] + 1;
                    } else {
                        $order = 1;
                    }
                }
                //now lets save our changes
                $sql = "UPDATE " . $list_prefix . "links SET `category` = '" . $HTTP_POST_VARS['category'] . "', `title` = '" . $HTTP_POST_VARS['linktitle'] . "', `url` = '" . $HTTP_POST_VARS['linkurl'] . "', `order` = '" . $order . "' WHERE `id` = '" . $HTTP_POST_VARS['linkid'] . "';";
                $result = db_query($sql);
            } else {
                $WORK = "ERROR: you must check 'Save as a new link' to make a new link.<BR>\r\n" . $WORK;
            }
        }
        catorder();
    }
    //lets output our news cp.
    $WORK = insert_into_template($WORK, "{LINKSLIST}", linkslist());
    $WORK = insert_into_template($MAIN, "{CONTENT}", $WORK);
    $WORK = filltemplate($WORK, "{SITENAME} Administration panel");
    printf("%s", striptemplate($WORK));
}
Esempio n. 2
0
<?php

get_header();
?>

<div class="page_meta clear">
    <div class="rss">
        <a href="<?php 
bloginfo('rss2_url');
?>
">Subscribe to RSS feed</a>
    </div>
    <div class="heading">
        <h3>404 Page not found</h3>
    </div>
    <?php 
if (function_exists('catlist')) {
    catlist();
}
?>
 
    <?php 
get_search_form();
?>
</div>

<?php 
get_footer();
Esempio n. 3
0
 function catalogueDispatch($op)
 {
     if (isset($_POST['undo'])) {
         $op = 'catlist';
     }
     if (isset($_POST['undoentry'])) {
         $op = 'entrylist';
     }
     if (isset($_POST['cancelselector'])) {
         $op = 'catlist';
     }
     switch ($op) {
         case "catlist":
             catlist();
             break;
         case "newcatalogue":
             mancatalogue(false);
             break;
         case "modcatalogue":
             mancatalogue(importVar('id', false, 0));
             break;
         case "savecatalogue":
             savecatalogue();
             break;
         case "delcatalogue":
             delcatalogue();
             break;
         case "entrylist":
             entrylist();
             break;
         case "import":
             import();
             break;
         case "delentry":
             delentry();
             break;
         case "modcatalogueassoc":
             modcatalogueassoc();
             break;
     }
 }
Esempio n. 4
0
function content()
{
    global $HTTP_POST_VARS, $HTTP_GET_VARS, $list_prefix;
    $MAIN = loadadmintmplate("main");
    $ARTICLES = loadadmintmplate("articles");
    $WORK = $ARTICLES;
    if (0 == strcmp($HTTP_GET_VARS['mode'], "select")) {
        //if we are to edit an article
        //lets get the article from the db
        $sql = "SELECT * FROM `" . $list_prefix . "articles` WHERE `id` = '" . $HTTP_POST_VARS['article'] . "';";
        $result = db_query($sql);
        if ($result) {
            $rows = db_num_rows($result);
        } else {
            $rows = 0;
        }
        if ($rows == 0) {
            //lets make sure that the article exists
            $WORK = insert_into_template($WORK, "{NEWCHECK}", "checked");
            $WORK = insert_into_template($WORK, "{CATLIST}", catlist(0));
        } else {
            //if it does we will read it from the db and add it to our output.
            $row = db_fetch_array($result);
            $WORK = insert_into_template($WORK, "{ARTICLEID}", $row['id']);
            $WORK = insert_into_template($WORK, "{CATLIST}", catlist($row['category']));
            $WORK = insert_into_template($WORK, "{ARTICLETITLE}", $row['article_title']);
            $WORK = insert_into_template($WORK, "{TEASER}", stripslashes($row['teaser']));
            $WORK = insert_into_template($WORK, "{ARTICLE}", stripslashes($row['article']));
            $WORK = insert_into_template($WORK, "{BYLINE}", $row['byline']);
        }
    } else {
        //if we are not editing an article lets prepare the form for a new article.
        $WORK = insert_into_template($WORK, "{NEWCHECK}", "checked");
        $WORK = insert_into_template($WORK, "{CATLIST}", catlist(0));
    }
    //lets delete an article if its selected
    if (0 == strcmp($HTTP_GET_VARS['mode'], "delete") && isset($HTTP_POST_VARS['delete_yes'])) {
        $sql = "DELETE FROM `" . $list_prefix . "articles` WHERE `id` = '" . $HTTP_POST_VARS['article'] . "';";
        $result = db_query($sql);
    } elseif (0 == strcmp($HTTP_GET_VARS['mode'], "delete")) {
        $WORK = "You must check the confirmation box to delete an article.<br>\r\n" . $WORK;
    }
    if (0 == strcmp($HTTP_GET_VARS['mode'], "edit")) {
        $user = admincookie();
        $posted_by = $user['user_id'];
        if (isset($HTTP_POST_VARS['newarticle'])) {
            //its a new article being saved.
            $sql = "INSERT INTO " . $list_prefix . "articles VALUES ('', '" . addslashes($HTTP_POST_VARS['articletitle']) . "', '" . addslashes($HTTP_POST_VARS['teaser']) . "', '" . addslashes($HTTP_POST_VARS['article']) . "', '" . $posted_by . "', '" . addslashes($HTTP_POST_VARS['byline']) . "', '" . time() . "', '" . $HTTP_POST_VARS['category'] . "');";
            $result = db_query($sql);
        } elseif (isset($HTTP_POST_VARS['articleid'])) {
            //its an old article being saved
            $sql = "UPDATE `" . $list_prefix . "articles` SET `article_title` = '" . addslashes($HTTP_POST_VARS['articletitle']) . "', `teaser` = '" . addslashes($HTTP_POST_VARS['teaser']) . "', `article` = '" . addslashes($HTTP_POST_VARS['article']) . "', `byline` = '" . addslashes($HTTP_POST_VARS['byline']) . "', `category` = '" . $HTTP_POST_VARS['category'] . "' WHERE `id` = '" . $HTTP_POST_VARS['articleid'] . "';";
            $result = db_query($sql);
        } else {
            $WORK = "You must check the new article box to save a new article<br>\r\n" . $WORK;
        }
    }
    //lets output our article cp.
    $WORK = insert_into_template($WORK, "{ARTICLELIST}", articlelist());
    $WORK = insert_into_template($MAIN, "{CONTENT}", $WORK);
    $WORK = filltemplate($WORK, "{SITENAME} Administration panel");
    printf("%s", striptemplate($WORK));
}