function sys_process_session_request() { if (!empty($_REQUEST["popup"]) and !empty($_REQUEST["iframe"])) { unset($_REQUEST["iframe"]); } if (!empty($_REQUEST["iframe"])) { sys::$smarty->assign("iframe", 1); } $keep_vars = array("popup", "preview", "lookup", "eto"); foreach ($keep_vars as $var) { if (empty($_REQUEST[$var])) { continue; } sys::$urladdon .= "&" . $var . "=" . $_REQUEST[$var]; sys::$smarty->assign($var, $_REQUEST[$var]); } $_SESSION["view"]["_" . $GLOBALS["tfolder"]] = $GLOBALS["tview"]; sys::$urladdon = "folder2=" . rawurlencode($GLOBALS["tfolder"]) . "&view2=" . $GLOBALS["tview"] . sys::$urladdon; sys::$smarty->assign("urladdon", sys::$urladdon); if (!empty($_REQUEST["action_sys"]) and !empty($_SESSION["username"]) and sys_is_super_admin($_SESSION["username"])) { admin::process_action_sys(); } if (!empty($_REQUEST["style"])) { $_SESSION["theme"] = basename($_REQUEST["style"]); } sys::$smarty->assign("sys_style", !empty($_SESSION["theme"]) ? $_SESSION["theme"] : DEFAULT_STYLE); $table = $GLOBALS["table"]; if ($GLOBALS["tview"] != $table["view"]) { $GLOBALS["tview"] = $table["view"]; } $tview = $GLOBALS["tview"]; $tfolder = $GLOBALS["tfolder"]; $tfolders = $GLOBALS["tfolders"]; $tname = $GLOBALS["tname"]; $tquota = $GLOBALS["tquota"]; $anchor = $GLOBALS["sel_folder"]["anchor"]; if (!empty($_REQUEST["reset_view"])) { $_SESSION[$tname][$tview] = array(); $_SESSION["_" . $tfolder] = array(); $_SESSION["view"]["_" . $tfolder] = $tview; $_SESSION[$tname]["_" . $tfolder] = array(); } $current_view = $table["views"][$tview]; $cview = $current_view; $template = $tview; if ($current_view["TEMPLATE"] != "") { $template = $current_view["TEMPLATE"]; } if (isset($current_view["SCHEMA"]) and $current_view["SCHEMA"] != "") { $table2 = db_get_schema(sys_find_module($current_view["SCHEMA"])); $current_view = array_shift($table2["views"]); // preserve in search, override for schema=x if (!empty($table["att"]["SQL_HANDLER"]) and empty($current_view["SQL_HANDLER"])) { $current_view["SQL_HANDLER"] = $table["att"]["SQL_HANDLER"]; } $GLOBALS["table"] = $table2; // needed for asset-functions and triggers $table["att"] = $table2["att"]; if ($current_view["TEMPLATE"] != "") { $template = $current_view["TEMPLATE"]; } } $GLOBALS["current_view"] = $current_view; $field_names = array(); foreach ($current_view["fields"] as $key => $field) { if (isset($field["NODB"]) and empty($current_view["SQL_HANDLER"])) { continue; } $field_names[] = $key; } if (!empty($_SESSION["alert"])) { sys::$alert = array_merge(sys::$alert, $_SESSION["alert"]); $_SESSION["alert"] = array(); } if (!empty($_SESSION["notification"])) { sys::$notification = array_merge(sys::$notification, $_SESSION["notification"]); $_SESSION["notification"] = array(); } if (!empty($_SESSION["warning"])) { sys::$warning = array_merge(sys::$warning, $_SESSION["warning"]); $_SESSION["warning"] = array(); } if ($table["views"][$tview]["SCHEMA_MODE"] != "") { $tfolders = _build_merge_folders(array_keys($tfolders), $tfolder, $tview, true); } $dclick = $current_view["DOUBLECLICK"]; if ($dclick == "") { if (in_array($template, array("display", "free")) and isset($current_view["views"]["details"])) { $dclick = "details"; } else { $dclick = "edit"; } } if (isset($current_view["MERGE_TABS"])) { unset($current_view["tabs"]); foreach (array_keys($current_view["fields"]) as $key) { $current_view["fields"][$key]["SIMPLE_TAB"] = array("general"); } } $tfield_1 = isset($current_view["TFIELD_1"]) ? $current_view["TFIELD_1"] : modify::get_required_field($current_view["fields"]); $tfield_2 = isset($current_view["TFIELD_2"]) ? $current_view["TFIELD_2"] : ""; // TODO2 reduce ?? $t = array("anchor" => $anchor, "att" => $table["att"], "buttons" => $current_view["buttons"], "custom_name" => $table["att"]["CUSTOM_NAME"], "data" => array(), "default_sql" => $current_view["DEFAULT_SQL"], "disable_tabs" => isset($current_view["DISABLE_TABS"]) ? $current_view["DISABLE_TABS"] : "", "doubleclick" => array_key_exists($dclick, $current_view["views"]) ? $dclick : "", "fields" => $current_view["fields"], "fields_all" => $table["fields"], "fields_query" => array_unique(array_merge(array($current_view["id"]), $field_names, array("created", "lastmodified", "createdby", "lastmodifiedby", "folder"))), "field_1" => $tfield_1, "field_2" => $tfield_2, "filter" => isset($current_view["FILTERS"]) ? $current_view["FILTERS"] : "", "filters" => $current_view["filters"], "folder" => $tfolder, "folders" => $tfolders, "folder_preview" => isset($_REQUEST["tpreview"]), "function" => isset($current_view["FUNCTION"]) ? $current_view["FUNCTION"] : "", "id" => $current_view["id"], "isdbfolder" => is_numeric($tfolder) ? true : false, "limit" => $current_view["LIMIT"], "links" => $current_view["links"], "linkstext" => $current_view["linkstext"], "load_css" => isset($table["att"]["LOAD_CSS"]) ? $table["att"]["LOAD_CSS"] : "", "load_js" => isset($table["att"]["LOAD_JS"]) ? $table["att"]["LOAD_JS"] : "", "lookup" => isset($_REQUEST["lookup"]) ? $_REQUEST["lookup"] : "", "order" => $current_view["ORDER"], "orderby" => $current_view["ORDERBY"], "groupby" => $current_view["GROUPBY"], "group" => $current_view["GROUP"], "handler" => $current_view["SQL_HANDLER"], "hidedata" => $_SESSION["hidedata"], "nosinglebuttons" => isset($cview["NOSINGLEBUTTONS"]) ? $cview["NOSINGLEBUTTONS"] : "", "notification" => &sys::$notification, "warning" => &sys::$warning, "noviewbuttons" => isset($cview["NOVIEWBUTTONS"]) ? $cview["NOVIEWBUTTONS"] : "", "page" => 1, "quota" => $tquota, "restore" => $current_view["restore"], "rights" => $GLOBALS["sel_folder"]["rights"], "vright" => isset($cview["RIGHT"]) ? $cview["RIGHT"] : "", "rowfilters" => $current_view["rowfilters"], "rowvalidates" => $current_view["rowvalidates"], "schema_mode" => $current_view["SCHEMA_MODE"], "singlebuttons" => $current_view["singlebuttons"], "sqllimit" => array(), "sqlorder" => "", "sqlvars" => array("folder" => $tfolder, "folders" => array_keys($tfolders)), "sqlvarsnoquote" => array(), "sqlwhere" => $current_view["SQLWHERE"], "sqlwhere_default" => $current_view["SQLWHERE_DEFAULT"], "subitem" => 0, "tabs" => isset($current_view["tabs"]) ? $current_view["tabs"] : array("general" => array("NAME" => "general")), "template" => "asset_" . $template . ".tpl", "template_mode" => isset($current_view["TEMPLATE_MODE"]) ? $current_view["TEMPLATE_MODE"] : "", "title" => $tname, "view" => $tview, "views" => $table["views"][$tview]["views"]); $GLOBALS["t"] = $t; if (!empty($current_view["SCHEMA_MODE"])) { sys_process_schema_request(); } }