<?php
if (strstr($_SERVER["PHP_SELF"], "/modules/"))  die ("You can't access this file directly...");

$modules["news"] = true;
include_once( "modules/news/lang/msg_".check_lang($cfg["core"]["lang"]).".php" );
$config["menu"][20] = array( "title"=>$lang["NEWS_TITLE"], "file"=>"news.php", "type"=>"A", "newwindow"=>"N" );
$config["menu"][30] = array( "title"=>$lang["NEWS_SUBMIT_TITLE"], "file"=> "adm_news2.php?new=1", "type"=>"L", "newwindow"=>"N" );

$config["admmenu"]["news_cat"] = array( "title"=>$lang["NEWS_CAT_EDIT"], "file"=>"adm_newscat.php", "class"=>"admin" );
$config["admmenu"]["news_pending"] = array( "title"=>$lang["NEWS_PENDING_TITLE"], "file"=>"adm_news2.php", "class"=>"admin" );
$config["admmenu"]["news_add"] = array( "title"=>$lang["NEWS_SUBMIT_TITLE"], "file"=>"adm_news2.php?new=1", "class"=>"news" );
$config["admmenu"]["news_archive"] = array( "title"=>$lang["NEWS_ARCH_TITLE"], "file"=>"adm_arch_news.php", "class"=>"news" );

$config["fileman"]["news"] = array( "name"=>"News", "folder"=>"/modules/news/images/" );
$config["fileman"]["news_cat"] = array( "name"=>"News Categories", "folder"=>"/modules/news/cat_images/" );

$config["stylecss"]["news"] = true;

if( !isset($cfg["news"]["max_at_index"]) ) $cfg["news"]["max_at_index"] = 5;
if( !isset($cfg["news"]["max_per_page"]) ) $cfg["news"]["max_per_page"] = 10;
$cfg["news"]["version"] = "1.0";

function check_news_pending()
{
	global $config, $lang, $pending_actions;
	if( !check_user_class($config["admmenu"]["news_pending"]["class"]) ) return;
	// list news that are waiting for publish
	$stmt = "select count(*) from {$config["prefix"]}_news where active='N' and archived='N'";
	$ret = db_query( $stmt );
	$pqty = 0;
	if( $ret ) {
		$pqty = db_result( $ret, 0, 0 );
		db_free_result( $ret );
	}
	if( $pqty > 0 )
		$pending_actions[] = array( "title"=>"News", "qty"=>$pqty, "link"=>"adm_news2.php" );
}

check_news_pending();
?>
