<?php
/*
######################      CWB\     #######################
############################################################
CWB PRO			$Name: release_version1_0_03112006 $
Revision		$Revision: 1.1 $
Author			$Author: zelteto $
Created 03/01/03        $Date: 2006/11/03 12:55:52 $
Writed by               GraFX (webmaster@grafxsoftware.com)
Scripts Home:           http://www.grafxsoftware.com
############################################################
*/

	// deschide un session
	session_start();
	//session_regenerate_id();
	include_once("./config.inc.php");

	if (!isset($_SESSION['session_lang']))
	{
		$session_lang = $LANG;
        $_SESSION['session_lang']=$session_lang;
	}
	else
     	$session_lang=$_SESSION['session_lang'];
	include_once(INDEX_PATH."cls_fast_template.php");
	$NEWLANG = $session_lang;
	include_once(INCLUDE_LANGUAGE_PATH.$NEWLANG.".inc.php");
	include_once(INCLUDE_PATH."cls_string.php");
	include_once(INCLUDE_PATH."cls_miniFile.php");
	include_once(INCLUDE_PATH."cls_pages.php");
    include_once(INCLUDE_ADMIN_PATH."cls_arrays.php");
	 
	$stringutil = new String("nope");
	$all_url_vars = array();
	$all_url_vars = $stringutil->parse_all();

	  if(empty($all_url_vars['page']) && NONSEO==1)
		{

			$expl = explode("index.php",$_SERVER["REQUEST_URI"]);
			$expl = array_reverse ($expl);
			
			if(sizeof($expl)>1)
			$all_url_vars['page'] = str_replace("/","",$expl[0]);
		  		else
			$all_url_vars['page'] ="";
			
			
		}
	 

	 
	$ft = new FastTemplate(TEMPLATE_PATH);
	$ft->define(array("main"=>"template_index.html", "content"=>"sitemap.html"));
	$ft->assign("KEYWORDS","");
	$ft->assign("SITE_NAME", CONF_SITE_NAME );
	$ft->assign("TITLE_TAG",LANG_TITLETAG_SITEMAP);
	$ft->assign("LANG", $NEWLANG);
	
	 $mf=new MiniFile("bd.php");
	 $data=$mf->getArray();	
	
	 $page = new Pages($all_url_vars['page']);	
		
	 $first=$page->getFirstElement();

	if(file_exists(INDEX_PATH."images/".$all_url_vars['page'].".gif"))
	$ft->assign("TITLE_TAG_IMG", CONF_INDEX_URL."images/".$all_url_vars['page']);
	else
	$ft->assign("TITLE_TAG_IMG", CONF_INDEX_URL."images/spacer");     

	 unset($data[$first]);
	 
	 $order_arr =
  			array(
   				array('title','a'),  
    		);

       $data = arfsort( $data, $order_arr);
	
	 $ft->define_dynamic("up","main");
	 $ft->define_dynamic("down","main");
	 $ft->define_dynamic("row","content");
	 
	 $ft->assign("URL_TYPE", "index.php");	
	 $ft->assign("TITLE_PAGES", LANG_HOME);
     $ft->parse("UP",".up");

     foreach( $data as $key =>$value){
     if(NONSEO==0)
	 $ft->assign("URL_TYPE", "index.php?page=".$key);	
	 else
	 $ft->assign("URL_TYPE", "index.php/".$key."/");
	 $ft->assign("TITLE_PAGES", $data[$key]["title"]);
	 
	 $ft->parse("UP",".up");
	 }


	 $ft->assign("URL_TYPE", "index.php");	
	 $ft->assign("TITLE_PAGES", LANG_HOME);
     $ft->parse("DOWN",".down");

     foreach( $data as $key =>$value){
	 if(NONSEO==0)
	 $ft->assign("URL_TYPE", "index.php?page=".$key);	
	 else
	 $ft->assign("URL_TYPE", "index.php/".$key."/");	
	 
	 $ft->assign("TITLE_PAGES", $data[$key]["title"]);
	 
	 $ft->parse("DOWN",".down");
	 }

	
     $ft->assign("URL_TYPE", "index.php");	
	 $ft->assign("TITLE_PAGES", LANG_HOME);
     $ft->parse("ROW",".row");

     foreach( $data as $key =>$value){
	 if(NONSEO==0)
	 $ft->assign("URL_TYPE", "index.php?page=".$key);	
	 else
	 $ft->assign("URL_TYPE", "index.php/".$key."/");	
	 
	 $ft->assign("TITLE_PAGES", $data[$key]["title"]);
	 
	 $ft->parse("ROW",".row");
	 }


		
	$ft->multiple_assign_define("LANG_");
	$ft->multiple_assign_define("CONF_");
	$ft->parse("BODY", array("content","main"));
	$ft->showDebugInfo(ERROR_DEBUG);
	$ft->FastPrint();
	$ft->clear_all();
?>