Location: PHPKode > projects > Enigma > Enigma2/Enigma2_Install/PortalSources/RemoveTopic.inc.php
<?php
/*
*****************************************************************

 RemoveTopic.inc.php
 
*****************************************************************
LSP: Lunabyte Systems Portal
Open-Source Project Inspired by Zef Hemel (hide@address.com)
*****************************************************************
Software Version:                  LSP 2.0 "Enigma 2"
Software by:                         Lunabyte Systems (http://www.lunabyte.net)
Copyright 2002-2005 by:       Lunabyte Systems (http://www.lunabyte.net)
Support, News, Updates at:    http://www.lunabyte.net
*****************************************************************
This program is free software; you may redistribute it and/or modify it 
under the terms of the provided license as published by Lunabyte Systems.

This program is distributed in the hope that it is and will be useful,                  
but WITHOUT ANY WARRANTIES; without even any implied warranty of           
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                        

See the "LSP_license.txt" file for details of the LSP license.
The latest version can always be found at http://www.lunabyte.net.
*****************************************************************
*/

if (!defined('ENIGMA'))
	die('<b>Access Violation</b><br />Direct Access to this location is not allowed.');

function eRemoveTopic2()
{
	global $sourcedir, $context, $topic, $newsTopics, $catchRedirect;

	$catchRedirect = 'removeNews';
	$newsTopics = $topic;

	require_once($sourcedir . '/RemoveTopic.php');
	RemoveTopic2();
}

function eRemoveOldTopics2()
{

	global $db_prefix, $sourcedir, $modSettings, $context, $newsTopics, $catchRedirect;

	$catchRedirect = 'removeNews';

	if (empty($_POST['boards']))
		redirectexit('action=maintain');

	$request = db_query("
		SELECT t.ID_TOPIC
		FROM {$db_prefix}topics AS t, {$db_prefix}messages AS m
		WHERE m.ID_MSG = t.ID_LAST_MSG
			AND m.posterTime < " . (time() - 3600 * 24 * $_POST['maxdays']) . (empty($modSettings['enableStickyTopics']) ? '' : "
			AND t.isSticky = 0") . "
			AND t.ID_BOARD IN (" . implode(', ', array_keys($_POST['boards'])) . ')', __FILE__, __LINE__);
	$newsTopics = array();
	while ($row = mysql_fetch_assoc($request))
		$newsTopics[] = $row['ID_TOPIC'];
	mysql_free_result($request);

	require_once($sourcedir . '/RemoveTopic.php');
	RemoveOldTopics2();

}

function eDeleteMessage()
{
	global $sourcedir, $context, $topic, $newsTopics, $catchRedirect;

	$catchRedirect = 'removeNews';
	$newsTopics = $topic;

	require_once($sourcedir . '/RemoveTopic.php');
	DeleteMessage();

}

function removeNews()
{
	global $db_prefix, $context, $newsTopics;

 	// Nothing to do?
	if (empty($newsTopics))
		return;
	// Only a single topic.
	elseif (is_numeric($newsTopics))
	{
		$condition = '= ' . $newsTopics;
		$newsTopics = array($newsTopics);
	}
	elseif (count($newsTopics) == 1)
		$condition = '= ' . $newsTopics[0];
	// More than one topic.
	else
		$condition = 'IN (' . implode(', ', $newsTopics) . ')';

	db_query("
		DELETE FROM {$db_prefix}news
		WHERE ID_TOPIC $condition", __FILE__, __LINE__);

}
?>
Return current item: Enigma