assign('bookmarkdata',$bookmarkdata); //$breadcrumbs[0]['link'] = 'index.php?mode=bookmarks'; //$breadcrumbs[0]['linkname'] = 'subnav_bookmarks'; //$smarty->assign('breadcrumbs',$breadcrumbs); $smarty->assign('subnav_location', 'subnav_bookmarks'); $smarty->assign('total_bookmarks', $total_bookmarks); $smarty->assign('action', 'bookmark'); $smarty->assign('subtemplate', 'bookmark.inc.tpl'); $template = 'main.tpl'; break; case 'move_bookmark': if (isset($_GET['move_up_bookmark'])) move_item($db_settings['bookmark_table'], intval($_GET['move_up_bookmark']), 'up'); elseif (isset($_GET['move_down_bookmark'])) move_item($db_settings['bookmark_table'], intval($_GET['move_down_bookmark']), 'down'); header("Location: index.php?mode=bookmarks"); exit; break; case 'delete_bookmark': $id = intval($_GET['delete_bookmark']); $result = mysqli_query($connid, "SELECT `posting_id`, `subject` FROM ".$db_settings['bookmark_table']." WHERE id= ".$id." LIMIT 1") or raise_error('database_error', mysqli_error($connid)); if(mysqli_num_rows($result) > 0) { $row = mysqli_fetch_array($result); $bookmark['id'] = $id; $bookmark['pid'] = intval($row['posting_id']); $bookmark['title'] = htmlspecialchars($row['subject']); $smarty->assign('bookmark', $bookmark); } mysqli_free_result($result); $breadcrumbs[0]['link'] = 'index.php?mode=bookmarks'; $breadcrumbs[0]['linkname'] = 'subnav_bookmarks'; $smarty->assign('breadcrumbs',$breadcrumbs); $smarty->assign('action','delete_bookmark'); $smarty->assign('subnav_location','subnav_delete_bookmark'); $smarty->assign('subtemplate','bookmark.inc.tpl'); $template = 'main.tpl'; break; case 'delete_bookmark_submit': mysqli_query($connid, "DELETE FROM ".$db_settings['bookmark_table']." WHERE `id` = ". intval($_POST['id']) ." AND `user_id` = ". intval($user_id) ." LIMIT 1") or raise_error('database_error', mysqli_error($connid)); header("Location: index.php?mode=bookmarks"); exit; break; case 'edit_bookmark': $id = intval($_GET['edit_bookmark']); $result = mysqli_query($connid, "SELECT `posting_id`, `subject` FROM ".$db_settings['bookmark_table']." WHERE id= ".$id." LIMIT 1") or raise_error('database_error', mysqli_error($connid)); if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_array($result); $bookmark['id'] = $id; $bookmark['pid'] = intval($row['posting_id']); $bookmark['title'] = htmlspecialchars($row['subject']); $smarty->assign('bookmark', $bookmark); } mysqli_free_result($result); $breadcrumbs[0]['link'] = 'index.php?mode=bookmarks'; $breadcrumbs[0]['linkname'] = 'subnav_bookmarks'; $smarty->assign('breadcrumbs', $breadcrumbs); $smarty->assign('action', 'edit_bookmark'); $smarty->assign('subnav_location', 'subnav_edit_bookmark'); $smarty->assign('subtemplate', 'bookmark.inc.tpl'); $template = 'main.tpl'; break; case 'edit_bookmark_submit': mysqli_query($connid, "UPDATE ".$db_settings['bookmark_table']." SET `subject` = '". mysqli_real_escape_string($connid, $_POST['bookmark']) ."' WHERE `id` = ". intval($_POST['id']) ." AND `user_id` = ". intval($user_id) ." LIMIT 1") or raise_error('database_error', mysqli_error($connid)); header("Location: index.php?mode=bookmarks"); exit; break; case 'reorder': if (isset($_POST['bookmarks'])) { $items = explode(',', $_POST['bookmarks']); $order_id = 1; foreach ($items as $id) { mysqli_query($connid, "UPDATE ".$db_settings['bookmark_table']." SET `order_id` = ". intval($order_id) ." WHERE id = ". intval($id) ." AND `user_id` = ". intval($user_id) ." LIMIT 1") or raise_error('database_error', mysqli_error($connid)); $order_id++; } } exit; break; default: header("Location: index.php"); exit; break; } } else { header("Location: index.php"); exit; } ?>