level_info['level_poll_allow'] ) { header("Location: /premium.php?premiumonly=1"); exit; }*/ // SET ENTRY SORT-BY VARIABLES FOR HEADING LINKS $d = "dd"; // poll_DATE $t = "t"; // poll_TITLE $c = "cd"; // TOTAL_COMMENTS // SET SORT VARIABLE FOR DATABASE QUERY if($s == "d") { $sort = "poll_date"; $d = "dd"; } elseif($s == "dd") { $sort = "poll_datecreated DESC"; $d = "d"; } elseif($s == "t") { $sort = "poll_title"; $t = "td"; } elseif($s == "td") { $sort = "poll_title DESC"; $t = "t"; } elseif($s == "c") { $sort = "total_comments"; $c = "cd"; } elseif($s == "cd") { $sort = "total_comments DESC"; $c = "c"; } else { $sort = "poll_datecreated DESC"; $d = "d"; } // SET WHERE CLAUSE if($search != "") { $where = "(poll_title LIKE '%{$search}%' OR poll_desc LIKE '%{$search}%' OR poll_options LIKE '%{$search}%')"; } else { $where = ""; } // CREATE POLL OBJECT $entries_per_page = $user->level_info['level_poll_entries']; $poll = new se_poll($user->user_info['user_id']); // DELETE NECESSARY ENTRIES $start = ($p - 1) * $entries_per_page; if($task == "delete") { $poll->polls_delete($start, $entries_per_page, $sort, $where); } // GET TOTAL ENTRIES $total_polls = $poll->poll_total($where); // MAKE ENTRY PAGES $page_vars = make_page($total_polls, $entries_per_page, $p); // GET ENTRY ARRAY $polls = $poll->poll_list($page_vars[0], $entries_per_page, $sort, $where); $smarty->assign('polls', $polls); $smarty->assign('s', $s); $smarty->assign('d', $d); $smarty->assign('t', $t); $smarty->assign('c', $c); $smarty->assign('search', $search); $smarty->assign('total_polls', $total_polls); $smarty->assign('p', $page_vars[1]); $smarty->assign('maxpage', $page_vars[2]); $smarty->assign('p_start', $page_vars[0]+1); $smarty->assign('p_end', $page_vars[0]+count($polls)); include "footer.php"; ?>