	<?php 
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ^ E_DEPRECATED ^ E_STRICT); 
$rootPath = is_file("../../../../library/document.php") ? "../../../../" : "../../";
define("CMS", "korCMS");
include($rootPath."config/odyssey.ini.php");
include($rootPath."library/db.php");
include($rootPath."library/system.php");
include($rootPath."library/messages.php");
include($rootPath."library/variables.php");
include($rootPath."library/language.php");
include($rootPath."library/parameters.php");
include($rootPath."library/content.php");
include($rootPath."library/admin_pagination.php");
include($rootPath."library/fileSystem.php");
include($rootPath."library/imageResize.php");
include($rootPath."library/authentication.php");
include($rootPath."library/sef.php");
$sef = new sef();
$db = new db();
$system = new system();
$messages = new messages();
$variables = new variables();
$language = new language();
$parameters = new parameters();
$content = new content();
$fileSystem = new fileSystem();
$imageResize = new imageResize();
$authentication = new authentication(false, true);
$db->query("SET NAMES 'utf8mb4'");

function getFPath(){
	$parts = explode("/", $_SERVER["PHP_SELF"]);
	array_shift($parts); // the first element will be empty to we get rid of it
	array_pop($parts); // get rid of script name
	$fPath =implode("/", $parts);
	if(substr($fPath, -1) != "/") $fPath.="/";
	$fPath = ($fPath == "/") ? null : $fPath;	
	return $fPath;	
}

$langID = ($_GET['langID']) ? (int)$_GET['langID'] : $language->getDefaultLanguage();
$Lsufix = ((int)$langID > 1) ? "_translated" : NULL;
$variables->getSafeVars(array_keys($_REQUEST));

$token1 = "38629649";
$token2 = "73972658";
list($stage1, $token2b) = explode($token2, $_REQUEST['u']);
list($token1b, $userID) = explode($token1, $stage1);
if(empty($userID)) die("Access denied");

// lets check if the section's record belongs to this user
$section = $system->getTableSectionName($sectionID);
$uid = $db->getRecord("select userID from $section where id='$linkID'")->userID;
if($uid <> $userID) die("Access denied");



$parameters->importParameters();
$isMultilingualSite = $language->isMultilingualSite();
$defaultLanguageID = $db->getRecord("select id from languages where defaultlanguage=1")->id;
if($action=="add" && $fileID && $linkID && $sectionID && $writedata){ // procceed to attach the selected file
	$default = ($default) ? 1 : 0;
	$results = $db->query("select id from mediabank where id='$fileID'");
	$row = $db->getRow($results);
	if($fileSystem->isImage($row->id)){ //it is image
		$bankID = $fileID;
		$sort= 0;
		$db->query("INSERT INTO images VALUES('','$bankID','$sectionID','$linkID','$default', '$slider', '$logo', '$sort')");
		$imgID=$db->lastID();
		$Lresult = $db->query("SELECT * FROM languages WHERE active=1 ");
		$LRecords = $db->getRows($Lresult);
		foreach($LRecords as $Lrow) {
			$extension = ($Lrow->extension) ? $Lrow->extension : '_gr';
			$languageID = $Lrow->id;
			$title = str_replace('"', '&#034;', str_replace("'", "&#039;", ${'title'.$extension}));
			$description = ${'description'.$extension};
			if(!$title && $languageID == $defaultLanguageID){
				// make sure that a title exists for default language
				$title = $fileSystem->getMediabankTitle($bankID);	
			}			
			$keys="id,imgID,langID,title,description";
			$values="'','$imgID','$languageID','$title','$description'";
			if($title || $description){
				$query = "INSERT INTO content_images (".$keys.") VALUES(".$values.")";
				$db->query($query);
			}
		}
	}else{ //it is other type of file
		$bankID = $fileID;
		$sort = 0;
		$db->query("INSERT INTO files VALUES('','$bankID','$sectionID','$linkID','$sort')");
		$fileID=$db->lastID();
		$Lresult =$db->query("SELECT * FROM languages WHERE active=1 ");
		$LRecords = $db->getRows($Lresult);
		foreach($LRecords as $Lrow) {
			$extension = ($Lrow->extension) ? $Lrow->extension : '_gr';
			$languageID = $Lrow->id;
			$title = str_replace('"', '&#034;', str_replace("'", "&#039;", ${'title'.$extension}));
			if(!$title){
				// make sure that a title exists for default language
				$title = $fileSystem->getMediabankTitle($bankID);	
			}			
			if($top) $title.="|top"; // for swf positioning			
			$keys="id,fileID,langID,title";
			$values="'','$fileID','$languageID','$title'";
			if($title || $description){
				$query = "INSERT INTO content_files (".$keys.") VALUES(".$values.")";
				$db->query($query);
			}
		}
		
	}
echo'<script type="text/javascript">
	parent.$("#attachments_instructions").css("display","block");
	parent.attachments.location.reload();
	parent.$.fancybox.close();
	</script>';
	
exit;
}

