Exemple #1
0
                fwrite($fd, $k . ': ' . $v . "\r\n");
            }
        }
        fwrite($fd, "# end settings.php */\r\n?>\r\n");
        fclose($fd);
        if ($post_action != $testSettingsStr && $post_action2 != $createNewStr) {
            $onload .= "alert('" . translate('Your settings have been saved', true) . ".\\n\\n');";
        }
        // Change to read/write by us only (only applies if we created file)
        // and read-only by all others. Would be nice to make it 600, but
        // the send_reminders.php script is usually run under a different
        // user than the web server.
        @chmod($file, 0644);
        // Clear the db cache.  Otherwise, users may get bounced back to this
        // install page even after the upgrade.
        dbi_clear_cache();
    }
}
//print_r ( $_SESSION);
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><title>WebCalendar Setup Wizard</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<?php 
include '../includes/js/visible.php';
?>
<script language="JavaScript" type="text/javascript">
<!-- <![CDATA[
Exemple #2
0
function dbi_query($sql, $fatalOnError = true, $showError = true)
{
    global $c, $db_connection_info, $db_query_count, $phpdbiVerbose, $SQLLOG;
    if (!isset($SQLLOG) && !empty($db_connection_info['debug'])) {
        $SQLLOG = array();
    }
    if (!empty($db_connection_info['debug'])) {
        $SQLLOG[] = $sql;
    }
    // echo "dbi_query!: " . htmlentities ( $sql ) . "<br />";
    // Connect now if not connected.
    if (is_array($db_connection_info) && !$db_connection_info['connected']) {
        $c = dbi_connect($db_connection_info['host'], $db_connection_info['login'], $db_connection_info['password'], $db_connection_info['database'], false);
        $db_connection_info['connected'] = true;
        $db_connection_info['connection'] = $c;
        // echo '<!-- Created delayed db connection (lazy) -->' . "\n";
    }
    $db_query_count++;
    // If caching is enabled, then clear out the cache for any request
    // that may update the datatabase.
    if (!empty($db_connection_info['cachedir'])) {
        if (!preg_match('/^select/i', $sql)) {
            dbi_clear_cache();
            if (!empty($db_connection_info['debug'])) {
                $SQLLOG[] = translate('Cache cleared from previous SQL!');
            }
        }
    }
    // do_debug ( "SQL:" . $sql);
    $found_db_type = false;
    if (strcmp($GLOBALS['db_type'], 'mysql') == 0) {
        $found_db_type = true;
        $res = mysql_query($sql, $db_connection_info['connection']);
    } elseif (strcmp($GLOBALS['db_type'], 'mysqli') == 0) {
        $found_db_type = true;
        $res = $GLOBALS['db_connection']->query($sql);
    } elseif (strcmp($GLOBALS['db_type'], 'mssql') == 0) {
        $found_db_type = true;
        $res = mssql_query($sql);
    } elseif (strcmp($GLOBALS['db_type'], 'oracle') == 0) {
        if (false === ($GLOBALS['oracle_statement'] = OCIParse($GLOBALS['oracle_connection'], $sql))) {
            dbi_fatal_error(translate('Error executing query.') . $phpdbiVerbose ? dbi_error() . "\n\n<br />\n" . $sql : '' . '', $fatalOnError, $showError);
        }
        return OCIExecute($GLOBALS['oracle_statement'], OCI_COMMIT_ON_SUCCESS);
    } elseif (strcmp($GLOBALS['db_type'], 'postgresql') == 0) {
        $found_db_type = true;
        $res = pg_exec($GLOBALS['postgresql_connection'], $sql);
    } elseif (strcmp($GLOBALS['db_type'], 'odbc') == 0) {
        return odbc_exec($GLOBALS['odbc_connection'], $sql);
    } elseif (strcmp($GLOBALS['db_type'], "ibm_db2") == 0) {
        $found_db_type = true;
        $res = db2_exec($GLOBALS['ibm_db2_connection'], $sql);
    } elseif (strcmp($GLOBALS['db_type'], 'ibase') == 0) {
        $found_db_type = true;
        $res = ibase_query($sql);
    } elseif (strcmp($GLOBALS['db_type'], 'sqlite') == 0) {
        $found_db_type = true;
        $res = sqlite_query($GLOBALS['sqlite_c'], $sql, SQLITE_NUM);
    }
    if ($found_db_type) {
        if (!$res) {
            dbi_fatal_error(translate('Error executing query.') . ($phpdbiVerbose ? dbi_error() . "\n\n<br />\n" . $sql : ''), $fatalOnError, $showError);
        }
        return $res;
    } else {
        dbi_fatal_error('dbi_query (): ' . translate('db_type not defined.'));
    }
}