Ejemplo n.º 1
0
function initialize_session()
{
    global $ptitle_strings, $adm_strings;
    $session_vars = array('s_init' => TRUE, 's_cookies' => 'untested', 's_stylesheet_etag' => '', 's_connected' => FALSE, 's_binpath' => FALSE, 's_referer' => '', 's_page' => '', 's_cust' => get_customize_defaults($useragent), 's_login' => array('database' => DEFAULT_PATH . DEFAULT_DB, 'user' => DEFAULT_USER, 'host' => DEFAULT_HOST, 'password' => '', 'role' => DEFAULT_ROLE, 'cache' => DEFAULT_CACHE, 'charset' => DEFAULT_CHARSET, 'dialect' => DEFAULT_DIALECT, 'server' => DEFAULT_SERVER), 's_create_db' => '', 's_create_user' => '', 's_create_pw' => '', 's_create_host' => '', 's_create_pagesize' => 4096, 's_create_charset' => 'NONE', 's_delete_db' => array('database' => '', 'user' => '', 'host' => '', 'password' => ''), 's_systable' => array('table' => '', 'order' => '', 'dir' => 'ASC', 'ffield' => '', 'fvalue' => '', 'sysdata' => TRUE, 'refresh' => 15), 's_system_table' => '', 's_system_data' => TRUE, 's_systbl_order' => '', 's_systbl_dir' => 'ASC', 's_tables' => array(), 's_fields' => array(), 's_foreigns' => array(), 's_primaries' => array(), 's_uniques' => array(), 's_tables_valid' => FALSE, 's_tables_counts' => FALSE, 's_tables_cnames' => FALSE, 's_tables_def' => FALSE, 's_tables_comp' => FALSE, 's_tables_comment' => FALSE, 's_charsets' => array(), 's_create_table' => '', 's_create_num' => '', 's_coldefs' => array(), 's_modify_name' => '', 's_modify_col' => '', 's_enter_name' => '', 's_enter_values' => array(), 's_domains' => array(), 's_domains_valid' => FALSE, 's_mod_domain' => '', 's_triggers' => array(), 's_triggers_valid' => FALSE, 's_triggerdefs' => array(), 's_viewdefs' => array('name' => '', 'source' => '', 'check' => 'no'), 's_views_counts' => FALSE, 's_procedures' => array(), 's_proceduredefs' => array(), 's_procedures_valid' => FALSE, 's_udfs' => array(), 's_udfs_valid' => FALSE, 's_udfs_order' => 1, 's_udfs_dir' => 'ASC', 's_exceptions' => array(), 's_exceptions_valid' => FALSE, 's_exceptions_order' => 1, 's_exceptions_dir' => 'ASC', 's_exception_defs' => array(), 's_indexes' => array(), 's_mod_index' => '', 's_index_order' => 'name', 's_index_dir' => 'ASC', 's_wt' => array('table' => '', 'columns' => array(), 'blob_links' => array(), 'blob_as' => array(), 'rows' => DEFAULT_ROWS, 'start' => 1, 'order' => '', 'direction' => 'ASC', 'edit' => TRUE, 'delete' => TRUE, 'tblob_inline' => TRUE, 'tblob_chars' => 50, 'condition' => '', 'fks' => array()), 's_watch_buffer' => '', 's_sql' => array('queries' => array(), 'buffer' => '', 'more' => FALSE), 's_edit_idx' => 0, 's_edit_where' => array(), 's_edit_values' => array(), 's_delete_idx' => 0, 's_confirmations' => array(), 's_sysdba_pw' => '', 's_user_name' => '', 's_sql_buffer' => array(), 's_sql_pointer' => 0, 's_gfix' => array('buffers' => 75, 'dialect' => '', 'access_mode' => '', 'write_mode' => '', 'use_space' => '', 'sweep_interval' => 20000, 'sweep_ignore' => FALSE, 'repair' => '', 'repair_ignore' => FALSE, 'shutdown' => '', 'shutdown_seconds' => 3, 'reconnect' => TRUE), 's_dbstat_option' => IBASE_STS_HDR_PAGES, 's_backup' => array('target' => '', 'servicemgr' => '', 'bfactor' => 0, 'mdonly' => '', 'mdoldstyle' => '', 'create' => '', 'transport' => '', 'convert' => '', 'nogc' => '', 'ignorecs' => '', 'ignorelt' => '', 'verbose' => TRUE), 's_restore' => array('source' => '', 'servicemgr' => '', 'target' => '', 'overwrite' => 'no', 'pagesize' => '8192', 'buffers' => '', 'amode' => $adm_strings['ReadWrite'], 'inactive' => '', 'oneattime' => '', 'useall' => '', 'novalidity' => '', 'kill' => '', 'verbose' => TRUE, 'connect' => 'no'), 's_csv' => array('import_null' => FALSE), 's_export' => array(), 's_iframejobs' => array(), 's_POST' => array(), 's_GET' => array(), 's_database_panels' => array(array('info', $ptitle_strings['info'], 'open'), array('db_login', $ptitle_strings['db_login'], 'open'), array('db_create', $ptitle_strings['db_create'], 'close'), array('db_delete', $ptitle_strings['db_delete'], 'close'), array('db_systable', $ptitle_strings['db_systable'], 'close'), array('db_meta', $ptitle_strings['db_meta'], 'close')), 's_tables_panels' => array(array('info', $ptitle_strings['info'], 'open'), array('tb_show', $ptitle_strings['tb_show'], 'close'), array('tb_create', $ptitle_strings['tb_create'], 'close'), array('tb_modify', $ptitle_strings['tb_modify'], 'close'), array('tb_delete', $ptitle_strings['tb_delete'], 'close')), 's_accessories_panels' => array(array('info', $ptitle_strings['info'], 'open'), array('acc_index', $ptitle_strings['acc_index'], 'close'), array('acc_gen', $ptitle_strings['acc_gen'], 'close'), array('acc_trigger', $ptitle_strings['acc_trigger'], 'close'), array('acc_proc', $ptitle_strings['acc_proc'], 'close'), array('acc_domain', $ptitle_strings['acc_domain'], 'close'), array('acc_view', $ptitle_strings['acc_view'], 'close'), array('acc_exc', $ptitle_strings['acc_exc'], 'close'), array('acc_udf', $ptitle_strings['acc_udf'], 'close')), 's_sql_panels' => array(array('info', $ptitle_strings['info'], 'open'), array('sql_enter', $ptitle_strings['sql_enter'], 'close'), array('sql_output', $ptitle_strings['sql_output'], 'close'), array('tb_watch', $ptitle_strings['tb_watch'], 'close')), 's_data_panels' => array(array('info', $ptitle_strings['info'], 'open'), array('dt_enter', $ptitle_strings['dt_enter'], 'close'), array('tb_watch', $ptitle_strings['tb_watch'], 'close'), array('dt_export', $ptitle_strings['dt_export'], 'close'), array('dt_import', $ptitle_strings['dt_import'], 'close')), 's_users_panels' => array(array('info', $ptitle_strings['info'], 'open'), array('usr_user', $ptitle_strings['usr_user'], 'close'), array('usr_role', $ptitle_strings['usr_role'], 'close'), array('usr_cust', $ptitle_strings['usr_cust'], 'close')), 's_admin_panels' => array(array('info', $ptitle_strings['info'], 'open'), array('adm_server', $ptitle_strings['adm_server'], 'close'), array('adm_dbstat', $ptitle_strings['adm_dbstat'], 'close'), array('adm_gfix', $ptitle_strings['adm_gfix'], 'close'), array('adm_backup', $ptitle_strings['adm_backup'], 'close'), array('adm_restore', $ptitle_strings['adm_restore'], 'close')));
    $cookie = get_customize_cookie_name();
    if (isset($_COOKIE[$cookie])) {
        $session_vars['s_cust'] = set_customize_settings($_COOKIE[$cookie]);
    }
    // take care for the $HIDE_PANELS config setting
    foreach (array('database', 'tables', 'accessories', 'sql', 'data', 'users', 'admin') as $topic) {
        foreach ($session_vars['s_' . $topic . '_panels'] as $pidx => $parray) {
            if (in_array($parray[0], $GLOBALS['HIDE_PANELS'])) {
                unset($session_vars['s_' . $topic . '_panels'][$pidx]);
            }
        }
    }
    foreach ($session_vars as $key => $val) {
        $_SESSION[$key] = $val;
    }
    localize_session_vars();
}
Ejemplo n.º 2
0
function set_customize_cookie($customize)
{
    // don't save rubbish if the session is gone
    if (empty($customize['color'])) {
        return;
    }
    $settings = get_customize_cookie_version() . "\n" . $customize['language'] . "\n" . $customize['askdel'] . "\n" . implode('|', $customize['enter']) . "\n";
    $fk_lookup = '';
    foreach ($customize['fk_lookups'] as $tablename => $table_lookups) {
        if (empty($tablename) || empty($table_lookups)) {
            continue;
        }
        $fk_lookup .= $tablename . '|';
        foreach ($table_lookups as $fk_column => $lookup_column) {
            if (empty($fk_column) || empty($lookup_column)) {
                continue;
            }
            $fk_lookup .= $fk_column . '|' . $lookup_column . '|';
        }
        $fk_lookup[strlen($fk_lookup) - 1] = '#';
    }
    $fk_lookup = substr($fk_lookup, 0, -1);
    $settings .= $fk_lookup . "\n";
    $wts = '';
    foreach ($customize['wt'] as $database => $wt) {
        if (empty($database)) {
            continue;
        }
        $wts .= $database . '|' . implode('|', $wt) . '#';
    }
    $wts = substr($wts, 0, -1);
    $settings .= $wts . "\n";
    $pstate = '';
    foreach (panel_array_names() as $pname) {
        foreach ($GLOBALS[$pname] as $panel) {
            $settings .= $panel[0] . '|';
            $pstate .= $panel[2] == 'open' ? '1' : '0';
        }
        $settings = substr($settings, 0, -1) . "\n";
    }
    $settings .= $pstate;
    setcookie(get_customize_cookie_name(), $settings, time() + 60 * 60 * 24 * 180, '/');
}