$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'])) { $all_article_stats = get_articles_stats(); if (!empty($all_article_stats)) { $first_site_post = isset($all_article_stats['P']) ? $all_article_stats['P']['first_post'] : ''; $last_site_post = isset($all_article_stats['P']) ? $all_article_stats['P']['last_post'] : ''; $total_site_post = isset($all_article_stats['P']) ? $all_article_stats['P']['total'] : ''; } $all_comment_stats = get_comments_stats(); $all_new_comments = get_new_comments(); } // output aside content // quick links $quicklinks = ' <ul> <li><a href="' . $_SERVER["PHP_SELF"] . '?page_name=categories">Manage Categories</a></li> <li><a href="' . $_SERVER["PHP_SELF"] . '?page_name=tags">Manage Tags</a></li> <li><a href="' . $_SERVER["PHP_SELF"] . '?page_name=authors">Manage Authors</a></li>
// postdated if (isset($_GET['postdated'])) { $status = ' postdated'; } // other statuses if (isset($_GET['status'])) { $status_list = define_article_status(); $status = ' ' . $status_list[$_GET['status']]; } // any content generation $left_header = $total_articles . ' articles found'; $right_header = '<a href="' . $_SERVER["PHP_SELF"] . '?page_name=write">/Write a new article</a>'; $page_header = show_page_header($left_header, $right_header); // get aside content // any functions $status_list = get_articles_stats(1); $author_list = get_authors_admin(1); $category_list = get_categories_admin(1); $tags_list = get_tags_admin(1); // any content generation // output main content - into $main_content variable $main_content = $page_header; $main_content .= '<h4>Showing all' . $status . ' articles' . implode(', ', $title_text) . '</h4>'; $main_content .= build_admin_article_listing($articles); if ($total_articles > $per_page) { $main_content .= show_admin_listing_nav($total_pages, $per_page); } // output aside content - into $aside_content variable $aside_content = '<h4>Filter articles</h4>'; $aside_content .= '<p><a href="' . $_SERVER["PHP_SELF"] . '?page_name=articles">show all articles</a></p>'; $aside_content .= build_snippet('Status', $status_list);
// delete author if (isset($_POST['confirm_delete_author']) && $_POST['confirm_delete_author'] == 'Yes') { $author_id = (int) $_GET['author_id']; $delete_status = delete_author($author_id); if ($delete_status === true) { $reload = $_SERVER["PHP_SELF"] . '?page_name=authors'; header('Location: ' . $reload); } else { $error = $delete_status; } } // author list $author_id = isset($_GET['author_id']) ? (int) $_GET['author_id'] : $_SESSION[WW_SESS]['user_id']; $author = get_author($author_id); // check if author has written any articles $usage = get_articles_stats(1); // redirect if author details not found if (empty($author)) { $reload = $_SERVER["PHP_SELF"] . '?page_name=authors'; header('Location: ' . $reload); } // any content generation $left_text = $author['name']; $right_text = $author['level']; $page_header = show_page_header($left_text, $right_text); $main_content = $page_header; // confirm file delete if (isset($_GET['action']) && $_GET['action'] == 'delete' && empty($usage)) { $main_content .= ' <h2>Are you sure you want to delete this author?</h2> <form action="' . $action_url . '" method="post" name="confirm_delete_author_form">