All pastes #297145 Raw Edit

Untitled

public text v1 · immutable
#297145 ·published 2006-12-30 21:48 UTC
rendered paste body
<?php
session_start();
require "sources/core/global.php";

$query = $libmysql->query("SELECT * FROM `$table_settings`"); 
$row = $libmysql->fetch_array($query);

$onlinestat = $row['online_status'];

// **********************************************************
// *****************  Default Module Code  ******************
// **********************************************************

if ($mod == NULL) {

	$query = $libmysql->query("SELECT * FROM $table_modules WHERE default_module='1' LIMIT 1");
	$row = $libmysql->fetch_array($query);	
	$nums = $libmysql->num_rows($query);	
	
	$mod_default = $row['default_module'];
	$mod_active = $row['active_module'];
	$mod_title = $row['title'];

		if ($mod_active == '0') {
			require "sources/lib/header.tpl.php"; 
			echo $lang['mod_noactive'];
			require "sources/lib/footer.tpl.php"; 	
			die();
		}

		if ($nums == '0' || (!file_exists("modules/$mod_title/".$file.".php"))) {
			require "sources/lib/header.tpl.php"; 
			echo $lang['mod_nodefault'];
			require "sources/lib/footer.tpl.php"; 	
			die();
		}


		if ($mod_active == '1' && file_exists("modules/$mod_title/".$file.".php")) {
			require "sources/lib/header.tpl.php";
		
				// Is the CMS offline?
				if ($mod !== 'usercp' && $onlinestat == '0') {
					// If the CMS is offline, and user is an administrator, do not redirect.
					if ($_SESSION['sid'] == '1' || $_SESSION['sid'] == '2') {
					echo $lang['mod_offline'];
					echo "<br /><br />";
					// If the CMS is offline, and user isn't an administrator, redirect to usercp.
					} else {
					echo $lang['mod_redirect'];
					require "sources/lib/footer.tpl.php";
					die();
					}
				}			
				
			// Show CMS offline message in usercp
			if ($mod == 'usercp') {
				if (isset($_SESSION['username'])) 
				{
				echo $lang['mod_offline'];
				echo "<br /><br />";
				}
			}
			
			// Include Module
			include("modules/$mod_title/".$file.".php");
			require "sources/lib/footer.tpl.php";
			die();
		}
		
}

// **********************************************************
// *****************  Module Structure Code  ****************
// **********************************************************