function t($key, $langID=NULL, $context=NULL){ // shortcut of $language->getText($key, $langID=NULL, $context=NULL)
	global $language;
	global $langID;
	return $language->getText($key, $langID, $context);
}

?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="<?php echo $rootPath;?>admin/css/admin.css" rel="stylesheet" type="text/css">
<link href="<?php echo $rootPath;?>admin/css/pagination.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<?php echo $rootPath;?>js/jquery.js"></script>
<script type="text/javascript" src="<?php echo $rootPath;?>admin/js/admin.js"></script>

<script  type="text/javascript">
<!--
jQuery(function($){
	$('#loading').css("display", "none");
});
function showHide(elm){
	default_obj = document.getElementById('default');
	slider_obj = document.getElementById('slider');
	logo_obj = document.getElementById('logo');
	if(elm.id == "logo"){
		if(elm.checked) {
			default_obj.checked = false;
			default_obj.disabled = true;
			slider_obj.checked = false;
			slider_obj.disabled = true;			
		}else{
			default_obj.disabled = false;
			slider_obj.disabled = false;
		}		
	}
	if(elm.id == "slider"){
		if(elm.checked) {
			default_obj.checked = false;
			default_obj.disabled = true;
			logo_obj.checked = false;
			logo_obj.disabled = true;			
		}else{
			default_obj.disabled = false;
			logo_obj.disabled = false;
		}		
	}
}

//-->
</script>
<style type="text/css">
body{
	margin:0 3px 3px 0;
	background: #ededed;
	font-family: Verdana, sans-serif, Arial;
	font-size:11px;
}
</style>
<link href="css/odyssey_users.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="loading" style="width:100%; height:100%; z-index:999; background: url(images/white.gif); text-align:center; position:absolute; top:0; left:0">
	<img src="<?php echo $rootPath;?>/admin/images/loading_page.gif" width="50" height="50" alt="loading page" style="margin-top:150px">
</div>

