<?php
//---[CZ]: ověříme přístup
if ($login->check_access("options")==1):

//---[CZ]: načteme potřebné třídy
include CLASSES_PATH."Options.php";

//---[CZ]: vytvoříme instance
$options=new Options();

//---[CZ]: uložení změn v nastavení
if (isset($_POST["submit"])) { $status_messages->print_success(LANG_ACTION_WAS_SUCCESSFULLY_COMPLETED); }
?>

<h2><?php echo LANG_OPTIONS; ?></h2>

<ul id="tab-bar">
<li<?php if ($_GET["tab"]=="") { echo " class=\"active-item\""; } ?>><a href="./admin.php?function=options"><?php echo LANG_SETTINGS; ?></a></li>
<li<?php if ($_GET["tab"]=="access") { echo " class=\"active-item\""; } ?>><a href="./admin.php?function=options&amp;tab=access"><?php echo LANG_ACCESS; ?></a></li>
<li<?php if ($_GET["tab"]=="meta_tags") { echo " class=\"active-item\""; } ?>><a href="./admin.php?function=options&amp;tab=meta_tags"><?php echo LANG_META_TAGS; ?></a></li>
<li><span class="float-ending"><!-- --></span></li>
</ul>


<?php if ($_GET["tab"]==""): ?>

<form action="./admin.php?function=options" method="post">

<div>

<table>
<tr>
<td style="width: 33%;"><strong><?php echo LANG_LANGUAGE_FILE; ?>:</strong><br />
<select name="lang" style="width: 200px;">
<?php $options->selection($config_variables->get("lang"), "languages"); ?>
</select></td>
<td style="width: 34%;"><strong><?php echo LANG_THEME; ?>:</strong><br />
<select name="theme" style="width: 200px;">
<?php $options->selection($config_variables->get("theme"), "themes"); ?>
</select></td>
<td style="width: 33%;"><strong><?php echo LANG_TEMPLATE; ?>:</strong><br />
<select name="template" style="width: 200px;">
<?php $options->selection($config_variables->get("template"), "templates"); ?>
</select></td>
</tr>
</table>

</div>

<div>

<table>
<tr>
<td style="width: 50%;"><strong><?php echo LANG_SITENAME; ?>:</strong><br /><input type="text" name="sitename" value="<?php echo $config_variables->get("sitename"); ?>" style="width: 300px;" /></td>
<td style="width: 50%;"><strong><?php echo LANG_TABLE_WITH_USERS; ?>:</strong><br /><input type="radio" name="table_users" value="kcms_users"<?php if (TABLE_USERS=="kcms_users") { echo " checked=\"checked\""; } ?> /> kcms_users <input type="radio" name="table_users" value="kboard_users"<?php if (TABLE_USERS=="kboard_users") { echo " checked=\"checked\""; } ?> /> kboard_users</td>
</tr>
</table>

</div>

<div>
<table>
<tr>
<td style="width: 50%;"><strong><?php echo LANG_NEWS; ?> box:</strong><br /><input type="checkbox" name="show_news_box" value="1"<?php if ($config_variables->get("show_news_box")==1) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_SHOW; ?>, <?php echo LANG_NUMBER_OF_ITEMS; ?>: <input type="text" name="news_box_items" value="<?php echo $config_variables->get("news_box_items"); ?>" style="width: 30px;" /></td>
<td style="width: 50%;"><strong><?php echo LANG_IMPORTANT_ARTICLES; ?> box:</strong><br /><input type="checkbox" name="show_promo_box" value="1"<?php if ($config_variables->get("show_promo_box")==1) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_SHOW; ?>, <?php echo LANG_NUMBER_OF_ITEMS; ?>: <input type="text" name="promo_box_items" value="<?php echo $config_variables->get("promo_box_items"); ?>" style="width: 30px;" /></td>
</tr>
</table>
</div>

