<?php
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2006                                            */
/* http://www.php-maximus.fr                                            */
/* dev@php-maximus.org                                                  */
/*                                                                      */
/* 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.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
defined('MAXIMUS') or Header("Location: index.php");

    incoh( 'Content', 'html', "".CACHE_VCONTENT."", '1' );
    title("$sitename: "._PAGESLIST."");
    Max_OpenTable();
    echo "<center><font class=\"content\">"._LISTOFCONTENT." $sitename:</font></center><br /><br />";
    $sql = "SELECT * FROM `".TABLE_PAGES_CATEGORIES."`";
    if ( !($result = $GLOBALS['db']->sql_query($sql)) )
{ query_die(CORE_ERROR, 'Could not obtain _pages_categories', '', __LINE__, __FILE__, $sql);}
    $numrows  = $GLOBALS['db']->sql_numrows($result);
    $numrows2 = $GLOBALS['db']->sql_numrows($GLOBALS['db']->sql_query("SELECT * FROM `".TABLE_PAGES."` WHERE `cid`!='0' AND `active`='1'"));
    if ($numrows > 0 AND $numrows2 > 0) {
		echo "<center>"._CONTENTCATEGORIES."</center><br /><br />"
	   		."<table border=\"1\" align=\"center\" width=\"95%\">";
		while ($row = $GLOBALS['db']->sql_fetchrow($result)) {
		    $cid = $GLOBALS['db']->XMFnum($row['cid']);
		    $title       = stripslashes(check_html($row['title'], "nohtml"));
		    $description = stripslashes($row['description']);
		    $numrows3 = $GLOBALS['db']->sql_numrows($GLOBALS['db']->sql_query("SELECT * FROM `".TABLE_PAGES."` WHERE `cid`='$cid'"));
		    if ($numrows3 > 0) {
				echo "<tr><td>&nbsp;<a href=\"modules.php?name=$module_name&amp;pa=list_pages_categories&amp;cid=$cid\">$title</a>&nbsp;</td><td align=\"left\">$description</td></tr>";
		    }
		}
		echo "</table><br /><br />"
		    ."<center>"._NONCLASSCONT."</center><br /><br />";
    }
    $result4 = $GLOBALS['db']->sql_query("SELECT `pid`, `title`, `subtitle`, `clanguage` FROM `".TABLE_PAGES."` WHERE `active`='1' AND `cid`='0' ORDER BY `date`");
    echo "<blockquote>";
    while ($row4 = $GLOBALS['db']->sql_fetchrow($result4)) {
		$pid = $GLOBALS['db']->XMFnum($row4['pid']);
		$title     = stripslashes(check_html($row4['title'], "nohtml"));
		$subtitle  = stripslashes(check_html($row4['subtitle'], "nohtml"));
		$clanguage = $GLOBALS['db']->XMFlang($row4['clanguage']);
		if ($multilingual == 1) {
		    $the_lang = "<img src=\"images/language/flag-".$clanguage.".png\" hspace=\"3\" border=\"0\" height=\"10\" width=\"20\" />";
		} else {
		    $the_lang = "";
		}
	    if ($subtitle != "") {
		    $subtitle = " ($subtitle)";
		} else {
	  	    $subtitle = "";
		}
		if (defined('ADMIN_ALLOW')) {
		    echo "<strong><big>&middot;</big></strong> $the_lang <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid\">$title</a> $subtitle [ <a href=\"".$admin_file.".php?op=content_edit&amp;pid=$pid\">"._EDIT."</a> | <a href=\"".$admin_file.".php?op=content_change_status&amp;pid=$pid&amp;active=1\">"._DEACTIVATE."</a> | <a href=\"".$admin_file.".php?op=content_delete&amp;pid=$pid\">"._DELETE."</a> ]<br />";
		} else {
		    echo "<strong><big>&middot;</big></strong> $the_lang <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid\">$title</a> $subtitle<br />";
		}
    }
    echo "</blockquote>";
    if (defined('ADMIN_ALLOW')) {
		$sql5 = "SELECT `pid`, `cid`, `title`, `subtitle`, `clanguage` FROM `".TABLE_PAGES."` WHERE `active`='0' ORDER BY `date`";
		    if ( !($result5 = $GLOBALS['db']->sql_query($sql5)) )
{ query_die(CORE_ERROR, 'Could not obtain _pages', '', __LINE__, __FILE__, $sql5);}
		br('2');
		echo "<center><b>"._YOURADMINLIST."</b></center>";
		br('2');
		echo "<blockquote>";
		while ($row5 = $GLOBALS['db']->sql_fetchrow($result5)) {
		    $pid      = $GLOBALS['db']->XMFnum($row5['pid']);
		    $cid      = $GLOBALS['db']->XMFnum($row5['cid']);
		    $title    = stripslashes(check_html($row5['title'], "nohtml"));
		    $subtitle = stripslashes(check_html($row5['subtitle'], "nohtml"));
		    $clanguage= $GLOBALS['db']->XMFlang($row5['clanguage']);
		    if ($multilingual == 1) {
				$the_lang = "<img src=\"images/language/flag-".$clanguage.".png\" hspace=\"3\" border=\"0\" height=\"10\" width=\"20\" />";
		    } else {
				$the_lang = "";
		    }
	    	if ($subtitle != "") {
		        $subtitle = " ($subtitle) ";
		    } else {
	    	    $subtitle = " ";
		    }
		    echo "<strong><big>&middot;</big></strong> $the_lang <a href=\"modules.php?name=$module_name&amp;pa=showpage&amp;pid=$pid\">$title</a> $subtitle [ <a href=\"".$admin_file.".php?op=content_edit&amp;pid=$pid\">"._EDIT."</a> | <a href=\"".$admin_file.".php?op=content_change_status&amp;pid=$pid&amp;active=0\">"._ACTIVATE."</a> | <a href=\"".$admin_file.".php?op=content_delete&amp;pid=$pid\">"._DELETE."</a> ]<br />";
		}
		echo "</blockquote>";
    }
    Max_CloseTable();
    incof( 'Content', 'html', "".CACHE_VCONTENT."", '1'  );