Location: PHPKode > projects > ZompLog > admin/editor.php
<?php
ob_start();
include_once("functions.php");
include('config.php');
include("session.php");

// this setting activates tinyMCE for all textareas in the page
$set_mce = 1;
include("header.php");

$user = loadUser($_SESSION['login'],$link,$table_users);
$entry = loadEntry($link,$table);

if(!$_SESSION["loggedIn"]){
?>

You are not allowed to view this page, please log in first.
<?php
}
else
{


if($_POST['Submit']){

//another dirty date hack
$publishdate = "$_POST[year]" . "$_POST[month]" . "$_POST[day]" . "$_POST[hours]" . "$_POST[minutes]" . "00";

// expirydate
//  create expirydate
$expirydate = $_POST[expiryyear] . $_POST[expirymonth] . $_POST[expiryday] . $_POST[expiryhour] . $_POST[expiryminute];
if ( $expirydate
 AND ((!$_POST[expiryyear])
 OR  (!$_POST[expirymonth])
 OR  (!$_POST[expiryday])
 OR  (!$_POST[expiryhour])
 OR  (!$_POST[expiryminute]))) {
$messages[]="$lang_no_expirydate";
}
if (!$expirydate) {
	$expirydate = "99999999999999";
} else {
	$expirydate = $expirydate . "99";
}

// check dates for validity
if (!checkdate($_POST[month],$_POST[day],$_POST[year]) ) {
	$messages[]="$lang_false_publishdate";
}
if (($_POST[expiryyear]) AND (!checkdate ($_POST[expirymonth],$_POST[expiryday],$_POST[expiryyear]))) {
	$messages[]="$lang_false_expirydate";
}

// expiry date must be later than startdate
if ($publishdate >= $expirydate) {
$messages[]="$lang_wrong_date_order";
}

if(!$_POST[title])
{
$messages[]="$lang_enter_title";
}

if(strlen($_POST[day]) != 2) { 
$messages[]="$lang_message038"; 
} 

if($_POST[day] > 31){
$messages[]="$lang_message039";
}

if(strlen($_POST[month]) != 2) { 
$messages[]="$lang_message040"; 
} 

if($_POST[month] > 12){
$messages[]="$lang_message041";
}

if(strlen($_POST[year]) != 4) { 
$messages[]="$lang_message042"; 
} 

if($_POST[year] > 2038){
$messages[]="$lang_message043";
}

if($_POST[year] < 1971){
$messages[]="$lang_message044";
}

if(strlen($_POST[hours]) != 2) { 
$messages[]="$lang_message045"; 
} 

if(strlen($_POST[minutes]) != 2) { 
$messages[]="$lang_message046"; 
} 

 // upload script
include("upload_files.php");



if(empty($messages)) {


foreach($HTTP_POST_VARS[deletefile] as $delete){
// delete images/files that belong to this post
$query = mysql_query("DELETE FROM $table_files WHERE id = $delete LIMIT 1");
}

    editEntry($link,$table,$image,$imagewidth,$imageheight,$publishdate,$entry[id],$expirydate);
	
  
foreach ($aBestanden as $sFilename => $sFiletype) 
{ 
if($sFiletype == 'image/jpeg' || $sFiletype == 'image/pjpeg' || $sFiletype == 'image/gif'){
$imgsize = getimagesize("../upload/$sFilename");
$query = "INSERT INTO $table_files (entry_id, name, type, width, height) VALUES ('". $entry[id] . "', '". $sFilename . "', '". $sFiletype . "', '". $imgsize[0] . "', '". $imgsize[1] . "')";  
$result=mysql_query($query, $link) or die("Died inserting info into db.  Error returned if any: ".mysql_error());	
}
else
{
$query = "INSERT INTO $table_files (entry_id, name, type) VALUES ('". $entry[id] . "', '". $sFilename . "', '". $sFiletype . "')";  
$result=mysql_query($query, $link) or die("Died inserting info into db.  Error returned if any: ".mysql_error());	
}
}

if($_POST[media_url]){
$query = "UPDATE $table_files SET name = '". $_POST[media_url] . "', type = '". $_POST[type] . "', full_url = '1' WHERE entry_id = '$entry[id]' AND full_url = '1'";  
$result=mysql_query($query, $link) or die("Died inserting info into db.  Error returned if any: ".mysql_error());	
}

$q = "SELECT * FROM $table_files WHERE entry_id = '$entry[id]' AND type = 'embed'";
$result=mysql_query($q, $link) or die("Died.  Error returned if any: ".mysql_error());	
$num = mysql_num_rows($result);

if($_POST[embed]){
	if($num > 0){
	$query = "UPDATE $table_files SET full_url = '$_POST[embed]' WHERE entry_id = '$entry[id]' AND type = 'embed' LIMIT 1";  
	$result=mysql_query($query, $link) or die("Died inserting info into db.  Error returned if any: ".mysql_error());	
	}
	else
	{
	$query = "INSERT INTO $table_files (entry_id, full_url, type) VALUES ('". $entry[id] . "', '". $_POST[embed] . "', 'embed')";  
	$result=mysql_query($query, $link) or die("Died inserting login info into db.  Error returned if any: ".mysql_error());	
	}
}
elseif($_POST[embed] == '' && $num > 0)
{
$query = mysql_query("DELETE FROM $table_files WHERE entry_id = $entry[id] AND type = 'embed' LIMIT 1");
}

	
$hook = 'editentry-submit';
include("loadplugins.php");	

header("Location: editor.php?id=$entry[id]&message=2");
ob_end_flush();

	}


}


// another gerben timestamp hack
	  $day = substr($entry['date'], 6, 2);
	  $month = substr($entry['date'], 4, 2);
	  $year = substr($entry['date'], 0, 4);
	  $hours = substr($entry['date'], 8, 2);
	  $minutes = substr($entry['date'], 10, 2);

//  cut up expiry date
	if ($entry['expirydate'] == "99999999999999") {
		$curr_expiryyear = "";
		$curr_expirymonth = "";
		$curr_expiryday = "";
		$curr_expiryhour = "";
		$curr_expiryminute = "";
	} else {
		$curr_expiryyear = substr($entry['expirydate'], 0, 4);
		$curr_expirymonth = substr($entry['expirydate'], 4, 2);
		$curr_expiryday = substr($entry['expirydate'], 6, 2);
		$curr_expiryhour = substr($entry['expirydate'], 8, 2);
		$curr_expiryminute = substr($entry['expirydate'], 10, 2);
	}

?>

<div id="submenu"><a href="newentry.php" class="sub"><?php echo "$lang_newentry"; ?></a> | <a href="entry.php" class="sub"><?php echo "$lang_edit_delete"; ?></a><?php if($user[admin]){ ?> | <a href="comments.php" class="sub"><?php echo "$lang_manage_comments"; ?></a> | <a href="category.php" class="sub"><?php echo "$lang_manage_categories"; ?></a><?php } ?></div>


<div id="side">
<div class="title">&nbsp;</div>
<div class="box"><?php
if(!empty($messages)){
	displayErrors($messages);
}

elseif($_GET[message] && empty($messages)){
displayMessage($_GET[message]);
  }

else{
echo "$lang_message047";
}  
  
?>
</div>
<br />
<div class="box"><img src="icons/hourglass.png" alt="<?php echo "$lang_not_published"; ?>" title="<?php echo "$lang_not_published"; ?>"width="16" height="16" align="absmiddle" /> <?php echo "$lang_not_published"; ?><br />
<img src="icons/delete.png" alt="<?php echo "$lang_expired"; ?>" title="<?php echo "$lang_expired"; ?>" width="16" height="16" align="absmiddle" /> <?php echo "$lang_expired"; ?>
</div>

</div>


<div id="main">

<form name="editform" method="post" enctype="multipart/form-data">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="text">
        <tr>
          <td width="500"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><h1><?php echo "$lang_edit"; ?></h1></td>
    <td><input type="submit" name="Submit" value="<?php echo"$lang_submit"; ?>" id="button"></td>
  </tr>
</table></td>
        </tr>
        
        <tr>
          <td><input name="id" type="hidden" id="id" value="<?php echo "$_GET[id]"; ?>"></td>
        </tr>
        <tr>
          <td valign="top">
		  
		  <fieldset id="titlediv">
      <legend><?php echo "$lang_title"; ?></legend> <input name="title" type="text" value="<?php echo "$entry[title]"; ?>" size="30"><?php if($entry[teaser]){
	?>
                  <input name="teaser" type="checkbox" value="1" checked="checked" />
                  <?php
	}
	else
	{
	?>
                  <input name="teaser" type="checkbox" value="1" />
                  <?php
	}
	echo "$lang_teaser";
    
// determine status: not yet published / expired
$rev_datetime  = date('YmdHis');

 ?>

	  </fieldset>			</td>
      </tr>
        <tr>
          <td valign="top">
      <a name="dateoptions" id="dateoptions"></a>
          <div class="text" onclick="expandcontent(this, 'sc1')" style="cursor:hand; cursor:pointer">
            <div align="right"> <a href="#dateoptions"><span class="showstate"></span><?php echo "$lang_date_options"; ?></a></div>
          </div>
        <div id="sc1" class="switchcontent">
		  	  <fieldset id="titlediv">
      <legend><?php echo "$lang_publicationdates"; ?></legend>
        <? echo "<strong>$lang_publishdate</strong>"; ?><br />
<select name="day">
    <option value="<?php echo "$day"; ?>" selected="selected"><?php echo "$day"; ?></option>
    <option value="01">01</option>
    <option value="02">02</option>
    <option value="03">03</option>
    <option value="04">04</option>
    <option value="05">05</option>
    <option value="06">06</option>
    <option value="07">07</option>
    <option value="08">08</option>
    <option value="09">09</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
    <option value="13">13</option>
    <option value="14">14</option>
    <option value="15">15</option>
    <option value="16">16</option>
    <option value="17">17</option>
    <option value="18">18</option>
    <option value="19">19</option>
    <option value="20">20</option>
    <option value="21">21</option>
    <option value="22">22</option>
    <option value="23">23</option>
    <option value="24">24</option>
    <option value="25">25</option>
    <option value="26">26</option>
    <option value="27">27</option>
    <option value="28">28</option>
    <option value="29">29</option>
    <option value="30">30</option>
    <option value="31">31</option>
</select>
            
<select name="month">
    <option value="<?php echo "$month"; ?>" selected="selected"><?php echo "$month"; ?></option>
    <option value="01">01</option>
    <option value="02">02</option>
    <option value="03">03</option>
    <option value="04">04</option>
    <option value="05">05</option>
    <option value="06">06</option>
    <option value="07">07</option>
    <option value="08">08</option>
    <option value="09">09</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
</select>

<select name="year">  
<option value="<?php echo "$year"; ?>" selected="selected"><?php echo "$year"; ?></option>
    <option value="2008">2008</option>
    <option value="2009">2009</option>
    <option value="2010">2010</option>
    <option value="2011">2011</option>
    <option value="2012">2012</option>
    <option value="2013">2013</option>
    <option value="2014">2014</option>
    <option value="2015">2015</option>
    <option value="2016">2016</option>
    <option value="2017">2017</option>
    <option value="2018">2018</option>
</select>

<?php echo "&nbsp;&nbsp;"; ?>
<select name="hours">
    <option value="<?php echo "$hours"; ?>" selected="selected"><?php echo "$hours"; ?></option>
    <option value="00">00</option>
    <option value="01">01</option>
    <option value="02">02</option>
    <option value="03">03</option>
    <option value="04">04</option>
    <option value="05">05</option>
    <option value="06">06</option>
    <option value="07">07</option>
    <option value="08">08</option>
    <option value="09">09</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
    <option value="13">13</option>
    <option value="14">14</option>
    <option value="15">15</option>
    <option value="16">16</option>
    <option value="17">17</option>
    <option value="18">18</option>
    <option value="19">19</option>
    <option value="20">20</option>
    <option value="21">21</option>
    <option value="22">22</option>
    <option value="23">23</option>
</select>
<?php echo "$lang_hour&nbsp;&nbsp;"; ?>

<select name="minutes">
    <option value="<?php echo "$minutes"; ?>" selected="selected"><?php echo "$minutes"; ?></option>
    <option value="00">00</option>
    <option value="01">01</option>
    <option value="02">02</option>
    <option value="03">03</option>
    <option value="04">04</option>
    <option value="05">05</option>
    <option value="06">06</option>
    <option value="07">07</option>
    <option value="08">08</option>
    <option value="09">09</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
    <option value="13">13</option>
    <option value="14">14</option>
    <option value="15">15</option>
    <option value="16">16</option>
    <option value="17">17</option>
    <option value="18">18</option>
    <option value="19">19</option>
    <option value="20">20</option>
    <option value="21">21</option>
    <option value="22">22</option>
    <option value="23">23</option>
    <option value="24">24</option>
    <option value="25">25</option>
    <option value="26">26</option>
    <option value="27">27</option>
    <option value="28">28</option>
    <option value="29">29</option>
    <option value="30">30</option>
    <option value="31">31</option>
    <option value="32">32</option>
    <option value="33">33</option>
    <option value="34">34</option>
    <option value="35">35</option>
    <option value="36">36</option>
    <option value="37">37</option>
    <option value="38">38</option>
    <option value="39">39</option>
    <option value="40">40</option>
    <option value="41">41</option>
    <option value="42">42</option>
    <option value="43">43</option>
    <option value="44">44</option>
    <option value="45">45</option>
    <option value="46">46</option>
    <option value="47">47</option>
    <option value="48">48</option>
    <option value="49">49</option>
    <option value="50">50</option>
    <option value="51">51</option>
    <option value="52">52</option>
    <option value="53">53</option>
    <option value="54">54</option>
    <option value="55">55</option>
    <option value="56">56</option>
    <option value="57">57</option>
    <option value="58">58</option>
    <option value="59">59</option>
</select>
<?php echo "$lang_minutes"; ?>
<?php if ($entry[date] > $rev_datetime) {
	echo "&nbsp;<img src='icons/hourglass.png' alt='$lang_not_published' title='$lang_not_published' align='absmiddle' >";
} ?>
<br />
<br />

<? echo "<strong>$lang_expirydate</strong>"; ?><br />
<select name="expiryday" type="text" id="expiryday"> 
    <option value="<? echo "$curr_expiryday"; ?>" selected="selected"><? echo "$curr_expiryday"; ?></option>
    <option value=""></option>
    <option value="01">01</option>
    <option value="02">02</option>
    <option value="03">03</option>
    <option value="04">04</option>
    <option value="05">05</option>
    <option value="06">06</option>
    <option value="07">07</option>
    <option value="08">08</option>
    <option value="09">09</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
    <option value="13">13</option>
    <option value="14">14</option>
    <option value="15">15</option>
    <option value="16">16</option>
    <option value="17">17</option>
    <option value="18">18</option>
    <option value="19">19</option>
    <option value="20">20</option>
    <option value="21">21</option>
    <option value="22">22</option>
    <option value="23">23</option>
    <option value="24">24</option>
    <option value="25">25</option>
    <option value="26">26</option>
    <option value="27">27</option>
    <option value="28">28</option>
    <option value="29">29</option>
    <option value="30">30</option>
    <option value="31">31</option>
</select>

<select name="expirymonth" type="text" id="expirymonth">
    <option value="<? echo "$curr_expirymonth"; ?>" selected="selected"><? echo "$curr_expirymonth"; ?></option>
    <option value=""></option>
    <option value="01">01</option>
    <option value="02">02</option>
    <option value="03">03</option>
    <option value="04">04</option>
    <option value="05">05</option>
    <option value="06">06</option>
    <option value="07">07</option>
    <option value="08">08</option>
    <option value="09">09</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
</select>

<select name="expiryyear" type="text" id="expiryyear">
<option value="<? echo "$curr_expiryyear"; ?>" selected="selected"><? echo "$curr_expiryyear"; ?></option>
<option value=""></option>
    <option value="2008">2008</option>
    <option value="2009">2009</option>
    <option value="2010">2010</option>
    <option value="2011">2011</option>
    <option value="2012">2012</option>
    <option value="2013">2013</option>
    <option value="2014">2014</option>
    <option value="2015">2015</option>
    <option value="2016">2016</option>
    <option value="2017">2017</option>
    <option value="2018">2018</option>
</select>

<?php echo "&nbsp;&nbsp;"; ?>
<select name="expiryhour" type="text" id="expiryhour">
<option value="<? echo "$curr_expiryhour"; ?>" selected="selected"><? echo "$curr_expiryhour"; ?></option>
<option value=""></option>
    <option value="00">00</option>
    <option value="01">01</option>
    <option value="02">02</option>
    <option value="03">03</option>
    <option value="04">04</option>
    <option value="05">05</option>
    <option value="06">06</option>
    <option value="07">07</option>
    <option value="08">08</option>
    <option value="09">09</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
    <option value="13">13</option>
    <option value="14">14</option>
    <option value="15">15</option>
    <option value="16">16</option>
    <option value="17">17</option>
    <option value="18">18</option>
    <option value="19">19</option>
    <option value="20">20</option>
    <option value="21">21</option>
    <option value="22">22</option>
    <option value="23">23</option>
</select>
<?php echo "$lang_hour&nbsp;&nbsp;"; ?>

<select name="expiryminute" type="text" id="expiryminute">
<option value="<? echo "$curr_expiryminute"; ?>" selected="selected"><? echo "$curr_expiryminute"; ?></option>
<option value=""></option>
    <option value="00">00</option>
    <option value="01">01</option>
    <option value="02">02</option>
    <option value="03">03</option>
    <option value="04">04</option>
    <option value="05">05</option>
    <option value="06">06</option>
    <option value="07">07</option>
    <option value="08">08</option>
    <option value="09">09</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
    <option value="13">13</option>
    <option value="14">14</option>
    <option value="15">15</option>
    <option value="16">16</option>
    <option value="17">17</option>
    <option value="18">18</option>
    <option value="19">19</option>
    <option value="20">20</option>
    <option value="21">21</option>
    <option value="22">22</option>
    <option value="23">23</option>
    <option value="24">24</option>
    <option value="25">25</option>
    <option value="26">26</option>
    <option value="27">27</option>
    <option value="28">28</option>
    <option value="29">29</option>
    <option value="30">30</option>
    <option value="31">31</option>
    <option value="32">32</option>
    <option value="33">33</option>
    <option value="34">34</option>
    <option value="35">35</option>
    <option value="36">36</option>
    <option value="37">37</option>
    <option value="38">38</option>
    <option value="39">39</option>
    <option value="40">40</option>
    <option value="41">41</option>
    <option value="42">42</option>
    <option value="43">43</option>
    <option value="44">44</option>
    <option value="45">45</option>
    <option value="46">46</option>
    <option value="47">47</option>
    <option value="48">48</option>
    <option value="49">49</option>
    <option value="50">50</option>
    <option value="51">51</option>
    <option value="52">52</option>
    <option value="53">53</option>
    <option value="54">54</option>
    <option value="55">55</option>
    <option value="56">56</option>
    <option value="57">57</option>
    <option value="58">58</option>
    <option value="59">59</option>
</select>
<?php echo "$lang_minutes"; ?>
<?php if ($entry[expirydate] < $rev_datetime) {
	echo "&nbsp;<img src='icons/delete.png' alt='$lang_expired' title='$lang_expired' align='absmiddle' >";
} ?>

	  	    </fieldset>
            </div></td>
        </tr>
        <tr>
          <td valign="top">&nbsp;</td>
        </tr>
        <tr>
          <td valign="top">
		   <fieldset id="titlediv">
      <legend><?php echo "$lang_text"; ?></legend>
		  
		  		  <?php
		  // present safari users with a different editor
		  $a_browser_data = browser_detection('full');
if ( $a_browser_data[0] == 'saf' || !$settings[use_tinymce])
{
?>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
<tr>
          <td width="34%" class="title">&nbsp;</td>
          <td width="66%">
	<input type="button" class="button" value="<?php echo"$lang_bold"; ?>" name="bold2" onmousedown="javascript:tag_construct('bold','text'); return false;"/>
              <input type="button" class="button" value="<?php echo"$lang_italic"; ?>" name="italic2" onmousedown="javascript:tag_construct('italic','text'); return false;"/>
              <input type="button" class="button" value="<?php echo"$lang_underline"; ?>" name="underline2" onmousedown="javascript:tag_construct('underline','text'); return false;"/>
              <input type="button" class="button" value="<?php echo"$lang_url"; ?>" name="url2" onmousedown="javascript:tag_construct('link','text'); return false;"/>
              <input type="button" class="button" value="<?php echo"$lang_img"; ?>" name="img2" onmousedown="javascript:tag_construct('image','text'); return false;"/> 
			 <input type="button" class="button" value="<?php echo"$lang_email"; ?>" name="email2" onmousedown="javascript:tag_construct('email','text'); return false;"/> 
		      </td>
        </tr>		
		 </table>	  
<?			  
}

?>
<textarea name="text" cols="75" rows="20" id="text"><?php echo "$entry[text]"; ?></textarea>
		   </fieldset></td>
        </tr>
        
        <tr>
          <td>
		     <a name="extended"></a><div class="text" onClick="expandcontent(this, 'sc2')" style="cursor:hand; cursor:pointer">
      <div align="right"><a href="#extended"><span class="showstate"></span><?php echo"$lang_options"; ?></a></div>
    </div>
      <div id="sc2" class="switchcontent">
<fieldset id="titlediv">
      <legend><?php echo "$lang_extended"; ?></legend> 
	  		  <?php
		  // present safari users with a different editor
		  $a_browser_data = browser_detection('full');
if ( $a_browser_data[0] == 'saf' || !$settings[use_tinymce])
{
?>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
<tr>
          <td width="34%" class="title">&nbsp;</td>
          <td width="66%">
<input type="button" class="button" value="<?php echo"$lang_bold"; ?>" name="bold" onMouseDown="javascript:tag_construct('bold','extended'); return false;"/>
            <input type="button" class="button" value="<?php echo"$lang_italic"; ?>" name="italic" onMouseDown="javascript:tag_construct('italic','extended'); return false;"/>
            <input type="button" class="button" value="<?php echo"$lang_underline"; ?>" name="underline" onMouseDown="javascript:tag_construct('underline','extended'); return false;"/>
            <input type="button" class="button" value="<?php echo"$lang_url"; ?>" name="url" onMouseDown="javascript:tag_construct('link','extended'); return false;"/>
            <input type="button" class="button" value="<?php echo"$lang_img"; ?>" name="img" onMouseDown="javascript:tag_construct('image','extended'); return false;"/> 
			<input type="button" class="button" value="<?php echo"$lang_email"; ?>" name="email" onmousedown="javascript:tag_construct('email','text'); return false;"/>
			
			</td>
        </tr>		
		 </table>	  
<?			  
}

?>		 
	  <textarea name="extended" rows="20" cols="75" id="extended"><?php echo "$entry[extended]"; ?></textarea>
</fieldset>
      </div></td>
        </tr>
</table>

	<?php
	$hook = 'editentry-field-text';
	include("loadplugins.php");
	?>
	

 
	  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="text">

<?php 

$query = "SELECT * FROM $table_files WHERE entry_id = '$entry[id]' AND full_url = '' ORDER BY fileorder ASC";
$result = mysql_query($query, $link);
$numrows = mysql_num_rows($result);
if($numrows){
?>

<tr><td>

		  	     <fieldset id="titlediv">
      <legend><?php echo "$lang_curr_img_file";?></legend>
	<table width="50%" border="0" cellspacing="0" cellpadding="0">
<?php
while($row = mysql_fetch_array($result)){
if($row[type] == 'image/jpeg' || $row[type] == 'image/pjpeg' || $row[type] == 'image/gif'){
echo "  <tr><td><img src='../upload/thumbnail.php?gd=2&src=$row[name]&maxw=100' border='0'></td><td><a href='schredder.php?tablename=$table_files&amp;fileid=$row[id]&amp;id=$entry[id]'>$lang_delete</a> </td></tr><tr><td>&nbsp;</td></tr>";
}
else
{
// fix to get the real name of the file
$name = substr($row[name],13);
$filename = urlencode($row[name]);
echo "<tr><td><a href='../upload/force_download.php?file=$filename&amp;type=$row[type]'>$name</a></td><td><a href='schredder.php?tablename=$table_files&amp;fileid=$row[id]&amp;id=$entry[id]'>$lang_delete</a></td></tr><tr><td>&nbsp;</td></tr>";
}
}


?>

</table>
</fieldset>





		
		<div style="float: right;"><a href="reorder.php?id=<?php echo $entry['id']?>"><?php echo "$lang_reorder_img_file"; ?></a></div>
		
	<?php } 
	
	?>	
	</tr></td>
        <tr>
          <td>&nbsp;</td>
        </tr>
	
        <?php if($settings[use_upload]){ ?>
        
          <tr>
          <td><?php include("file_manager_include.php"); ?></td>
        </tr>
        <tr>
          <td>
	
		     <fieldset id="titlediv">
      <legend><?php echo "$lang_upload_img_file"; ?></legend>	  


        <input id="my_file_element" type="file" value="1" name="file_1" \ />
        <div id="files_list"></div>
<script>
	<!-- Create an instance of the multiSelector class, pass it the output target and the max number of files -->
	var multi_selector = new MultiSelector( document.getElementById( 'files_list' ), 20 );
	<!-- Pass in the file element -->
	multi_selector.addElement( document.getElementById( 'my_file_element' ) );
</script>

</fieldset></td></tr>		
	
<tr>
      <td><div class="text" onclick="expandcontent(this, 'sc3')" style="cursor:hand; cursor:pointer">
          <div align="right"><a name="upload" id="upload"></a><a href="#upload"><span class="showstate"></span><?php echo"$lang_options"; ?></a></div>
      </div>
          <div id="sc3" class="switchcontent">
            <p>
	        <table width="100%" style='border: #CCCCCC solid; border-width: 5px 1px 1px 1px; padding: 5px 5px 5px 5px;'>
              <tr>
                <td width="17%">
			<?php echo "$lang_jpeg_gif"; ?></td><td width="26%"><input name="thumbnail" type="checkbox" value="1" checked="checked" /> 
        <?php echo "$lang_thumbnails"; ?></td>
			<td width="57%"><?php echo "$lang_mediafile"; ?></td>
              </tr>
		<tr>
		  <td>
		<?php echo "$lang_mp3_mov"; ?></td><td><input name="podcast" type="checkbox" id="podcast" value="1" checked="checked" /> 
        <?php echo "$lang_podcast"; ?></td>
		<td>
		<?php
		$query = "SELECT* FROM $table_files WHERE entry_id = '$entry[id]' AND full_url != ''";
		$result = mysql_query($query,$link);
		$media = mysql_fetch_array($result);
		$media_url = $media[name];
		$media_type = $media[type];
		$full_url = $media[full_url];
		
		?>
		<input name="media_url" type="text" size="25" value="<?php echo $media_url?>" />
		  <select name="type">
            <option value="audio/mp3" <?php if($media_type == 'audio/mp3'){ echo 'selected="selected"'; } ?>>Mp3</option>
            <option value="video/quicktime" <?php if($media_type == 'video/quicktime'){ echo 'selected="selected"'; } ?>>Quicktime</option>
            <option value="video/x-ms-wmv" <?php if($media_type == 'video/x-ms-wmv'){ echo 'selected="selected"'; } ?>>Windows media</option>
			  <option value="video/youtube" <?php if($media_type == 'video/youtube'){ echo 'selected="selected"'; } ?>>YouTube Movie</option>
          </select></td>
		</tr>
        <tr>
		        <td colspan="3">Embed code for Youtube, Myspace, Vimeo, etc:</td>
	          </tr>
		      <tr>
		        <td colspan="3">
               <?php if($media_type == 'embed'){ ?>
   <script type="text/javascript">
	// insert embed code through javascript, otherwise the movie gets loaded
				function ShowEmbed() { javascript:document.editform.embed.value='<?php echo $full_url; ?>' }
				
				
			</script>             
            <?php } ?>
            
            <img src="icons/stats.jpg" onload="ShowEmbed();" style="display: none;" /> <?php // hackish, I know, but I can't get the javascript to load otherwise ?>
  <input name="embed" type="text" size="70" /></td>
	          </tr>
	        </table>
            </p>
        </div></td>
    </tr>
	   
		
		<?php } ?>
		
		</table>

	<?php
	$hook = 'editentry-field-upload';
	include("loadplugins.php");
	?>
 
	  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="text">
       
        <tr>
          <td>&nbsp;</td>
        </tr>
        <?php
	}
  if($settings[categories]){
  ?>
        
        <tr>
          <td>
		  
		      <fieldset id="titlediv">
      <legend><?php echo "$lang_category"; ?></legend>	  
		  
		  <select name="catid" size="1"
 onChange="setOptions(document.myform.catid.options[document.myform.catid.selectedIndex].value);">
              <?php
 $query = "SELECT * FROM $table_cat WHERE id = $entry[catid]";
$result = mysql_query ($query, $link) or die("Died getting info from db.  Error returned if any: ".mysql_error());
$chosencat = mysql_fetch_array($result,MYSQL_ASSOC);

 if(!$chosencat){
  ?>
              <option value="0" selected="selected"><?php echo "$lang_choosemaincat" ?></option>
              <?php
 }
 else
 {
 ?>
              <option value="<?php echo "$entry[catid]"; ?>" selected="selected"><?php echo "$chosencat[name]"; ?></option>
              <?php
		}
$query = "SELECT * FROM $table_cat WHERE id != $entry[catid]";
$result = mysql_query ($query, $link) or die("Died getting info from db.  Error returned if any: ".mysql_error());
$categories = arrayMaker($result,MYSQL_ASSOC);
foreach ($categories as $cat){

echo '<option value="'.$cat["id"].'">'.$cat["name"].'</option>';
}
?>
            </select>
              <?php
  }
  ?></fieldset>          </td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
		<tr><td>
			<?php
	$hook = 'editentry-field';
	include("loadplugins.php");
	?>
	</td></tr>
        <tr>
          <td><input type="submit" name="Submit" value="<?php echo"$lang_submit"; ?>" id="button"></td>
        </tr>
      </table>
  </table>
</form>
</div>
<?php
include ("footer.php");
?>
Return current item: ZompLog