Project: stupidCMS
Code Location: https://stupidcms.svn.sourceforge.net/svnroot/stupidcms
Browse
/
Download File
index.php
<?php
/* Copyright (C) 2011  Jacopo Cascioli

This file is part of stupidCMS

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
require "layout.php";
require "format.php";
require "settings.php";

$con = mysql_connect($server, $user, $password);
mysql_select_db($database, $con);
			
$query = mysql_query("SELECT * FROM general LIMIT 1");
$general = mysql_fetch_array($query);
$title = $general[1];
$description = $general[2];
$license = $general[4];
$version = $general[5];
$lastupdate = date("l j F Y", $general[6]);

$header = sprintf($header, $title, $description, '');
$footer = sprintf($footer, $lastupdate, $version, $license);

$from_last = $_GET["fromlast"];
if (!$from_last)
{
	$query = mysql_query("SELECT * FROM posts ORDER BY id DESC LIMIT 0,10");
	$posts = fetch_all($query);
	$formatted_posts = format_posts($posts, 1);
	$page_slide = format_page_slide(1, 0, 0);
}
else 
{
	$query = mysql_query("SELECT * FROM posts ORDER BY id DESC");
	$posts_array = fetch_all($query);
	$posts = limit_workaround($posts_array, $from_last, 10);
	$formatted_posts = format_posts($posts, 1);
	$page_slide = format_page_slide($from_last, 0, 0);
}

$main_content = $formatted_posts.$page_slide;

printf($html_base, $title, $header, $main_content, $footer);
?>