<?php
require_once ('inc/core.php');

include_once( 'password_protect.php' );

require_once( PROJECT_DIR.'/libs/classes/xml2array.php' );

$path_to_xml_languages = PROJECT_DIR.'/pages/languages.xml';
if( ! file_exists( $path_to_xml_languages ) ){
  $error_msg .= 'Brak pliku.'.$path_to_xml_languages;
}else{
  if( ! is_writable($path_to_xml_languages)){
    $error_msg .= 'Plik nie jest zapisywalny. '.$path_to_xml_languages;
  }
}

$array =  xml2array(file_get_contents($path_to_xml_languages));
echo "<pre>";
print_r( $array );
$subsmarty -> assign("arrLangs", $array['LANGUAGES']['LANG'] );
//print_r( $array );
// ############## tresc php ##############################
$subsmarty -> assign("error_msg", $error_msg );
// ###############  display *.tpl ########################
$Strona = new cwebpage ();
$Strona -> setTitle ( '' );
//$Strona -> setJSScripts ( 'pages.js' );
$Strona -> setCsses ( 'style.css' );
$Strona -> setContent ( $subsmarty->fetch(TEMPLATES_DIR.'/admin_languages.tpl.html'));
$smarty->assign('Content', $Strona -> Content );
$smarty->assign('Title', $Strona -> Title );
$smarty->assign('JSScripts', $Strona -> JSScripts );
$smarty->assign('Csses', $Strona -> Csses );
//$smarty->debugging = true;
$smarty->display(TEMPLATES_DIR.'/index.tpl.html');

?>
