No returned results...';
}
while ($item_row = mysql_fetch_array($item_list)) { //for each item in db
//convert timestamp to readable/human date
$item_row['timestamp'] = date($globalvars['time_format'],$item_row['timestamp']);
$item_row['article_cat_name'] = gen_cat_name($item_row['article_cat']); //switch cat_id to readable name
$row_bg = ($row_bg == $globalvars['altcolor'][2]) ? $globalvars['altcolor'][1] : $globalvars['altcolor'][2]; //current row bg
//switch active column to yes, draft, or unapproved.
if ($item_row['active'] == 1) { $item_row['active'] = 'Yes'; } elseif ($item_row['active'] == 0) { $item_row['active'] = 'Draft'; }
if ($item_row['approved'] == 0) { $item_row['active'] = 'Unapproved'; }
$item_row['comments'] = mysql_num_rows(general_query('SELECT * FROM '.$databaseinfo['prefix'].'comments WHERE article_id="'.$item_row['id'].'"'));
if (strlen($item_row['article_title']) > 30) {
$item_row['article_title'] = wordwrap($item_row['article_title'], 30, " ");
}
//generate the actual html rows
$table_rows = $table_rows.'
';
} //end of each item in db generation
$content = manage_form(); //generate form
} elseif ($do == "deleteitems") { //if we're deleting items
//quick permission check (redir to error)
if ($globalvars['rank'][16] == 0) {
header("Location: index.php?do=permissiondenied");
die();
}
$items = $_POST; //get vars
if (!$items) { //if no items, avoid mysql error by just redirecting
header("Location: manage.php");
}
//we're going to create list of ids to be deleted from database.
foreach($items as $key=>$value) {
$items_f = $items_f."'$key',";
}
//remove last comma in list for SQL
$items_f = substr_replace($items_f,"",-1);
//delete the items in 'articles'
delete('articles',$items_f);
//log this action
log_this('delete_items','User '.$_SESSION['username'].' has deleted the following articles: "'.$items_f.'"');
//redirect back to manage.php
header("Location: manage.php?delete_success=1");
} elseif ($do == "search") { //search
$globalvars['page_name'] = 'search'; //set page name
//get query and category from POST or from GET
$search['query'] = $_POST['query'];
if ($search['query'] == "") { $search['query'] = $_GET['q']; }
$search['category'] = $_POST['category'];
if (!$search['category']) { $search['category'] = $_GET['c']; }
if ($search['query'] == "click here to start the search..." || $search['query'] == "") {
header("Location: manage.php");
}
$searchres = search($search); //form and execute search query/cat
//if no results
if (mysql_num_rows($searchres) == 0) { $table_rows = '
No returned results...
'; }
//for each item, generate html table row
while ($item_row = mysql_fetch_assoc($searchres)) {
//convert timestamp to readable/human date
$item_row['timestamp'] = date($globalvars['time_format'],$item_row['timestamp']);
$item_row['article_cat_name'] = gen_cat_name($item_row['article_cat']); //switch cat_id to readable name
$row_bg = ($row_bg == $globalvars['altcolor'][2]) ? $globalvars['altcolor'][1] : $globalvars['altcolor'][2]; //current row bg
//switch active column to yes, draft, or unapproved.
if ($item_row['active'] == 1) { $item_row['active'] = 'Yes'; } elseif ($item_row['active'] == 0) { $item_row['active'] = 'Draft'; }
if ($item_row['approved'] == 0) { $item_row['active'] = 'Unapproved'; }
$item_row['comments'] = mysql_num_rows(general_query('SELECT * FROM '.$databaseinfo['prefix'].'comments WHERE article_id="'.$item_row['id'].'"'));
//generate the actual html rows
$table_rows = $table_rows.'