image uploading fixes involving database filepaths, with no filename.
[phpns.git] / index.php
blob5fc86afd9d6740b0387a160586f64b99ec7add6f
1 <?php
3 /* Copyright (c) 2007-08 Alec Henriksen
4 * phpns is free software; you can redistribute it and/or modify it under the
5 * terms of the GNU General Public Licence (GPL) as published by the Free
6 * Software Foundation; either version 2 of the Licence, or (at your option) any
7 * later version.
8 * Please see the GPL at http://www.gnu.org/copyleft/gpl.html for a complete
9 * understanding of what this license means and how to abide by it.
11 include("inc/init.php");
13 $globalvars['page_name'] = 'index';
14 $globalvars['page_image'] = 'index';
16 include("inc/header.php");
18 $do = $_GET['do'];
20 if ($do == NULL) { //if no action, we display index as usual
21 $num['article'] = content_num("articles",1,0);
22 $num['users'] = content_num("users",1,0);
23 $num['categories'] = content_num("categories",1,0);
24 $num['pendarticle'] = content_num("articles",1,1);
25 $num['logins'] = content_num("userlogin",1,0);
26 $num['unapproved'] = content_num("articles",1,2);
28 $load_recent = load_items('articles',0,4,'','',''); //load recent items (SQL)
30 //init recent_row_gen
31 $recent_row_gen = FALSE;
33 while($recent_row = mysql_fetch_array($load_recent)) {
34 $recent_row_gen = $recent_row_gen.
35 '<li><a href="article.php?id='.$recent_row['id'].'&amp;do=edit">'.$recent_row['article_title'].'</a></li>';
38 $content = "
39 <h3>Information</h3>
40 <div id=\"columnright\">
41 <h4>Recent articles</h4>
42 <ul>
43 ".$recent_row_gen."
44 </ul>
45 </div>
46 <h4>Statistics</h4>
47 <ul id=\"stats\">
48 <li>There are currently <a href=\"manage.php\">" . $num['article'] . " articles posted</a> with <a href=\"preferences.php?do=categories\">" . $num['categories'] . " categories</a>.</li>
49 <li>There are currently <a href=\"user.php\">" . $num['users'] . " active users</a>.</li>
50 <li>There are currently <a href=\"manage.php?v=unactive\">" . $num['pendarticle'] . " drafts</a> and <a href=\"manage.php?v=unapproved\">" . $num['unapproved'] . " unapproved articles</a>.</li>
51 <li>There are currently <a href=\"user.php?do=loginrec\">" . $num['logins'] . " login records</a>.</li>
52 </ul>
53 <div class=\"clear\"></div>
55 } elseif ($_GET['do'] == "permissiondenied") { //display permission denied error
56 $globalvars['page_name'] = 'permission denied';
57 $globalvars['page_image'] = 'lock';
59 $content = '<h3>Why am I getting this?</h3>
60 <p>When your rank was created, the author denied any members associated with this rank to view this feature/page. If you think you should have access, contact your admin. If this has just barely been changed for you, you will need to logout and log back in.</p> ';
61 } elseif ($_GET['do'] == "lulz") {
62 $globalvars['page_name'] = 'lulz all around!';
63 $globalvars['page_image'] = 'none';
64 echo <<<EDO
65 <pre>
66 (__)
67 (oo)
68 /------\/
69 / | ||
70 * /\---/\
71 ~~ ~~ - mmmmm, apt-get.
72 </pre>- alec (alecwh)<hr />
73 phpns makes kyle a happy panda - kyle (kyleO)
74 EDO;
75 die(); //die!
78 include("inc/themecontrol.php"); //include theme script