3 // ----------------------------------------------------------------------
4 // POST-NUKE Content Management System
5 // Copyright (C) 2001 by the Post-Nuke Development Team.
6 // http://www.postnuke.com/
7 // ----------------------------------------------------------------------
9 // PHP-NUKE Web Portal System - http://phpnuke.org/
10 // Thatware - http://thatware.org/
11 // ----------------------------------------------------------------------
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License (GPL)
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
24 // To read the license please visit http://www.gnu.org/copyleft/gpl.html
25 // ----------------------------------------------------------------------
26 // Original Author of this file: Francisco Burzi
27 // Purpose of this file: Directs to the start page as defined in config.php
28 // ----------------------------------------------------------------------
33 include_once("../../globals.php");
34 include_once("$srcdir/calendar.inc");
35 include_once("$srcdir/patient.inc");
36 include "includes/pnre.inc.php";
37 include 'includes/pnAPI.php';
39 // From Michael Brinson 2006-09-19:
40 if (isset($_POST['pc_username'])) $_SESSION['pc_username'] = $_POST['pc_username'];
42 //(CHEMED) Facility filter
43 if (isset($_POST['all_users'])) $_SESSION['pc_username'] = $_POST['all_users'];
45 // bug fix to allow default selection of a provider
46 // added 'if..POST' check -- JRM
47 if (isset($_REQUEST['pc_username']) && $_REQUEST['pc_username']) $_SESSION['pc_username'] = $_REQUEST['pc_username'];
49 // (CHEMED) Get the width of vieport
50 if (isset($_GET['framewidth'])) $_SESSION['pc_framewidth'] = $_GET['framewidth'];
52 // FACILITY FILTERING (lemonsoftware) (CHEMED)
53 $_SESSION['pc_facility'] = 0;
55 /*********************************************************************
56 if ($_POST['pc_facility']) $_SESSION['pc_facility'] = $_POST['pc_facility'];
57 *********************************************************************/
58 if (isset($_COOKIE['pc_facility']) && $GLOBALS['set_facility_cookie']) $_SESSION['pc_facility'] = $_COOKIE['pc_facility'];
59 // override the cookie if the user doesn't have access to that facility any more
60 if ($_SESSION['userauthorized'] != 1 && $GLOBALS['restrict_user_facility']) {
61 $facilities = getUserFacilities($_SESSION['authId']);
62 // use the first facility the user has access to, unless...
63 $_SESSION['pc_facility'] = $facilities[0]['id'];
64 // if the cookie is in the users' facilities, use that.
65 foreach ($facilities as $facrow) {
66 if (($facrow['id'] == $_COOKIE['pc_facility']) && $GLOBALS['set_facility_cookie'])
67 $_SESSION['pc_facility'] = $_COOKIE['pc_facility'];
70 if (isset($_POST['pc_facility'])) $_SESSION['pc_facility'] = $_POST['pc_facility'];
71 /********************************************************************/
73 if (isset($_GET['pc_facility'])) $_SESSION['pc_facility'] = $_GET['pc_facility'];
74 if ($GLOBALS['set_facility_cookie'] && ($_SESSION['pc_facility'] > 0)) setcookie("pc_facility", $_SESSION['pc_facility'], time() +
(3600 * 365));
76 // Simplifying by just using request variable instead of checking for both post and get - KHY
77 if (isset($_REQUEST['viewtype'])) $_SESSION['viewtype'] = $_REQUEST['viewtype'];
82 //if (empty($_GET['no_nav'])) {
83 // $_SESSION['last_calendar_page'] = $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'];
101 $type,) = pnVarCleanFromInput('module',
108 // Defaults for variables
109 if (isset($catid)) { pnVarCleanFromInput('catid'); }
111 // check requested module and set to start module if not present
113 $name = pnConfigGetVar('startpage');
114 // fixed for the new style of loading modules and set start page for them [class007]
115 if (empty($module)) { $module = $name; }
118 // get module information
119 $modinfo = pnModGetInfo(pnModGetIDFromName($module));
121 if ($modinfo['type'] == 2)
123 // New-new style of loading modules
124 if (empty($type)) { $type = 'user'; }
125 if (empty($func)) { $func="main"; }
127 // it should be $module not $name [class007]
128 if (pnModAvailable($module)) {
129 if (pnModLoad($module, $type)) {
131 $return = pnModFunc($module, $type, $func);
139 // Sort out return of function. Can be
141 // false - display error msg
142 // text - return information
143 if ((empty($return)) ||
($return == false)) {
144 // Failed to load the module
145 $output = new pnHTML();
146 $output->StartPage();
147 $output->Text('Failed to load module ' . $module .' ( At function: "'.$func.'" )');
149 $output->PrintPage();
151 } elseif (strlen($return) > 1) {
153 $output = new pnHTML();
154 //$output->StartPage();
155 $output->SetInputMode(_PNH_VERBATIMINPUT
);
156 $output->Text($return);
157 $output->SetInputMode(_PNH_PARSEINPUT
);
158 //$output->EndPage();
159 $output->PrintPage();
166 // Old-old style of loading modules
174 include 'includes/legacy.php';
178 define("LOADED_AS_MODULE","1");
179 // added for the module/system seperation [class007]
180 if (file_exists('modules/' . pnVarPrepForOS($name) . '/' . pnVarPrepForOS($file) . '.php')) {
181 include 'modules/' . pnVarPrepForOS($name) . '/' . pnVarPrepForOS($file) . '.php';
183 // Failed to load the module
184 $output = new pnHTML();
185 //$output->StartPage();
186 $output->Text('Failed to load module ' . $module);
188 $output->PrintPage();
193 // Failed to load the module
194 $output = new pnHTML();
195 //$output->StartPage();
196 $output->Text('Sorry, you cannot access this file directly...');
198 $output->PrintPage();