Skip these checks if (stristr($_SERVER['SCRIPT_FILENAME'], "/") !== FALSE) { $_SESSION[$_PAGE_INFO['id']]['base'] = $_DEFAULT['base']; $_SESSION[$_PAGE_INFO['id']]['base_path'] = $_DEFAULT['base_path']; if (is_ReleaseCandidate()) { $_SESSION[$_PAGE_INFO['id']]['base'] = $_RELEASE['rc']['url'] . $_SESSION[$_PAGE_INFO['id']]['release_dir'] . "/"; $_SESSION[$_PAGE_INFO['id']]['base_path'] = $_RELEASE['rc']['dir'] . $_SESSION[$_PAGE_INFO['id']]['release_dir'] . "/"; } } /* * Check resolution */ $_PAGE_INFO['tablet'] = is_tablet(); /* * Project selected? */ $_PAGE_INFO['page_project'] = ""; if ((isset($_SESSION[$_PAGE_INFO['id']]['login']['project']['name'])) && (($_SESSION[$_PAGE_INFO['id']]['login']['project']['name'] != "skip") || ($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'] != -1)) ) { $_PAGE_INFO['page_project'] = "&page_project=" . $_GET['page_project']; } /* * Define header main menu button and history link */ $_PAGE_INFO['MAIN_LINK'] = ""; if (db_ver_rights_user_one_valid($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'], "hoofdmenu")) { $_PAGE_INFO['MAIN_LINK'] = "action/_a_project&link=page/menu&project=skip&project_id=-1"; } if (isset($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'])) { $project = db_fetch_project($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'], "", 1); // Project name removed!! $_PAGE_INFO['HIST_MAIN'] = "Project info"; } else { $_PAGE_INFO['HIST_MAIN'] = "Main menu"; } /* * Define skin */ // Skin defaults $_PAGE_INFO['default_skin'] = ($_PAGE_INFO['tablet']) ? "dualinventive_tablet" : "dualinventive"; $_PAGE_INFO['default_skin_name'] = "dualinventive"; // Define skin name $customer = db_fetch_customer($_SESSION[$_PAGE_INFO['id']]['login']['customer']['id'], 1); $_SESSION[$_PAGE_INFO['id']]['skin_name'] = _(strtolower($customer['skin'])); $_SESSION[$_PAGE_INFO['id']]['skin'] = ($_PAGE_INFO['tablet']) ? strtolower($customer['skin']) . "_tablet" : strtolower($customer['skin']); // Skin not available/not logged in => Default skin if ((!isset($_SESSION[$_PAGE_INFO['id']]['logged_on'])) || ((isset($_GET['href'])) && ($_GET['href'] == "page/login")) || (!strlen($_SESSION[$_PAGE_INFO['id']]['skin'])) || (!is_dir(SKIN_DIR . $_SESSION[$_PAGE_INFO['id']]['skin']))) { $_SESSION[$_PAGE_INFO['id']]['skin_name'] = _($_PAGE_INFO['default_skin_name']); $_SESSION[$_PAGE_INFO['id']]['skin'] = $_PAGE_INFO['default_skin']; } // Retrieve ini file skin $ini_file = get_all_files(SKIN_DIR . $_SESSION[$_PAGE_INFO['id']]['skin'] . "/", array("ini")); $_PAGE_INFO['ini'] = parse_ini_file($ini_file[0], true); // Update global variables UpdateGlobals(); /* * Define Header menu items */ if ((!isset($_SESSION[$_PAGE_INFO['id']]['logged_on'])) || ((isset($_GET['href'])) && ($_GET['href'] == "page/login"))) { $_PAGE_INFO['header_menu_buttons'] = array("WELCOME TO MTINFO 3000"); $_PAGE_INFO['header_menu_links'] = array(""); } else { $_PAGE_INFO['header_menu_buttons'] = array("MAIN MENU", "LOGOUT", "BACK", $_PAGE_INFO['ini']['news'][$_SESSION[$_PAGE_INFO['id']]['i18n']], "HELP"); $_PAGE_INFO['header_menu_links'] = array($_PAGE_INFO['MAIN_LINK'], PAGE_LOGIN, "javascript:window.history.back();", $_PAGE_INFO['ini']['news'][$_SESSION[$_PAGE_INFO['id']]['i18n'] . "_link"], "javascript:windowOpener('" . $_SESSION[$_PAGE_INFO['id']]['base'] . "?id=" . $_PAGE_INFO['id'] . "&href=page/help','mtinfo_help_menu','scrollbars=1,resizable=yes,width=600px,height=200px');"); $_PAGE_INFO['header_menu_oncontext'] = array("javascript:ShowPopup(this);", "", "", "", ""); } /** * Print the framework header * * Inputs: * - $extra_head_html: Extra HTML code to be inserted between the and tags. * Useful for including extra CSS and JavaScript * - $body_tag: The HTML tag. This parametrisable to allow extra JavaScript events * such as onload() */ function print_page_header($extra_head_html="", $body_tag = NULL) { GLOBAL $_PAGE_INFO; echo "\n"; echo "\n\n"; echo "\n"; echo ""; echo $_SESSION[$_PAGE_INFO['id']]['skin_name'] . " - " . ucfirst(_($_PAGE_INFO['page_title'])); echo "\n"; // Add google analytics ?>\n"; echo "\n"; echo "\n"; echo "\n"; if (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) { echo "\n"; } // Ibox stylesheets echo "\n"; echo "\n"; // New page/session? if (!is_dev("RS3000")) { echo "\n"; } // Calender multiple language support echo "\n"; // IE6 detection echo ""; // include stylesheets // Tablet and non-tablet if (!$_PAGE_INFO['tablet']) { echo "\n"; $_PAGE_INFO['menu_button_sizes'] = ((isset($_SESSION[$_PAGE_INFO['id']]['logged_on'])) ? 196 : 335); $_SESSION[$_PAGE_INFO['id']]['print_table_width'] = 354; $_SESSION[$_PAGE_INFO['id']]['print_table_large_width'] = 458; if (browser() != "IE") { echo "\n"; } else { echo ""; echo ""; echo ""; } } else { echo "\n"; echo "\n"; $_PAGE_INFO['menu_button_sizes'] = ((isset($_SESSION[$_PAGE_INFO['id']]['logged_on'])) ? 196 : 335); $_SESSION[$_PAGE_INFO['id']]['print_table_width'] = 354; $_SESSION[$_PAGE_INFO['id']]['print_table_large_width'] = 458; if (browser() != "IE") { echo "\n"; echo "\n"; } else { echo ""; echo ""; echo ""; } } if ($_GET['href'] == "page/menu_rt") { // CSS Realtime status echo "\n"; // CSS extended view if (isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])) { echo "\n"; if ($_PAGE_INFO['tablet']) { echo "\n"; } } // rtstatus javascript echo "\n"; } if (isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) { // CSS extended menu echo "\n"; if ($_PAGE_INFO['tablet']) { echo "\n"; } } // iBox support (including alternate stylesheets) echo "\n"; echo "\n"; // Hide Select controls echo ""; // Busy function echo "\n"; // Slideshow functionality if (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) { echo "\n"; } // Define button functionality echo "\n"; // Create status div echo "
"; echo "
"; // Status function echo "\n"; // Onclick event listener echo "\n"; // Set base echo "\n"; // Get icon $icon_image = SKIN_DIR . $_SESSION[$_PAGE_INFO['id']]['skin'] . "/" . $_PAGE_INFO['ini']['image']['icon']; if ((file_exists($icon_image)) && (strlen($_PAGE_INFO['ini']['image']['icon']))) { echo "\n"; } // Insert skin style sheets (when available) $css_files = get_all_files(SKIN_DIR . $_SESSION[$_PAGE_INFO['id']]['skin'] . "/css/", array("css")); if (is_array($css_files)) { foreach($css_files as $file) { echo "\n"; } } // Add extra head items echo $extra_head_html; echo "\n\n"; if( !$body_tag ) { $body_tag=""; } echo $body_tag; // Add tooltips functionality echo "\n"; echo ""; // Header content (logo & header menu) if (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) { echo "
\n"; echo "\n"; echo "
\n"; echo "\n"; echo "
\n"; // Show print icon if ((!is_tablet()) && ((Browser() != "IE") || (browser_version() > 7))) { $print_actions = array("project_info" , "project_new" , "project_duplicate" , "project_change" , "project_design" , "project_verify_design" , "project_validate_design" , "project_plan" , "project_verify_plan" , "project_validate_plan" , "project_release" , "project_return" , "lance_info" , "user_info" , "cust_info"); $print_pages = array("page/menu_report_live", "page/menu&page_project="); // Define printable pages $print_icon_visible = FALSE; // Printable action (with the exception of the search pages) if (((is_array($print_actions)) && (in_array($_SESSION[$_PAGE_INFO['id']]['action'], $print_actions))) && (stristr($_GET['href'], "_search") === FALSE)) { $print_icon_visible = TRUE; } // Printable href else if ((is_array($print_pages)) && (in_array($_GET['href'], $print_pages))) { $print_icon_visible = TRUE; } // Printable uri? else { if (is_array($print_pages)) { foreach($print_pages as $print_page) { if (stristr($_SERVER['REQUEST_URI'], $print_page) !== FALSE) { $print_icon_visible = TRUE; } } } } if ($print_icon_visible) { echo "
"; echo ""; echo "\"\"\n"; echo ""; echo "
"; } } // Show refresh button (including cache clearing) echo "
"; echo ""; echo "\"\"\n"; echo ""; echo "
"; // Show screen mode icon if ((!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) && ((isset($_SESSION[$_PAGE_INFO['id']]['standard_view'])) || (isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])))) { echo "
\n"; if (isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])) { echo ""; echo ""; echo "\"\"\n"; echo ""; echo ""; } else { echo ""; echo ""; echo "\"\"\n"; echo ""; echo ""; } echo "
"; } // Insert Shortcuts from skin (when available) echo "
\n"; if ((is_array($_PAGE_INFO['ini']['link'])) && (!empty($_PAGE_INFO['ini']['link']))) { $i=0; foreach($_PAGE_INFO['ini']['link'] as $link => $key) { // Add link echo "" . ucfirst(strtolower($link)) . ""; // Increment counter $i++; } } echo "
\n"; // Version info echo "
" . strtoupper(((is_ReleaseCandidate()) ? $_SESSION[$_PAGE_INFO['id']]['release_dir'] : VERSION)) . "
\n"; // Heartbeat if ((isset($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu']))) { echo "\n"; echo "
\n"; echo "\"\"\n"; echo "\"\"\n"; echo "
\n"; } // Logo image $logo_svg = SKIN_DIR . $_SESSION[$_PAGE_INFO['id']]['skin'] . "/" . $_PAGE_INFO['ini']['image']['header_logo_svg']; $logo_image = SKIN_DIR . $_SESSION[$_PAGE_INFO['id']]['skin'] . "/" . $_PAGE_INFO['ini']['image']['header_logo']; if (((strlen($_PAGE_INFO['ini']['image']['header_logo_svg'])) && (file_exists($logo_svg))) && ((Browser() != "IE") || (browser_version() > 8))) { // Open the file $handle = fopen($logo_svg ,"r"); // Read SVG data echo fread($handle, filesize($logo_svg)); // close handle fclose($handle); } else if ((strlen($_PAGE_INFO['ini']['image']['header_logo'])) && (file_exists($logo_image))) { echo "\"\""; } echo "
\n\n"; echo "\n"; echo "
\n"; echo "
\n"; // Create header button divisions for ($i = 0; $i <= sizeof($_PAGE_INFO['header_menu_buttons']); $i++) { // Only separator? if ($i < sizeof($_PAGE_INFO['header_menu_buttons'])) { echo "
\n"; echo "\"\"\n"; // Create link or not if (!empty($_PAGE_INFO['header_menu_links'][$i])) { // Start with javascript: if (stristr($_PAGE_INFO['header_menu_links'][$i], "javascript:")) { echo "\n"; } else { // Link to other host? $url_info = parse_url($_PAGE_INFO['header_menu_links'][$i]); if ((isset($url_info['host'])) && (stristr($url_info['host'], $_SESSION[$_PAGE_INFO['id']]['base']) === FALSE)) { echo "\n"; } else { echo "\n"; } } } else { echo "\n"; } } else { echo "
\n"; echo "\"\"\n"; } echo "
\n"; echo "\n"; } echo "
\n"; echo "
\n\n"; } // Insert project name if ((isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])) && (isset($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu']))) { echo "
\n"; $project = db_fetch_project($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'], "", 1); echo htmlspecialchars($project['naam']); echo "
\n"; } // Header image & message of the day echo "\n"; if (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) { echo "
\n"; echo "
\n"; if (!isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])) { echo "
    \n"; // Get all header images $header_images = get_all_files(SKIN_DIR . $_SESSION[$_PAGE_INFO['id']]['skin'] . "/header/", array("jpg","png")); // Get all header label $header_labels = $_PAGE_INFO['ini']["header"]; // Check for i18n header labels if (isset($_PAGE_INFO['ini']["header_" . $_SESSION[$_PAGE_INFO['id']]['i18n']])) { $header_labels = $_PAGE_INFO['ini']["header_" . $_SESSION[$_PAGE_INFO['id']]['i18n']]; } if (is_array($header_images)) { // Define start image srand((double)microtime()*1000000); $start = rand() % (sizeof($header_images) - 1); for($i=0; $i\n"; echo "\"\"\n"; if (isset($header_labels)) { $label_index = rand() % (sizeof($header_labels) - 1); echo "
    "; // Search for extra actions (hyperlinks/etc.)? $header_value = explode(";", $header_labels["line" . $label_index]); echo "
    " . $header_value[0] . "
    "; if (isset($header_value[1])) { switch(trim(strtolower($header_value[1]))) { case "hyper_button": echo ""; echo utf8_encode($header_value[2]); echo "
    "; break; default: echo utf8_encode($footer_value[0]) . "
    "; break; } } echo "
    "; } echo ""; } } echo "
"; } echo "
\n"; echo "
\n"; } // ibox workaround => preload image echo "
\n"; echo "\n"; // IE workaround => indicator does not work when preloaded if (browser() != "IE") { echo "\n"; } echo "
\n"; // Message of the day if ((isset($_SESSION[$_PAGE_INFO['id']]['login'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu']))) { $motd = db_fetch_system_maint_mes(); if (is_array($motd)) { foreach ($motd as $item) { if ($item['i18n'] == $_SESSION[$_PAGE_INFO['id']]['i18n']) { if (strlen($item['onderhoud'])) { echo "\n"; echo "
\n"; echo "
\n"; echo htmlspecialchars(strip_tags($item['onderhoud'])); echo "
\n"; echo "
\n"; } else { echo "
\n"; echo "
\n"; } } } } } // Extended view & project if ((!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) && (isset($_SESSION[$_PAGE_INFO['id']]['extended_view']))) { echo ""; echo ""; echo "\"\""; echo ""; echo "\n"; echo ""; echo "\"\""; echo "\n"; echo ""; echo ""; echo "\"\""; echo ""; echo "\n"; } echo "
\n"; // Page content echo "\n"; echo "
\n"; echo "
\n"; if (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) { echo "
\n"; // Login info if ((isset($_SESSION[$_PAGE_INFO['id']]['login'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_view']))) { echo "
"; echo "
\n"; echo "

