<?PHP
/*
Nombre: set_lang.php
Autor: Julio Tuozzo
Función: Configura el lenguaje de la aplicación.
Ver: 2.00
*/
session_start();
if (!isset($_SESSION['LANG']) or ($_GET[lang]!='ESP' and $_GET[lang]!='ENG'))
{include('setup_head.inc');
echo "<p class='danger'>INVALID CALL</p>";
exit();
}
session_destroy();
$path_lang="";
$a_include = explode( PATH_SEPARATOR, ini_get('include_path') );
$a_long=count($a_include);
for ($I=0; $I<$a_long; $I++)
{$f_path=str_replace("\\","/",$a_include[$I]);
if (substr($f_path,-1)!='/')
{$f_path.='/';
}
if (is_readable($f_path."lang.inc"))
{ if (strlen($path_lang)>0)
{include('setup_head.inc');
echo "<p class='danger'><b>ERROR - THERE ARE AT LEAST TWO FILES <i>lang.inc</i></p>
<p class='ok'>One is place in <i>$path_lang</i> and other in <i>$f_path</i>.<br />
Make sure that are only one accesible in the variable <i>include_path</i> of the file
lang.inc that are inicialy in <i>/phd_2_00/include/.</i></p>";
exit();
}
else
{$path_lang=$f_path;
}
}
}
switch ($_GET[lang])
{case "ESP":
if (!is_readable($path_lang."lang_esp.inc"))
{include('setup_head.inc');
echo "<p class='danger'><b>IMPOSSIBLE TO READ FILE $path_lang lang_esp.inc </b></p>
<p class='ok'>Verify if the file exists and the access permission and try again.<br />
The lang_esp.inc file is placed in <b>/phd_2_00/include/.</b></p>";
exit();
}
break;
case "ENG":
if (!is_readable($path_lang."lang_eng.inc"))
{include('setup_head.inc');
echo "<p class='danger'><b>IMPOSSIBLE TO READ FILE $path_lang lang_eng.inc </b></p>
<p class='ok'>Verify if the file exists and the access permission and try again.<br />
The lang_eng.inc file is placed in <b>/phd_2_00/include/.</b></p>";
exit();
}
break;
}
if (!is_writable($path_lang."lang.inc"))
{include('setup_head.inc');
echo "<p class='danger'><b>IMPOSSIBLE TO WRITE FILE $path_lang lang.inc </b></p>
<p class='ok'>Verify if the file exists and the access permission and try again.<br />
The lang.inc file is placed in <b>/phd_2_00/include/.</b>
</p>";
exit();
}
if (!unlink($path_lang."lang.inc"))
{include('setup_head.inc');
echo "<p class='danger'><b>IMPOSSIBLE TO DELETE FILE $path_lang lang.inc </b></p>
<p class='ok'>Verify if the file exists and the access permission and try again.<br />
The lang.inc file is placed in <b>/phd_2_00/include/.</b>
</p>";
exit();
}
switch ($_GET[lang])
{case "ESP":
if (!copy($path_lang."lang_esp.inc",$path_lang."lang.inc"))
{include('setup_head.inc');
echo "<p class='danger'><b>IMPOSSIBLE TO COPY FILE $path_lang lang_esp.inc </b></p>
<p class='ok'>Verify if the file exists and the access permission and try again.</p>";
exit();
}
break;
case "ENG":
if (!copy($path_lang."lang_eng.inc",$path_lang."lang.inc"))
{include('setup_head.inc');
echo "<p class='danger'><b>IMPOSSIBLE TO COPY FILE $path_lang lang_eng.inc </b></p>
<p class='ok'>Verify if the file exists and the access permission and try again.</p>";
exit();
}
break;
}
header("Location: index.php");
?>