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


	incoh();
	Max_OpenTable();
$result    = $GLOBALS['db']->sql_query("SELECT * FROM `".TABLE_PLAN."` WHERE `id`='$pid' ");
$row       = $GLOBALS['db']->sql_fetchrow($result);
$id        = $GLOBALS['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  = $GLOBALS['db']->XMFnum($row['brconfig']);
$actif     = $GLOBALS['db']->XMFbin($row['actif']);
$tab       = $GLOBALS['db']->XMFnum($row['tab']);
$bold      = $GLOBALS['db']->XMFbin($row['bold']);
$italik    = $GLOBALS['db']->XMFbin($row['italik']);
$target    = $GLOBALS['db']->XMFbin($row['target']);
$view      = $GLOBALS['db']->XMFnum($row['view']);
$groups    = stripslashes($row['groups']);

echo "<form action=\"".$admin_file.".php\" method=\"post\">"
    ."<table width=\"80%\" align=\"center\">"
    ."<tr><td width=\"40%\"><b>"._IMGBEFOREDESC."</b> </td><td width=\"60%\"> <input type=\"text\" name=\"firstimg\" value=\"$firstimg\" size=\"25\" maxlength=\"100\"></td></tr>"
    ."<tr><td ><b>"._TITLE1LANGUE."</b></td><td ><input type=\"text\" name=\"titre\" value=\"$titre\" size=\"25\" maxlength=\"100\"></td></tr>"
    ."<tr><td ><b>"._TITLE2LANGUE."</b></td><td><input type=\"text\" name=\"title\" value=\"$title\" size=\"25\" maxlength=\"100\"></td></tr>"
    ."<tr><td ><b>"._URLLINK."</b></td><td > <input type=\"text\" name=\"url\" value=\"$url\" size=\"35\" maxlength=\"100\"></td></tr>"
    ."<tr><td><b>"._IMGAFTERDESC."</b></td><td><input type=\"text\" name=\"secondimg\" value=\"$secondimg\" size=\"25\" maxlength=\"100\"></td></tr>"
    ."<tr><td><b>"._NBINTERLIGNES."</b></td><td ><input type=\"text\" name=\"brconfig\" value=\"$brconfig\" size=\"2\" maxlength=\"3\"></td></tr>"
    ."<tr><td><b>"._NBTABSBEFORETITLE."</b></td><td ><input type=\"text\" name=\"tab\" value=\"$tab\" size=\"2\" maxlength=\"3\"></td></tr>";
$sel1 = $sel2 = "";
    if ($bold) {
        $sel1 = "checked";
        $sel2 = "";
    } else {
        $sel1 = "";
        $sel2 = "checked";
    }
echo "<tr><td><b>"._LINKBOLD."</b></td><td ><input type=\"radio\" name=\"bold\" value=\"1\" $sel1>"._YES." &nbsp;&nbsp;"
        ."<input type=\"radio\" name=\"bold\" value=\"0\" $sel2>"._NO."</td></tr>";

$sel1 = $sel2 = "";
    if ($italik) {
        $sel1 = "checked";
        $sel2 = "";
    } else {
        $sel1 = "";
        $sel2 = "checked";
    }
echo "<tr><td><b>"._LINKITALIK."</b></td><td ><input type=\"radio\" name=\"italik\" value=\"1\" $sel1>"._YES." &nbsp;&nbsp;"
        ."<input type=\"radio\" name=\"italik\" value=\"0\" $sel2>"._NO."</td></tr>";


$sel1 = $sel2 = "";
    if ($target) {
        $sel1 = "checked";
        $sel2 = "";
    } else {
        $sel1 = "";
        $sel2 = "checked";
    }
echo "<tr><td><b>"._OPENNEWWIN."</b></td><td ><input type=\"radio\" name=\"target\" value=\"1\" $sel1>"._YES." &nbsp;&nbsp;"
        ."<input type=\"radio\" name=\"target\" value=\"0\" $sel2>"._NO."</td></tr>";

$sel1 = $sel2 = "";
    if ($actif) {
        $sel1 = "checked";
        $sel2 = "";
    } else {
        $sel1 = "";
        $sel2 = "checked";
    }
echo "<tr><td><b>"._ACTIVELINK."</b></td><td ><input type=\"radio\" name=\"actif\" value=\"1\" $sel1>"._YES." &nbsp;&nbsp;"
        ."<input type=\"radio\" name=\"actif\" value=\"0\" $sel2>"._NO."</td></tr>";
 $sel1 = $sel2 = $sel3 = $sel4 = $sel5 = "";
    if ($view == 0) {
	$sel1 = "selected";
	$sel2 = "";
	$sel3 = "";
	$sel4 = "";
	$sel5 = "";
    } elseif ($view == 1) {
	$sel1 = "";
	$sel2 = "selected";
	$sel3 = "";
	$sel4 = "";
	$sel5 = "";
    } elseif ($view == 2) {
	$sel1 = "";
	$sel2 = "";
	$sel3 = "selected";
	$sel4 = "";
	$sel5 = "";
    } elseif ($view == 3) {
	$sel1 = "";
	$sel2 = "";
	$sel3 = "";
	$sel4 = "selected";
	$sel5 = "";
    } elseif ($view > 3) {
	$sel1 = "";
	$sel2 = "";
	$sel3 = "";
	$sel4 = "";
        $sel5 = "selected";
    }
echo "</td></tr><tr><td>"._VIEWPRIV."</td><td><select name=\"view\">"
        ."<option value=\"0\" $sel1>"._MVALL."</option>"
        ."<option value=\"1\" $sel2>"._MVUSERS."</option>"
        ."<option value=\"2\" $sel3>"._MVADMIN."</option>"
        ."<option value=\"3\" $sel4>"._MVANON."</option>"
	."<option value=\"4\" $sel5>"._MVGROUPS."</option>"
        ."</select></td></tr><tr><td nowrap>"
	."<b>"._WHATGROUPS."</b></td><td><font class=\"tiny\">"._WHATGRDESC."</font><br /><select name=\"groups[]\" multiple size=\"5\">";
    $ingroups = explode("-",$groups);
    $groupsResult = $GLOBALS['db']->sql_query("SELECT `gid`, `gname` FROM `".TABLE_NSNGR_GROUPS."`");
    while(list($gid, $gname) = $GLOBALS['db']->sql_fetchrow($groupsResult)) {
        if(in_array($gid,$ingroups)) { $sel = " selected"; } else { $sel = ""; }
        echo "<option value='$gid'$sel>$gname</option>";
    }
    echo "</select></td></tr>";

echo "<input type=\"hidden\" name=\"pid\" value=\"$id\" ><input type=\"hidden\" name=\"op\" value=\"SaveAdvancePlan\">
<a href=\"".$admin_file.".php?op=Plan\">Plan</a>      <center><input type=\"submit\" value=\""._VALIDPLAN."\"></center>"
    ."</form></table>";
br('3');
    Max_CloseTable();
    incof();

}
}else {
	echo "Access Denied";
}