<?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                                 */
/************************************************************************/

	incoh();
	include("modules/$module_name/l_config.php");
	if(defined('USER_ALLOW')) {
		$user2 = base64_decode($user);
		$user2 = addslashes($user2);
		$cookie = explode(":", $user2);
		cookiedecode($user);
		$ratinguser = $cookie[1];
	} else {
		$ratinguser = "$anonymous";
	}
	menu('1');
	br('1');
	Max_OpenTable();
	$blocknow = 0;
	$lid = $db->XMFnum(trim($lid));
	if ($blockunregmodify == 1 && $ratinguser=="$anonymous") {
		echo "<br /><br /><center>"._ONLYREGUSERSMODIFY."</center>";
		$blocknow = 1;
	}
	if ($blocknow != 1) {
		$result = $db->sql_query("SELECT cid, sid, title, url, description from ".TABLE_LINKS_LINKS." where lid='$lid'");
		echo "<center><font class=\"option\"><b>"._REQUESTLINKMOD."</b></font><br /><font class=\"content\">";
		while($row = $db->sql_fetchrow($result)) {
			$cid = $db->XMFnum($row['cid']);
			$sid = $db->XMFnum($row['sid']);
			$title = stripslashes(check_html($row['title'], "nohtml"));
			$url = stripslashes($row['url']);
			$description = stripslashes($row['description']);
			echo "<form action=\"modules.php?name=$module_name\" method=\"post\">"
			.""._LINKID.": <b>$lid</b></center><br /><br /><br />"
			.""._LINKTITLE.":<br /><input type=\"text\" name=\"title\" value=\"$title\" size=\"50\" maxlength=\"100\" /><br /><br />"
			.""._URL.":<br /><input type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\" /><br /><br />"
			.""._DESCRIPTION.": <br /><textarea name=\"description\" cols=\"70\" rows=\"15\">$description</textarea><br /><br />";
			// $result2=sql_query("select cid, title from ".TABLE_LINKS_CATEGORIES." order by title", $dbi);
			echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\" />"
			."<input type=\"hidden\" name=\"modifysubmitter\" value=\"$ratinguser\" />"
			.""._CATEGORY.": <select name=\"cat\">";
			$result2 = $db->sql_query("SELECT cid, title, parentid from ".TABLE_LINKS_CATEGORIES." order by title");
			while($row2 = $db->sql_fetchrow($result2)) {
				$cid2 = $db->XMFnum($row2['cid']);
				$ctitle2 = stripslashes(check_html($row2['title'], "nohtml"));
				$parentid2 = $db->XMFnum($row2['parentid']);
				if ($cid2==$cid) {
					$sel = "selected";
				} else {
					$sel = "";
				}
				if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
				echo "<option value=\"$cid2\" $sel>$ctitle2</option>";
			}
			echo "</select><br /><br />"
			."<input type=\"hidden\" name=\"l_op\" value=\"modifylinkrequestS\" />"
			."<input type=\"submit\" value=\""._SENDREQUEST."\" /></form>";
		}
	}
	Max_CloseTable();
	incof();