assign_file('FILENAME_PAGINATION', 'pagination.xtpl'); if(isset($_COOKIE["rpp"])) { $results_per_page = $rpp_array[$_COOKIE["rpp"]]; } if(!isset($_GET['s']) AND !isset($_POST['pageselect'])) { $current_page = 1; } elseif(!isset($_GET['s'])) { $current_page = $_POST['pageselect']; } else { $current_page = $_GET['s']; } $tmp = "SELECT * FROM `%sfiles` WHERE `owner` = '$uid'"; $db->query($tmp); $tot_results = mysql_num_rows($db->result); $pagination = new Pagination($current_page, $tot_results, $results_per_page); $slimit = $pagination->current_result_start; $elimit = $pagination->current_result_end; $prev = $pagination->current_page - 1; $next = $pagination->current_page + 1; $tot_pages = $pagination->tot_pages; $xtpl->assign('TEXT_SHOWSINCE', $lang['showsince']); $xtpl->assign('TEXT_DELETE', $lang['delete']); $xtpl->assign('TEXT_URL', $lang['url']); $xtpl->assign('TEXT_BBCODE', $lang['bbcode']); $xtpl->assign('TEXT_NEXT', $lang['next']); $xtpl->assign('TEXT_PREV', $lang['previous']); $xtpl->assign('TEXT_FIRST', $lang['first']); $xtpl->assign('TEXT_LAST', $lang['last']); $xtpl->assign('TEXT_PAGE', $lang['page']); $xtpl->assign('TEXT_SELECT', $lang['select']); $xtpl->assign('TEXT_GOTOPAGE', $lang['gotopage']); $xtpl->assign('TEXT_RPP', $lang['resultsperpage']); $xtpl->assign('TPLDIR', $tpldir); for ($i = 1; $i <= $tot_pages; $i++) { $xtpl->assign('PAGENUMBER', $i); $xtpl->parse('main.pagination.pageselect.options'); } $xtpl->parse('main.pagination.pageselect'); for ($i = 1; $i <= count($rpp_array); $i++) { $xtpl->assign('RPPNUMBER', $i); $xtpl->assign('RPP', $rpp_array[$i]); $xtpl->assign('RPPCHANGEURL', RPPCHANGE); $xtpl->parse('main.pagination.rppselect.options'); } $xtpl->parse('main.pagination.rppselect'); $xtpl->assign('PAGINATION_PREV_URL', $burl . IMGPAGINATE . $prev); $xtpl->assign('PAGINATION_NEXT_URL', $burl . IMGPAGINATE . $next); $xtpl->assign('PAGINATION_FIRST_URL', $burl . IMGPAGINATE . 1); $xtpl->assign('PAGINATION_LAST_URL', $burl . IMGPAGINATE . $tot_pages); $xtpl->assign('PAGINATION_TOTPAGES', $tot_pages); $xtpl->assign('PAGINATION_CURRENTPAGE', $current_page); // The SHOWPREV/-NEXTLINK is for use hidden/visible in css rather than use the blocks if ($current_page -1 < 1) { $xtpl->assign('SHOWPREVLINK', 'FALSE'); $xtpl->parse('main.pagination.prev_disabled'); } else { $xtpl->assign('SHOWPREVLINK', 'TRUE'); $xtpl->parse('main.pagination.prev_enabled'); } if ($current_page >= $tot_pages) { $xtpl->assign('SHOWNEXTLINK', 'FALSE'); $xtpl->parse('main.pagination.next_disabled'); } else { $xtpl->assign('SHOWNEXTLINK', 'TRUE'); $xtpl->parse('main.pagination.next_enabled'); } $xtpl->parse('main.pagination'); $uid = mysql_real_escape_string($uid,$db->link); if($uid === $_SESSION['uid']) { $sql = "SELECT * FROM `%sfiles` WHERE `owner` = '$uid' ORDER BY `id` DESC LIMIT $slimit, $elimit"; } else { $sql = "SELECT * FROM `%sfiles` WHERE `owner` = '$uid' AND `private` != '1' ORDER BY `id` DESC LIMIT $slimit, $elimit"; } $db->query($sql); $nums = mysql_num_rows($db->result); if ($nums != 0) { while ($item = mysql_fetch_array($db->result)) { $date = date("d.m.y",$item['date']); if (!$simpleurl) { $imgurl = $burl.$item['id'].'x'.$item['code']; $lurl = $burl.'/l/'.$item['id'].'x'.$item['code']; } else { $imgurl = $burl.$item['id']; $lurl = $burl.'/l/'.$item['id']; } $xtpl->assign('IMGURL', $imgurl); $xtpl->assign('ITEMID', $item['id']); $xtpl->assign('ITEMVIEWS', $item['views']); $xtpl->assign('LURL', $lurl); $xtpl->assign('DATE', $date); $xtpl->assign('DELETEURL', DELETEIMAGE.$item['id']); // Check if the user is owner of image and if true parse some extended options if ($uid === $_SESSION['uid']) { $xtpl->parse('main.imagelist.ext'); } $xtpl->parse('main.imagelist'); } } else { // If the user don't have any images to show dialogbox($lang['noimages'] , 'warning'); include($includedir . 'tail.php'); die(); } /* Finally we parse the variables to the templatefile */ $xtpl->parse('main'); $xtpl->out('main'); // Tail, tail, tail. My foxy tail. include($includedir . 'tail.php'); ?>