All pastes #210194 Raw Edit

Miscellany

public text v1 · immutable
#210194 ·published 2006-10-19 16:04 UTC
rendered paste body
<?php
/*
SwishNews - Simple news module for websites - part of SwishCMS
Copyright (C) 2006 SwishCMS Development Team (http://swishcms.berlios.de)

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 2
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, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
*/

include("inc/db.inc.php");
include("inc/functions.inc.php");
include("inc/config.inc.php");
// Done the legal stuff, required the function files and config file.

// Now for functions!

function embednews() {
	// This function embeds the news into a page.
	$db->dbconnect();
	$db->getnewsheadlines();
	$db->dbdisconnect();
	// Do NOT remove this line, unless you are evil, sadistic or use IE.
	$functions->showcopyright();
	exit;
}

function newspage() {
	// This function has a editable page of news.
	$db->dbconnect();
	$db->getheader();
	$db->getnewsheadlines();
	$db->getfooter();
	$db->dbdisconnect();
	// Do NOT remove this line, unless you are evil, sadistic or use IE.
	$functions->showcopyright();
	exit;
}

function showcomments($_GET['article']) {
	// This function gets the comments for a particular article (and prints out the full body).
	$db->dbconnect();
	$db->getbody($_GET['article']);
	$db->getcomments($_GET['article']);
	$db->dbdisconnect();
	$functions->commentlink($_GET['article']);
	// Do NOT remove this line, unless you are evil, sadistic or use IE.
	$functions->showcopyright();
	exit;
}

function postcomment($_GET['article']) {
	// One day, I will write this...
	// This function lets you post a comment.
	if($_GET['post'] == "yes") {
		// If we are posting...
		// Foo...
	} else {
		// If we are not...
		// Foo...
	}
	// Nothing more here!
}

// If we have linked here without a ?q= bit, show the main page.

if(!isset($_GET['q'])) {
	newspage();
} else {
	// Nasty!
	$_GET['q']();
}

// EoF