<?php 
if(!$sectionID || !$linkID){
	$messages->addError(t("Μη εξουσιοδοτημένη πρόσβαση")."!");
}
if($messages->hasErrors){
	$messages->printSystemMessages();
}else{
if($action=="add" && !$fileID){ // select file to attach
	?>

	<div style="text-align:left">
    	<div class="tip">
		<b><?php echo t("Προσοχή");?>!</b><br><?php echo t("Αν δεν βρίσκετε το αρχείο που θέλετε να επισυνάψετε στην βιβλιοθήκη των αρχείων σας, μπορείτε να προσθέσετε τώρα κάποιο αρχείο από τον υπολογιστή σας");?>:
        </div>
	</div>
    <div id="add_item" style="margin: 10px; text-align:right;">
	<a href="?bank_action=add&linkID=<?php echo $linkID;?>&sectionID=<?php echo $sectionID;?>&u=<?php echo $u;?>" style="min-width:110px">
	<?php echo t("Επιλογή αρχείου από τον υπολογιστή σας");?>
    </a>
	</div>
	<?php
	$header=t("ΕΠΙΛΟΓΗ ΑΡΧΕΙΟΥ ΓΙΑ ΕΠΙΣΥΝΑΨΗ");
	 ?>
	<div class="section_title"><?php echo $header;?></div>	
	<?php
    if($_REQUEST['criteria_search']){
    ?>
    <script type="text/javascript">
    jQuery(function($){
        toggleSearch($('.find'));
    });
    </script>
    <?php
    }
    ?>            
	<a href="javascript:void(0)" onclick="toggleSearch(this)" class="find search_off" style='margin-top: 10px; font-size: 1.2em !important; font-family: "Roboto Condensed",sans-serif !important'><?php echo t("Αναζήτηση");?></a>
	<form id="find" method="post" class="admin_form form_centered hidden">
	<div class="normal" style="text-align:center">
	<div class="admin_label"><?php echo t("Τύπος αρχείου");?>:</div>
	<div style="clear:both"><select name="filetypeID" class="listbox" id="ext">
	<option value="0" selected="selected"><?php echo t("Όλοι οι τύποι");?>...</option>
	<?php 
	$extres = $db->query("select * from filetypes");
	$FTRecords = $db->getRows($extres);
	foreach($FTRecords as $extrow){
	 ?>
	<option value="<?php  echo $extrow->id;?>"><?php  echo $extrow->title;?>	</option>
	<?php 
}
	?>
	</select>
	</div>
	<div class="admin_label"><?php echo t("Λέξη ή φράση κλειδί");?>:</div>
	<div style="clear:both"><input name="keyword" type="text" class="listbox" id="keyword" value="<?php  echo $keyword;?>" onClick="this.value=''"></div>
	<div class="admin_label"><input name="action" type="hidden" id="action" value="<?php  echo $action;?>">
	<input name="linkID" type="hidden" id="linkID" value="<?php  echo $linkID;?>">
	<input name="sectionID" type="hidden" id="sectionID" value="<?php  echo $sectionID;?>">
	</div>
	<div style="clear:both"><input name="criteria_search" type="submit" class="btn btn-success" id="button" value="<?php echo t("Αναζήτηση");?>"></div>
	</div>
	</form>
	<div id="mediabank_results">
	<?php 
	$q="select * from mediabank where userID='$userID' ";
	if($filetypeID) $q.=" and filetypeID=".$filetypeID;
	$keyword = ltrim(rtrim($keyword));
	if($keyword) $q.=" and (tags LIKE '%$keyword%' OR title LIKE '%$keyword%')";
	$presults = $parameters->getParameter('presults');
	$results=$db->query($q);
	$maxrows=$db->getNumRows($results);
	$page = ($_REQUEST['page'] > 0) ? $_REQUEST['page'] : 1;
	$startrecord=($page * $presults) - $presults;
	$startrecord=($startrecord < 0) ? 0 : $startrecord ;
	$results=$db->query($q." order by id desc LIMIT $startrecord, $presults");
	$rows=$db->getNumRows($results);
	 if(!$rows){
		 if(!$filetypeID && !$keyword){
			 $messages->addError(t("Δεν υπάρχουν προς το παρόν καταχωρημένες εγγραφές στη βιβλιοθήκη αρχείων του site σας")."!");
		 }else{
			 $messages->addError(t("Δεν βρέθηκαν αρχεία που να πληρούν τα συγκεκριμένα κριτήρια που θέσατε")."...");
		 }
		 $messages->printSystemMessages();
	 }else{
		$vars = 'action,sectionID,linkID,filetypeID,keyword,u';
		$pagination = new admin_pagination($maxrows, true, $vars);
		$pagination->printPages(); 
		$counter=0;
		$records = $db->getRows($results);
		foreach($records as $row){
			$ext = $fileSystem->getExtensionByFileTypeID($row->filetypeID);
			$counter++;
			?>
			<div style="margin-top:20px;"></div>
			<table style="float:left; padding:0;">
			<tr>
			<td style="background:url(images/placeholder.gif) 0 0 no-repeat; padding:0; margin:0; height:131px; width:170px; text-align:center; vertical-align:middle">
			<a href="?action=add&amp;sectionID=<?php  echo $sectionID;?>&amp;linkID=<?php  echo $linkID;?>&amp;fileID=<?php  echo $row->id;?>&amp;u=<?php echo $u;?>">
			<?php 
			if($fileSystem->isImage($row->id)){
				?>
				<img src="<?php echo $rootPath;?>mediabank/thumbs/small_<?php  echo $row->id.'.'.$ext;?>?r=<?php  echo @time();?>" alt="select to attach" title="select to attach" border="0">
				<?php 
}else{
				?>
				<img src="<?php echo $rootPath;?>mediabank/icons/filetype_<?php  echo $ext;?>.gif" alt="select to attach" title="select to attach" border="0">
				<?php 
}
			?>
			</a> </td>
			</tr>
			<tr>
			<td class="mediabank_text_container"><div><?php  echo $variables->unicode_substr(t($row->title), 0, 70);?></div></td>
			</tr>
			</table>
			<?php 
			//if($counter % 4 == 0) echo('<div style="clear:both"></div>');
	}
	?>
	<div style="clear:both"></div>
	<?php 
	 $pagination = new admin_pagination($maxrows, false, $vars);
	 $pagination->printPages();
	 }
	 ?>
	</div>
	<?php 
}
if($_REQUEST['action']=="add" && $_REQUEST['fileID'] && !$_REQUEST['writedata']){ // procceed to add info for the selected file
	$results = $db->query("select * from mediabank where id='$fileID' ");
	$row = $db->getRow($results);
	$ext = $fileSystem->getExtensionByFileTypeID($row->filetypeID);

	?>
	<div style="margin-top: 15px">
	
	<?php
	$header=t("ΣΥΜΠΛΗΡΩΜΑΤΙΚΑ ΣΤΟΙΧΕΙΑ ΤΟΥ ΠΡΟΣ ΕΠΙΣΥΝΑΨΗ ΑΡΧΕΙΟΥ");
	 ?>
	<div class="section_title"><?php echo $header;?></div>		
	</div>
	<form method="post" enctype="multipart/form-data" name="editFile" id="editFile">
	<div class="normal" style="margin-bottom:150px; margin-top:10px;">
	
	<div style="text-align:center">
    <div><?php echo t("Έχετε επιλέξει το αρχείο");?>: </div>
    <div style="display:inline-block">
	<div style="background:url(images/placeholder.gif) 0 0 no-repeat; padding:0; margin:0; height:131px; width:170px; text-align:center; display:table-cell; vertical-align:middle"><?php 
	if($fileSystem->isImage($row->id)){
		?>
		<img src="<?php echo $rootPath;?>mediabank/thumbs/small_<?php  echo $row->id.'.'.$ext;?>" alt="selected file" title="<?php  echo t($row->title);?>" border="0">
		<?php 
}else{
		?>
		<img src="<?php echo $rootPath;?>mediabank/icons/filetype_<?php  echo $ext;?>.gif" alt="selected file"  title="<?php  echo t($row->title);?>" border="0">
		<?php 
}
	?></div>
    </div>
    </div>
	<?php 
	$Lresult =$db->query("SELECT * FROM languages WHERE active=1 ");
	$LRecords = $db->getRows($Lresult);
	foreach($LRecords as $Lrow) {
		$extension = ($Lrow->extension) ? $Lrow->extension : '_gr';
		?>
        <div style="display:table; margin: 0 auto;"><div>
        <?php
		if($isMultilingualSite){ 
		?>
		<img class="admin_label_flag" src="<?php echo $rootPath;?>mediabank/flags/flag<?php  echo $extension;?>.png">
		<?php 
		}
		?>        
		<div class="admin_label">Τίτλος <?php  if($Lrow->extension && $isMultilingualSite){echo(' '.t("στα").' '.$Lrow->{title.$Lsufix});}?>: </div>
		<div style="clear:both">
		<input name="title<?php  echo $extension;?>" type="text" class="listbox" style="width:90	%; min-width:200px" id="title<?php  echo $extension;?>"  value="<?php  echo t($row->title);?>"></div>
        </div>
        </div>
		<?php 
}
	if($ext=="swf"){
	?>
    <div style="display:table; margin: 0 auto;"><div>
	<div class="admin_label">
    <div style="float:left;"><input name="top" type="checkbox" id="top" value="1"></div>
	<?php echo t("να εμφανίζεται στην κορυφή του άρθρου");?>
    </div>
    </div>
    </div>
	<?php 
}
	if($fileSystem->isImage($row->id)){
	$Lresult =$db->query("SELECT * FROM languages WHERE active=1 ");
	$LRecords = $db->getRows($Lresult);
	foreach($LRecords as $Lrow) {
		$extension = ($Lrow->extension) ? $Lrow->extension : '_gr';
		?>
        <div style="display:table; margin: 0 auto;"><div>
        <?php
		if($isMultilingualSite){ 
		?>
		<img class="admin_label_flag" src="<?php echo $rootPath;?>mediabank/flags/flag<?php  echo $extension;?>.png">
		<?php 
		}
		?>        
		<div class="admin_label">Περιγραφή <?php  if($Lrow->extension  && $isMultilingualSite){echo(' '.t("στα").' '.$Lrow->{title.$Lsufix});}?>: 
		<br>
		<span <?php if($isMultilingualSite){ ?>style="font-weight: normal"<?php 
} ?>>(<?php echo t("θα εμφανίζεται ώς λεζάντα");?>)</span></div>
		<div style="clear:both">
		<textarea name="description<?php  echo $extension;?>" rows="2" class="listbox" style="width:90	%; min-width:200px" id="description<?php  echo $extension;?>"><?php  echo t($row->title);?></textarea></div>
        </div></div>
		<?php 
}
	?>
    <div style="display:table; margin: 0 auto;"><div>
	<div class="admin_label">
    <div style="float:left;"><input name="default" type="checkbox" id="default" value="1"></div>
	<?php echo t("να θεωρείται η εξ ορισμού κύρια εικόνα");?>
    </div>
	<div class="admin_label">
    <div style="float:left;"><input name="slider" type="checkbox" id="slider" value="1" onClick="showHide(this)"></div>
	<?php echo t("να χρησιμοποιηθεί μόνο σε slider");?>
    </div>
	<div class="admin_label">
    <div style="float:left;"><input name="logo" type="checkbox" id="logo" value="1" onClick="showHide(this)"></div>
	<?php echo t("να χρησιμοποιηθεί ως logo (λογότυπο)");?>
    </div>
    </div></div>       
	
	<?php 
}
	?>
	<div style="display:table; margin: 0 auto;"><div>
	<div class="admin_label">
    <input name="attach" type="submit" class="btn btn-success" id="attach" value="<?php echo t("Επισύναψη");?>">
	<input name="writedata" type="hidden" id="writedata" value="1">
	<input name="linkID" type="hidden" id="linkID" value="<?php  echo $linkID;?>">
	<input name="fileID" type="hidden" id="fileID" value="<?php  echo $row->id;?>">
	<input name="action" type="hidden" id="action" value="add">
	<input name="sectionID" type="hidden" id="sectionID" value="<?php  echo $sectionID;?>">
    </div>
	</div></div>
	</div>
	</form>
	<?php 
}


   if($_REQUEST['bank_action'] == "add" && empty($_REQUEST['writedata'])){
	   
	$header=t("ΠΡΟΣΘΗΚΗ ΑΡΧΕΙΟΥ ΑΠΟ ΤΟΝ ΥΠΟΛΟΓΙΣΤΗ ΣΑΣ");
	 ?>
	<div class="section_title"><?php echo $header;?></div>   
      <form method="post" enctype="multipart/form-data" name="addFile" id="addFile">
        <div class="normal">
        
        
        <div style="display:table; margin: 0 auto;"><div>       
		<div class="admin_label"><?php echo t("Επιλέξτε αρχείο");?>: </div>
		<div style="clear:both;"><input name="file" type="file" class="listbox" id="file" style="width:90%; min-width:200px"></div>
        </div></div>
        
        <div style="display:table; margin: 0 auto;"><div>       
		<div class="admin_label"><?php echo t("Τίτλος (προαιρετικά)");?>: </div>
		<div style="clear:both;"><input name="title" type="text" class="listbox" id="title" style="width:90%; min-width:200px"></div>
        </div></div>  
        
        <div style="display:table; margin: 0 auto;"><div>
        <div class="admin_label">
        <div style="float:left;"><input name="attach" type="checkbox" value="1" checked="checked"></div>
        <?php echo t("Να επισυναφθεί αυτόματα το αρχείο στην τρέχουσα καταχώρηση");?>
        </div>
        </div></div>
              
        <div style="display:table; margin: 0 auto; text-align:center"><div>
        <div style="clear:both;">        	
        	<input name="sbmt" type="submit" class="btn btn-success" id="sbmt" value="<?php echo t("Προσθήκη");?>" style="margin:2px;">
			<input type="button" class="btn btn-inverse" value="<?php echo t("Ακύρωση & επιστροφή");?>" style="margin:2px;" onclick="window.history.back()">
			<input name="bank_action" type="hidden" id="action" value="<?php  echo $_REQUEST['bank_action'];?>">
            <input name="linkID" type="hidden" value="<?php  echo (int)$_REQUEST['linkID'];?>">
            <input name="userID" type="hidden" value="<?php  echo $userID;?>">
            <input name="u" type="hidden" value="<?php  echo $u;?>">
            <input name="sectionID" type="hidden" value="<?php  echo (int)$_REQUEST['sectionID'];?>">
			<input name="writedata" type="hidden" id="writedata" value="1">            
        </div>
        </div></div>       
        
        
        <div style="float:left">
        
        
        <div style="display:table; margin: 10px auto; text-align:center; max-width:400px"><div>       
		<div style="clear:both;"><?php echo t("Επιτρεπτοί τύποι αρχείων είναι οι ακόλουθοι");?>: </div>
        
<?php 
$fres = $db->query("select * from filetypes where 1");
$frows = $db->getRows($fres);
foreach($frows as $frow){
?>
              <img src="<?php echo $rootPath;?>mediabank/icons/filetype_<?php  echo $frow->extension;?>.gif" alt="<?php  echo $frow->title;?>" title="<?php  echo $frow->title;?>" style="float:left; margin:6px;">
<?php 
}
?>        
         </div></div>       
        </div>

		  
            

			<div class="normal" style="margin-top:20px; float:left">
                <div style="display:table; margin: 10px auto; text-align:left; max-width:400px">
                    <div>
                        <strong><?php echo t("Οι τρέχουσες ρυθμίσεις εικόνων απαιτούν");?></strong><br><br>
                        <?php echo t("Μέγιστο πλάτος σε pixels");?>: <?php  echo $parameters->getParameter('max_image_width');?><br><br>
                        <?php echo t("Μέγιστο ύψος σε pixels");?>: <?php  echo $parameters->getParameter('max_image_height')?><br><br>
                        <div class="tip">
                            <?php echo t("Σε περίπτωση που επιλέξετε μια εικόνα με μεγαλύτερες διαστάσεις, το σύστημα θα τις μετατρέψει αυτόματα στην καλύτερη δυνατή επιλογή ύψους - πλάτους, διατηρώντας την αναλογία της εικόνας χωρίς παραμορφώσεις");?>   
                        </div>         
                        </div>
                    </div>
              </div>
        </div>
      </form>
      <?php 
}

if($_REQUEST['bank_action'] == "add" && (isset($_REQUEST['writedata']))){
	$file=$_FILES['file']['name'];
	$ext = $fileSystem->getExtensionByFileName($file);
	$filetypeID = $fileSystem->isValidExtension($ext);
	if($filetypeID){
		$title = ($title) ? $title : $file;
		$title = str_replace('"', '&#034;', str_replace("'", "&#039;", $title));
		$tags = null;
		$db->query("INSERT INTO mediabank VALUES(null,'$title','$tags','$filetypeID','$userID')");
		$id=$db->lastID();
		$path= $rootPath."uploads/";
		$currentFile = $path.$id.".".$ext;
		if($fileSystem->isImageExtension($ext)){
			move_uploaded_file ($_FILES['file']['tmp_name'], $currentFile);
			$imageResize = new imageResize($id, $ext, $path);
		}else{ // it's a non-image valid file, Just upload it!
			move_uploaded_file ($_FILES['file']['tmp_name'], $currentFile);
			$sourceFile = $path.$id.".".$ext;
			$destinationFile =$id.".".$ext;
			$fileSystem->copyToMediabank($sourceFile, $destinationFile );			
		}
		$fileSystem->deleteUploadedFiles($id, $path);
	}else{
		$messages->addError(t("Ο τύπος αρχείου")." [".$ext."] ".t("δεν υποστηρίζεται")."!");
	}
	if($messages->hasErrors){
		$messages->printSystemMessages();
	}else{
		if($attach && $linkID){
			?>
			<script>document.location.href="?action=add&sectionID=<?php echo $sectionID;?>&u=<?php echo $u;?>&linkID=<?php echo $linkID;?>&fileID=<?php echo $id;?>"</script>
			<?php
		}else{
		?>
		<script>document.location.href="?action=add&presults=10&u=<?php echo $u;?>&sectionID=<?php echo $sectionID;?>&section=<?php echo $system->getTableSectionName($sectionID);?>&linkID=<?php echo $linkID;?>&option=option2";</script>
		<?php
		}
	}
}



}
?>
</body>
</html>
