<?php
	#################################################################
	##  WHMX Billing system for cPanel / WHM					   ##
	##-------------------------------------------------------------##
	##  Version: 1.00 - ENVATO MARKET                              ##
	##-------------------------------------------------------------##
	##  Author: Gianck Luiz obviosistemas@gmail.com         	   ##
	##-------------------------------------------------------------##
	##  Copyright ©2016 . All rights reserved.	                   ##
	##-------------------------------------------------------------##
	#################################################################
    session_start();
    ob_start();
    $filename = 'config/conexao.php';
    if (!file_exists($filename)) {
	header("Location: ../install.php");
    }
    require_once("config/conexao.class.php");
    require_once("config/crud.class.php");  
	include_once("config/common.php"); // Language
	include_once("above.class.php"); // Language
	include_once("functions.php"); // Language
	
    $con = new conexao(); // New conection 
    
    $con->connect(); // Open conection 
    
    if ( !isset($_SESSION['login']) ){ // Verifica Login do Usuário
	echo "
	<script>
	window.location = 'login.php';
	</script>
	";
	} else { 
	$idbase = $_SESSION['admid'];  
	if($idbase){ 
	$cslogin = mysql_query("SELECT * FROM users WHERE id = '$idbase'");
	$logado = mysql_fetch_array($cslogin);
	}
	} // Fim Session

	if ( !isset($_SESSION['nivel']) ){ // Verifica Login do Usuário
	echo "
	<script>
	window.location = 'login.php';
	</script>
	";
	} 
    
    $dbconfig = mysql_query("SELECT * FROM config WHERE id = '1'");
    $config = mysql_fetch_array($dbconfig);
    
    // Gravatar
    $gravatar_link = 'http://www.gravatar.com/avatar/' . md5($config['email']) . '?s=128';
?>

