예제 #1
0
파일: search.php 프로젝트: noveopiu/dCTL
<?php

if (!defined('_INCLUDE')) {
    define('_INCLUDE', true);
}
// header
require_once str_replace('//', '/', dirname(__FILE__) . '/') . 'header.php';
$connection = dctl_sql_connect(DCTL_DB_ICONCLASS);
if ($connection) {
    //
    $name = '';
    if (isset($_REQUEST['name'])) {
        $name = $_REQUEST['name'];
    }
    $id = '';
    if (isset($_REQUEST['id'])) {
        $id = $_REQUEST['id'];
    }
    if ($name != '') {
        $nameX = my_strtoupper($name);
        $nameSoundex = my_soundex($nameX);
        echo "<h2>Ricerca per NOME: " . $name . " ({$nameX} - {$nameSoundex})</h2>";
        $query = "SELECT  * FROM tNAME WHERE tNAME.nameSoundex='{$nameSoundex}' OR tNAME.nameNormalized LIKE '%{$nameX}%' OR SUBSTRING(SOUNDEX(tNAME.nameNormalized), 1, 4) =  SUBSTRING(SOUNDEX('" . $name . "'), 1, 4) ORDER BY tNAME.name";
    } else {
        echo "<h2>Ricerca per KEY: {$id}</h2>";
        $query = "SELECT  * FROM tNAME WHERE tNAME.id='{$id}'";
    }
    $result = mysql_query($query) or die("Error in query: {$query}.  " . mysql_error());
    if (mysql_num_rows($result) > 0) {
        echo '<table>';
        echo '<tr>';
예제 #2
0
파일: search.php 프로젝트: noveopiu/dCTL
<?php

if (!defined('_INCLUDE')) {
    define('_INCLUDE', true);
}
// header
require_once str_replace('//', '/', dirname(__FILE__) . '/') . 'header.php';
$connection = dctl_sql_connect(DCTL_DB_NAME);
if ($connection) {
    //
    $name = '';
    if (isset($_REQUEST['name'])) {
        $name = $_REQUEST['name'];
    }
    $id = '';
    if (isset($_REQUEST['id'])) {
        $id = $_REQUEST['id'];
    }
    if ($name != '') {
        $nameX = my_strtoupper($name);
        $nameSoundex = my_soundex($nameX);
        echo "<h2>Ricerca per NOME: " . $name . " ({$nameX} - {$nameSoundex})</h2>";
        $query = "SELECT  * FROM tNAME WHERE tNAME.nameSoundex='{$nameSoundex}' OR tNAME.nameNormalized LIKE '%{$nameX}%' OR SUBSTRING(SOUNDEX(tNAME.nameNormalized), 1, 4) =  SUBSTRING(SOUNDEX('" . $name . "'), 1, 4) ORDER BY tNAME.name";
    } else {
        echo "<h2>Ricerca per KEY: {$id}</h2>";
        $query = "SELECT  * FROM tNAME WHERE tNAME.id='{$id}'";
    }
    $result = mysql_query($query) or die("Error in query: {$query}.  " . mysql_error());
    if (mysql_num_rows($result) > 0) {
        echo '<table>';
        echo '<tr>';
예제 #3
0
function parse_command($text2parse)
{
    global $area;
    global $area_c;
    global $area_a;
    global $area;
    global $curr_area;
    global $curr_lang;
    global $string;
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    do {
        $PHP_SELF = $_SERVER['PHP_SELF'];
        $has_command1 = stripos($text2parse, '$[');
        if ($has_command1 !== false) {
            $has_command2 = stripos($text2parse, ']$');
            if ($has_command2 !== false) {
                $token = substr($text2parse, $has_command1, $has_command2 - $has_command1 + 2);
                $what = substr($token, 2, strlen($token) - 4);
                $prefix0 = explode(':', $what);
                $what = $prefix0[count($prefix0) - 1];
                $prefix = $prefix0[0];
                if ($prefix != $what) {
                    $prev_prefix = basename(dirname($PHP_SELF));
                    $PHP_SELF = str_ireplace($prev_prefix . SYS_PATH_SEP, $prefix . SYS_PATH_SEP, $PHP_SELF);
                    require_once str_replace(SYS_PATH_SEP_DOUBLE, SYS_PATH_SEP, dirname(__FILE__) . SYS_PATH_SEP) . DCTL_DATA_PATH . $prefix . SYS_PATH_SEP . 'config.inc.php';
                    switch ($prefix) {
                        case WEB_WCTL_NAME:
                            $key = array_multi_search($what, $area_c);
                            break;
                        case WEB_DCTL_NAME:
                            $key = array_multi_search($what, $area_a);
                            break;
                    }
                } else {
                    $key = array_multi_search($what, $area);
                }
                if (!stripos($what, '.php') === false) {
                    $replace = $what;
                } else {
                    $replace = $PHP_SELF;
                }
                $replace .= "?lang=" . $curr_lang . "&amp;area=" . $key;
                if (XMLDB_PATH_BASE_TMP) {
                    $replace .= "&amp;temp=true";
                }
                $text2parse = str_replace($token, $replace, $text2parse);
            }
        }
    } while ($has_command1 && $has_command2);
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    do {
        $has_command1 = stripos($text2parse, '${');
        if (!($has_command1 === false)) {
            $has_command2 = stripos($text2parse, '}$');
            if (!($has_command2 === false)) {
                $token = substr($text2parse, $has_command1, $has_command2 - $has_command1 + 2);
                $what = substr($token, 2, strlen($token) - 4);
                $replace = '';
                switch ($what) {
                    case 'newsletter':
                        $email = '';
                        if (isset($_REQUEST['email'])) {
                            $email = $_REQUEST['email'];
                        }
                        if (!stripos($email, '@') === false) {
                            require_once str_replace('//', '/', dirname(__FILE__) . '/') . '../_shared' . SYS_PATH_SEP . 'config.inc.php';
                            require_once str_replace(SYS_PATH_SEP_DOUBLE, SYS_PATH_SEP, dirname(__FILE__) . SYS_PATH_SEP) . './config.inc.php';
                            $connection = dctl_sql_connect(WEB_NEWSLETTER);
                            if ($connection) {
                                $email = addslashes($email);
                                $email = trim($email);
                                $query = "SELECT * FROM news_address WHERE email = '{$email}'";
                                $result = mysql_query($query);
                                if (mysql_num_rows($result) != false) {
                                    $replace .= "<br /><strong class=\"thankyou\">" . $string[$curr_lang]['mail_yetrecorded'] . " (" . $email . ")...</strong>";
                                } else {
                                    $query = "INSERT INTO news_address (id, email) VALUES (NULL, '{$email}')";
                                    $result = mysql_query($query);
                                    if (mysql_affected_rows() == 1) {
                                        $replace .= "<br /><strong class=\"thankyou\">" . $string[$curr_lang]['mail_ok'] . "...</strong>";
                                    } else {
                                        $replace .= "<br /><strong class=\"thankyou\">" . $string[$curr_lang]['mail_not'] . " (" . $email . ")...</strong>";
                                    }
                                }
                                mysql_close($connection);
                            } else {
                                $replace .= "<br /><strong class=\"thankyou\">" . $string[$curr_lang]['mail_nosrv'] . "...</strong></em>";
                            }
                        } else {
                            $replace .= '<form id="newsletter" action="' . $_SERVER['PHP_SELF'] . '" method="' . DCTL_FORM_METHOD . '" enctype="' . DCTL_FORM_ENCTYPE . '">';
                            $replace .= "<fieldset>";
                            $replace .= "<input class=\"small\" type=\"text\" size=\"20\" name=\"email\" value=\"(e-mail)\" />";
                            $replace .= "<label class=\"small\">";
                            $replace .= "<a class=\"small\" href=\"javascript:submitform('newsletter');\"> -&gt; " . $string[$curr_lang]['mail_sign'] . "</a>";
                            $replace .= "</label>";
                            $replace .= "<input type=\"hidden\" name=\"area\" value=\"" . $curr_area . "\" />";
                            $replace .= "<input type=\"hidden\" name=\"lang\" value=\"" . $curr_lang . "\" />";
                            $replace .= "</fieldset></form>";
                        }
                        break;
                }
                $text2parse = str_replace($token, $replace, $text2parse);
            }
        }
    } while ($has_command1 && $has_command2);
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    return $text2parse;
}
예제 #4
0
function getRetrieverDB($doc, $what, $selector)
{
    $returnText = '';
    global $mysql_dbName;
    try {
        $mysql_dbName = dctl_sql_connect(DCTL_DB_NAME);
    } catch (Exception $e) {
        die('<div class="wctl_error">[DB] ' . $e . '</div>');
    }
    $name = $what;
    $nameX = my_strtoupper($name);
    $nameSoundex = my_soundex($nameX);
    $query = "SELECT * FROM tNAME WHERE";
    $byCode = preg_match('/^\\d{6}$/', $nameX);
    if ($byCode) {
        $query .= " tNAME.id = {$nameX} ";
    } else {
        $query .= " tNAME.nameNormalized LIKE '%{$nameX}%' ";
        if ($selector != '') {
            $query .= "AND tNAME.type='{$selector}' ";
        }
    }
    $query .= "ORDER BY tNAME.name";
    $result = mysql_query($query, $mysql_dbName) or die("Error in query: {$query}.  " . mysql_error());
    $code = array();
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        if (intval($row['collector']) != 0) {
            $code[$row['collector']] = $row['collector'];
        } else {
            $code[$row['id']] = $row['id'];
        }
    }
    if (count($code) > 0) {
        $iter = -1;
        $query = "SELECT * FROM tNAME WHERE ";
        foreach ($code as $collector => $id) {
            ++$iter;
            if ($iter > 0) {
                $query .= "OR ";
            }
            $query .= "tNAME.id='{$collector}' ";
        }
        $query .= "ORDER BY tNAME.type, tNAME.name";
        $result = mysql_query($query, $mysql_dbName) or die("Error in query: {$query}.  " . mysql_error());
        mysql_close($mysql_dbName);
        if (mysql_num_rows($result)) {
            $cachedKEY = '';
            // load all KEYs to cache for next XSLT
            preloadKEY($doc, &$cachedKEY);
            if ($cachedKEY) {
                while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
                    $theKey = sprintf("%06s", $row['id']);
                    if (stripos($cachedKEY, $theKey) !== false) {
                        $returnText .= $row['name'];
                        $returnText .= ' [' . $row['type'] . ']';
                        $returnText .= "|" . $theKey . "\n";
                    }
                }
            }
        }
    }
    return $returnText;
}
예제 #5
0
파일: functions.inc.php 프로젝트: net7/dCTL
function publish_SendToXDB($exist, $collName, $packName, $partName, &$operationsPublish)
{
    global $EXTENSION_PACKAGE;
    // INIT
    $toPublish = array();
    // PREPARA FOLDERS
    $component = $collName;
    if ($packName != '') {
        $component .= SYS_PATH_SEP . $packName;
    }
    $operationsPublish .= '&gt; avvio la preparazione dei dati per "' . $component . ':<br />';
    hardFlush(&$operationsPublish);
    $prosecute = TRUE;
    if (!is_dir(DCTL_PUBLISH)) {
        if (mkdir(DCTL_PUBLISH, CHMOD)) {
            $operationsPublish .= '&gt; creo cartella ' . DCTL_PUBLISH . '...<br />';
        } else {
            $operationsPublish .= '<span class="error">impossibile creare la cartella "' . DCTL_PUBLISH . '"!</span><br />';
            $prosecute = FALSE;
        }
    }
    @chmod(DCTL_PUBLISH, CHMOD);
    $operationsPublish .= '&gt; avvio la preparazione dei file in "' . DCTL_PUBLISH . '":<br />';
    hardFlush(&$operationsPublish);
    if ($prosecute) {
        // COPIA I DTD
        dircopy(DCTL_SETTINGS_DTD, DCTL_PUBLISH);
        $operationsPublish .= '&#160;&#160;- copio "' . DCTL_DTD . '"...<br />';
        hardFlush(&$operationsPublish);
        // COPIA GLI ADD-ONS
        dircopy(DCTL_SETTINGS_ADDONS, DCTL_PUBLISH);
        $operationsPublish .= '&#160;&#160;- copio "' . DCTL_ADDONS . '"...<br />';
        hardFlush(&$operationsPublish);
        // AGGIORNA IL CATALOGO.XML
        $operationsPublish .= '&#160;&#160;- verifico il catalogo dei "' . DCTL_DTD . '":<br />';
        hardFlush(&$operationsPublish);
        $dtd_catalog = XMLDB_CATALOG;
        try {
            if (isset($xml_dom)) {
                unset($xml_dom);
            }
            $xml_dom = new DOMDocument('1.0', 'UTF-8');
            $xml_dom->preserveWhiteSpace = false;
            forceUTF8($dtd_catalog);
            $xml_dom->load($dtd_catalog, DCTL_XML_LOADER);
        } catch (Exception $e) {
            $operationsPublish .= '<span class="error">impossibile caricare XML "' . $entry . '"... {' . $e . '}</span><br />';
            $prosecute = FALSE;
        }
        if ($prosecute) {
            $upd = FALSE;
            $dtds_needed = array();
            $handle = opendir(DCTL_SETTINGS_DTD);
            while ($entry = readdir($handle)) {
                if (substr($entry, 0, 1) != '.') {
                    $srcx = filemtime(DCTL_SETTINGS_DTD . $entry);
                    $tgtx = false || @filemtime(XMLDB_ENTITIES . SYS_PATH_SEP . $entry);
                    if ($srcx > $tgtx) {
                        $upd = TRUE;
                    }
                }
            }
            dircopy(DCTL_SETTINGS_DTD, XMLDB_ENTITIES, &$dtds_needed);
            $operationsPublish .= '&#160;&#160;- copio da "' . DCTL_SETTINGS_DTD . '" a "' . XMLDB_ENTITIES . '"...<br />';
            hardFlush(&$operationsPublish);
            $dtds_present = $xml_dom->getElementsByTagName('system');
            foreach ($dtds_present as $dtd_present) {
                $dtd_chk = $dtd_present->getAttribute('systemId');
                $dtd_key = array_search($dtd_chk, $dtds_needed);
                if ($dtd_key !== FALSE) {
                    $dtds_needed[$dtd_key] = '';
                }
            }
            foreach ($dtds_needed as $dtd_needed) {
                if ($dtd_needed != '') {
                    $node = $xml_dom->createElement('system');
                    $dtd_root = $xml_dom->getElementsByTagName('catalog')->item(0);
                    $newnode = $dtd_root->appendChild($node);
                    $newnode->setAttribute('systemId', $dtd_needed);
                    $newnode->setAttribute('uri', 'entities' . SYS_PATH_SEP . $dtd_needed);
                    $operationsPublish .= '&gt; aggiungo ' . $dtd_needed . '...<br />';
                    hardFlush(&$operationsPublish);
                    $upd = TRUE;
                }
            }
            if ($upd == TRUE) {
                $xml_dom->save($dtd_catalog);
                $operationsPublish .= '<span class="error">Aggiornamento non eseguito per modifiche necessarie al database.</span><br />';
                $operationsPublish .= '<span class="error">IMPORTANTE: riavviare exist per proseguire correttamente (aggiornato "catalog.xml")!</span><br />';
                $prosecute = FALSE;
            }
            if ($prosecute) {
                // PREPARA XML #1
                $xsl_path = DCTL_COMMODORO_XSLT . 'tei_publisher_1.xsl';
                if (!is_file($xsl_path)) {
                    $operationsPublish .= '<span class="error">impossibile trovare XSLT "' . $xsl_path . '"!</span><br />';
                    $prosecute = FALSE;
                } else {
                    try {
                        if (isset($xsl_dom)) {
                            unset($xsl_dom);
                        }
                        $xsl_dom = new DOMDocument('1.0', 'UTF-8');
                        $xsl_dom->preserveWhiteSpace = false;
                        forceUTF8($xsl_path);
                        $xsl_dom->load($xsl_path, DCTL_XML_LOADER);
                    } catch (Exception $e) {
                        $operationsPublish .= '<span class="error">impossibile caricare XSLT "' . $xsl_path . '"... {' . $e . '}</span><br />';
                        $prosecute = FALSE;
                    }
                    if ($prosecute) {
                        $operationsPublish .= '&gt; carico XSLT "' . $xsl_path . '"...<br />';
                        hardFlush(&$operationsPublish);
                        try {
                            if (isset($xsl_proc)) {
                                unset($xsl_proc);
                            }
                            $xsl_proc = new XSLTProcessor();
                            $xsl_proc->registerPHPFunctions();
                            $xsl_proc->importStyleSheet($xsl_dom);
                            // attach the xsl rules
                        } catch (Exception $e) {
                            $operationsPublish .= '<span class="error">impossibile inizializzare il processore XSL... {' . $e . '}</span><br />';
                            $prosecute = FALSE;
                        }
                        if ($prosecute) {
                            $operationsPublish .= '&gt; trasformo i file XML (#1):<br />';
                            $prosecute = publish_recurseContents(DCTL_PROJECT_PATH . $collName, $collName, $packName, $xsl_proc, &$operationsPublish, &$toPublish);
                        }
                        if ($prosecute) {
                            // PREPARA XML #2
                            $xsl_path = DCTL_COMMODORO_XSLT . 'tei_publisher_2.xsl';
                            if (!is_file($xsl_path)) {
                                $operationsPublish .= '<span class="error">impossibile trovare XSLT "' . $xsl_path . '"!</span><br />';
                                $prosecute = FALSE;
                            } else {
                                try {
                                    if (isset($xsl_dom)) {
                                        unset($xsl_dom);
                                    }
                                    $xsl_dom = new DOMDocument('1.0', 'UTF-8');
                                    $xsl_dom->preserveWhiteSpace = false;
                                    forceUTF8($xsl_path);
                                    $xsl_dom->load($xsl_path, DCTL_XML_LOADER);
                                } catch (Exception $e) {
                                    $operationsPublish .= '<span class="error">impossibile caricare XSLT "' . $xsl_path . '"... {' . $e . '}</span><br />';
                                    $prosecute = FALSE;
                                }
                                if ($prosecute) {
                                    $operationsPublish .= '&gt; carico XSLT "' . $xsl_path . '"...<br />';
                                    hardFlush(&$operationsPublish);
                                    try {
                                        if (isset($xsl_proc)) {
                                            unset($xsl_proc);
                                        }
                                        $xsl_proc = new XSLTProcessor();
                                        $xsl_proc->registerPHPFunctions();
                                        $xsl_proc->importStyleSheet($xsl_dom);
                                        // attach the xsl rules
                                    } catch (Exception $e) {
                                        $operationsPublish .= '<span class="error">impossibile inizializzare il processore XSL... {' . $e . '}</span><br />';
                                        $prosecute = FALSE;
                                    }
                                    if ($prosecute) {
                                        $operationsPublish .= '&gt; trasformo i file XML :: ID/NUM (#2):<br />';
                                        hardFlush(&$operationsPublish);
                                        foreach ($toPublish as $fullsrc) {
                                            $prosecute = true;
                                            $fulldst = $fullsrc;
                                            $entry = basename($fulldst);
                                            if (in_array(substr($entry, -8, 4), $EXTENSION_PACKAGE) !== FALSE) {
                                                $operationsPublish .= '&#160;- trasformazione XSLT per XML "' . $entry . '":';
                                                try {
                                                    if (isset($xml_dom)) {
                                                        unset($xml_dom);
                                                    }
                                                    $xml_dom = new DOMDocument('1.0', 'UTF-8');
                                                    $xsl_dom->preserveWhiteSpace = false;
                                                    forceUTF8($fullsrc);
                                                    $xml_dom->load($fullsrc, DCTL_XML_LOADER);
                                                } catch (Exception $e) {
                                                    $operationsPublish .= '<span class="error">impossibile caricare XML "' . $entry . '"... {' . $e . '}</span><br />';
                                                    $prosecute = FALSE;
                                                }
                                                if ($prosecute) {
                                                    $operationsPublish .= '&#160;aggiorno...';
                                                    try {
                                                        $text = $xsl_proc->transformToXML($xml_dom);
                                                    } catch (Exception $e) {
                                                        $operationsPublish .= '<span class="error">impossibile trasformare XML "' . $entry . '"... {' . $e . '}</span><br />';
                                                        $prosecute = FALSE;
                                                    }
                                                    if ($prosecute) {
                                                        $operationsPublish .= '&#160;scrivo XML...';
                                                        $text = str_ireplace('xmlns=""', '', $text);
                                                        try {
                                                            $fd = fopen($fulldst, "wb");
                                                            $out = fwrite($fd, forceUTF8($text));
                                                            fclose($fd);
                                                            @chmod($fulldst, CHMOD);
                                                            $operationsPublish .= '&#160;ok<br/>';
                                                        } catch (Exception $e) {
                                                            $operationsPublish .= '<span class="error">impossibile riscrivere XML "' . $entry . '"... {' . $e . '}</span><br />';
                                                            $prosecute = FALSE;
                                                        }
                                                        hardFlush(&$operationsPublish);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    if ($prosecute) {
                                        // PREPARA XML #3
                                        // 3) carico i file XML e li trasformo
                                        $xsl_path = DCTL_COMMODORO_XSLT . 'tei_publisher_3.xsl';
                                        if (!is_file($xsl_path)) {
                                            $operationsPublish .= '<span class="error">impossibile trovare XSLT "' . $xsl_path . '"!</span><br />';
                                            $prosecute = FALSE;
                                        }
                                        if ($prosecute) {
                                            try {
                                                if (isset($xsl_dom)) {
                                                    unset($xsl_dom);
                                                }
                                                $xsl_dom = new DOMDocument('1.0', 'UTF-8');
                                                $xsl_dom->preserveWhiteSpace = false;
                                                forceUTF8($xsl_path);
                                                $xsl_dom->load($xsl_path, DCTL_XML_LOADER);
                                            } catch (Exception $e) {
                                                $operationsPublish .= '<span class="error">impossibile caricare XSLT "' . $xsl_path . '"... {' . $e . '}</span><br />';
                                                $prosecute = FALSE;
                                            }
                                            if ($prosecute) {
                                                $operationsPublish .= '&gt; carico XSLT "' . $xsl_path . '"...<br />';
                                                hardFlush(&$operationsPublish);
                                                try {
                                                    if (isset($xsl_proc)) {
                                                        unset($xsl_proc);
                                                    }
                                                    $xsl_proc = new XSLTProcessor();
                                                    $xsl_proc->registerPHPFunctions();
                                                    $xsl_proc->importStyleSheet($xsl_dom);
                                                    // attach the xsl rules
                                                } catch (Exception $e) {
                                                    $operationsPublish .= '<span class="error">impossibile inizializzare il processore XSL... {' . $e . '}</span><br />';
                                                    $prosecute = FALSE;
                                                }
                                                if ($prosecute) {
                                                    $operationsPublish .= '&gt; trasformo i file XML :: LABEL/NAME/TOPIC (#3):<br />';
                                                    hardFlush(&$operationsPublish);
                                                    global $mysql_dbName;
                                                    global $mysql_dbIconclass;
                                                    try {
                                                        $mysql_dbName = dctl_sql_connect(DCTL_DB_NAME);
                                                    } catch (Exception $e) {
                                                        die('<span class="wctl_error">[DB] ' . $e . '</span>');
                                                    }
                                                    try {
                                                        $mysql_dbIconclass = dctl_sql_connect(DCTL_DB_ICONCLASS);
                                                    } catch (Exception $e) {
                                                        die('<span class="wctl_error">[DB] ' . $e . '</span>');
                                                    }
                                                    foreach ($toPublish as $fullsrc) {
                                                        $prosecute = true;
                                                        $fulldst = $fullsrc;
                                                        $entry = basename($fulldst);
                                                        if (in_array(substr($entry, -8, 4), $EXTENSION_PACKAGE) !== FALSE) {
                                                            $operationsPublish .= '&#160;- trasformazione XSLT per XML "' . $entry . '":';
                                                            try {
                                                                if (isset($xml_dom)) {
                                                                    unset($xml_dom);
                                                                }
                                                                $xml_dom = new DOMDocument('1.0', 'UTF-8');
                                                                $xml_dom->preserveWhiteSpace = false;
                                                                forceUTF8($fullsrc);
                                                                $xml_dom->load($fullsrc, DCTL_XML_LOADER);
                                                            } catch (Exception $e) {
                                                                $operationsPublish .= '<span class="error">impossibile caricare XML "' . $entry . '"... {' . $e . '}</span><br />';
                                                                $prosecute = FALSE;
                                                            }
                                                            if ($prosecute) {
                                                                $operationsPublish .= '&#160;aggiorno...';
                                                                if ($mysql_dbName && $mysql_dbIconclass) {
                                                                    try {
                                                                        // the two parameters (collection and package) are needed for key_items, they will
                                                                        // be used by the function *get_n_from_xml_id*, which is called from xslt
                                                                        $xsl_proc->setParameter('', 'collection', $collName);
                                                                        // if $packName is empty, we need to do some ugly hack on the
                                                                        if ($packName == '') {
                                                                            $package = substr($entry, strpos($entry, $collName . '-') + strlen($collName . '-'), strrpos($entry, '.') - strlen($entry));
                                                                        } else {
                                                                            $package = $packName;
                                                                        }
                                                                        $xsl_proc->setParameter('', 'package', $package);
                                                                        $text = $xsl_proc->transformToXML($xml_dom);
                                                                    } catch (Exception $e) {
                                                                        $operationsPublish .= '<span class="error">impossibile trasformare XML "' . $entry . '"... {' . $e . '}</span><br />';
                                                                        $prosecute = FALSE;
                                                                    }
                                                                    if ($prosecute) {
                                                                        $operationsPublish .= '&#160;scrivo XML...';
                                                                        $text = str_ireplace('xmlns=""', '', $text);
                                                                        try {
                                                                            $fd = fopen($fulldst, "wb");
                                                                            $out = fwrite($fd, forceUTF8($text, $fulldst));
                                                                            fclose($fd);
                                                                            @chmod($fulldst, CHMOD);
                                                                            $operationsPublish .= 'ok<br/>';
                                                                        } catch (Exception $e) {
                                                                            $operationsPublish .= '<span class="error">impossibile riscrivere XML "' . $entry . '"... {' . $e . '}</span><br />';
                                                                            $prosecute = FALSE;
                                                                        }
                                                                        hardFlush(&$operationsPublish);
                                                                    }
                                                                } else {
                                                                    $operationsPublish .= '<span class="error">impossibile connettersi a MySQL...</span><br />';
                                                                    $prosecute = FALSE;
                                                                }
                                                            }
                                                        }
                                                    }
                                                    mysql_close($mysql_dbName);
                                                    mysql_close($mysql_dbIconclass);
                                                    if ($prosecute) {
                                                        // PREPARA XMLDB
                                                        $operationsPublish .= '&gt; connessione al database "exist":<br />';
                                                        hardFlush(&$operationsPublish);
                                                        if (!$exist) {
                                                            $operationsPublish .= '<span class="error">impossibile connettersi al database "exist"... {' . $e . '}</span><br />';
                                                            $prosecute = FALSE;
                                                        }
                                                        if ($prosecute) {
                                                            $baseDB = XMLDB_PATH_BASE;
                                                            $result = $exist->createCollection($baseDB) != FALSE or dump($exist->getError());
                                                            if (!$result) {
                                                                $operationsPublish .= '<span class="error">impossibile creare la Collection base "' . $baseDB . '"!</span><br />';
                                                                $prosecute = FALSE;
                                                            }
                                                            if ($prosecute) {
                                                                // 1) creo la collezione in exist
                                                                $operationsPublish .= '&#160;&#160;- aggiorno la Collection "' . $collName . '":<br />';
                                                                hardFlush(&$operationsPublish);
                                                                if ($packName == '') {
                                                                    $exist->removeCollection($baseDB . $collName);
                                                                    $operationsPublish .= '&#160;&#160;- ripulisco la Collection "' . $collName . '"...<br />';
                                                                }
                                                                $result = $exist->createCollection($baseDB . $collName) != FALSE or dump($exist->getError());
                                                                if (!$result) {
                                                                    $operationsPublish .= '<span class="error">impossibile creare la Collection "' . $collName . '"!</span><br />';
                                                                    $prosecute = FALSE;
                                                                }
                                                                $operationsPublish .= '&gt; pubblico i dati nel database...<br />';
                                                                hardFlush(&$operationsPublish);
                                                                foreach ($toPublish as $fullsrc) {
                                                                    $prosecute = true;
                                                                    $fulldst = $fullsrc;
                                                                    $entry = basename($fulldst);
                                                                    // 3) pubblico nella collezione di exist
                                                                    $operationsPublish .= '&#160;&#160;- pubblico "' . $entry . '"...';
                                                                    $pathTo = $baseDB . $collName . DB_PATH_SEP . $entry;
                                                                    $result = $exist->uploadResource($pathTo, $fulldst) !== FALSE or dump($exist->getError());
                                                                    if (!$result) {
                                                                        $operationsPublish .= '<span class="error">impossibile pubblicare XML "' . $entry . '"!</span><br />';
                                                                        $prosecute = FALSE;
                                                                    } else {
                                                                        $operationsPublish .= '&#160;ok<br />';
                                                                        $prosecute = TRUE;
                                                                    }
                                                                    hardFlush(&$operationsPublish);
                                                                }
                                                                if ($prosecute) {
                                                                    $fullsrc = DCTL_PROJECT_PATH . $collName . SYS_PATH_SEP . DCTL_MEDIA;
                                                                    if (true) {
                                                                        $prosecute = publish_recurseMedia($fullsrc, DCTL_PUBLISH_MEDIA, &$operationsPublish);
                                                                    } else {
                                                                        if (!COPY_MEDIA) {
                                                                            $operationsPublish .= '<br /><span class="error">RI-ABILITA COPIA DEI MEDIA...';
                                                                        } else {
                                                                            // COPIA MEDIA
                                                                            $operationsPublish .= '&#160;&#160;- copio "' . $fullsrc . '"...<br />';
                                                                            hardFlush(&$operationsPublish);
                                                                            dircopy($fullsrc, DCTL_PUBLISH_MEDIA);
                                                                        }
                                                                    }
                                                                    $operationsPublish .= '<br /><span class="ok">Pubblicazione per "' . $collName;
                                                                    if ($packName != '') {
                                                                        $operationsPublish .= SYS_PATH_SEP . $packName;
                                                                    }
                                                                    $operationsPublish .= '" effettuata con successo.</span><br /><br />';
                                                                } else {
                                                                    $operationsPublish .= '<br /><span class="error">Errori nella pubblicazione per "' . $component . '"!</span><br /><br />';
                                                                }
                                                                hardFlush(&$operationsPublish);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return TRUE && $prosecute;
}