Просмотр файла FFDB/sub_category.php

Размер файла: 4.76Kb
<?php
// +----------------------------------------------------------------------+
// |                      Fantastic File Database                         |
// +----------------------------------------------------------------------+
// |                          By Tony Baird                               |
// |                  Copyright (c) 2003 Fantastic Scripts                |
// |                          http://fscripts.com                         |
// +----------------------------------------------------------------------+
// | Fantastic File Database Can be modified freely as long as copyright  | 
// | is intact and this is left at the top of every source file           |
// +----------------------------------------------------------------------+
// | sub_category.php                                                     |
// | Date Started: February 21, 2003                                      |
// | Last Modified: March 29, 2003                                        |
// +----------------------------------------------------------------------+
Class SubCategory {
    function SubCategory() {
        global $tpl,$mysql,$online,$ffdb;
        switch ($_REQUEST['action']) {
            case "delete_subcategory":
                $this->ConfirmDeleteSubCategory();
                break;
            case "edit_subcategory":
                $this->EditSubCategory();
                break;
            default:
                $this->DisplaySubCategory();
                break;
        }

    }
    //*************************************************/
    // Delete Sub Category Confirm, then delete
    //*************************************************/
    function ConfirmDeleteSubCategory() {
    }
    //*************************************************/
    // Edit Sub Category Form
    //*************************************************/
    function EditSubCategory() {
    }
    //*************************************************/
    // Displays a Sub Category
    //*************************************************/
    function DisplaySubCategory() {
        global $mysql,$tpl,$ffdb,$online,$CONFIG;
        if (!$_REQUEST['id']) {
            $ffdb->Error("You did not select a Sub Category");
        }
        if (empty($_REQUEST['page'])) {
            $page=1;
        } else {
            $page=$_REQUEST['page'];
        }

        // Setting up the pages we don't want too many files on one page do we?
        $ffdb->DivideData("SELECT * FROM ffdb_files WHERE sub_category_id=".$_REQUEST['id']."",$page,$CONFIG['files_per_page']);

        $ffdb->MakePages("<a href=\"filedb.php?page={eachpage}&action=sub_category&id=".$_REQUEST['id']."\">{eachpage}</a>&nbsp;","<b>({page})</b>&nbsp;","<a href=\"filedb.php?page=1&action=sub_category&id=".$_REQUEST['id']."\">« First Page</a>&nbsp;","<a href=\"filedb.php?page={eachpage}&action=sub_category&id=".$_REQUEST['id']."\">Last Page »</a>",$page,$ffdb->num_pages);
        // We need to make the searching thing later
        $order_by="ORDER BY date_added DESC";
        
        // Loading Our Templates
		if ($ffdb->hasdata !="No") {
			$tpl->LoadTemplate("file_list","templates/$online->skin/file_list.tpl");
			$tpl->LoadTemplate("file_list_top","templates/$online->skin/file_list_top.tpl");
			$tpl->LoadTemplate("file_list_bottom","templates/$online->skin/file_list_bottom.tpl");
			$mysql->Query("SELECT * FROM ffdb_files WHERE sub_category_id=".$_REQUEST['id']." $order_by LIMIT $ffdb->data_bottom,$ffdb->data_top");
			// Setting up the Sub Category List
			while ($show_file=mysql_fetch_array($mysql->result_id)) {
				$ffdb->strip_array($show_file);
				$date_added=date($CONFIG[date_format],$show_file[date_added]);
				if ($show_file[num_ratings]==0) {
					$rating=0;
				} else {
					$rating=round($show_file[total_ratings]/$show_file[num_ratings],2);
				}
				$file_list_array = array(
					'file_name'=> $show_file[file_name],
					'date_added'=> $date_added,
					'downloads' => $show_file[downloads],
					'file_description' => $show_file[file_description],
					'rating' => $rating,
					'file_id' => $show_file[file_id],
				);
				$tpl->ParseTemplate("file_list",$file_list_array,"Yes");
			}
			$tpl->ParseTemplate("file_list_top",$file_list_array_top,"Yes");
			$file_list_bottom_array = array(
				'pages'=> $ffdb->pages
			);
			$tpl->ParseTemplate("file_list_bottom",$file_list_bottom_array,"Yes");
			$tpl->ParseTemplate("file_list_top",$file_list_top_array,"Yes");
			$tpl->PrintTemplate("file_list_top");
			$tpl->PrintTemplate("file_list");
			$tpl->PrintTemplate("file_list_bottom");
			$online->CurrentlyBrowsing("SubCategory");
		} else {
			$ffdb->Error("Currently there are no files in this sub category");
		}
    }
}


?>