Пример #1
0
<?php

define("comune", true);
//require ("setting.php");
//require ("common.php");
require_once 'login.php';
$db = new sql_db(DB_HOST, DB_USER, DB_PWD, DB_NAME, false);
if (!$db->db_connect_id) {
    die("Impossibile connettersi al database");
}
//$z="A";
$z = $_GET['zona'];
if (strlen($z) == 2) {
    $z = substr($z, 0, 1);
}
$cond = "%Modifica di destinazione%";
$query_1 = "SELECT coefficiente FROM tabella_a WHERE tipo_intervento LIKE '" . $cond . "' && zona LIKE '%" . $z . "%'";
//$query_1 = "SELECT coefficiente FROM tabella_a WHERE tipo_intervento='";
//echo $query_1.'<br>';
$result = $db->sql_query($query_1);
$row_1 = $db->sql_fetchrow($result);
//echo "culo<br>";
$coeff = $row_1["coefficiente"];
//echo $coeff;
echo $coeff;
?>
		
<?php

include_once "login.php";
//print_r($_REQUEST);
$db = new sql_db(DB_HOST, DB_USER, DB_PWD, DB_NAME, false);
if (!$db->db_connect_id) {
    die("Impossibile connettersi al database");
}
$object = $_POST["obj"];
$id = $_POST["id"];
$azione = $_POST["action"];
$sql = "select distinct zona.nome_tavola as id from vincoli.zona left join vincoli.tavola on(zona.nome_tavola=tavola.nome_tavola) where zona.nome_vincolo= '{$id}' and tavola.cdu=1;";
$db->sql_query($sql);
print_debug($sql);
$ris = $db->sql_fetchrowset();
for ($i = 0; $i < count($ris); $i++) {
    $out[] = "{id:'" . $ris[$i]["id"] . "',name:'" . $ris[$i]["id"] . "'}";
}
header("Content-Type: text/plain; Charset=UTF-8");
$debug = "{id:'{$object}',values:[" . implode(',', $out) . "]}";
print_debug($debug);
echo $debug;
<?php

