function form_groupings() { if (s('enable_extras') == 'YES') { if (isset($_GET['id']) && is_numeric($_GET['id']) && !is_null($_GET['id'])) { $extraid = $_GET['id']; $query = mysql_query('SELECT id,name,seftitle,description FROM ' . _PRE . 'extras' . ' WHERE id=' . $extraid); $r = mysql_fetch_array($query); $frm_action = _SITE . '?action=process&task=admin_groupings&id=' . $extraid; $frm_add_edit = l('edit'); $frm_name = $r['name']; $frm_sef_title = $r['seftitle']; $frm_description = $r['description']; $frm_task = 'edit_groupings'; $frm_submit = l('edit'); } else { $frm_action = _SITE . '?action=process&task=admin_groupings'; $frm_add_edit = l('add_groupings'); $frm_name = $_POST['name']; $frm_sef_title = $_POST['name'] == '' ? cleanSEF($_POST['name']) : cleanSEF($_POST['seftitle']); $frm_description = ''; $frm_task = 'add_groupings'; $frm_submit = l('add_groupings'); } echo html_input('form', '', 'post', '', '', '', '', '', '', '', '', '', 'post', $frm_action, ''); echo '<div class="adminpanel">'; echo html_input('fieldset', '', '', '', '', '', '', '', '', '', '', '', '', '', $frm_add_edit); echo html_input('text', 'name', 't', $frm_name, l('name'), '', 'onchange="genSEF(this,document.forms[\'post\'].seftitle)"', 'onkeyup="genSEF(this,document.forms[\'post\'].seftitle)"', '', '', '', '', '', '', ''); echo html_input('text', 'seftitle', 's', $frm_sef_title, l('extra_title'), '', '', '', '', '', '', '', '', '', ''); echo html_input('text', 'description', 'desc', $frm_description, l('description'), '', '', '', '', '', '', '', '', '', ''); echo '</fieldset></div><p>'; echo html_input('hidden', 'task', 'task', 'admin_groupings', '', '', '', '', '', '', '', '', '', '', ''); echo html_input('submit', $frm_task, $frm_task, $frm_submit, '', 'button', '', '', '', '', '', '', '', '', ''); if (!empty($extraid)) { echo ' '; echo html_input('hidden', 'id', 'id', $extraid, '', '', '', '', '', '', '', '', '', '', ''); if ($extraid != 1) { echo html_input('submit', 'delete_groupings', 'delete_groupings', l('delete'), '', 'button', 'onclick="javascript: return pop()"', '', '', '', '', '', '', '', ''); } } echo '</p></form>'; } }
function edit_article($mode) { ?> <h2><?php echo l('edit_article') . " [" . $mode . "]"; ?> </h2><?php $id = $_REQUEST['id']; $query = mysql_query("SELECT * FROM " . s('prefix') . "articles WHERE id='{$id}'"); $r = mysql_fetch_array($query); $article_category = $r['category']; ?> <fieldset> <legend><?php echo l('article'); ?> </legend> <form name="post-text" method="post" action="index.php?action=process&task=edit&id=<?php echo $id; ?> "> <p><?php echo l('title'); ?> :</p> <p><input type="text" name="title" id="article_title" value="<?php echo $_SESSION['temp']['title'] ? $_SESSION['temp']['title'] : $r['title']; ?> " class="field" /><?php if ($mode == "advanced") { if_javascript_on(' <a href="javascript:makesef();">' . l('make_sef_text') . '</a>'); } ?> </p> <?php if ($mode == "advanced") { ?> <p><?php echo l('sef_title'); ?> :</p> <p><input type="text" name="seftitle" id="article_sef" class="field" value="<?php echo $_SESSION['temp']['seftitle'] ? cleanSEF($_SESSION['temp']['seftitle']) : $r['seftitle']; ?> " /></p> <?php } ?> <p><?php echo l('text'); ?> :</p> <?php if ($mode == "advanced") { $text = str_replace('&', '&', $_SESSION['temp']['text'] ? $_SESSION['temp']['text'] : $r['text']); } if ($mode == "simple") { $text = str_replace(array("<br />", "<p>", "</p>"), "", $r[text]); } ?> <p><textarea name="text" class="mceEditor"><?php echo $text; ?> </textarea></p> <p><?php echo l('limit_article'); ?> :</p> <p><input type="text" name="text_limit" value="<?php echo $r['textlimit']; ?> " class="field" /></p> <p><br /><?php echo l('category'); ?> : <select name="category" class="text"> <option value="category" <?php if ($article_category == 0) { echo "selected"; } ?> ><?php echo l('home'); ?> </option> <?php $category_query = "SELECT * FROM " . s('prefix') . "categories ORDER BY id"; $category_result = mysql_query($category_query); while ($cat = mysql_fetch_array($category_result)) { echo "<option value='" . $cat['id'] . "'"; if ($article_category == $cat['id']) { echo "selected"; } echo ">" . $cat['name'] . "</option>"; } ?> </select></p> </fieldset><br /> <fieldset> <legend><?php echo l('position'); ?> </legend> <?php if ($r['position'] == 3) { ?> <p><input type="radio" value="3" name="position" checked> <?php echo l('display_menu_item'); ?> </p> <?php } else { ?> <p><input type="radio" value="3" name="position"> <?php echo l('display_menu_item'); ?> </p> <?php } if ($r['position'] == 5) { ?> <p><input type="radio" value="5" name="position" checked> <?php echo l('left'); ?> </p> <?php } else { ?> <p><input type="radio" value="5" name="position"> <?php echo l('left'); ?> </p> <?php } if ($r['position'] == 1) { ?> <p><input type="radio" value="1" name="position" checked> <?php echo l('center'); ?> </p> <?php } else { ?> <p><input type="radio" value="1" name="position"> <?php echo l('center'); ?> </p> <?php } if ($r['position'] == 2) { ?> <p><input type="radio" value="2" name="position" checked> <?php echo l('right'); ?> </p> <?php } else { ?> <p><input type="radio" value="2" name="position"> <?php echo l('right'); ?> </p> <?php } ?> </fieldset><br /> <fieldset> <legend><?php echo l('customize'); ?> </legend> <?php if ($r['displaytitle'] == "YES") { ?> <p><input type="checkbox" value="YES" name="display_title" checked> <?php echo l('display_title'); ?> </p> <?php } else { ?> <p><input type="checkbox" value="YES" name="display_title"> <?php echo l('display_title'); ?> </p> <?php } if ($r['displayinfo'] == "YES") { ?> <p><input type="checkbox" value="YES" name="display_info" checked> <?php echo l('display_info'); ?> </p> <?php } else { ?> <p><input type="checkbox" value="YES" name="display_info"> <?php echo l('display_info'); ?> </p> <?php } if ($r['commentable'] == "YES") { ?> <p><input type="checkbox" value="YES" name="commentable" checked> <?php echo l('enable_commenting'); ?> </p> <?php } else { ?> <p><input type="checkbox" value="YES" name="commentable"> <?php echo l('enable_commenting'); ?> </p> <?php } if ($r['position'] == 4) { ?> <p><input type="checkbox" value="ON" name="publish"> <?php echo l('publish_article'); ?> </p> <?php } else { ?> <p><input type="checkbox" value="ON" name="publish" checked> <?php echo l('publish_article'); ?> </p> <?php } ?> </fieldset><br /> <?php if ($mode == "advanced") { ?> <fieldset> <legend><?php echo l('publish_date'); ?> </legend> <p><?php echo l('day') . ":"; ?> <select name="fposting_day"><?php $thisDay = intval(date('d')); for ($i = 1; $i < 32; $i++) { echo '<option value="' . $i . '"'; if ($i == substr($r['date'], 8, 2)) { echo 'selected'; } echo '>' . $i . '</option>'; } ?> </select> <?php echo l('month') . ":"; ?> <select name="fposting_month"><?php $thisMonth = intval(date('m')); for ($i = 1; $i < 13; $i++) { echo '<option value="' . $i . '"'; if ($i == substr($r['date'], 5, 2)) { echo 'selected'; } echo '>' . $i . '</option>'; } ?> </select> <?php echo l('year') . ":"; ?> <select name="fposting_year"><?php $thisYear = intval(date('Y')); for ($i = $thisYear; $i < $thisYear + 5; $i++) { echo '<option value="' . $i . '"'; if ($i == substr($r['date'], 0, 4)) { echo 'selected'; } echo '>' . $i . '</option>'; } ?> </select> <?php echo l('hour') . ":"; ?> <select name="fposting_hour"><?php $thisHour = intval(date('H')); for ($i = 0; $i < 24; $i++) { echo '<option value="' . $i . '"'; if ($i == substr($r['date'], 11, 2)) { echo 'selected'; } echo '>' . $i . '</option>'; } ?> </select> <?php echo l('minute') . ":"; ?> <select name="fposting_minute"><?php $thisMinute = intval(date('i')); for ($i = 0; $i < 60; $i++) { echo '<option value="' . $i . '"'; if ($i == substr($r['date'], 14, 2)) { echo 'selected'; } echo '>' . $i . '</option>'; } ?> </select></p> </fieldset><br /> <?php } ?> <fieldset> <legend><?php echo l('attach_image'); ?> </legend> <select name="image" class="text"><?php if (stripslashes($r['image']) == "") { echo "<option value='' selected>" . l('no_image') . "</option>"; } else { echo "<option value=''>" . l('no_image') . "</option>"; } $upload_dir = s('image_folder') . "/"; $rep = opendir($upload_dir); while ($file = readdir($rep)) { if ($file != '..' && $file != '.' && $file != '') { if (!is_dir($file)) { $folder = substr($file, 0, -4); if ($file == stripslashes($r['image'])) { echo "<option value='{$file}' selected>{$folder}</option>"; } else { if ($folder != "Thumb") { echo "<option value='{$file}'>{$folder}</option>"; } } } } } ?> </select></p> </fieldset> <p><input type="hidden" name="id" value="<?php echo $id; ?> "></p> <?php if ($mode == "simple") { ?> <p><input type="hidden" name="task" value="simpleedit"></p> <?php } if ($mode == "advanced") { ?> <p><input type="hidden" name="task" value="advancededit"></p> <?php } ?> <p><input type="submit" name="submit_text" value="<?php echo l('edit'); ?> "></p> </form><?php }