" . _("Login info") . "

\n"; echo "\n"; echo "
\n"; echo "
\n"; } // History menu (became menu structure!) if ((!empty($_PAGE_INFO['history_menu_buttons'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_view']))) { echo "
"; echo "
\n"; echo "

" . _("Menu structure") . "

\n"; echo "
    \n"; for ($i = 0; $i < sizeof($_PAGE_INFO['history_menu_buttons']); $i++) { if ($i) { echo "
  • \n"; } // Hyperlink? and catch project exception: no "magazijn" rigths => no projects page $projects = db_fetch_user_projects($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'], "normaal"); $valid_project = 0; if (is_array($projects)) { foreach($projects as $project) { // Check for non-closed projects // normal project => planning status must be finished // rc project => planning and design status must be validated if (($project['status'] != "afgesloten") && ((($project['type'] == "normaal") && ($project['pstatus'] == "gereed")) || (($project['type'] == "rc") && (($project['pstatus'] == "gevalideerd") && ($project['ostatus'] == "gevalideerd"))))) { $valid_project = 1; } } } $value = shorten_text(_($_PAGE_INFO['history_menu_buttons'][$i]),31); if ((empty($_PAGE_INFO['history_menu_links'][$i])) || (($_PAGE_INFO['history_menu_links'][$i] == PAGE_PROJECT) && ((!db_ver_rights_user_one_valid($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'], "menu:projecten:root,menu:projecten&projecten:d")))) && (!$valid_project)) { echo " When value was too long if (($value != _($_PAGE_INFO['history_menu_buttons'][$i])) || (stristr($value, "..") !== FALSE)) { echo " onmouseover=\"Tip('" . _($_PAGE_INFO['history_menu_buttons'][$i]) . "',BGCOLOR,'" . $_PAGE_INFO['ini']['tooltip']['background'] . "',BORDERCOLOR, '" . $_PAGE_INFO['ini']['tooltip']['border'] . "');\" onmouseout=\"UnTip();\" "; } echo ">" . $value . "\n"; } else { echo "
  • When value was too long if (($value != _($_PAGE_INFO['history_menu_buttons'][$i])) || (stristr($value, "..") !== FALSE)) { echo " onmouseover=\"Tip('" . _($_PAGE_INFO['history_menu_buttons'][$i]) . "',BGCOLOR,'" . $_PAGE_INFO['ini']['tooltip']['background'] . "',BORDERCOLOR, '" . $_PAGE_INFO['ini']['tooltip']['border'] . "');\" onmouseout=\"UnTip();\" "; } echo">" . $value . "
  • \n"; } } echo "
\n"; echo "
\n"; echo "
\n"; } // Shortcut menu if ((!empty($_PAGE_INFO['shortcut_menu_buttons'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_view']))) { echo "
"; echo "
\n"; echo "

" . _("Shortcuts") . "

\n"; echo "\n"; echo "
\n"; echo "
\n"; } echo "
\n"; // id="content_table_col1" } // Page content (forms, menus, etc) echo "
\n"; echo "
"; // Display extended menu if ((isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu']))) { echo "
\n"; // Store extended menu id when not exist if ((!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu_id'])) || (!strlen($_SESSION[$_PAGE_INFO['id']]['extended_menu_id']))) { $_SESSION[$_PAGE_INFO['id']]['extended_menu_id'] = UniqSessionId(); } // Create iframe if (isset($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'])) { // Project selected => lance use & shortcuts echo ""; } else { // No project selected => Select lances & shortcuts echo ""; } echo "
\n"; } } /** * Add xmlhttp request header * */ function print_xml_header($ypos = 0, $extra_header_HTML="") { GLOBAL $_PAGE_INFO; // Add extra header tags to include more JavaScript and CSS than usual $extra_header_HTML .= ""; $extra_header_HTML .= ""; // Show page header $body = ""; print_page_header($extra_header_HTML, $body); } /** * Print the framework footer */ function print_page_footer() { GLOBAL $_PAGE_INFO; echo "
"; // contextmenu popup menu if (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) { echo "\n"; } echo "
\n"; // id="content_xmlhttp" echo "
\n"; // id="content_table_col1" echo "
\n"; // id="content_table" echo "
\n\n"; // id="content" if ((!isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu']))) { echo "\n"; echo "
\n"; echo "
\n"; // Get footer blocks (max 4 blocks) for ($i=0; $i < 4; $i++) { // Default block name $block = $_PAGE_INFO['ini']["footer" . $i]; // Check for i18n block name if (isset($_PAGE_INFO['ini']["footer" . $i . "_" . $_SESSION[$_PAGE_INFO['id']]['i18n']])) { $block = $_PAGE_INFO['ini']["footer" . $i . "_" . $_SESSION[$_PAGE_INFO['id']]['i18n']]; } if (isset($block)) { echo "
\n"; $found = TRUE; $count = 0; do { // Check if line exists $found = (isset($block["line" . $count])) ? $found : FALSE; if ($found) { if (!$count) { echo "

"; } // Search for extra actions (hyperlinks/images/etc.)? $footer_value = explode(";", $block["line" . $count]); if (isset($footer_value[1])) { switch(trim(strtolower($footer_value[1]))) { case "newsletter": echo ""; echo ">>
"; break; case "hyper_button": echo ""; echo utf8_encode($footer_value[0]); echo "
"; break; case "hyper_twitter": echo ""; echo utf8_encode($footer_value[0]); echo ""; echo ""; echo ""; echo "\"twitter\""; echo ""; echo "
"; break; case "hyper": echo ""; echo utf8_encode($footer_value[0]); echo "
"; break; case "last_tweets": // To be sure the twitter functionality is available require_once("twitter.php"); $timeline = TwitterPublicTimeline(trim($footer_value[2])); echo ""; echo "
"; echo "
"; echo ""; echo "
"; if (is_array($timeline)) { echo "
    "; echo "
    "; foreach($timeline as $item) { echo "
  • "; echo $item['user'] . ": " . $item['text']; echo "
  • "; } echo "
    "; echo "
"; } echo "
"; if (sizeof($timeline) > 1) { echo "\n"; } break; case "media_icons": // Initial values $icons_found = TRUE; $icons_count = 0; echo "
"; do { $icons_found = (isset($footer_value[2 + $icons_count])) ? $icons_found : FALSE; if ($icons_found) { switch(trim(strtolower($footer_value[2 + $icons_count]))) { case "facebook": echo ""; echo ""; echo "\"facebook\""; echo ""; echo ""; break; case "linked_in": echo ""; echo ""; echo "\"linked-in\""; echo ""; echo ""; break; case "youtube": echo ""; echo ""; echo "\"youtube\""; echo ""; echo ""; break; default: break; } } // Increment icon counter $icons_count++; } while ($icons_found); echo "
"; break; default: echo utf8_encode($footer_value[0]) . "
"; break; } } else { echo utf8_encode($footer_value[0]) . "
"; } if (!$count) { echo "

