$v_label) { $sql_cols[$k_field] = ''; } $db = DB::getDB( $conf['sql_db'] ); $sql = "show fields from `".$conf['sql_table']."`; "; $res = $db->query( $sql ); while ($r = $db->fetch( $res )) { /** [Field] => ID [Type] => int(8) [Null] => NO [Key] => PRI [Default] => [Extra] => auto_increment */ if (array_key_exists($r->Field, $sql_cols)) { $r->Perm = 'RWC';// TODO: raed from wskaznik.pytanie $r->Label = $allowed_cols[$r->Field]; $sql_cols[$r->Field] = (array)$r;//json_encode( $r ); } } $conf['sql_cols'] = $sql_cols;// ['sql_col_name'] = 'sql_name;perm;type;default'; $conf['_last_access_time'] = time();// _gc $_SESSION['_ajax_req_id'] [$generate_uniq_ajax_req_id] = $conf; } else { trigger_error("App::generat_ajax_request_id: unknown tbl '$tbl_zasob_id'", E_USER_WARNING); } return $generate_uniq_ajax_req_id; } function &get_conf($ajax_req_id) { $ret = null; if (array_key_exists($ajax_req_id, $_SESSION['_ajax_req_id'])) { $_SESSION['_ajax_req_id'][$ajax_req_id]['_last_access_time'] = time(); return $_SESSION['_ajax_req_id'][$ajax_req_id]; } return $ret; } /* * Garbage collector - remove old ajax request from $_SESSION. */ function _gc() { $count_limit = 10;// TODO: limit na ilosc requestow - usuwac najstarsze $time_limit = 5 * 60; foreach ($_SESSION['_ajax_req_id'] as $ajax_req_id => $conf) { if (!isset($conf['_last_access_time'])) {// bad data unset($_SESSION['_ajax_req_id'][$ajax_req_id]); } else if (time() - $conf['_last_access_time'] > $time_limit) {// too old request unset($_SESSION['_ajax_req_id'][$ajax_req_id]); } } } }