All pastes #737350 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-10-15 11:09 UTC
rendered paste body
<?php

/**
 *
 * INDEXU 5.3.0
 * Copyright(C) 2000-2006, All Rights Reserved.
 *
 *
 */
 
  /*===================================================
    ShowMyFiles()
  ===================================================*/

  function ShowMyFiles() {
  
    // vars global configuration
    global $dbConn, $theme_path;

    // vars messages
    global $msg;

    // vars template
    global $error_msg, $status, $files, $owner, $test, $total, $paginate;
    
    if ($err) {
      $error_msg = $msg['20191'];
    }
    
    
    if(!isset($_GET['page'])){
    $page = 1;
    } else {
    $page = $_GET['page'];
    }
    
    // Define the number of results per page
    $max_results = 10;
    
    // Figure out the limit for the query based
    // on the current page number.
    $from = (($page * $max_results) - $max_results);
    
    
    // get file listing
    $sql = "SELECT title, description, date FROM idx_reslink where category_id=1 LIMIT $from, $max_results";
    $result     = $dbConn->Execute($sql);
    
    // Figure out the total number of results in DB:
    $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM idx_reslink where category_id=1"),0);
    
    // Figure out the total number of pages. Always round up using ceil()
    $lastpage = ceil($total_results / $max_results);
    
    
    global $pagination;
    $pagination .= "<center>Select a Page<br />";
    
    if ($page == 1) {
    $pagination .= " FIRST PREV ";
    } else {
       $pagination .= " <a href='{$_SERVER['PHP_SELF']}?page=1'>FIRST</a> ";
       $prevpage = $page-1;
       $pagination .= " <a href='{$_SERVER['PHP_SELF']}?page=$prevpage'>PREV</a> ";
    } 
    $pagination .= " ( Page $page of $lastpage ) ";
    
    if ($page == $lastpage) {
   $pagination .= " NEXT LAST ";
    } else {
   $nextpage = $page+1;
   $pagination .= " <a href='{$_SERVER['PHP_SELF']}?page=$nextpage'>NEXT</a> ";
   $pagination .= " <a href='{$_SERVER['PHP_SELF']}?page=$lastpage'>LAST</a> ";
    }
    
    
    $total .= $total_results;
    
    
    $test = '';
       for($i = 0;$i < $result->RecordCount(); $i++)
       {
       $date = $result->Fields("date");
       $description = $result->Fields("description");
       $title = $result->Fields("title");
       $test .= '<table width="100%%"  border="0">
      <tr>
        <td></td>
      </tr>
    </table>

    <table cellpadding="2" cellspacing="1" border="0" align="center" width="100%" class="tbl_border_mem">
    <tr class="tbl_caption_mem">
      <td width="16%"><strong>Date</strong></td>
      <td width="51%"><strong>Description</strong></td>
      <td width="13%"><strong>Date Added</strong></td>
    </tr>
    <tr class="tbl_caption_mem">
      <td valign="top">'.$title.'</td>
      <td valign="top">'.$description.'</td>
      <td valign="top">'.$date.'</td>
      </tr>
    </table>';


    $result->movenext();
    }
    $files = $test;
    $paginate = $total;
    
   DisplayTemplate($theme_path . "cp/cprm1.html", "\$files,\$paginate,\$error_msg");
      }
  

  /*===================================================
    main
  ===================================================*/

  
  include "../application.php";

  RunPreFilter(__FILE__);

  ShowMyFiles();

  RunPostFilter(__FILE__);

?>