<?php

##################################################################################
# HOTELDRUID
# Copyright (C) 2001-2009 by Marco Maria Francesco De Santis (marco@digitaldruid.net)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version accepted by Marco Maria Francesco De Santis, which
# shall act as a proxy as defined in Section 14 of version 3 of the
# license.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
##################################################################################





$percorso_cartella_modello = esegui_query("select valpersonalizza from $PHPR_TAB_PRE"."personalizza where idpersonalizza = 'percorso_cartella_modello' and idutente = '1'");
$percorso_cartella_modello = risul_query($percorso_cartella_modello,0,"valpersonalizza");
if (!defined("C_CARTELLA_CREA_MODELLI") or C_CARTELLA_CREA_MODELLI == "") $c_cartella_crea_mod = "";
else {
$c_cartella_crea_mod = C_CARTELLA_CREA_MODELLI;
if (substr($c_cartella_crea_mod,-1) == "/") $c_cartella_crea_mod = substr($c_cartella_crea_mod,0,-1);
if (substr($percorso_cartella_modello,0,strlen($c_cartella_crea_mod)) != $c_cartella_crea_mod) $percorso_cartella_modello = $c_cartella_crea_mod;
} # fine else if (!defined("C_CARTELLA_CREA_MODELLI") or...
$perc_cart_mod_int = $percorso_cartella_modello;
$perc_cart_mod_vett = explode(",",$percorso_cartella_modello);
$num_perc_cart_mod_vett = count($perc_cart_mod_vett);
$vett_tmp = "";
$num_vett_tmp = 0;
for ($num_cart = 0 ; $num_cart < $num_perc_cart_mod_vett ; $num_cart++) {
if (!$c_cartella_crea_mod or substr($perc_cart_mod_vett[$num_cart]."/",0,strlen($c_cartella_crea_mod."/")) == $c_cartella_crea_mod."/") {
if (@is_dir($perc_cart_mod_vett[$num_cart])) {
$percorso_cartella_modello = $perc_cart_mod_vett[$num_cart];
$vett_tmp[$num_vett_tmp] = $percorso_cartella_modello;
$num_vett_tmp++;
if ($percorso_cartella_modello == $perc_cart_mod_sel) break;
} # fine if (@is_dir($perc_cart_mod_vett[$num_cart]))
} # fine if (!$c_cartella_crea_mod or...
} # fine for $num_cart
$perc_cart_mod_vett = $vett_tmp;
$num_perc_cart_mod_vett = $num_vett_tmp;



function mex2 ($messaggio,$pagina,$lingua) {

if ($lingua != "ita") {
include("./includes/lang/$lingua/$pagina");
} # fine if ($lingua != "ita")
elseif ($pagina == "unit.php") include("./includes/unit.php");
return $messaggio;

} # fine function mex2





function includi_file ($file_incluso,$file) {

if (defined("C_CARTELLA_FILES_REALI") and substr($file_incluso,0,7) != "./dati/") $linee_file = file(C_CARTELLA_FILES_REALI.$file_incluso);
else $linee_file = file("$file_incluso");
fwrite($file,"
###########################################
### INIZIO $file_incluso
###########################################
");
for ($num1 = 0 ; $num1 < count($linee_file) ; $num1++) {
if (!preg_match("/^<\?/i",$linee_file[$num1]) and !preg_match("/^\?>/i",$linee_file[$num1])) fwrite($file,$linee_file[$num1]);
} # fine for $num1
fwrite($file,"
###########################################
### FINE $file_incluso
###########################################
");

} # fine function includi_file





function formatta_input_var_x_file ($input_utente) {

if (@get_magic_quotes_gpc()) $input_utente = stripslashes($input_utente);
$input_utente = str_replace("\\","\\\\",$input_utente);
$input_utente = str_replace("\"","\\\"",$input_utente);
$input_utente = str_replace("\\\\n","\\n",$input_utente);
return $input_utente;

} # fine function formatta_input_var_x_file





?>