if ($mod !== NULL) {

	$query = $libmysql->query("SELECT * FROM $table_modules WHERE title='$mod' LIMIT 1");
	$row = $libmysql->fetch_array($query);	
	$nums = $libmysql->num_rows($query);	
	
	$mod_default = $row['default_module'];
	$mod_active = $row['active_module'];
	$mod_title = $row['title'];
	
		// ##################################################################################
		// # Does the module file exist? If so, check if it exists in the database as well. #
		// ##################################################################################
		if (file_exists("modules/$mod/".$file.".php") && $nums == '0') {
			require "sources/lib/header.tpl.php"; 
			
				// Is the CMS offline?
				if ($mod !== 'usercp' && $onlinestat == '0') {
					// If the CMS is offline, and user is an administrator, do not redirect.
					if ($_SESSION['sid'] == '1' || $_SESSION['sid'] == '2') {
					echo $lang['mod_offline'];
					echo "<br /><br />";
					// If the CMS is offline, and user isn't an administrator, redirect to usercp.
					} else {
					echo $lang['mod_redirect'];
					require "sources/lib/footer.tpl.php";
					die();
					}
				}			
				
			// Show CMS offline message in usercp
			if ($mod == 'usercp') {
				if (isset($_SESSION['username'])) 
				{
				echo $lang['mod_offline'];
				echo "<br /><br />";
				}
			}
			
			// Include Error Message
			echo $lang['mod_no_data'];
			require "sources/lib/footer.tpl.php";
			die();
		}
		
		// ##########################################################################################
		// # Does the module exist in the database? If so, check if the module file exists as well. #
		// ##########################################################################################
		if (!file_exists("modules/$mod/".$file.".php") && $nums == '1') {
			require "sources/lib/header.tpl.php"; 
			
				// Is the CMS offline?
				if ($mod !== 'usercp' && $onlinestat == '0') {
					// If the CMS is offline, and user is an administrator, do not redirect.
					if ($_SESSION['sid'] == '1' || $_SESSION['sid'] == '2') {
					echo $lang['mod_offline'];
					echo "<br /><br />";
					// If the CMS is offline, and user isn't an administrator, redirect to usercp.
					} else {
					echo $lang['mod_redirect'];
					require "sources/lib/footer.tpl.php";
					die();
					}
				}			
				
			// Show CMS offline message in usercp
			if ($mod == 'usercp') {
				if (isset($_SESSION['username'])) 
				{
				echo $lang['mod_offline'];
				echo "<br /><br />";
				}
			}
			
			// Include Error Message
			echo $lang['mod_no_file'];
			require "sources/lib/footer.tpl.php";
			die();
		}

		// Check if module file exists.
		if (!file_exists("modules/$mod/".$file.".php")) {
			require "sources/lib/header.tpl.php"; 
			
				// Is the CMS offline?
				if ($mod !== 'usercp' && $onlinestat == '0') {
					// If the CMS is offline, and user is an administrator, do not redirect.
					if ($_SESSION['sid'] == '1' || $_SESSION['sid'] == '2') {
					echo $lang['mod_offline'];
					echo "<br /><br />";
					// If the CMS is offline, and user isn't an administrator, redirect to usercp.
					} else {
					echo $lang['mod_redirect'];
					require "sources/lib/footer.tpl.php";
					die();
					}
				}			
				
			// Show CMS offline message in usercp
			if ($mod == 'usercp') {
				if (isset($_SESSION['username'])) 
				{
				echo $lang['mod_offline'];
				echo "<br /><br />";
				}
			}
			
			// Include Error Message
			echo $lang['mod_doesntexist'];
			require "sources/lib/footer.tpl.php"; 	
			die();
		}
		// ##################################################################################
		// ### Check if module is deactivated.											  ###
		// ##################################################################################
		if ($mod_active == '0') {
			require "sources/lib/header.tpl.php"; 
			
				// Is the CMS offline?
				if ($mod !== 'usercp' && $onlinestat == '0') {
					// If the CMS is offline, and user is an administrator, do not redirect.
					if ($_SESSION['sid'] == '1' || $_SESSION['sid'] == '2') {
					echo $lang['mod_offline'];
					echo "<br /><br />";
					// If the CMS is offline, and user isn't an administrator, redirect to usercp.
					} else {
					echo $lang['mod_redirect'];
					require "sources/lib/footer.tpl.php";
					die();
					}
				}			
				
			// Show CMS offline message in usercp
			if ($mod == 'usercp') {
				if (isset($_SESSION['username'])) 
				{
				echo $lang['mod_offline'];
				echo "<br /><br />";
				}
			}
			
			// Include Error Message
			echo $lang['mod_closed'];
			require "sources/lib/footer.tpl.php"; 
			die();	
		}

		// ##################################################################################
		// # If module is activated and file exists, continue!                            ###
		// ##################################################################################
		if ($mod_active == '1' && file_exists("modules/$mod_title/".$file.".php")) {
			require "sources/lib/header.tpl.php";
		
				// Is the CMS offline?
				if ($mod !== 'usercp' && $onlinestat == '0') {
					// If the CMS is offline, and user is an administrator, do not redirect.
					if ($_SESSION['sid'] == '1' || $_SESSION['sid'] == '2') {
					echo $lang['mod_offline'];
					echo "<br /><br />";
					// If the CMS is offline, and user isn't an administrator, redirect to usercp.
					} else {
					echo $lang['mod_redirect'];
					require "sources/lib/footer.tpl.php";
					die();
					}
				}
			
			// Show CMS offline message in usercp
			if ($mod == 'usercp') {
				if (isset($_SESSION['username']) && $onlinestat == '0') 
				{
				echo $lang['mod_offline'];
				echo "<br /><br />";
				}
			}
			
			// Include Module
			include("modules/$mod_title/".$file.".php");
			require "sources/lib/footer.tpl.php";
			die();
		}
		
}