<?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();
    title("$sitename: "._PAGESLIST."");
    Max_OpenTable();
    echo "<center><font class=\"content\">"._LISTOFCONTENT." $sitename:</font></center><br /><br />";
    $cid    = $GLOBALS['db']->XMFnum($cid);
    $sql = "SELECT `pid`, `title`, `subtitle`, `clanguage` FROM `".TABLE_PAGES."` WHERE `active`='1' AND `cid`='$cid' ORDER BY `date`";
    if ( !($result = $GLOBALS['db']->sql_query($sql)) )
{ query_die(CORE_ERROR, 'Could not obtain _pages', '', __LINE__, __FILE__, $sql);}
    echo "<blockquote>";
    while ($row = $GLOBALS['db']->sql_fetchrow($result)) {
	$pid       = $GLOBALS['db']->XMFnum($row['pid']);
	$title     = stripslashes(check_html($row['title'], "nohtml"));
	$subtitle  = stripslashes(check_html($row['subtitle'], "nohtml"));
	$clanguage = $GLOBALS['db']->XMFlang($row['clanguage']);
	if ($multilingual == 1) {
	    $the_lang = "<img src=\"images/language/flag-".$clanguage.".png\" hspace=\"3\" border=\"0\" height=\"10\" width=\"20\" alt='$clanguage' title='$clanguage' />";
	} 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')) {
	$sql2 = "SELECT `pid`, `title`, `subtitle`, `clanguage` FROM `".TABLE_PAGES."` WHERE `active`='0' AND `cid`='$cid' ORDER BY `date`";
	if ( !($result2 = $GLOBALS['db']->sql_query($sql2)) )
{ query_die(CORE_ERROR, 'Could not obtain _pages', '', __LINE__, __FILE__, $sql2);}
	echo "<br /><br /><center><b>"._YOURADMINLIST."</b></center><br /><br />";
	echo "<blockquote>";
	while ($row2 = $GLOBALS['db']->sql_fetchrow($result2)) {
	    $pid       = $GLOBALS['db']->XMFnum($row2['pid']);
	    $title     = stripslashes(check_html($row2['title'], "nohtml"));
	    $subtitle  = stripslashes(check_html($row2['subtitle'], "nohtml"));
	    $clanguage = stripslashes($row2['clanguage']);
	    if ($multilingual == 1) {
		$the_lang = "<img src=\"images/language/flag-".$clanguage.".png\" hspace=\"3\" border=\"0\" height=\"10\" width=\"20\" alt='$clanguage' title='$clanguage' />";
	    } 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>";
    }
    echo "<center>"._GOBACK."</center>";
    Max_CloseTable();
    incof();