<?php

// tady můžete nastavit práva (1 - 3)
// here you can set the rights (1 - 3)
if ($rights>=3):

?>

<h2><?php echo($lang_publish_articles); ?></h2>

<?php if ($f2==""): ?>

<table>
<tr>
<th><?php echo($lang_form_article_title); ?></th>
<th><?php echo($lang_form_section); ?></th>
<th><?php echo($lang_form_create_date); ?></th>
<th><?php echo($lang_form_author); ?></th>
<th><?php echo($lang_form_confirmed); ?></th>
<th><?php echo($lang_form_options); ?></th>
</tr>
<?php

$print=mysql_query("SELECT id, quick, title, section, confirmed, added, author FROM kcms_articles WHERE published='0' ORDER by added DESC");
while (list($id, $quick, $title, $section, $confirmed, $added, $author) = mysql_fetch_row($print)) {

$section=mysql_query("SELECT name, quick FROM kcms_sections WHERE id='$section'");
$section=mysql_fetch_array($section);

$author=mysql_query("SELECT login, realname FROM kcms_users WHERE id='$author'");
$author=mysql_fetch_array($author);

echo "<tr>
<td><a href=\"/".$section["quick"]."/$quick/\">".stripslashes($title)."</a></td>
<td>".$section["name"]."</td>
<td>".date("d.m.Y, H:i", $added)."</td>
<td><a href=\"/profiles/".$author["login"]."/\">".$author["realname"]."</a></td>
<td>";

if ($confirmed==1) { echo "$lang_yes"; } else { echo "$lang_no"; }

echo "</td>
<td><input type=\"button\" value=\"$lang_button_publish\" onclick=\"parent.location='./admin.php?f=publish_articles&amp;f2=publish&amp;id=$id';\" /> <input type=\"button\" value=\"$lang_button_edit\" onclick=\"parent.location='./admin.php?f=edit_article&amp;id=$id';\" /> <input type=\"button\" value=\"$lang_button_delete\" onclick=\"if (!confirm('$lang_alert_sure')) return false; parent.location='./admin.php?f=publish_articles&amp;a=delete_article&amp;id=$id';\" /></td>
</tr>\n";

}

?>
</table>

<?php endif; if ($f2=="publish" AND $id!=""):

$article=mysql_query("SELECT title, published FROM kcms_articles WHERE id='".addslashes($id)."'");
$article=mysql_fetch_array($article);

if ($article["published"]==0) { $date=getdate(time()); } else { $date=getdate($article["published"]); }

?>

<form action="./admin.php?f=<?php if ($article["published"]==0) { echo "publish_articles"; } else { echo "edit_article"; } ?>&amp;a=publish_article&amp;id=<?php echo($id); ?>" method="post">

<div><strong><?php echo($lang_form_set_release_date." ".stripslashes($article["title"])); ?>:</strong><br /><?php if ($article["published"]!=0) { echo "<input type=\"checkbox\" name=\"cancel\" value=\"1\" /> $lang_form_cancel_publication<br />"; } ?><select name="day">
<?php for ($i=1; $i<=31; $i++) {
echo "<option value=\"$i\"";
if ($date["mday"]==$i) { echo " selected=\"selected\""; }
echo ">$i</option>\n";
}
?>
</select> . <select name="month">
<?php for ($i=1; $i<=12; $i++) {
echo "<option value=\"$i\"";
if ($date["mon"]==$i) { echo " selected=\"selected\""; }
echo ">$i</option>\n";
}
?>
</select> . <select name="year">
<?php for ($i=2000; $i<=2020; $i++) {
echo "<option value=\"$i\"";
if ($date["year"]==$i) { echo " selected=\"selected\""; }
echo ">$i</option>\n";
}
?>
</select> <input type="text" name="hour" value="<?php echo($date["hours"]); ?>" style="width: 20px;" /> : <input type="text" name="minute" value="<?php echo($date["minutes"]); ?>" style="width: 20px;" /> <input type="submit" value="<?php if ($article["published"]==0) { echo($lang_button_publish); } else { echo($lang_button_save); } ?>" /></div>

</form>

<?php endif; else: $access_denied=1; endif; ?>