<?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)  {


$pagetitle = _PLAN;

incoh();
title (_PLAN);
Max_OpenTable();
echo "<table width=\"100%\"><CENTER>"._PL_VISUEL."</CENTER>"	;
echo "<table width=\"100%\">";
$result= $db->sql_query("SELECT * from ".TABLE_PLAN." WHERE actif='1' ORDER BY pos ");
while ($row = $db->sql_fetchrow($result)) {
$id = $db->XMFnum($row['id']);
$firstimg = stripslashes(FixQuotes($row['firstimg']));
$titre = stripslashes(FixQuotes($row['titre']));
$url = stripslashes(FixQuotes($row['url']));
$secondimg = stripslashes(FixQuotes($row['secondimg']));
$brconfig = $db->XMFnum($row['brconfig']);
$tab = $db->XMFnum($row['tab']);
$bold = $db->XMFbin($row['bold']);
$italik = $db->XMFbin($row['italik']);
$target = $db->XMFbin($row['target']);

if ($bold) { $bl1 = "<b>"; $bl2 = "</b>"; } else {$bl1 =  $bl2 = "";}
if ($italik) { $it1 = "<i>"; $it2 = "</i>"; } else { $it1 = $it2 = "";}
if ($target) { $targ = "target='new'";  } else { $targ = ""; }


if ($tab) {
for ($h=0; $h < $tab; $h++) {
echo "&nbsp;";
} }

if ($firstimg) { echo "<img src='images/blocks/$firstimg'\"> "; }

if ($url) {

 echo "<a href=\"$url\" $targ>".$it1.$bl1.$titre.$bl2.$it2."</a>"; } else {

  echo "".$it1.$bl1.$titre.$bl2.$it2.""; }
if ($secondimg) { echo " <img src='images/blocks/$secondimg'\"> "; }
if ($brconfig) {
for ($i=0; $i < $brconfig; $i++) {
br('1');
}
}
br('1');
}
echo "</table><br />";
Max_CloseTable();
br('1');
Max_OpenTable();

echo "<table border=\"1\" width=\"100%\"><tr>"
	."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._WEIGHT."</b></td>"
	."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._IMAGE."</b></td>"
	."<td align=\"center\" bgcolor=\"$bgcolor2\" colspan=\"2\"><b>"._TITLEFREN."</b></td>"
	."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._URL."</b></td>"
	."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._IMAGE."</b></td>"
	."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>BR</b></td>"
	."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._EDIT."</b></td></tr>";


echo "";
$a = 0;
$result= $db->sql_query("select * from ".TABLE_PLAN." ORDER BY pos");
while ($row = $db->sql_fetchrow($result)) {
$id = $db->XMFnum($row['id']);
$firstimg = stripslashes($row['firstimg']);
$titre = stripslashes($row['titre']);
$title = stripslashes($row['title']);
$url = stripslashes($row['url']);
$secondimg = stripslashes($row['secondimg']);
$brconfig = $db->XMFnum($row['brconfig']);
$actif = $db->XMFbin($row['actif']);
$pos = $db->XMFnum($row['pos']);
$newposdown = $pos + 1;
$newposup = $pos - 1;
$a++;

echo "<form action=\"".$admin_file.".php\" method=\"post\">"
    ."<input type=\"hidden\" name=\"pid\" value=\"$id\" >"
    ."<tr><td>";
if ($pos !=1){
echo "<a href=\"".$admin_file.".php?op=PlanUp&pid=$id&pos=$pos&newposup=$newposup\"><img src=\"images/up.gif\" alt=\""._LINEUP."\" title=\""._LINEUP."\" border=\"0\" hspace=\"3\"></a>";
}
echo "<a
href=\"".$admin_file.".php?op=PlanDown&pid=$id&pos=$pos&newposdown=$newposdown\"><img src=\"images/down.gif\" alt=\""._LINEDOWN."\" title=\""._LINEDOWN."\" border=\"0\" hspace=\"3\"></a></td>";

echo "<td><input type=\"text\" name=\"firstimg\" value=\"$firstimg\" size=\"15\" maxlength=\"100\"></td>"
    ."<td><input type=\"text\" name=\"titre\" value=\"$titre\" size=\"15\" maxlength=\"100\"></td>"
    ."<td><input type=\"text\" name=\"title\" value=\"$title\" size=\"15\" maxlength=\"100\"></td>"
    ."<td><input type=\"text\" name=\"url\" value=\"$url\" size=\"30\" maxlength=\"100\"></td>"
    ."<td><input type=\"text\" name=\"secondimg\" value=\"$secondimg\" size=\"15\" maxlength=\"100\"></td>"
    ."<td><input type=\"text\" name=\"brconfig\" value=\"$brconfig\" size=\"2\" maxlength=\"3\"></td>"
    ."<td><input type=\"hidden\" name=\"op\" value=\"ModifPlanSite\">
       <input type=\"submit\" value=\""._EDITPLAN."\"></td></tr>";

echo "<tr><td></td><td><A HREF=\"".$admin_file.".php?op=AdvancePlan&pid=$id\">"._ADVANCECONFIG."</a></td><td>";

if ($actif) {
echo "<A HREF=\"".$admin_file.".php?op=ActivePlan&pactif=0&pid=$id\"><font color='red'>"._DEACTIVEPLAN."</font></A><br /></td></tr>";
} else {  echo "<A HREF=\"".$admin_file.".php?op=ActivePlan&pactif=1&pid=$id\"><font color='green'>"._ACTIVEPLAN."</font></a><br /></td></tr>"; }

echo "</form>";

}

$id = $id+1;
$a++;
Max_CloseTable();
br('1');
Max_OpenTable();

echo "</table><br /><table width='100%' border='1'><td align='center'><b>"._ADDPLAN."</b></td><tr></table><form action='".$admin_file.".php' method='post'><table border='1' width='100%'><tr>"
	."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._IMAGE."</b></td>"
	."<td align=\"center\" bgcolor=\"$bgcolor2\" colspan=\"2\"><b>"._TITLEFREN."</b></td>"
	."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._URL."</b></td>"
	."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._IMAGE."</b></td>"
	."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>BR</b></td>"
	."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._EDIT."</b></td></tr>";

echo "<input type=\"hidden\" name=\"id\" value=\"$id\">"
    ."<input type=\"hidden\" name=\"pos\" value=\"$a\">"
    ."<td><input type=\"text\" name=\"firstimg\" size=\"15\" maxlength=\"100\"></td>"
    ."<td><input type=\"text\" name=\"titre\" size=\"15\" maxlength=\"100\"></td>"
    ."<td><input type=\"text\" name=\"title\" size=\"15\" maxlength=\"100\"></td>"
    ."<td><input type=\"text\" name=\"url\" size=\"20\" maxlength=\"100\"></td>"
    ."<td><input type=\"text\" name=\"secondimg\" size=\"15\" maxlength=\"100\"></td>"
    ."<td><input type=\"text\" name=\"brconfig\" size=\"2\" maxlength=\"3\"></td>"
    ."<td><input type=\"hidden\" name=\"op\" value=\"AddPlan\">
       <input type=\"submit\" value=\""._ADDLINE."\"></form></td></tr>";

echo "</table>";
br('3');
Max_CloseTable();

incof();

}
}else {
	echo "Access Denied";
}