<?php

/**
 *
 * INDEXU
 * Copyright(C), Nicecoder, 2000-2006, All Rights Reserved.
 *
 * INDEXU(tm) is protected by Indonesia and International copyright laws.
 * Unauthorized use or distribution of INDEXU(tm) is strictly prohibited,
 * violators will be prosecuted. To obtain a license for using INDEXU(tm),
 * please register at Nicecoder home page at http://www.nicecoder.com
 *
 * Author:
 *    Dody Rachmat Wicaksono (dody@nicecoder.com)
 *    M. Zuber (zubby@nicecoder.com)
 *
 */

  /*===================================================
    SponsoredLink()
  ===================================================*/

  function SponsoredLink() {

    // vars global configuration
    global $dbConn, $category_separator, $admin_template_path;

    // vars url & form
    global $title, $url, $description, $cat, $contact_name, $email, $bid,
      $password;

    // vars messages
    global $msg;

    // vars template
    global $num_rows,$pagination,$link,$param;


    // get all sponsored listing

    $expire = date("Y-m-d H:i:s");

    $query = "select a.*
              from idx_link a
                   inner join idx_paid_listing b on a.link_id = b.link_id
              where b.sponsored = 1
                    and b.expire > '$expire'";

    $links_obj = new clsLink;
    $links_obj->table_name = "idx_link";
    $links_obj->category_table_name = "idx_category";

    $links_obj->query = $query;
    $links_obj->template_file = $admin_template_path . "link_view_rows.html";
    $links_obj->date_format = $msg["20081"];

    $links_obj->paging = true;
    $links_obj->pg_size = 20;
    $links_obj->href = "link_premium_listing.php";
    $links_obj->new_link_number=1;
    $link = $links_obj->Display();
    $pagination = $links_obj->pagination;
    $num_rows = $links_obj->new_link_number-1;
    $param = $links_obj->more_param . "&pg_which=$pg_which";

    DisplayTemplate($admin_template_path . "link_sponsored_listing.html",
      "\$num_rows,\$pagination,\$link,\$param");
  }


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

  include "../application.php";
  
  RunPreFilter(__FILE__);

  DisplayTemplate($admin_template_path . "header.html");
  SponsoredLink();
  DisplayTemplate($admin_template_path . "footer.html");

  RunPostFilter(__FILE__);

?>