<div>
<table>
<tr>
<td style="width: 50%;"><strong><?php echo LANG_USERS_MUST_BE_LOGGED_IN_FOR_WRITING_COMMENTS; ?>:</strong><br /><input type="radio" name="login_for_comments" value="1"<?php if ($config_variables->get("login_for_comments")==1) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_YES; ?> <input type="radio" name="login_for_comments" value="0"<?php if ($config_variables->get("login_for_comments")==0) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_NO; ?></td>
<td style="width: 50%;"><strong><?php echo LANG_SHOW_TEXT_OF_THE_ARTICLE_IF_PEREX_IS_NULL; ?>:</strong><br /><input type="radio" name="show_text" value="1"<?php if ($config_variables->get("show_text")==1) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_YES; ?> <input type="radio" name="show_text" value="0"<?php if ($config_variables->get("show_text")==0) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_NO; ?></td>
</tr>
<tr>
<td><strong><?php echo LANG_SORT_SECTIONS_BY_NAME; ?>:</strong><br /><input type="radio" name="sort_sections_by_name" value="1"<?php if ($config_variables->get("sort_sections_by_name")==1) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_YES; ?> <input type="radio" name="sort_sections_by_name" value="0"<?php if ($config_variables->get("sort_sections_by_name")==0) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_NO; ?></td>
<td><strong><?php echo LANG_SORT_IMAGES_BY_NAME; ?>:</strong><br /><input type="radio" name="sort_images_by_name" value="1"<?php if ($config_variables->get("sort_images_by_name")==1) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_YES; ?> <input type="radio" name="sort_images_by_name" value="0"<?php if ($config_variables->get("sort_images_by_name")==0) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_NO; ?></td>
</tr>
<tr>
<td><strong><?php echo LANG_SORT_COMMENTS_FROM_NEWEST; ?>:</strong><br /><input type="radio" name="sort_comments_from_newest" value="1"<?php if ($config_variables->get("sort_comments_from_newest")==1) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_YES; ?> <input type="radio" name="sort_comments_from_newest" value="0"<?php if ($config_variables->get("sort_comments_from_newest")==0) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_NO; ?></td>
<td><strong><?php echo LANG_USE_EMOTICONS; ?>:</strong><br /><input type="radio" name="use_emoticons" value="1"<?php if ($config_variables->get("use_emoticons")==1) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_YES; ?> <input type="radio" name="use_emoticons" value="0"<?php if ($config_variables->get("use_emoticons")==0) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_NO; ?></td>
</tr>
</table>
</div>

<div>
<table>
<tr>
<td style="width: 50%;"><strong><?php echo LANG_NUMBER_OF_ARTICLES_ON_ONE_PAGE; ?>:</strong><br /><input type="text" name="articles_number" value="<?php echo $config_variables->get("articles_number"); ?>" style="width: 30px;" /></td>
<td style="width: 50%;"><strong><?php echo LANG_NUMBER_OF_COMMENTS; ?>:</strong><br /><input type="text" name="comments_number" value="<?php echo $config_variables->get("comments_number"); ?>" style="width: 30px;" /></td>
</tr>
</table>
</div>

<div>
<strong><?php echo LANG_ARTICLE_INFO; ?>:</strong><br />
<table>
<tr>
<td style="width: 50%;"><input type="checkbox" name="show_article_date" value="1"<?php if ($config_variables->get("show_article_date")==1) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_SHOW_DATE; ?></td>
<td style="width: 50%;"><input type="checkbox" name="show_article_section" value="1"<?php if ($config_variables->get("show_article_section")==1) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_SHOW_SECTION; ?></td>
</tr>
<tr>
<td><input type="checkbox" name="show_article_comments_number" value="1"<?php if ($config_variables->get("show_article_comments_number")==1) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_SHOW_COMMENTS_NUMBER; ?></td>
<td><input type="checkbox" name="show_article_views_number" value="1"<?php if ($config_variables->get("show_article_views_number")==1) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_SHOW_VIEWS_NUMBER; ?></td>
</tr>
<tr>
<td><input type="checkbox" name="show_article_author" value="1"<?php if ($config_variables->get("show_article_author")==1) { echo " checked=\"checked\""; } ?> /> <?php echo LANG_SHOW_AUTHOR; ?></td>
<td><!-- --></td>
</tr>
</table>
</div>

<div>

<p><input type="submit" class="greenbutton" name="submit" value="<?php echo LANG_SAVE_CHANGES; ?>" /></p>

</div>

</form>

<?php endif; ?>

<?php if ($_GET["tab"]=="access"): ?>

<form action="./admin.php?function=options&amp;tab=access" method="post">

<div>

<p><strong><?php echo LANG_REQUIRED_RIGHTS_FOR_ACCESS_TO_THE_ADMIN_SECTIONS; ?>:</strong></p>

