Site Map

perpage = ‘-1’;

$defaultorderby = ‘post_date’; $defaultorder = ‘DESC’;

define(‘NL’, “\n”);

function showyearselect() { global $wpdb, $tableposts, $m; $m = substr($m,0,4); $years = $wpdb->getcol(“SELECT DISTINCT YEAR(postdate) as year FROM $tableposts ORDER BY year ASC”); $output .= ‘‘.NL; foreach ($years as $year) { $output .= ‘

function archivedate($format=’Y-m-d H:i:s’) { global $post; echo mysql2date($format, $post->postdate); }

?>

POST[“orderby”] == ‘category’) { global $author, $m; $orderby = ‘category’; if ($POST[“order”] == ”) $order = “DESC”; else $order = $POST[“order”]; $year = ” . intval($POST[“m”]); $m = $year; $author = ”.intval($POST[“author”]); if (empty($author)) { $whichauthor=”; } else { $author = ”.urldecode($author).”; $author = addslashesgpc($author); if (stristr($author, ‘-‘)) { $eq = ‘!=’; $andor = ‘AND’; $author = explode(‘-‘, $author); $author = ”.intval($author[1]); } else { $eq = ‘=’; $andor = ‘OR’; } $authorarray = explode(‘ ‘, $author); $whichauthor .= ‘ AND (postauthor ‘.$eq.’ ‘.intval($authorarray[0]); for ($i = 1; $i < (count($authorarray)); $i = $i + 1) { $whichauthor .= ‘ ‘.$andor.’ postauthor ‘.$eq.’ ‘.intval($authorarray[$i]); } $whichauthor .= ‘)’; }

// Author stuff for nice URIs

if ('' != $author_name) {
    if (stristr($author_name,'/')) {
        $author_name = explode('/',$author_name);
        if ($author_name[count($author_name)-1]) {
        $author_name = $author_name[count($author_name)-1];#no trailing slash
        } else {
        $author_name = $author_name[count($author_name)-2];#there was a trailling slash
        }
    }
    $author_name = preg_replace('|[^a-z0-9-]|', '', strtolower($author_name));
    $author = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_nicename='".$author_name."'");
    $whichauthor .= ' AND (post_author = '.intval($author).')';
}
if (!empty($year)) $where .= ' AND YEAR(post_date)=' . $year;
if (!empty($whichauthor)) $where .= $whichauthor;
?>

Sort By:
<form action="<?php getenv('PHP_SELF') ?>" method="post">
<?php show_orderby_select() ?>
<?php show_order_select() ?>
<?php show_year_select() ?>
<?php show_author_select() ?>
<input type="submit" name="submit" value="sort" />
</form>
<?php
$dogs = $wpdb->get_results("SELECT * FROM $tablecategories WHERE 1=1 ORDER BY cat_name $order");
foreach ($dogs as $catt) {
    $categories = $wpdb->get_results("SELECT * FROM $tablepost2cat WHERE category_id = $catt->cat_ID");
    if ($categories) {
        foreach ($categories as $post2category) {
            $posts = $wpdb->get_results("SELECT * FROM $tableposts WHERE $post2category->post_id = ID".$where);
            //$category_realname = $wpdb->get_row("SELECT cat_name FROM $tablecategories WHERE cat_ID = $post2category->category_id");
            //print_r($category_realname);
            global $category_name;
            $category_name = $post2category->category_id;
            if ($posts) {
                foreach ($posts as $post) {
                    start_wp();
                    archive_header('<h3>', '</h3>');
                    archive_date('m-d-Y h:iA') ?>: <a href="<?php echo get_permalink($post->ID) ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a><br />
                    <?php

                }
            }
        }
    }
}

} else { require_once (‘./wordpress/wp-blog-header.php’); // echo $request; ?>

Sort By:
<form action="<?php getenv('PHP_SELF') ?>" method="post">
<?php show_orderby_select() ?>
<?php show_order_select() ?>
<?php show_year_select() ?>
<?php show_author_select() ?>
<input type="submit" name="submit" value="sort" />
</form>

<?php if ($posts) { foreach ($posts as $post) { start_wp(); ?>
<?php //print_r($post); ?>
<?php archive_header('<h3>', '</h3>') ?>
<?php archive_date('m-d-Y h:iA') ?>: <a href="<?php echo get_permalink($post->ID) ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a><br />
<?php } }
}?>