<!DOCTYPE html>
<html>
  <head>
   <?php include("inc/head.php"); ?>
  </head>
  <body class="hold-transition skin-blue sidebar-mini">
    <div class="wrapper">

      <header class="main-header">
       <?php include("inc/header.php"); ?>
      </header>
      
      <!-- Left side column. contains the logo and sidebar -->
      <aside class="main-sidebar">
        <?php include("inc/aside.php"); ?>
      </aside>

	       <?php
	       $mod = (isset ( $_GET ['mod'] ) ? $_GET ['mod'] : 'mod');
	       switch ($mod) {
	
 	       
 	       case 'NewCustomer' : 
 	       include_once ('app/customers/new.php');
 	       break;
 	       case 'Customers' : 
 	       include_once ('app/customers/index.php');
 	       break;
 	      
 	       
 	       case 'Invoices' : 
 	       include_once ('app/invoices/index.php');
 	       break;
 	       case 'InvoicesPaid' : 
 	       include_once ('app/invoices/paid.php');
 	       break;
 	       case 'InvoicesCancel' : 
 	       include_once ('app/invoices/cancel.php');
 	       break;
 	       case 'InvoicesDue' : 
 	       include_once ('app/invoices/due.php');
 	       break;
 	       
 	       case 'NewCMS' : 
 	       include_once ('app/cms/new.php');
 	       break;
 	       case 'CMS' : 
 	       include_once ('app/cms/index.php');
 	       break;
 	       
 	       case 'NewDomain' : 
 	       include_once ('app/domains/new.php');
 	       break;
 	       case 'Domains' : 
 	       include_once ('app/domains/index.php');
 	       break;
 	
 	       case 'Tickets' : 
 	       include_once ('app/tickets/index.php');
 	       break;
 	       case 'TicketsAnswered' : 
 	       include_once ('app/tickets/answered.php');
 	       break;
 	       case 'TicketsProcess' : 
 	       include_once ('app/tickets/process.php');
 	       break;
 	       case 'TicketsClosed' : 
 	       include_once ('app/tickets/closed.php');
 	       break;
 	       case 'Ticket' : 
 	       include_once ('app/tickets/ticket.php');
 	       break;
 	       case 'NewTicket' : 
 	       include_once ('app/tickets/new.php');
 	       break;
 	       case 'TicketResume' : 
 	       include_once ('app/tickets/resume.php');
 	       break;
 	       
 	       case 'Departments' : 
 	       include_once ('app/departments/index.php');
 	       break;
 	       case 'NewDepartment' : 
 	       include_once ('app/departments/new.php');
 	       break;
 	       
 	       case 'Departments' : 
 	       include_once ('app/departments/index.php');
 	       break;
 	       case 'NewDepartment' : 
 	       include_once ('app/departments/new.php');
 	       break;
 	       
 	       case 'Report1' : 
 	       include_once ('app/reports/invoice.php');
 	       break;
 	       
 	       case 'PriceDomainsTLD' : 
 	       include_once ('app/domains/price.php');
 	       break;
 	       
 	       case 'Promotions' : 
 	       include_once ('app/promotions/index.php');
 	       break;
 	       case 'NewPromotion' : 
 	       include_once ('app/promotions/new.php');
 	       break;
 	       
 	       case 'Categories' : 
 	       include_once ('app/categories/index.php');
 	       break;
 	       case 'NewCategory' : 
 	       include_once ('app/categories/new.php');
 	       break;
 	       
 	       case 'Tutorials' : 
 	       include_once ('app/tutorials/index.php');
 	       break;
 	       case 'NewTutorial' : 
 	       include_once ('app/tutorials/new.php');
 	       break;
 	       
 	       case 'Groups' : 
 	       include_once ('app/groups/index.php');
 	       break;
 	       case 'NewGroup' : 
 	       include_once ('app/groups/new.php');
 	       break;
 	       
 	       case 'Order' : 
 	       include_once ('app/order/index.php');
 	       break;
 	       case 'Orders' : 
 	       include_once ('app/order/orders.php');
 	       break;
 	       case 'OrderEdit' : 
 	       include_once ('app/order/edit.php');
 	       break;
 	       case 'OrderInvoice' : 
 	       include_once ('app/order/invoice.php');
 	       break;
 	       case 'OrderAccepted' : 
 	       include_once ('app/order/accepted.php');
 	       break;
 	       case 'OrderCanceled' : 
 	       include_once ('app/order/canceled.php');
 	       break;
 	       
 	       case 'PriceDomains' : 
 	       include_once ('app/pricedomains/index.php');
 	       break;
 	       
 	       case 'Products' : 
 	       include_once ('app/products/index.php');
 	       break;
		   case 'NewProduct' : 
 	       include_once ('app/products/new.php');
 	       break;
 	       
 	       
 	       case 'Packages' : 
 	       include_once ('app/packages/index.php');
 	       break;
		   case 'NewPackage' : 
 	       include_once ('app/packages/new.php');
 	       break;
 	       case 'PackageAcc' : 
 	       include_once ('app/packages/listacc.php');
 	       break;
 	       
 	       
		   case 'Servers' : 
 	       include_once ('app/servers/index.php');
 	       break;
		   case 'NewServer' : 
 	       include_once ('app/servers/new.php');
 	       break;
 	       case 'ListAcc' : 
 	       include_once ('app/servers/listacc.php');
 	       break;
 	       
 	       
 	       case 'TPLMail' : 
 	       include_once ('app/mails/index.php');
 	       break;
		   case 'TPLNewEmail' : 
 	       include_once ('app/mails/new.php');
 	       break;
 	       
		   case 'Gateways' : 
 	       include_once ('app/gateways/index.php');
 	       break;
 	       
 	       case 'Users' : 
 	       include_once ('app/users/index.php');
 	       break;
 	       case 'NewUser' : 
 	       include_once ('app/users/new.php');
 	       break;

 	       case 'Profile' : 
 	       include_once ('app/profile/profile.php');
 	       break;
 	       case 'Adm' : 
 	       include_once ('app/profile/index.php');
 	       break;
 	       
 	       case 'Config' : 
 	       include_once ('app/config/index.php');
 	       break;
		    	       
	       case 'home' :
 	       default :
 	       include_once ('app/dashboard/index.php');
 	       break;
	       }
           ?>
	
	
		  
      <footer class="main-footer">
       <?php include("inc/footer.php"); ?>
      </footer>

    </div><!-- ./wrapper -->

   
  </body>
</html>