<table>
<tr>
<td><select name="rights_overview"><?php $options->rights_selection($config_variables->get("rights_overview")); ?></select> <?php echo LANG_OVERVIEW; ?></td>
<td><select name="rights_add_content"><?php $options->rights_selection($config_variables->get("rights_add_content")); ?></select> <?php echo LANG_ADD_CONTENT; ?></td>
<td><select name="rights_my_content"><?php $options->rights_selection($config_variables->get("rights_my_content")); ?></select> <?php echo LANG_MY_CONTENT; ?></td>
</tr>
<tr>
<td><select name="rights_sections"><?php $options->rights_selection($config_variables->get("rights_sections")); ?></select> <?php echo LANG_SECTIONS." & ".LANG_COLUMNS; ?></td>
<td><select name="rights_images"><?php $options->rights_selection($config_variables->get("rights_images")); ?></select> <?php echo LANG_IMAGES; ?></td>
<td><select name="rights_files"><?php $options->rights_selection($config_variables->get("rights_files")); ?></select> <?php echo LANG_FILES; ?></td>
</tr>
<tr>
<td><select name="rights_comments"><?php $options->rights_selection($config_variables->get("rights_comments")); ?></select> <?php echo LANG_COMMENTS; ?></td>
<td><select name="rights_unverified_articles"><?php $options->rights_selection($config_variables->get("rights_unverified_articles")); ?></select> <?php echo LANG_UNVERIFIED_ARTICLES; ?></td>
<td><select name="rights_unpublished_articles"><?php $options->rights_selection($config_variables->get("rights_unpublished_articles")); ?></select> <?php echo LANG_UNPUBLISHED_ARTICLES; ?></td>
</tr>
<tr>
<td><select name="rights_archive"><?php $options->rights_selection($config_variables->get("rights_archive")); ?></select> <?php echo LANG_ARCHIVE; ?></td>
<td><select name="rights_polls"><?php $options->rights_selection($config_variables->get("rights_polls")); ?></select> <?php echo LANG_POLLS; ?></td>
<td><select name="rights_options"><?php $options->rights_selection($config_variables->get("rights_options")); ?></select> <?php echo LANG_OPTIONS; ?></td>
</tr>
<tr>
<td><select name="rights_meta_tags"><?php $options->rights_selection($config_variables->get("rights_meta_tags")); ?></select> <?php echo LANG_META_TAGS; ?></td>
<td><select name="rights_users"><?php $options->rights_selection($config_variables->get("rights_users")); ?></select> <?php echo LANG_USERS; ?></td>
<td><select name="rights_bans"><?php $options->rights_selection($config_variables->get("rights_bans")); ?></select> <?php echo LANG_BANS; ?></td>
</tr>
<tr>
<td><select name="rights_mail_messages"><?php $options->rights_selection($config_variables->get("rights_mail_messages")); ?></select> <?php echo LANG_MAIL_MESSAGES; ?></td>
<td><select name="rights_edit_content"><?php $options->rights_selection($config_variables->get("rights_edit_content")); ?></select> <?php echo LANG_EDIT_CONTENT; ?></td>
<td><!-- --></td>
</tr>
</table>

<p><input type="submit" class="greenbutton" name="submit" value="<?php echo LANG_SAVE_CHANGES; ?>" /></p>

</div>

</form>

<?php endif; ?>

<?php if ($_GET["tab"]=="meta_tags"): ?>

<form action="./admin.php?function=options&amp;tab=meta_tags" method="post">

<div>

<p><strong><?php echo LANG_META_COPYRIGHT; ?>:</strong><br /><input type="text" name="meta_copyright" value="<?php echo htmlspecialchars($config_variables->get("meta_copyright")); ?>" style="width: 700px;" /></p>

<p><strong><?php echo LANG_META_KEYWORDS; ?>:</strong><br /><textarea name="meta_keywords" cols="" rows="" style="width: 700px; height: 100px;"><?php echo $config_variables->get("meta_keywords"); ?></textarea></p>

<p><strong><?php echo LANG_META_DESCRIPTION; ?>:</strong><br /><textarea name="meta_desc" cols="" rows="" style="width: 700px; height: 100px;"><?php echo $config_variables->get("meta_desc"); ?></textarea></p>

<p><input type="submit" name="submit" class="greenbutton" value="<?php echo LANG_SAVE_CHANGES; ?>" /></p>

</div>

</form>

<?php endif; ?>

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