function blog_page_admin_newpost() { global $lang, $var1, $cont1, $cont2, $cont3; //If form is posted... if (isset($_POST['save']) || isset($_POST['save_exit'])) { if (seo_url($cont1)) { //Save blogpost. $seoname = blog_save_post($cont1, $cont2, $cont3); //Redirect user. if (isset($_POST['save'])) { redirect('?module=blog&page=editpost&var1=' . $seoname, 0); } else { redirect('?module=blog', 0); } } else { $error = show_error($lang['page']['no_title'], 1, true); } } if (isset($error)) { echo $error; } ?> <div class="rightmenu"> <p><?php echo $lang['page']['items']; ?> </p> <?php show_link_insert_box(); show_image_insert_box('images'); ?> </div> <form method="post" action=""> <p> <label class="kop2" for="cont1"><?php echo $lang['general']['title']; ?> </label> <input name="cont1" id="cont1" type="text" /> </p> <p> <label class="kop2" for="cont2"><?php echo $lang['blog']['category']; ?> </label> <select name="cont2" id="cont2"> <option value=""><?php echo $lang['blog']['choose_cat']; ?> </option> <?php //If there are categories. if ($categories = blog_get_categories()) { foreach ($categories as $category) { echo '<option value="' . $category['seoname'] . '">' . $category['title'] . '</option>'; } unset($key); } ?> </select> </p> <p> <label class="kop2" for="cont3"><?php echo $lang['general']['contents']; ?> </label> <textarea class="<?php if (defined('WYSIWYG_TEXTAREA_CLASS')) { echo WYSIWYG_TEXTAREA_CLASS; } ?> " name="cont3" id="cont3" cols="70" rows="20"></textarea> </p> <?php show_common_submits('?module=blog', true); ?> </form> <?php }
//Reverse array $posts = array_reverse($posts); //Move all posts to data/settings/modules/blog foreach ($posts as $post) { rename('data/settings/modules/blog/posts/' . $post, 'data/settings/modules/blog/' . $post); } //Include blog functions include_once 'data/modules/blog/functions.php'; //Save all posts in new format foreach ($posts as $post) { //Get post information include_once 'data/settings/modules/blog/' . $post; //Get hour and minute from post_time list($hour, $minute) = explode(':', $post_time); //Save blog post $post_seoname = blog_save_post($post_title, $post_category, $post_content, null, mktime($hour, $minute, '00', $post_month, $post_day, $post_year)); //Check if there are reactions if (isset($post_reaction_title)) { foreach ($post_reaction_title as $index => $title) { //Get hour and minute from post_reaction_time list($hour, $minute) = explode(':', $post_reaction_time[$index]); blog_save_reaction($post_seoname, $post_reaction_name[$index], 'unknown', 'unknown', $post_reaction_content[$index], null, mktime($hour, $minute, '00', $post_reaction_month[$index], $post_reaction_day[$index], $post_reaction_year[$index])); } } unset($post_reaction_title); //Delete post file unlink('data/settings/modules/blog/' . $post); } unset($posts); //Delete post index unlink('data/settings/modules/blog/post_index.dat');