예제 #1
0
if (!defined('WW_SESS')) {
    exit;
}
// page title - if undefined the site title is displayed by default
$page_title = 'Article Listings';
// get main content
// any functions
/* 
	contributors can only see their own articles
	authors and editors have access to all articles
*/
if (!empty($_SESSION[WW_SESS]['guest']) && $_SESSION[WW_SESS]['level'] == 'contributor') {
    $_GET['author_id'] = $_SESSION[WW_SESS]['user_id'];
}
$articles = get_articles_admin();
$total_articles = !empty($articles) ? $articles[0]['total_found'] : 0;
$total_pages = !empty($articles) ? $articles[0]['total_pages'] : 0;
// per page - same definition as list_admin_articles()
$per_page = !isset($_GET['per_page']) || empty($_GET['per_page']) ? 15 : (int) $_GET['per_page'];
// sub header text
$title_text = array();
$status = '';
// category
if (isset($_GET['category_id'])) {
    $title_text[] = " filed under " . get_category_title($_GET['category_id']);
    $sub_header_text[] = get_category_title($_GET['category_id']);
}
// author
if (isset($_GET['author_id'])) {
    $title_text[] = " by " . get_author_name($_GET['author_id']);
예제 #2
0
<?php

if (!defined('WW_SESS')) {
    exit;
}
// page title
$page_title = 'Home Page';
// list of author's recent articles
$_GET['author_id'] = $_SESSION[WW_SESS]['user_id'];
$recent_articles = get_articles_admin();
// output main content
$left_header = 'Welcome back, ' . $_SESSION[WW_SESS]['name'];
$right_header = '<a href="' . $_SERVER["PHP_SELF"] . '?page_name=write">/Write a new article</a>';
$main_content = show_page_header($left_header, $right_header);
$main_content .= "\n\t\t<h4>Your most recent articles are listed below.</h4>\n\t\t<p>To view all articles posted to the site click on the <strong><a href=\"" . $_SERVER["PHP_SELF"] . "?page_name=articles\">Articles</a></strong> item in the menu.</p>";
// output articles list
$main_content .= build_admin_article_listing($recent_articles);
// get stats for this author
$user_article_stats = get_articles_stats(1);
$user_comment_stats = get_comments_stats($_SESSION[WW_SESS]['user_id']);
$user_new_comments = get_new_comments($_SESSION[WW_SESS]['user_id']);
if (!empty($user_article_stats)) {
    $first_user_post = isset($user_article_stats['P']) ? $user_article_stats['P']['first_post'] : '';
    $last_user_post = isset($user_article_stats['P']) ? $user_article_stats['P']['last_post'] : '';
    $total_user_post = isset($user_article_stats['P']) ? $user_article_stats['P']['total'] : '0';
}
unset($_GET['author_id']);
// now get sitewide stats (if author rights allow)
$all_article_stats = '';
$all_comment_stats = '';
if (empty($_SESSION[WW_SESS]['guest'])) {