<?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                                 */
/************************************************************************/
if (!defined('ADMIN_ALLOW') && !defined('ADMIN_MAX')) {
	die ("Access Denied");
}
if ($acces == 1) {
if($admintest && $adminsecu)  {

    OpenHeader(_BLOCKMGR);
    		echo "<br /><table border=\"1\" width=\"100%\"><tr>"
		."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._TITLE."</b></td>"
		."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._NAME."</b></td>";
		if ($multilingual == 1) {
			echo "<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._LANGUAGE."</b></td>";
		}
		echo "<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._FUNCTIONS."</b></tr>";
		$sql = "select bid, bkey, title, url, bposition, weight, active, blanguage, blockfile, view from ".TABLE_BLOCKS." order by bposition, weight";
		if ( !($result = $db->sql_query($sql)) )
{ query_die(GENERAL_ERROR, 'Could not obtain Admin _blocks', '', __LINE__, __FILE__, $sql);}
		while ($row = $db->sql_fetchrow($result)) {
			$bid = $db->XMFnum($row['bid']);
			$bkey = $db->XMFnum($row['bkey']);
			$title = stripslashes($row['title']);
			$active = $db->XMFbin($row['active']);
			$blanguage = stripslashes($row['blanguage']);
			$blockfile = stripslashes($row['blockfile']);
		if ( $blockfile == "" ) { $blockfile = " <i>System block</i> "; }
			echo "<tr>"
			."<td align=\"center\">$title</td>"
			."<td align=\"center\">$blockfile</td>";
			if ($multilingual == 1) {
				if ($blanguage == "") {
					$blanguage = _ALL;
				} else {
					$blanguage = ucfirst($blanguage);
				}
				echo "<td align=\"center\">$blanguage</td>";
			}

echo "<td align=\"center\"><font class=\"content\">&nbsp;<a href=\"".$admin_file.".php?op=BlocksManager_BlocksEdit&amp;page=BlocksManager_AllBlocks&amp;bid=$bid\"><img src=\"images/edit.gif\" alt=\""._EDIT."\" title=\""._EDIT."\" border=\"0\" width=\"17\" height=\"17\"></a>  <a href=\"".$admin_file.".php?op=BlocksManager_ChangeStatus&amp;bid=$bid&amp;active=$block_config&amp;wb_name=$wb_name\">$change</a>  ";
	if ($bkey == "") {
		echo "<a href=\"".$admin_file.".php?op=BlocksManager_DelBlock&amp;bid=$bid&amp;ok=0\"><img src=\"images/delete.gif\" alt=\""._DELETE."\" title=\""._DELETE."\" border=\"0\" width=\"17\" height=\"17\"></a>  ";
	} elseif ($bkey != "") {
		echo "<img src=\"images/delete_x.gif\" alt=\""._DELETE."\" title=\""._DELETE."\" border=\"0\" width=\"17\" height=\"17\"> ";
	}

include_once ("kernel/popup.php");

	if ($block_act == 0) {
	echo "<a href='".$admin_file.".php?op=BlocksManager_block_show&bid=$bid' onclick=\"NewsReadWindow(this.href,'SeeBlock','600','400','yes');return false;\"><img src=\"images/view.gif\" alt=\""._SHOW."\" title=\""._SHOW."\" border=\"0\" width=\"17\" height=\"17\"></a></font>&nbsp;</td></tr>";
	} else {
		echo "<img src=\"images/view_x.gif\" alt=\""._SHOW."\" title=\""._SHOW."\" border=\"0\" width=\"17\" height=\"17\"></font>&nbsp;</td></tr>";
}

}
		echo "</table>";
	$db->sql_freeresult($result);
    CloseFooter();
}
}else {
	echo "Access Denied";
}