View file FFDB/filedb.php

File size: 5.32Kb
<?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           |
// +----------------------------------------------------------------------+
// | filedb.php                                                           |
// | Date Started: February 18, 2003                                      |
// | Last Modified: March 1, 2003                                         |
// +----------------------------------------------------------------------+
require("config.php");
require("functions.php");
$ffdb=new Ffdb;
$ffdb->StartTimer();
$tpl=new Templates;
$mysql=new Mysql;
$mysql->Connect();
require("online.php");
set_magic_quotes_runtime(0);
error_reporting  (E_ERROR | E_WARNING | E_PARSE);
if ($_REQUEST['action']!="download_agree" && empty($_REQUEST['login']) && $_REQUEST['action'] !="logout" && $_REQUEST['action']!="download_file") {
	$online=new Online;
}
if ($_REQUEST['action']!="download_agree" && empty($_REQUEST['login']) && $_REQUEST['action'] !="logout" && $_REQUEST['action']!="download_file") {
	$ffdb->Header($online->user_id);
}
$main=new Main;
class Main {
	function Main() {
		global $online;
		// This is just the biggest mess I've ever seen :(
		if ($_REQUEST['action']=="category") {
			require("category.php");
			$category=new Category;
		}elseif ($_REQUEST['action']=="sub_category") {
			require("sub_category.php");
			$sub_category=new SubCategory;
		}elseif ($_REQUEST['action']=="file" 
			|| $_REQUEST['action']=="download_file" 
			|| 	$_REQUEST['action']=="download_agree" 
			|| $_REQUEST['action']=="rate_file" 
			|| isset($_REQUEST['rate_file']) 
			|| $_REQUEST['action']=="friend" 
			|| isset($_REQUEST['send_friend'])) {
			require("file.php");
			$file=new File;
		}elseif ($_REQUEST['action']=="register" || isset($_REQUEST['register'])) {
			require("register.php");
			$register=new Register;
		}elseif ($_REQUEST['action']=="login" || isset($_REQUEST['login']) || $_REQUEST['action']=="user_cp" || isset($_REQUEST['edit_profile']) || $_REQUEST['action']=="logout") {
			require("user.php");
			$user=new User;
		}elseif ($_REQUEST['action']=="online") {
			$online->OnlineList();
		}elseif ($_REQUEST['action']=="comments" 
			|| $_REQUEST['action']=="post_comments" 
			|| isset($_REQUEST['post_comments']) 
			|| $_REQUEST['action']=="delete_comments" 
			|| $_REQUEST['action']=="edit_comments" || isset($_REQUEST['edit_comments'])) {
			require("comments.php");
			$comments=new Comments;
		}elseif ($_REQUEST['action']=="stats") {
			require("stats.php");
			$stats=new Stats;
		}elseif ($_REQUEST['action']=="member" || $_REQUEST['action']=="send_email") {
			require("member.php");
			$member=new Member;
		}elseif ($_REQUEST['action']=="memberlist") {
			require("memberlist.php");
			$memberlist=new MemberList;
		}elseif ($_REQUEST['action']=="search" || isset($_REQUEST['search'])) {
			require("search.php");
			$search=new Search;
		} else {
			$this->FirstPage();
		}
	}
	function FirstPage() {
		global $tpl,$mysql,$online,$ffdb,$CONFIG;
	//********************************************/
	// Lets Setup our templates
	//*******************************************/
	$tpl->LoadTemplate("category_list_top","templates/$online->skin/category_list_top.tpl");
	$tpl->LoadTemplate("category_list","templates/$online->skin/category_list.tpl");
	$mysql->Query("SELECT * FROM ffdb_categorys WHERE active='Yes' ORDER BY display_order ASC");
	
	while ($show_category=mysql_fetch_array($mysql->result_id)) {
		$ffdb->strip_array($show_category);
		// Just giving the template it's much needed variables
		$category_list_array = array(
			'category_name'=> $show_category[category_name],
			'category_description'=> $show_category[category_description],
			'num_files'=> $show_category[num_files],
			'num_sub_categorys'=> $show_category[num_sub_categorys],
			'category_id'=> $show_category[category_id]
		);
		$tpl->ParseTemplate("category_list",$category_list_array,"Yes");
		$has_category=1;
	}
	if (isset($online->username)) {
		$last_visit=date($CONFIG[date_format],$online->last_visit);
		$welcome_user="Welcome, $online->username your last visit was $last_visit";
	}
	$category_list_top_array = array(
		'welcome_user'=> $welcome_user,
	);
	$tpl->ParseTemplate("category_list_top",$category_list_top_array,"No");
	$tpl->PrintTemplate("category_list_top");
	if ($has_category==1) {
		$tpl->PrintTemplate("category_list");
	}
	$tpl->LoadTemplate("category_list_bottom","templates/$online->skin/category_list_bottom.tpl");
	$tpl->ParseTemplate("category_list_bottom",$category_list_bottom_array,"No");
	$tpl->PrintTemplate("category_list_bottom");
	$online->MainOnline();
	}
}
if ($_REQUEST['action']!="download_agree") {
	$ffdb->Footer();
}
?>