Example #1
0
function create_post($authorname = '')
{
    global $db, $tprefix, $tld, $install_folder;
    $today = date('Y-m-d H:m:s');
    //==========================================
    //create entry in meta table
    $new_meta_id = get_new_meta_id();
    echo 'new meta_id = ' . $new_meta_id . '<br>';
    $meta_sql = "INSERT INTO `{$tprefix}" . "_meta` (`meta_id`,`path`,`meta_canonical`,`type`) VALUES ('{$new_meta_id}','{$tld}','checked','post')";
    echo $meta_sql . '<br>';
    //create entry in content table
    $new_post_id = get_latest_post_id();
    echo 'new post_id = ' . $new_post_id . '<br>';
    $content_sql = "INSERT INTO `{$tprefix}" . "_content` (`id`,`meta_id`,`date_posted`,`published`,`author`,`title`) \n\t\tVALUES ('{$new_post_id}', '{$new_meta_id}','{$today}' ,'N','{$authorname}','YOUR TITLE HERE')";
    echo $content_sql . '<br>';
    $db->query($meta_sql) or die('query failed');
    $db->query($content_sql) or die('query failed');
    //create entry in cat_post table
    //get the uncategorized cat_id
    $sql = "select `cat_id` from `{$tprefix}" . "_category` where `cat_label` = 'uncategorized'";
    $result = $db->query($sql);
    $row = $result->fetch_assoc();
    if (empty($row['cat_id'])) {
        echo 'uncategorized not available';
        exit;
    } else {
        $cat_id = $row['cat_id'];
    }
    //create cat_post association
    $cat_post_sql = "insert into `{$tprefix}" . "_cat_post` (`cat_id`,`post_id`) VALUES ('" . $row['cat_id'] . "','" . $new_post_id . "')";
    echo $cat_post_sql;
    $db->query($cat_post_sql);
    //==========================================
    return $new_post_id;
}
Example #2
0
				<label><input type="radio" name="published" value="N" <?php 
    if ($post['published'] == 'N') {
        echo "checked";
    } else {
        echo "";
    }
    ?>
> Unpublish</label>
			</td>	
	
	
			
			<td>Post Id<br/>
				<input type="text" readonly name="id" size ="6" maxlength="10" value="<?php 
    if (!isset($editid)) {
        echo get_latest_post_id();
    } else {
        echo $post['id'];
    }
    ?>
">
				<input type="hidden" name="meta_id" value="<?php 
    echo $post['meta_id'];
    ?>
" />
			</td>
			
			<td>Date Posted<br/>
				<input type="text" name="date_posted" size ="19" maxlength="19" value="<?php 
    if (!isset($editid)) {
        echo date('Y-m-d H:m:s');
require INC_DIR . 'bbcode.php';
define('REBUILD_SEARCH_ABORTED', 0);
// when the user aborted the processing
define('REBUILD_SEARCH_PROCESSED', 1);
// when a batch of posts has been processed
define('REBUILD_SEARCH_COMPLETED', 2);
// when all the db posts have been processed
//
// Define initial vars
//
$def_post_limit = 50;
$def_refresh_rate = 3;
$def_time_limit = ($sys_time_limit = @ini_get('max_execution_time')) ? $sys_time_limit : 30;
$last_session_data = get_rebuild_session_details('last', 'all');
$last_session_id = (int) $last_session_data['rebuild_session_id'];
$max_post_id = get_latest_post_id();
$start_time = TIMENOW;
$mode = (string) @$_REQUEST['mode'];
// check if the user has choosen to stop processing
if (isset($_REQUEST['cancel_button'])) {
    // update the rebuild_status
    if ($last_session_id) {
        DB()->query("\n\t\t\tUPDATE " . BB_SEARCH_REBUILD . " SET\n\t\t\t\trebuild_session_status = " . REBUILD_SEARCH_ABORTED . "\n\t\t\tWHERE rebuild_session_id = {$last_session_id}\n\t\t");
    }
    bb_die(sprintf($lang['REBUILD_SEARCH_ABORTED'], $last_session_data['end_post_id']) . '<br /><br />' . sprintf($lang['CLICK_RETURN_REBUILD_SEARCH'], '<a href="admin_rebuild_search.php">', '</a>'));
}
// from which post to start processing
$start = abs(intval(@$_REQUEST['start']));
// get the total number of posts in the db
$total_posts = get_total_posts();
// clear the search tables and clear mode (delete or truncate)