Fix a nasty bug; avoid 0 value for pc_multiple field.
[openemr.git] / interface / main / calendar / index.php
blob1efd3f2b87938c6f46167f3ec3ed87983305fb36
1 <?php
2 // File: $Id$ $Name$
3 // ----------------------------------------------------------------------
4 // POST-NUKE Content Management System
5 // Copyright (C) 2001 by the Post-Nuke Development Team.
6 // http://www.postnuke.com/
7 // ----------------------------------------------------------------------
8 // Based on:
9 // PHP-NUKE Web Portal System - http://phpnuke.org/
10 // Thatware - http://thatware.org/
11 // ----------------------------------------------------------------------
12 // LICENSE
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 // ----------------------------------------------------------------------
30 // include base api
33 //$ignoreAuth = true;
34 include_once("../../globals.php");
35 include_once("$srcdir/calendar.inc");
36 include_once("$srcdir/patient.inc");
37 include "includes/pnre.inc.php";
38 include 'includes/pnAPI.php';
40 // From Michael Brinson 2006-09-19:
41 if ($_POST['pc_username']) $_SESSION['pc_username'] = $_POST['pc_username'];
43 //if (empty($_GET['no_nav'])) {
44 // $_SESSION['last_calendar_page'] = $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'];
45 //}
47 //print_r($_SESSION);
48 // start PN
49 pnInit();
51 // Get variables
52 list($module,
53 $func,
54 $op,
55 $name,
56 $file,
57 $type,) = pnVarCleanFromInput('module',
58 'func',
59 'op',
60 'name',
61 'file',
62 'type');
64 // Defaults for variables
65 if (isset($catid)) {
66 pnVarCleanFromInput('catid');
69 // check requested module and set to start module if not present
70 if (empty($name)) {
71 $name = pnConfigGetVar('startpage');
72 // fixed for the new style of loading modules and set start page for them [class007]
73 if (empty($module)) {
74 $module = $name;
78 // get module information
79 $modinfo = pnModGetInfo(pnModGetIDFromName($module));
81 if ($modinfo['type'] == 2)
83 // New-new style of loading modules
84 if (empty($type)) {
85 $type = 'user';
87 if (empty($func)) {
88 $func="main";
91 // it should be $module not $name [class007]
92 if (pnModAvailable($module)) {
93 if (pnModLoad($module, $type)) {
94 // Run the function
95 $return = pnModFunc($module, $type, $func);
96 } else {
97 $return = false;
99 } else {
100 $return = false;
106 // Sort out return of function. Can be
107 // true - finished
108 // false - display error msg
109 // text - return information
110 if ((empty($return)) || ($return == false)) {
111 // Failed to load the module
112 $output = new pnHTML();
113 $output->StartPage();
114 $output->Text('Failed to load module ' . $module .' ( At function: "'.$func.'" )');
115 $output->EndPage();
116 $output->PrintPage();
117 exit;
118 } elseif (strlen($return) > 1) {
119 // Text
120 $output = new pnHTML();
121 //$output->StartPage();
122 $output->SetInputMode(_PNH_VERBATIMINPUT);
123 $output->Text($return);
124 $output->SetInputMode(_PNH_PARSEINPUT);
125 //$output->EndPage();
126 $output->PrintPage();
128 } else {
132 exit;
133 } else {
134 // Old-old style of loading modules
135 if (empty($op)) {
136 $op = "modload";
138 if (empty($file)) {
139 $file="index";
142 include 'includes/legacy.php';
143 switch ($op) {
144 case 'modload':
146 define("LOADED_AS_MODULE","1");
147 // added for the module/system seperation [class007]
148 if (file_exists('modules/' . pnVarPrepForOS($name) . '/' . pnVarPrepForOS($file) . '.php')) {
149 include 'modules/' . pnVarPrepForOS($name) . '/' . pnVarPrepForOS($file) . '.php';
150 } else {
151 // Failed to load the module
152 $output = new pnHTML();
153 //$output->StartPage();
154 $output->Text('Failed to load module ' . $module);
155 $output->EndPage();
156 $output->PrintPage();
157 exit;
159 break;
160 default:
161 // Failed to load the module
162 $output = new pnHTML();
163 //$output->StartPage();
164 $output->Text('Sorry, you cannot access this file directly...');
165 $output->EndPage();
166 $output->PrintPage();
167 break;