$sk = "geoweb";
$db1 = new sql_db(DB_HOST, DB_USER, DB_PWD, 'gisclient', false);
if (!$db1->db_connect_id) {
    die("Impossibile connettersi al database");
}
//ACQUISISCO ID DEL PROGETTO
$sql = "SELECT project_id FROM {$sk}.project WHERE project_name='" . GC_PROJECT . "';";
if (!$db1->sql_query($sql)) {
    print_array($db1->error_message);
}
$projectId = $db1->sql_fetchfield('project_id');
if ($role == 2) {
    //VERIFICO SE ESISTE L0 USERGROUP praticaweb
    $sql = "SELECT usergroup_id FROM {$sk}.usergroup WHERE project_id={$projectId} and usergroup='" . GC_ROLE . "'";
    if (!$db1->sql_query($sql)) {
        print_array($db1->error_message);
    }
    $usergroupId = $db1->sql_fetchfield('usergroup_id');
    if (!$usergroupId) {
        $sql = "select {$sk}.new_pkey('usergroup','usergroup_id') as newid;";
        if (!$db1->sql_query($sql)) {
            print_array($db1->error_message);
        }
        $newId = $db1->sql_fetchfield('newid');
        $sql = "INSERT INTO {$sk}.usergroup(usergroup_id,project_id,usergroup,description) VALUES({$newId},{$projectId},'praticaweb','Utenti delle Pratiche Edilizie')";
        if (!$db1->sql_query($sql)) {
            print_array($db1->error_message);
        }
        $usergroupId = $newId;
Пример #4
0
if (isset($_GET['id'])) {
    $plid = $_GET['id'];
    $query = "SELECT {$t['b3_clients']}.name, ctime.id, ctime.gone, ctime.came\n              FROM {$t['b3_clients']}, ctime, {$t['players']} \n              WHERE {$t['players']}.id = \"{$plid}\"\n              AND {$t['players']}.client_id = {$t['b3_clients']}.id\n              AND {$t['b3_clients']}.guid = ctime.guid\n              ORDER BY ctime.id DESC";
} else {
    if (isset($_GET['dbid'])) {
        $plid = $_GET['dbid'];
        $query = "SELECT {$t['b3_clients']}.name, ctime.id, ctime.gone, ctime.came\n              FROM {$t['b3_clients']}, ctime\n              WHERE {$t['b3_clients']}.id = \"{$plid}\"\n              AND {$t['b3_clients']}.guid = ctime.guid\n              ORDER BY ctime.id DESC";
    } else {
        return;
    }
}
$data = array();
global $t;
$count = 0;
$link = baselink();
$result = $coddb->sql_query($query);
$d = array();
$max = 31;
$idx = 1;
$suma = 0;
while ($row = $coddb->sql_fetchrow($result)) {
    $start = $row['came'];
    $end = $row['gone'];
    $d1 = date("Y-m-d", $start);
    $d2 = date("Y-m-d", $end);
    if (count($data) and $data[count($data) - 1][1] > $d1) {
        $diff = floor(($data[count($data) - 1][4] - $start) / (60 * 60 * 24));
        $empty = $data[count($data) - 1][4];
        for ($i = 0; $i < $diff; $i++) {
            if (count($d) >= $max) {
                break;
<?php

//if(!defined("comune")) return;
require_once "login.php";
$db = new sql_db(DB_HOST, DB_USER, DB_PWD, DB_NAME, false);
if (!$db->db_connect_id) {
    die("Impossibile connettersi al database");
}
$oggi = date("d-m-Y");
$dataoneri = date("d/m/Y");
$pratica = $_REQUEST['pratica'];
$sql = "SELECT numero,coalesce(data_prot,data_presentazione) as data from pe.avvioproc where pratica={$pratica}";
$db->sql_query($sql);
$numero = $db->sql_fetchfield('numero');
//$dataoneri=$db->sql_fetchfield('data');
$query = "SELECT * FROM oneri.parametri where '{$dataoneri}'::date BETWEEN datein AND coalesce(dateed,CURRENT_DATE);";
$result = $db->sql_query($query);
//if(!$result){echo "SQL Error - ".mysql_error()."<br>".$query;return;}
$row = $db->sql_fetchrow($result);
$costo_base = $row['costo_base'];
$qbase = $row['quota_base'];
$classe = $row['classe_comune'];
$quota = $row['corrispettivo'];
$delibera = $row['delibera'];
$sql = "SELECT case when (not coalesce(piva,'')='') then coalesce(ragsoc,'') else coalesce(cognome,'')||' '||coalesce(nome,'') end as nominativo FROM pe.soggetti WHERE richiedente=1 and pratica={$pratica};";
$db->sql_query($sql);
$ris = $db->sql_fetchlist('nominativo');
$nominativi = implode('; ', $ris);
$sql = "SELECT coalesce(via,'')||' '||coalesce(civico,'') as indirizzi FROM pe.indirizzi WHERE pratica={$pratica};";
$db->sql_query($sql);
$ris = $db->sql_fetchlist('indirizzi');
Пример #6
0
<head>
<title>Pratiche recenti</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<SCRIPT language="javascript" src="js/LoadLibs.js" type="text/javascript"></SCRIPT>
</head>
<body link="#0000FF" vlink="#0000FF" alink="#0000FF">
<?php 
include "./inc/inc.page_header.php";
?>
<H2 class=blueBanner>Ultime pratiche aperte</H2>
<?php 
$userid = $_SESSION["USER_ID"];
$db = new sql_db(DB_HOST, DB_USER, DB_PWD, DB_NAME, false);
if (!$db->db_connect_id) {
    die("Impossibile connettersi al dadabase");
}
$db->sql_query("select pratica from pe.recenti where utente={$userid} order by data desc");
$elenco_pratiche = $db->sql_fetchlist("pratica");
$prat_max = count($elenco_pratiche);
if (!$elenco_pratiche) {
    print "<p>Nessuna pratica aperta di recente dall'utente<p></body></html>";
    exit;
}
$offset = 0;
include "pe.elenco_pratiche.php";
?>
				<input  name=""  id="" class="hexfield1"  type="button" value="  Chiudi  " onClick="javascript:window.open('index.php','indexPraticaweb');window.close()"></td>
</BODY>
</HTML>
Пример #7
0
function valida_dati($array_config, $campi_obbligatori)
{
    //dall'array tratto dal file di configurazione crea l'array campi=>valori validati per il db
    $OK_Save = 1;
    $db = new sql_db(DB_HOST, DB_USER, DB_PWD, DB_NAME, false);
    if (!$db->db_connect_id) {
        die("Impossibile connettersi al database");
    }
    //Controllo dei campi obbligatori
    if (isset($campi_obbligatori)) {
        foreach ($campi_obbligatori as $c) {
            if (strlen(trim($_POST[trim($c)])) == 0) {
                $errors[trim($c)] = "Campo Obbligatorio";
                $OK_Save = 0;
            }
        }
    }
    //for ($i=1;$i<count($array_config);$i++){
    //	$row_config=explode('|',$array_config[$i]);
    //	foreach($row_config as  $r)
    //		$array_def[]=explode(';',$r);
    //}
    for ($i = 0; $i < count($array_config); $i++) {
        $row_config = $array_config[$i];
        foreach ($row_config as $r) {
            $array_def[] = explode(';', $r);
        }
    }
    foreach ($array_def as $def) {
        $campo = $def[1];
        $tipo = trim($def[3]);
        $val = trim($_POST[$campo]);
        //echo "Sto Validando $campo : $tipo con valore ".$val."<br>";
        switch ($tipo) {
            case "idriga":
                $val = '';
                //inutile metterlo nella query
                break;
            case "pratica":
                if (strlen(trim($val)) > 0) {
                    $sql = "SELECT pratica FROM pe.avvioproc WHERE numero='{$val}'";
                    if ($db->sql_query($sql)) {
                        $r = $db->sql_fetchrowset();
                        if (count($r) == 0) {
                            $OK_Save = 0;
                            $errors[$campo] = "La pratica {$val} non esiste";
                        } else {
                            $val = "'{$val}'";
                        }
                    }
                } else {
                    $val = "NULL";
                }
                break;
            case "text":
            case "textarea":
            case "richtext":
            case "autosuggest":
                if (strlen($val) > 0) {
                    if (get_magic_quotes_runtime() or get_magic_quotes_gpc()) {
                        //$val="'".htmlentities($val)."'";
                        $val = "'" . $val . "'";
                        //$val="'".$val."'";
                    } else {
                        //$val="'".htmlentities(addslashes($val),ENT_QUOTES)."'";
                        $val = "'" . addslashes($val) . "'";
                    }
                } elseif (strlen($val) === 0) {
                    $val = "NULL";
                }
                break;
            case "data":
                $l = strlen($val);
                //primo controllo se i caratteri inseriti sono del tipo corretto
                if (strlen($val) > 0 and !ereg("([0123456789/.-]{" . $l . "})", $val)) {
                    $OK_Save = 0;
                    $errors[$campo] = "Formato della data non valido {$val}";
                } else {
                    list($giorno, $mese, $anno) = split('[/.-]', $val);
                    //Da Verificare..... il 30 Febbraio 2005 lo prende se scritto come anno-mese-giorno con anno a 2 cifre!!!!! Errore
                    if (strlen($val) > 0 and checkdate((int) $mese, (int) $giorno, (int) $anno)) {
                        $val = "'" . $giorno . "/" . $mese . "/" . $anno . "'";
                    } elseif (strlen($val) > 0 and strlen($giorno) > 3 and checkdate((int) $mese, (int) $anno, (int) $giorno)) {
                        $val = "'" . $anno . "/" . $mese . "/" . $giorno . "'";
                    } elseif (strlen($val) > 0 and strlen($giorno) <= 2 and checkdate((int) $mese, (int) $anno, (int) $giorno)) {
                        $OK_Save = 0;
                        $errors[$campo] = "Data ambigua {$val}";
                    } elseif (strlen($val) > 0) {
                        $OK_Save = 0;
                        $errors[$campo] = "Data non valida {$val}";
                    } elseif (strlen($val) === 0) {
                        $val = "NULL";
                    }
                }
                break;
            case "select":
                if ($val) {
                    $val = "'" . addslashes($val) . "'";
                }
                break;
            case "multiselectdb":
                if (is_array($val) && count($val)) {
                    $val = implode(',', $val);
                } else {
                    $val = '';
                }
                break;
            case "selectdb":
            case "selectRPC":
                if ($val == -1) {
                    $OK_Save = 0;
                    $errors[$campo] = $campo == "tipo_allegati" ? "Impossibile modificare il tipo per allegati. Prima di modicarlo rimuovere tutti gli allegati presenti" : "Errore generico";
                } elseif (strlen(trim($val)) == 0) {
                    $val = 'null';
                } elseif (!is_numeric($val)) {
                    $val = "'" . addslashes($val) . "'";
                }
            case "elenco":
                break;
            case "valuta":
                //$val=str_replace("€","",$val);
                //$val=str_replace(".","",$val);
                $val = str_replace(",", ".", $val);
                if (strlen($val) and !is_numeric($val)) {
                    $OK_Save = 0;
                    $errors[$campo] = "Dato non numerico";
                } else {
                    if (strlen($val) == 0) {
                        $val = "0";
                    }
                }
                break;
            case "ora":
                $val = str_replace(",", ".", $val);
                $val = str_replace(":", ".", $val);
                if (strlen($val) and !is_numeric($val)) {
                    $OK_Save = 0;
                    $errors[$campo] = "Dato orario non valido";
                }
                break;
            case "superficie":
                $val = str_replace("mq", "", $val);
                $val = (double) str_replace(",", ".", $val);
                if (strlen($val) and !is_float($val)) {
                    $OK_Save = 0;
                    $errors[$campo] = "Dato non numerico";
                }
                break;
            case "volume":
            case "numero":
                $val = str_replace(",", ".", $val);
                if (strlen($val) and !is_numeric($val)) {
                    $OK_Save = 0;
                    $errors[$campo] = "Dato non numerico";
                }
                //else if (strlen($val)==0) $val=0.00;
                break;
            case "intero":
                if (is_numeric($val)) {
                    $val = (int) $val;
                }
                $val = str_replace(",", " ", $val);
                if (strlen($val) and !is_numeric($val) and !ereg("/^[0-9]{1,12}\$/")) {
                    $OK_Save = 0;
                    $errors[$campo] = "Dato non numerico";
                }
                //else if (strlen($val)==0) $val=0.00;
                break;
            case "bool":
                ($val = "SI") ? $val = "'t'" : ($val = "'f'");
                break;
            case "yesno":
                if ($val == 'SI') {
                    $val = 1;
                } else {
                    if ($val == 'NO') {
                        $val = 0;
                    }
                }
                break;
            case "checkbox":
            case "semaforo":
                if ($val == 'on') {
                    $val = 1;
                } else {
                    $val = 0;
                }
                break;
            case "radio":
                $arvalue = $_POST[$campo];
                break;
        }
        if ($tipo != "button" and $tipo != "submit") {
            $array_data[$campo] = $val;
        }
    }
    return array("data" => $array_data, "errors" => $errors);
}
function calcolacodicefiscale_calcolacomune($com)
{
    //----------------------------------------------------------------------------------------------------//
    //                               calcolacodicefiscale_calcolacomune                                   //
    // Restituisce il codice riferito al comune di nascita $com cercandolo nei files  comuni1(2,3,4).csv  //
    // La lista dei comuni Ú stata suddivisa in 4 files per rendere più veloce la ricerca.                //
    // Se non viene trovato il comune il valore di ritorno Ú "0"                                          //
    //                                                                                                    //
    //----------------------------------------------------------------------------------------------------//
    $finali = "12344";
    // stringa che contiene le lettere finali del file a seconda dell'iniziale
    //$PERCORSO="./dati/comuni/"; //path dei files comuni1-4.csv
    $iniziale = substr($com, 0, 1);
    // se l'iniziale non Ú una lettera ritorna il codice di errore
    if (ord($iniziale) < 65 || ord($iniziale) > 90) {
        return "0";
    }
    //sceglie il nome del file in base all'iniziale
    /* $filecomuni=$PERCORSO."comuni".substr($finali,floor((ord($iniziale)-64)/6),1).".csv";
       //apre in lettura il file in $filecomini che contiene l'elenco dei comuni e dei rispettivi codici
       $fp = fopen($filecomuni,"r");
       $cod="0";
       // legge il file finchÚ non trova il comune (inserisce il codice in $cod)
       while (  ($stringa = fgets($fp,4096)) and ($cod=="0")   ){
                  //riporta nell'array $campi il nome del comune letto($campi[0]) e il codice ($campi[1])
                  $campi=explode(";",$stringa);
                  if ($campi[0]==$com) {
                       //se ha trovato il comune mette in $cod il codice
                       $cod=substr($campi[1],0,4);
                  }
       }
       fclose($fp);*/
    $db = new sql_db(DB_HOST, DB_USER, DB_PWD, DB_NAME, false);
    if (!$db->db_connect_id) {
        die("Impossibile connettersi al database");
    }
    $sql = "SELECT codice FROM pe.e_comuni WHERE nome ilike '{$com}'";
    if ($db->sql_query($sql)) {
        $ris = $db->sql_fetchrowset();
        if (count($ris) == 1) {
            $cod = $ris[0]['codice'];
        } else {
            return 0;
        }
    }
    return $cod;
}
$db = new sql_db(DB_HOST, DB_USER, DB_PWD, DB_NAME, false);
if (!$db->db_connect_id) {
    die("Impossibile connettersi al dadabase {$dbtype}");
}
//Modalità di editing
if ($_POST["active_form"]) {
    $active_form = $_POST["active_form"] . "?step=0&pratica=" . $idpratica;
    $step = 0;
    $pratica = $_REQUEST["pratica"];
    if ($_POST["azione"] == "Salva") {
        // Se necessario inserisco il nuovo riferimento nella tabella
        $idref = $_POST["id"];
        if ($_POST["id"] == 0) {
            $descrizione = addslashes(trim($_POST["riferimento"]));
            $sql = "INSERT INTO pe.riferimenti(descrizione) VALUES('{$descrizione}')";
            $db->sql_query($sql);
            $sql = "select currval ('pe.riferimenti_id_seq')";
            $db->sql_query($sql);
            $row = $db->sql_fetchrow();
            $idref = $row[0];
        }
        //Modifico i riferimenti della tabella avvioproc
        $db->sql_query("SELECT pratica FROM pe.avvioproc,pe.riferimenti WHERE riferimenti.id=" . $_POST["id_prec"] . " AND avvioproc.riferimento=riferimenti.id");
        $nrif = $db->sql_numrows();
        if ($nrif <= 1) {
            $db->sql_query("DELETE FROM pe.riferimenti WHERE id=" . $_POST["id_prec"]);
        }
        $db->sql_query("update pe.avvioproc set riferimento={$idref} where pratica={$idpratica}");
    }
    return;
}
Пример #10
0
function getDBHost( $databasename = '' )
{
global $supportdb, $dbuser, $dbpasswd;
$dbsupport = new sql_db( $supportdb, $dbuser, $dbpasswd, 'nizex_support', false, true );

$query	= "select DBHost from optUserCompany where DBName = '".$databasename."'";

if ( !$result = $dbsupport->sql_query( $query ) )
	{
	LogError( 9369, $query ."<br>".$dbsupport->sql_error(), false );
	return false;
	}

$row = $dbsupport->sql_fetchrow( $result );
return $row[ "DBHost" ];
}
}
</script>

</head>

<body>
<H2 class=blueBanner>Elenco dei soggetti interessati</H2>
<TABLE cellPadding=0 cellspacing=0 border=0 class="stiletabella" width="100%">		

<?php 
$i = 0;
$db = new sql_db(DB_HOST, DB_USER, DB_PWD, DB_NAME, false);
if (!$db->db_connect_id) {
    die("Impossibile connettersi al database");
}
$db->sql_query("select * from pe.e_ruoli order by ordine;");
$elenco_ruoli = $db->sql_fetchrowset();
//print_array($elenco_ruoli);
$tabella_attuali = new Tabella_h("{$tabpath}/soggetto", 'list');
$tabella_variati = new Tabella_h("{$tabpath}/soggetto", 'list');
$tabella_variati->set_color("#FFFFFF", "#FF0000", 0, 0);
foreach ($elenco_ruoli as $row) {
    $ruolo = $row["ruolo"];
    $titolo = $row["titolo"];
    $ruolo == "proprietario" || $ruolo == "richiedente" || $ruolo == "concessionario" ? $img = "volture" : ($img = "variazioni");
    //$tabella_attuali->set_tag($ruolo);
    $tabella_attuali->params = array('ruolo' => $ruolo);
    $tabella_variati->params = array('ruolo' => $ruolo);
    //$tabella_variati->set_tag('v'.$ruolo);
    //$num_attuali=$tabella_attuali->set_dati("voltura=0 and $ruolo=1 and pratica=$idpratica");
    //$num_variati=$tabella_variati->set_dati("voltura=1 and $ruolo=1 and pratica=$idpratica");
Пример #12
0
<?php

include_once "login.php";
$db = new sql_db(DB_HOST, DB_USER, DB_PWD, DB_NAME, false);
if (!$db->db_connect_id) {
    die("Impossibile connettersi al database");
}
if (isset($_GET["mapkey"])) {
    $mapkey = explode('@', $_GET["mapkey"]);
}
//print_r ($mapkey);
$tipo = $mapkey[0];
$mappale = $mapkey[1];
$foglio = $mapkey[2];
$sql = "select oid,extent(buffer(the_geom," . BUFFER_SIZE . ")) from map.ct_particelle where foglio ilike('{$foglio}') and mappale ilike ('{$mappale}') group by oid;";
$result = $db->sql_query($sql);
$extent = $db->sql_fetchrow();
$ext = $extent["extent"];
$objid = $extent["oid"];
if ($ext) {
    $p1 = strpos($ext, "(") + 1;
    $p2 = strpos($ext, ")");
    $ext = substr($ext, $p1, $p2 - $p1);
    $ext = str_replace(",", "+", $ext);
    $ext = str_replace(" ", "+", $ext);
    $ext2 = str_replace("+", ";", $ext);
    include "http://localhost/cgi-bin/mapserv.exe?map=C:\\[pmapper]\\projects\\ceriale\\map\\catasto.map&mapext={$ext}";
    ?>
<SCRIPT LANGUAGE="JavaScript1.2">
  function openPmapper(winwidth, winheight, gLanguage, startParameters){
  //CASO FULLSCREEN DA AGGIUNGERE ALLE POSSIBILITA
Пример #13
0
 function change_menu($idpratica, $oldtipo, $newtipo)
 {
     if (!$idpratica) {
         return;
     }
     $db = new sql_db(DB_HOST, DB_USER, DB_PWD, DB_NAME, false);
     if (!$db->db_connect_id) {
         die("Impossibile connettersi al dadabase");
     }
     $sql = "select menu_list from pe.menu where pratica={$idpratica};";
     $result = $db->sql_query($sql);
     $oldmenu = $db->sql_fetchfield("menu_list");
     $pos = strpos($oldmenu, "#");
     if ($pos) {
         //ho aggiunto dei menu al menu originale
         $oldmenu = substr($oldmenu, $pos);
     } else {
         $oldmenu = "";
     }
     $db->sql_query("update pe.menu set menu_list=e_tipopratica.menu_default || '{$oldmenu}' from pe.e_tipopratica where e_tipopratica.id={$newtipo} and pratica={$idpratica};");
     unset($_SESSION["MENU_" . $this->tipo . "_{$idpratica}"]);
     //$db->sql_close();
 }
Пример #14
0
 print_debug($sql_piani, "tabella");
 //verifico l'esitenza dei vincoli per la pratica corrente
 $sql_vincoli = "select (coalesce(cdu.mappali.sezione,'') || ','::text || cdu.mappali.foglio || ','::text || cdu.mappali.mappale) as particella,mappali.vincolo,mappali.zona,mappali.perc_area,e_vincoli.descrizione from pe.e_vincoli, cdu.mappali where\nmappali.vincolo=e_vincoli.nome and pe.e_vincoli.cdu=1 and pratica={$idpratica} order by cdu.mappali.perc_area desc, cdu.mappali.sezione,cdu.mappali.foglio,cdu.mappali.mappale;";
 print_debug("Vincoli\n" . $sql_vincoli);
 //aggiungo i mappali che non risultano legati a vincoli
 $sql_mappali = "select (coalesce(cdu.mappali.sezione,'') || ','::text || cdu.mappali.foglio || ','::text || cdu.mappali.mappale)  as particella from cdu.mappali where pratica={$idpratica} and vincolo is null;";
 print_debug($sql_mappali, "tabella");
 //SCHEMA DB NUOVO
 //elenco dei piani
 $sql_piani2 = "select nome_vincolo,nome_tavola,descrizione from vincoli.tavola where cdu=1 order by ordine;";
 print_debug($sql_piani2, "tabella");
 //verifico l'esitenza dei vincoli per la pratica corrente
 $sql_vincoli2 = "select distinct(coalesce(cdu.mappali.sezione,'') || ','::text || cdu.mappali.foglio || ','::text || cdu.mappali.mappale) as particella,mappali.vincolo,mappali.zona,mappali.tavola,mappali.perc_area,\ncase when coalesce(zona.sigla,'')<>'' then zona.sigla else zona.descrizione end as descrizione from cdu.mappali left join vincoli.zona on (mappali.zona=zona.nome_zona and mappali.vincolo=zona.nome_vincolo) \nleft join vincoli.tavola on (mappali.tavola=zona.nome_tavola) where tavola.cdu=1 and  pratica={$idpratica}";
 print_debug("Vincoli\n" . $sql_vincoli2);
 //echo "<p>$sql_vincoli2</p>";
 $db->sql_query($sql_piani2);
 $piani = $db->sql_fetchrowset();
 $npiani = $db->sql_numrows();
 $db->sql_query($sql_vincoli2);
 $vincoli = $db->sql_fetchrowset();
 $nvincoli = $db->sql_numrows();
 $db->sql_query($sql_mappali);
 $mappali = $db->sql_fetchrowset();
 $nmappali = $db->sql_numrows();
 $array_mappali = array();
 $array_zone = array();
 //verifico se esiste il vincolo nelle tavole
 for ($r = 0; $r < $nvincoli; $r++) {
     $idparticella = $vincoli[$r]["particella"];
     $piano = $vincoli[$r]["tavola"];
     $zona = $array_zone[$idparticella][$piano];
Пример #15
0
}
// DATABASE
$coddb = new sql_db($db_host, $db_user, $db_pass, $db_db, false);
if (!$coddb->db_connect_id) {
    die("Could not connect to the database");
}
/*$query = "SELECT * 
  FROM ${t['players']}, ${t['b3_clients']} 
  WHERE ${t['b3_clients']}.id = ${t['players']}.client_id 
      AND ${t['players']}.id = '" . addslashes_gpc($player_id) . "'
      AND ((${t['players']}.kills > $minkills)
          OR (${t['players']}.rounds > $minrounds))
      AND (${t['players']}.hide = 0)
      AND ($current_time - ${t['b3_clients']}.time_edit  < $timelimit)";*/
$query = "SELECT * \n          FROM {$t['players']}, {$t['b3_clients']} \n          WHERE {$t['b3_clients']}.id = {$t['players']}.client_id \n              AND {$t['players']}.id = '" . addslashes_gpc($player_id) . "'";
$result = $coddb->sql_query($query);
$player = $coddb->sql_fetchrow($result);
$coddb->sql_query("START TRANSACTION");
$coddb->sql_query("BEGIN");
$coddb->sql_query("SET @place = 0");
$query2 = "select * from (\n             SELECT @place := @place + 1 AS place, {$t['players']}.id\n             FROM {$t['players']}, {$t['b3_clients']}\n          WHERE {$t['b3_clients']}.id = {$t['players']}.client_id\n              AND (({$t['players']}.kills > {$minkills})\n                  OR ({$t['players']}.rounds > {$minrounds}))\n              AND ({$t['players']}.hide = 0)\n              AND ({$current_time} - {$t['b3_clients']}.time_edit  < {$timelimit})";
if ($exclude_ban) {
    $query2 .= "AND {$t['b3_clients']}.id NOT IN (\n        SELECT distinct(target.id)\n        FROM {$t['b3_penalties']} as penalties, {$t['b3_clients']} as target\n        WHERE (penalties.type = 'Ban' OR penalties.type = 'TempBan')\n        AND inactive = 0\n        AND penalties.client_id = target.id\n        AND ( penalties.time_expire = -1 OR penalties.time_expire > UNIX_TIMESTAMP(NOW()) )\n      )";
}
$query2 .= "     ORDER BY {$t['players']}.skill DESC\n            ) derivated_table\n            where id = {$player_id}";
$result2 = $coddb->sql_query($query2);
$row2 = $coddb->sql_fetchrow($result2);
$coddb->sql_query("ROLLBACK");
if ($player['hide'] == 1) {
    $advertising = 1;
}
Пример #16
0
 /**
  * Loads self::$db if it is not loaded already.
  * Dies if the connection could not be established.
  *
  * @return void
  */
 protected static function loadDb()
 {
     global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $dbneedssetnames;
     if (self::$db !== null) {
         return;
     }
     include_once 'SemanticScuttle/db/' . $dbtype . '.php';
     $db = new sql_db();
     $db->sql_connect($dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist);
     if (!$db->db_connect_id) {
         message_die(CRITICAL_ERROR, 'Could not connect to the database', self::$db);
     }
     $dbneedssetnames && $db->sql_query('SET NAMES UTF8');
     self::$db = $db;
 }
define('ACL_OPTIONS_TABLE', $table_prefix . 'acl_options');
define('ACL_USERS_TABLE', $table_prefix . 'acl_users');
define('GROUPS_TABLE', $table_prefix . 'groups');
define('USERS_TABLE', $table_prefix . 'users');
$cache = new acm();
$db = new sql_db();
// Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
// auth => is_local, is_global
$f_permissions = array('f_' => array(1, 0), 'f_list' => array(1, 0), 'f_read' => array(1, 0), 'f_post' => array(1, 0), 'f_reply' => array(1, 0), 'f_edit' => array(1, 0), 'f_user_lock' => array(1, 0), 'f_delete' => array(1, 0), 'f_bump' => array(1, 0), 'f_poll' => array(1, 0), 'f_vote' => array(1, 0), 'f_votechg' => array(1, 0), 'f_announce' => array(1, 0), 'f_sticky' => array(1, 0), 'f_attach' => array(1, 0), 'f_download' => array(1, 0), 'f_icons' => array(1, 0), 'f_bbcode' => array(1, 0), 'f_smilies' => array(1, 0), 'f_img' => array(1, 0), 'f_flash' => array(1, 0), 'f_sigs' => array(1, 0), 'f_search' => array(1, 0), 'f_email' => array(1, 0), 'f_print' => array(1, 0), 'f_ignoreflood' => array(1, 0), 'f_postcount' => array(1, 0), 'f_noapprove' => array(1, 0), 'f_report' => array(1, 0), 'f_subscribe' => array(1, 0));
$m_permissions = array('m_' => array(1, 1), 'm_edit' => array(1, 1), 'm_delete' => array(1, 1), 'm_move' => array(1, 1), 'm_lock' => array(1, 1), 'm_split' => array(1, 1), 'm_merge' => array(1, 1), 'm_approve' => array(1, 1), 'm_unrate' => array(1, 1), 'm_auth' => array(1, 1), 'm_ip' => array(1, 1), 'm_info' => array(1, 1));
$a_permissions = array('a_' => array(0, 1), 'a_server' => array(0, 1), 'a_board' => array(0, 1), 'a_clearlogs' => array(0, 1), 'a_words' => array(0, 1), 'a_icons' => array(0, 1), 'a_bbcode' => array(0, 1), 'a_attach' => array(0, 1), 'a_email' => array(0, 1), 'a_styles' => array(0, 1), 'a_user' => array(0, 1), 'a_useradd' => array(0, 1), 'a_userdel' => array(0, 1), 'a_ranks' => array(0, 1), 'a_ban' => array(0, 1), 'a_names' => array(0, 1), 'a_group' => array(0, 1), 'a_groupadd' => array(0, 1), 'a_groupdel' => array(0, 1), 'a_forum' => array(0, 1), 'a_forumadd' => array(0, 1), 'a_forumdel' => array(0, 1), 'a_prune' => array(0, 1), 'a_auth' => array(0, 1), 'a_authmods' => array(0, 1), 'a_authadmins' => array(0, 1), 'a_authusers' => array(0, 1), 'a_authgroups' => array(0, 1), 'a_authdeps' => array(0, 1), 'a_backup' => array(0, 1), 'a_restore' => array(0, 1), 'a_search' => array(0, 1), 'a_events' => array(0, 1), 'a_cron' => array(0, 1));
$u_permissions = array('u_' => array(0, 1), 'u_sendemail' => array(0, 1), 'u_readpm' => array(0, 1), 'u_sendpm' => array(0, 1), 'u_sendim' => array(0, 1), 'u_hideonline' => array(0, 1), 'u_viewonline' => array(0, 1), 'u_viewprofile' => array(0, 1), 'u_chgavatar' => array(0, 1), 'u_chggrp' => array(0, 1), 'u_chgemail' => array(0, 1), 'u_chgname' => array(0, 1), 'u_chgpasswd' => array(0, 1), 'u_chgcensors' => array(0, 1), 'u_search' => array(0, 1), 'u_savedrafts' => array(0, 1), 'u_download' => array(0, 1), 'u_attach' => array(0, 1), 'u_sig' => array(0, 1), 'u_pm_attach' => array(0, 1), 'u_pm_bbcode' => array(0, 1), 'u_pm_smilies' => array(0, 1), 'u_pm_download' => array(0, 1), 'u_pm_edit' => array(0, 1), 'u_pm_printpm' => array(0, 1), 'u_pm_emailpm' => array(0, 1), 'u_pm_forward' => array(0, 1), 'u_pm_delete' => array(0, 1), 'u_pm_img' => array(0, 1), 'u_pm_flash' => array(0, 1));
echo "<p><b>Determining existing permissions</b></p>\n";
$sql = 'SELECT auth_option_id, auth_option FROM ' . ACL_OPTIONS_TABLE;
$result = $db->sql_query($sql);
$remove_auth_options = array();
while ($row = $db->sql_fetchrow($result)) {
    if (!in_array($row['auth_option'], array_keys(${substr($row['auth_option'], 0, 2) . 'permissions'}))) {
        $remove_auth_options[$row['auth_option']] = $row['auth_option_id'];
    }
    unset(${substr($row['auth_option'], 0, 2) . 'permissions'}[$row['auth_option']]);
}
$db->sql_freeresult($result);
if (sizeof($remove_auth_options)) {
    $db->sql_query('DELETE FROM ' . ACL_USERS_TABLE . ' WHERE auth_option_id IN (' . implode(', ', $remove_auth_options) . ')');
    $db->sql_query('DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE auth_option_id IN (' . implode(', ', $remove_auth_options) . ')');
    $db->sql_query('DELETE FROM ' . ACL_OPTIONS_TABLE . ' WHERE auth_option_id IN (' . implode(', ', $remove_auth_options) . ')');
    echo '<p><b>Removed the following auth options... [<i>' . implode(', ', array_keys($remove_auth_options)) . "</i>]</b></p>\n\n";
}
$prefixes = array('f_', 'a_', 'm_', 'u_');
Пример #18
0
//first we need to retrieve the list of all active companies that might have imported data
$db_support = new sql_db( $supportdb, $dbuser, $dbpasswd, 'nizex_support', false );

if ( $db_support->db_connect_id )
	{
	$query	= "select CompanyID, DBName, DBHost, TableVersion from optUserCompany where Active=1 ";
		
	if ( !( $result = $db_support->sql_query( $query ) ) )
		{	
		$lbl_error = $dblang[ "ErrorInSQL" ]."<br>".$db_support->sql_error();
		}
	
	while ( $row = $db_support->sql_fetchrow( $result ))
		{		
		$db = new sql_db( $dbhost, $dbuser, $dbpasswd, $row[ 'DBName' ], true );

		$query = "select * from conLeadSources where LeadName='Other'";
		if ( !( $result2 = $db->sql_query( $query ) ) )
			echo "Problem with: ".$query;

		if ( $db->sql_numrows( $result2 ) == 0 )
			{
			$query = "insert into conLeadSources values ( null, 'Other', 1 )";
			if ( !( $result2 = $db->sql_query( $query ) ) )
				echo "Problem with: ".$query;
			}
		} //end while looping through companies	 
	}
?>
Пример #19
0
    $mess_css = $db->sql_fetchfield('css_desc');
    $tipo = "modelli";
} elseif ($_REQUEST["mode"] == "new") {
    $tipo = "modelli";
}
if ($_REQUEST["form"]) {
    $form = $_REQUEST["form"];
}
if ($tipo == "modelli") {
    /*SELEZIONE DELLE VISTE DAL DATABASE*/
    $db = new sql_db(DB_HOST, DB_USER, DB_PWD, DB_NAME, false);
    if (!$db->db_connect_id) {
        die("Impossibile connettersi al database");
    }
    $sql = "(SELECT 'Seleziona -->' as nome,'' as tipo,'Seleziona -->' as alias_nome,'' as descrizione,1 as ord) UNION (SELECT DISTINCT nome_vista as nome,tipo,alias_nome_vista,descrizione_vista,2 as ord FROM stp.colonne) order by ord,nome;";
    $db->sql_query($sql);
    $tables = $db->sql_fetchlist('nome');
    $types = $db->sql_fetchlist('tipo');
    $alias = $db->sql_fetchlist('alias_nome');
    for ($i = 0; $i < count($tables); $i++) {
        $value = $types[$i] . "." . $tables[$i];
        $tmp = explode("_", $tables[$i]);
        $str_name = ucwords($alias[$i]);
        $print_options .= "\t\t\t\t\t\t\t\t\t<option value=\"{$value}\">{$str_name}</option>\n";
    }
    $sql = "SELECT CASE (tipo) WHEN 'FUNCTION' THEN 'FN_'||nome_vista ELSE nome_vista end as nome,nome as \t\tcolonna,alias_nome as alias_colonna,descrizione,visibile,tipo FROM stp.colonne WHERE visibile=1 order by nome_vista,nome;";
    //echo "<p>$sql</p>";
    if ($db->sql_query($sql)) {
        $ris = $db->sql_fetchrowset();
        for ($i = 0; $i < count($ris); $i++) {
            $cols[$ris[$i]["nome"]][] = array("colonna" => $ris[$i]["colonna"], "alias" => $ris[$i]["alias_colonna"], "descrizione" => $ris[$i]["descrizione"]);
<?php

$db = new sql_db(DB_HOST, DB_USER, DB_PWD, DB_NAME, false);
if (!$db->db_connect_id) {
    die("Impossibile connettersi al database");
}
$sql_CE = "delete from ce.commissione where ";
$sql_PD = "delete from ce.discusse where ";
$sql_PC = "delete from ce.partecipanti where ";
foreach ($idcomm as $id) {
    $filter .= "id={$id} or ";
    $filter1 .= "commissione={$id} or ";
}
$filter = substr($filter, 0, strlen($filter) - 3);
$filter1 = substr($filter1, 0, strlen($filter1) - 3);
$sql_CE .= $filter;
$sql_PD .= $filter1;
$sql_PC .= $filter1;
if (!$db->sql_query($sql_CE)) {
    echo "<br>{$sql_CE}<br>ERRORE NELLA CANCELLAZIONE!";
}
if (!$db->sql_query($sql_PD)) {
    echo "<br>{$sql_PD}<br>ERRORE NELLA CANCELLAZIONE!";
}
if (!$db->sql_query($sql_PC)) {
    echo "<br>{$sql_PC}<br>ERRORE NELLA CANCELLAZIONE!";
}
$notfound = 0;
//Attenzione funzione relazione tra il file elenco e
$pratichexpagina = 20;
$offset = 0;
$db = new sql_db(DB_HOST, DB_USER, DB_PWD, DB_NAME, false);
if (!$db->db_connect_id) {
    die("Impossibile connettersi al database");
}
//pagina con i risultati al primo giro faccio tutta la query poi mi porto dietro l'array delle pratiche trovate
$pagenum = $_POST["pag"] ? $_POST["pag"] : 1;
$elenco = $_POST["elenco"];
if (!isset($elenco)) {
    //se non ho ancora fatto la query la costruisco
    $sqlRicerca = "SELECT pratica,max(tmsins) FROM pe.wf_transizioni WHERE utente_fi={$_SESSION['USER_ID']} group by 1 order by 2 DESC LIMIT 100;";
    //echo $sqlRicerca;
    $db->sql_query($sqlRicerca);
    //trovo l'elenco degli id delle pratiche che mi interessano
    $elenco_pratiche = $db->sql_fetchlist("pratica");
    if ($elenco_pratiche) {
        $elenco = implode(",", $elenco_pratiche);
    }
    $_SESSION["RICERCA"] = $_POST;
} else {
    //sono al secondo giro ho l'elenco delle pratiche per la query
    $elenco_pratiche = explode(",", $elenco);
}
//così faccio una query in più la prima volta ma evito di fare una query pesante ad ogni pagina
?>
<html>
<head>
<title>Risultato Ricerca</title>
Пример #22
0
function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '')
{
    die("<html>\n<body bgcolor=\"#000000\">\n<span style=\"color:#FFFFFF;\">" . $msg_title . "</span>\n<br /><br />\n" . $msg_text . "</body>\n</html>");
}
/*
* The script itself :)
*/
$template->set_filenames(array('ct_body' => IP_ROOT_PATH . 'includes/ctracker/admin/console/emergency.tpl'));
/*
 * Console Operations
 */
$mode = $HTTP_GET_VARS['mode'];
if ($mode == 'restore') {
    // Drop existing Config Table
    $sql = 'DROP TABLE IF EXISTS ' . PREFIX . 'config';
    $result = $db->sql_query($sql);
    // Create Config table
    $sql = 'CREATE TABLE ' . PREFIX . 'config (
				`config_name` varchar(255) NOT NULL ,
				`config_value` text NOT NULL ,
				PRIMARY KEY (`config_name`)
				)';
    $result = $db->sql_query($sql);
    // Insert config data
    $sql = 'SELECT * FROM ' . PREFIX . 'ctracker_backup';
    $result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result)) {
        $sql2 = 'INSERT INTO ' . PREFIX . 'config (`config_name`, `config_value`) VALUES (\'' . $db->sql_escape($row['config_name']) . '\', \'' . $db->sql_escape($row['config_value']) . '\')';
        $result2 = $db->sql_query($sql2);
    }
    // Remove Backup Timestamp
Пример #23
0
        echo $idcomm;
        ?>
&active_form=ce.ordinegiorno.php';
			});
		</script>
	</form>
		
		<?php 
        // Eseguo cancellazione della pratica dalla commissione
        if ($idpratica) {
            $db = new sql_db(DB_HOST, DB_USER, DB_PWD, DB_NAME, false);
            if (!$db->db_connect_id) {
                die("Impossibile connettersi al database");
            }
            $sql = "DELETE FROM pe.pareri WHERE ente=(SELECT tipo_comm FROM ce.commissione WHERE id={$idcomm}) and data_rich=(SELECT data_convocazione FROM ce.commissione WHERE id={$idcomm}) and pratica={$idpratica}";
            if (!$db->sql_query($sql)) {
                echo "ERRORE NELLA CANCELLAZIONE DELLA PRATICA <br>{$sql}<br>";
            }
            print_debug($sql);
        }
        $tabella_h = new Tabella_h($file_config, $modo);
        $tabella_h->set_titolo("Elenco pratiche da discutere");
        $tabella_h->get_titolo();
        $tabella_h->set_dati("pratica > 0");
        ?>
	<form name="cancella" method="post" action="ce.ordinegiorno.php">
			<?php 
        $tabella_h->elenco();
        ?>
		<table>
			<tr>
Пример #24
0
} elseif ($azione == "Salva") {
    if ($pwd !== $pwd1) {
        $errors["pwd"] = "PassWord non Corrispondenti";
    }
    if ($livello_utente < $_SESSION["PERMESSI"]) {
        $errors["permessi"] = "Non si dispone dei permessi necessari";
    }
    $gruppi = implode(',', $_REQUEST['gruppi']);
    if ($modo == "new") {
        if (defined('GC_PROJECT')) {
            if ($_SESSION["PERMESSI"] > 1 && $role == 1) {
                $errors["role"] = "Non si dispone dei diritti per assegnare questo ruolo all'utente";
            } else {
                include "./db/db.gisclientuser.php";
                $sql = "INSERT INTO admin.users(userid,app,cognome,nominativo,username,pwd,enc_pwd,permessi,attivato,num_tel,info,gruppi,data_creazione,gisclient) VALUES({$newUserId},'{$app}','{$cognome}','{$nominativo}','{$username}','{$pwd}','{$enc_pwd}',{$livello_utente},{$attivato},'{$tel}','{$info}','{$gruppi}',now(),{$gc});";
                $db->sql_query($sql);
                $id = $newUserId;
            }
        } else {
            $sql = "INSERT INTO admin.users(app,cognome,nominativo,username,pwd,enc_pwd,permessi,attivato,num_tel,info,gruppi,data_creazione,gisclient) VALUES('{$app}','{$cognome}','{$nominativo}','{$username}','{$pwd}','{$enc_pwd}',{$livello_utente},{$attivato},'{$tel}','{$info}','{$gruppi}',now(),{$gc});";
            if (!$errors) {
                $db->sql_query($sql);
                $db->sql_query("SELECT max(userid) as lastvalue FROM admin.users");
                $id = $db->sql_fetchfield("lastvalue");
            }
        }
    } else {
        $sql = "UPDATE admin.users SET app='{$app}',nominativo='{$nominativo}',cognome='{$cognome}',username='******',pwd='{$pwd}',enc_pwd='{$enc_pwd}',gruppi='{$gruppi}',permessi='{$livello_utente}',attivato='{$attivato}',num_tel='{$tel}',info='{$info}',data_modifica=now(),gisclient={$gc} WHERE userid={$id}";
        if (!$errors) {
            $db->sql_query($sql);
        }
Пример #25
0
echo("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n");
echo("<meta name=\"author\" content=\"Icy Phoenix Team\" />\n");
echo("<title>Icy Phoenix :: UTF-8 Conversion</title>\n");
echo("</head>\n");
echo("<body>\n");
echo("<div style=\"font-family: 'Lucida Grande', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif; font-size: 10px;\">\n");
echo("<b style=\"color: #dd2222;\">DB Conversion to UTF-8 in progress, please do not stop the browser until the whole process is finished...</b><br />\n<br />\n<br />\n");
// HTML HEADER - END
flush();

$sql = "ALTER DATABASE {$db->sql_escape($dbname)}
	CHARACTER SET utf8
	DEFAULT CHARACTER SET utf8
	COLLATE utf8_bin
	DEFAULT COLLATE utf8_bin";
$db->sql_query($sql) or die($db->sql_error());

$sql = "SHOW TABLES";
$result = $db->sql_query($sql) or die($db->sql_error());
while ($row = $db->sql_fetchrow($result))
{
	// This assignment doesn't work...
	//$table = $row[0];

	$current_item = each($row);
	$table = $current_item['value'];
	reset($row);

	if (strpos($table, $table_prefix) === 0)
	{
		$sql = "ALTER TABLE {$db->sql_escape($table)}
Пример #26
0
        exit;
    }
}
$db = new sql_db($dbhost, $dbuname, $dbpass, $dbname, false);
if (!$db->db_connect_id) {
    die("Impossibile connettersi al database {$dbtype}");
}
$root = $dom->document_element();
$start = $root->get_elements_by_tagname("body");
$lista_field = $root->get_elements_by_tagname("user-field-get");
$out = get_table_fields($root);
$risultato = array();
//Ciclo sulle Tabelle
foreach ($out as $key => $value) {
    $sql_query[$key] = crea_query($key, $value, $cond);
    $db->sql_query($sql_query[$key]);
    $ris[$key] = $db->sql_fetchrowset();
    //Ciclo sui campi delle tabelle
    foreach ($value as $val) {
        $s = $key . "." . $val;
        $risultato[$s] = array();
        //Ciclo sui valori dei campi
        //echo "<br>";print_r($ris[$key]);
        foreach ($ris[$key] as $k => $v) {
            array_push($risultato[$s], $v[$val]);
        }
    }
}
//Modifico il file
foreach ($lista_field as $val) {
    $p = get_paragr($val);
Пример #27
0
 if ($install_step == 1) {
     if ($upgrade != 1) {
         if ($dbms != 'msaccess') {
             // Load in the sql parser
             include $phpbb_root_path . 'includes/sql_parse.' . $phpEx;
             // Ok we have the db info go ahead and read in the relevant schema
             // and work on building the table.. probably ought to provide some
             // kind of feedback to the user as we are working here in order
             // to let them know we are actually doing something.
             $sql_query = @fread(@fopen($dbms_schema, 'r'), @filesize($dbms_schema));
             $sql_query = preg_replace('/phpbb_/', $table_prefix, $sql_query);
             $sql_query = $remove_remarks($sql_query);
             $sql_query = split_sql_file($sql_query, $delimiter);
             for ($i = 0; $i < sizeof($sql_query); $i++) {
                 if (trim($sql_query[$i]) != '') {
                     if (!($result = $db->sql_query($sql_query[$i]))) {
                         $error = $db->sql_error();
                         page_header($lang['Install'], '');
                         page_error($lang['Installer_Error'], $lang['Install_db_error'] . '<br />' . $error['message']);
                         page_footer();
                         exit;
                     }
                 }
             }
             // Ok tables have been built, let's fill in the basic information
             $sql_query = @fread(@fopen($dbms_basic, 'r'), @filesize($dbms_basic));
             $sql_query = preg_replace('/phpbb_/', $table_prefix, $sql_query);
             $sql_query = $remove_remarks($sql_query);
             $sql_query = split_sql_file($sql_query, $delimiter_basic);
             for ($i = 0; $i < sizeof($sql_query); $i++) {
                 if (trim($sql_query[$i]) != '') {
Пример #28
0
<?php

include_once "../login.php";
error_reporting(E_ERROR);
//if(!$dbconn->connection_id){
$dbconn = new sql_db(DB_HOST, DB_USER, DB_PWD, DB_NAME, false);
if (!$dbconn->db_connect_id) {
    die("Impossibile connettersi al database");
}
//}
if ($_REQUEST['id_doc']) {
    $idDoc = $_REQUEST['id_doc'];
    $testo = $_REQUEST['testo'];
    $testo = html_entity_decode($testo);
    $sql = "SELECT file_doc,definizione,css.nome,print_type,stampe.form,stampe.pratica,c.testo as footer,d.testo as header,d.margin as mtop,c.margin as mbottom FROM stp.stampe left join stp.e_modelli on(stampe.modello=e_modelli.id) left join stp.css on(css_id=css.id) left join stp.e_intestazioni c on(footer=c.id) left join stp.e_intestazioni d on(header=d.id) WHERE stampe.id={$idDoc};";
    $dbconn->sql_query($sql);
    $pratica = $dbconn->sql_fetchfield('pratica');
    $file = $dbconn->sql_fetchfield('file_doc');
    $definizione = $dbconn->sql_fetchfield('definizione');
    $css_name = $dbconn->sql_fetchfield('nome');
    $form = $dbconn->sql_fetchfield('form');
    $footer = $dbconn->sql_fetchfield("footer");
    $header = $dbconn->sql_fetchfield("header");
    $mbottom = $dbconn->sql_fetchfield("mbottom");
    $mtop = $dbconn->sql_fetchfield("mtop");
    $is_cdu = $form == 'cdu.vincoli' ? 1 : 0;
    $infoFile = pathinfo($file);
    $nome = $infoFile["filename"];
    $ext = $infoFile["extension"];
    //print mb_detect_encoding($testo,"UTF-8, ISO-8859-1,ISO-8859-15");
    $testo = utf8_encode($testo);
Пример #29
0
$sql = "SELECT `module`, `config_name`, `config_value` FROM `" . NV_CONFIG_GLOBALTABLE . "` WHERE `lang`='" . NV_LANG_DATA . "' ORDER BY `module` ASC";
$list = nv_db_cache($sql, '', 'settings');
foreach ($list as $row) {
    if ($row['module'] == "global") {
        $global_config[$row['config_name']] = $row['config_value'];
    } else {
        $module_config[$row['module']][$row['config_name']] = $row['config_value'];
    }
}
if ($global_config['is_url_rewrite']) {
    $check_rewrite_file = nv_check_rewrite_file();
    if (!$check_rewrite_file) {
        $global_config['is_url_rewrite'] = 0;
    }
    if (empty($global_config['is_url_rewrite'])) {
        $db->sql_query("UPDATE `" . NV_CONFIG_GLOBALTABLE . "` SET `config_value`= '0' WHERE `module`='global' AND `config_name` = 'is_url_rewrite'");
        nv_delete_all_cache();
        //xoa toan bo cache
    }
}
if (defined('NV_ADMIN')) {
    if (!in_array(NV_LANG_DATA, $global_config['allow_adminlangs'])) {
        if ($global_config['lang_multi']) {
            $nv_Request->set_Cookie('data_lang', $global_config['site_lang'], NV_LIVE_COOKIE_TIME);
        }
        Header("Location: " . NV_BASE_ADMINURL);
        exit;
    }
    if (!in_array(NV_LANG_INTERFACE, $global_config['allow_adminlangs'])) {
        if ($global_config['lang_multi']) {
            $nv_Request->set_Cookie('int_lang', $global_config['site_lang'], NV_LIVE_COOKIE_TIME);
Пример #30
0
$sql = "SELECT `module`, `config_name`, `config_value` FROM `" . NV_CONFIG_GLOBALTABLE . "` WHERE `lang`='" . NV_LANG_DATA . "' ORDER BY `module` ASC";
$list = nv_db_cache($sql, '', 'settings');
foreach ($list as $row) {
    if ($row['module'] == "global") {
        $global_config[$row['config_name']] = $row['config_value'];
    } else {
        $module_config[$row['module']][$row['config_name']] = $row['config_value'];
    }
}
if (!isset($global_config['upload_checking_mode']) or !in_array($global_config['upload_checking_mode'], array("mild", "lite", "none"))) {
    $global_config['upload_checking_mode'] = "strong";
}
define('UPLOAD_CHECKING_MODE', $global_config['upload_checking_mode']);
//Cap nhat Country moi
if (!empty($newCountry)) {
    if ($db->sql_query("INSERT INTO `" . $db_config['prefix'] . "_ipcountry` VALUES (" . $newCountry['ip_from'] . ", " . $newCountry['ip_to'] . ", '" . $newCountry['code'] . "', '" . $newCountry['ip_file'] . "', " . NV_CURRENTTIME . ")")) {
        $time_del = NV_CURRENTTIME - 604800;
        $db->sql_query("DELETE FROM `" . $db_config['prefix'] . "_ipcountry` WHERE `ip_file`='" . $newCountry['ip_file'] . "' AND `country`='ZZ' AND `time` < " . $time_del);
        $result = $db->sql_query("SELECT `ip_from`, `ip_to`, `country` FROM `" . $db_config['prefix'] . "_ipcountry` WHERE `ip_file`='" . $newCountry['ip_file'] . "'");
        $array_ip_file = array();
        while ($row = $db->sql_fetch_assoc($result)) {
            $array_ip_file[] = $row['ip_from'] . " => array(" . $row['ip_to'] . ", '" . $row['country'] . "')";
        }
        file_put_contents(NV_ROOTDIR . "/" . NV_DATADIR . "/ip_files/" . $newCountry['ip_file'] . ".php", "<?php\n\n\$ranges = array(" . implode(', ', $array_ip_file) . ");\n\n?>", LOCK_EX);
    }
    unset($newCountry, $time_del, $array_ip_file, $result, $row);
}
if ($global_config['is_url_rewrite']) {
    $check_rewrite_file = nv_check_rewrite_file();
    if ($check_rewrite_file) {
        require NV_ROOTDIR . "/includes/rewrite.php";