"; } } // Increment line counter $count++; } while ($found); echo "
\n"; } } echo "
\n"; echo "
\n\n"; } // Define extended view div height (content div) if ((isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu']))) { echo "\n"; } // Display error alert/confirm message? echo "
\n"; echo "
\n"; // Project & Right checker (recursive funtion, only the parent!) if ((isset($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu']))) { // Project defined? $project = (isset($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'])) ? "&project=" . $_SESSION[$_PAGE_INFO['id']]['login']['project']['id'] : ""; $csrf_token = csrf_create_token("status_check"); echo ""; } // Display debug info if (!isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])) { echo "
\n"; include("include/debug_info.php"); echo "
\n"; } // Include errormessage include("include/errormsg.php"); echo "\n\n"; echo "\n"; } /** * Verify Rights (login), valid project (when req) and log page * * Inputs: * - rights Rights needed for current page * - menu menu name which will be logged in db * - log_info extra db log info (optional) * * Return: 1 (ok)/0 (false) */ function Ver_Rights_Project_Log($rights, $menu = "", $log_info = "") { GLOBAL $_PAGE_INFO; // Initial return value $result = 0; // Verify "login" rights and check if user is allowed at this time (begin/end date)! if (db_ver_right_user($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'], "login")) { // Verify if the user is still on the selected project and check if the project is still running if (isset($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'])) { $valid_project = 0; $row_users = db_fetch_project_users($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'], "", array("normaal","wbu","wbv")); if (is_array($row_users)) { foreach ($row_users as $row_user) { if ($row_user['id'] == $_SESSION[$_PAGE_INFO['id']]['login']['user']['id']) { $valid_project = 1; } } } if ($valid_project) { // Retrieve project info $row_project = db_fetch_project($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'], "", 1); // Check for non-closed projects // normal project => planning status must be finished // rc project => planning and design status must be validated and the project must be released // App => Also show projects which are ready for release if (($row_project['status'] == "afgesloten") || ((($row_project['type'] == "normaal") && ($row_project['pstatus'] != "gereed")) || (($row_project['type'] == "rc") && (($row_project['pstatus'] != "gevalideerd") || ($row_project['ostatus'] != "gevalideerd") || ($row_project['sstatus'] != "vrijgegeven"))))) { //(($row_project['sstatus'] != "vrijgegeven") && (!is_dev("APP"))))))) { $valid_project = 0; } } } else { // No project selected $valid_project = 1; } if ($valid_project) { // Verify rights for current menu if ((empty($rights)) || ($rights == "login") || (db_ver_rights_user_one_valid($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'], $rights))) { // Valid $result = 1; // Get link $href = (isset($_GET['action'])) ? $_GET['href'] . "&action=" . $_GET['action'] : $_GET['href']; $href .= (isset($_GET['page_project'])) ? "&page_project=" . $_GET['page_project'] : ""; // Log action to db? if (($_SESSION[$_PAGE_INFO['id']]['href_history'] != $href) && (strlen($menu))) { // Log data if (is_array($log_info)) { switch($log_info['table']) { case "log_gebruiker_project": $_PAGE_INFO['user_log_id'] = db_log_user_project($log_info['project_id'], $menu, $log_info['log_info']); break; default: break; } } else { $_PAGE_INFO['user_log_id'] = db_log_user($menu, $log_info); } // Store var (help function) $_SESSION[$_PAGE_INFO['id']]['MTinfo_menu'] = $menu; } // href changed? => Store old value! if ($_SESSION[$_PAGE_INFO['id']]['href_history'] != $href) { store_history($href); } } else { // Redirect page back to login page $_SESSION[$_PAGE_INFO['id']]['login_info']['errormsg'] = "No user rights"; $_SESSION[$_PAGE_INFO['id']]['login_info']['username'] = $_SESSION[$_PAGE_INFO['id']]['login']['user']['name']; $_SESSION[$_PAGE_INFO['id']]['login_info']['customer'] = $_SESSION[$_PAGE_INFO['id']]['login']['customer']['name']; header("Location: ?id=" . $_PAGE_INFO['id'] . "&href=" . PAGE_LOGIN . ""); } } else { // Redirect page back to login page $_SESSION[$_PAGE_INFO['id']]['login_info']['errormsg'] = "No valid project"; $_SESSION[$_PAGE_INFO['id']]['login_info']['username'] = $_SESSION[$_PAGE_INFO['id']]['login']['user']['name']; $_SESSION[$_PAGE_INFO['id']]['login_info']['customer'] = $_SESSION[$_PAGE_INFO['id']]['login']['customer']['name']; header("Location: ?id=" . $_PAGE_INFO['id'] . "&href=" . PAGE_LOGIN . ""); } } else { // Redirect page back to login page $_SESSION[$_PAGE_INFO['id']]['login_info']['errormsg'] = "Account has been blocked"; $_SESSION[$_PAGE_INFO['id']]['login_info']['username'] = $_SESSION[$_PAGE_INFO['id']]['login']['user']['name']; $_SESSION[$_PAGE_INFO['id']]['login_info']['customer'] = $_SESSION[$_PAGE_INFO['id']]['login']['customer']['name']; header("Location: ?id=" . $_PAGE_INFO['id'] . "&href=" . PAGE_LOGIN . ""); } return $result; } ?>