1 |
<?php
|
2 |
//$Header: /hl/cvsroots/gpl01/gpl01/webprojs/fboprime/sw/phplib/stdformat.inc,v 1.9 2006/07/04 17:13:49 dashley Exp $
|
3 |
//--------------------------------------------------------------------------------------------------------------
|
4 |
//stdformat--FboPrime Page Standard "Look and Feel" Functions
|
5 |
//Copyright (C) 2006 David T. Ashley
|
6 |
//
|
7 |
//This program is free software; you can redistribute it and/or
|
8 |
//modify it under the terms of the GNU General Public License
|
9 |
//as published by the Free Software Foundation; either version 2
|
10 |
//of the License, or (at your option) any later version.
|
11 |
//
|
12 |
//This program is distributed in the hope that it will be useful,
|
13 |
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
//GNU General Public License for more details.
|
16 |
//
|
17 |
//You should have received a copy of the GNU General Public License
|
18 |
//along with this program; if not, write to the Free Software
|
19 |
//Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
20 |
//********************************************************************************
|
21 |
//This contains functions used in development and debugging of FBO-Prime. The
|
22 |
//contents of this file are kept separate to avoid introducing baggage into
|
23 |
//the production software.
|
24 |
//--------------------------------------------------------------------------------------------------------------
|
25 |
require_once("config.inc");
|
26 |
require_once("confighard.inc");
|
27 |
require_once("htmlformat.inc");
|
28 |
require_once("strfunc.inc");
|
29 |
require_once("usrs.inc");
|
30 |
//
|
31 |
//--------------------------------------------------------------------------------------------------------------
|
32 |
//This file contains functions that emit standard elements of FboPrime pages and otherwise give the set of
|
33 |
//pages a consistent (and hopefully easy to modify) look and feel.
|
34 |
//--------------------------------------------------------------------------------------------------------------
|
35 |
//Emits the standard page when the script can't connect to MySQL or select the database of interest.
|
36 |
//
|
37 |
function STDFORMAT_dbstartuperrorpage()
|
38 |
{
|
39 |
?>
|
40 |
<html>
|
41 |
<head>
|
42 |
<title>Server Internal Database Connect/Select Error</title>
|
43 |
</head>
|
44 |
<body>
|
45 |
<p align="center">
|
46 |
<font size="6">
|
47 |
<b>
|
48 |
There has been an internal server error (unable to connect to database and/or unable
|
49 |
to select database).
|
50 |
</b>
|
51 |
</font>
|
52 |
</p>
|
53 |
<p align="center">
|
54 |
<font size="6">
|
55 |
<b>
|
56 |
If this problem persists, please contact <?php echo CONFIG_FBO_NAME_LONG;?>
|
57 |
at <?php echo CONFIG_FBO_OPHONE;?>.
|
58 |
</b>
|
59 |
</font>
|
60 |
</p>
|
61 |
</body>
|
62 |
</html>
|
63 |
<?php
|
64 |
}
|
65 |
//
|
66 |
//--------------------------------------------------------------------------------------------------------------
|
67 |
//Emits the standard page when the client page requires that a user be logged in but there is no user logged in.
|
68 |
//
|
69 |
function STDFORMAT_nologgedinerrorpage($sddt, $sdtim)
|
70 |
{
|
71 |
HTMLFORMAT_echo_push_nl("<html>");
|
72 |
HTMLFORMAT_echo_push_nl("<head>");
|
73 |
HTMLFORMAT_echo_noop_nl("<title>FBO-Prime User Login Required</title>");
|
74 |
HTMLFORMAT_echo_pull_nl("</head>");
|
75 |
HTMLFORMAT_echo_push_nl("<body>");
|
76 |
HTMLFORMAT_echo_push_nl("<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" rules=\"none\">");
|
77 |
HTMLFORMAT_echo_push_nl("<tr>");
|
78 |
HTMLFORMAT_echo_push_nl("<td align=\"center\">");
|
79 |
HTMLFORMAT_echo_noop_nl("<title>FBO-Prime User Login Required</title>");
|
80 |
HTMLFORMAT_echo_noop_nl("<br><br><br><br><br><p>In order to use this page, you must be logged in as a user. The most");
|
81 |
HTMLFORMAT_echo_noop_nl("likely reason for this message is that your session timed out due to");
|
82 |
HTMLFORMAT_echo_noop_nl("inactivity.</p>");
|
83 |
|
84 |
HTMLFORMAT_echo_noop_nl("<p>Click ");
|
85 |
|
86 |
$baseurl = "index.php";
|
87 |
if (($sddt === FALSE) && ($sdtim === FALSE))
|
88 |
{
|
89 |
//No adjustment to the base URL needed.
|
90 |
}
|
91 |
else if (($sddt === FALSE) && ($sdtim !== FALSE))
|
92 |
{
|
93 |
$baseurl = $baseurl . "?sdtim=" . $sdtim;
|
94 |
}
|
95 |
else if (($sddt !== FALSE) && ($sdtim === FALSE))
|
96 |
{
|
97 |
$baseurl = $baseurl . "?sddt=" . $sddt;
|
98 |
}
|
99 |
else
|
100 |
{
|
101 |
$baseurl = $baseurl . "?sddt=" . $sddt . "&sdtim=" . $sdtim;
|
102 |
}
|
103 |
HTMLFORMAT_echo_noop_nl("<a href=\"" . $baseurl . "\">here</a> to return to the day view scheduler.</p><br><br><br><br><br>");
|
104 |
HTMLFORMAT_echo_pull_nl("</td>");
|
105 |
HTMLFORMAT_echo_pull_nl("</tr>");
|
106 |
HTMLFORMAT_echo_pull_nl("</table>");
|
107 |
STDFORMAT_stdfooter_tabular(FALSE, $sddt, $sdtim);
|
108 |
HTMLFORMAT_echo_pull_nl("</body>");
|
109 |
HTMLFORMAT_echo_pull_nl("</html>");
|
110 |
}
|
111 |
//
|
112 |
//--------------------------------------------------------------------------------------------------------------
|
113 |
//Forms the standard string characteristic of an FBO-prime footer.
|
114 |
//
|
115 |
//Parameters:
|
116 |
// uiarray : An associative array containing user information for the logged-in user,
|
117 |
// or FALSE if no user is logged in.
|
118 |
// sddate : The date string to use when returning to the main scheduling page if the
|
119 |
// logout link is clicked. If FALSE is passed for this parameter, it is
|
120 |
// omitted.
|
121 |
// sdtime : The time string to use when returning to the main scheduling page if the
|
122 |
// logout link is clicked. If FALSE is passed for this parameter, it is
|
123 |
// omitted.
|
124 |
//
|
125 |
function STDFORMAT_stdfooter_string($uiarray, $sddate, $sdtime)
|
126 |
{
|
127 |
global $GLOBAL_stime_year;
|
128 |
global $GLOBAL_stime_month;
|
129 |
global $GLOBAL_stime_day;
|
130 |
global $GLOBAL_stime_hour;
|
131 |
global $GLOBAL_stime_minute;
|
132 |
global $GLOBAL_stime_second;
|
133 |
|
134 |
$s = "";
|
135 |
$s .= "This page was generated by the server on ";
|
136 |
$s .= DATEFUNC_stdlongdate_w_dow($GLOBAL_stime_year, $GLOBAL_stime_month, $GLOBAL_stime_day);
|
137 |
$s .= " at ";
|
138 |
$s .= DATEFUNC_stdtimenosec($GLOBAL_stime_hour, $GLOBAL_stime_minute);
|
139 |
$s .= " local time. ";
|
140 |
if ($uiarray === FALSE)
|
141 |
{
|
142 |
$s .= "You are not logged in.";
|
143 |
}
|
144 |
else
|
145 |
{
|
146 |
USRS_form_display_strings_a($uiarray, $dispuserid, $dispname);
|
147 |
$s .= "You are logged in as ";
|
148 |
$s .= $dispname;
|
149 |
$s .= " (<i>";
|
150 |
$s .= $dispuserid;
|
151 |
$s .= "</i>) (<a href=\"index.php?logout=1";
|
152 |
if (($sddate !== FALSE) && ($sdtime !== FALSE))
|
153 |
{
|
154 |
$s = $s . "&sddt=" . $sddate . "&sdtim=" . $sdtime;
|
155 |
}
|
156 |
else if ($sddate !== FALSE)
|
157 |
{
|
158 |
$s = $s . "&sddt=" . $sddate;
|
159 |
}
|
160 |
else if ($sdtime !== FALSE)
|
161 |
{
|
162 |
$s = $s . "&stim=" . $sdtime;
|
163 |
}
|
164 |
$s .= "\">logout</a>).";
|
165 |
}
|
166 |
|
167 |
$s .= " <i>FBO-Prime</i> is free open-source software—it can be downloaded <a href=\""
|
168 |
. CONFIGHARD_FBOPRIME_HOME_PAGE_URL
|
169 |
. "\" target=\"_blank\">here</a>.";
|
170 |
return($s);
|
171 |
}
|
172 |
//
|
173 |
//--------------------------------------------------------------------------------------------------------------
|
174 |
//Emits the standard footer characteristic of the FBO-Prime software.
|
175 |
//
|
176 |
//Parameters:
|
177 |
// uiarray : An associative array containing user information for the logged-in user,
|
178 |
// or FALSE if no user is logged in.
|
179 |
//
|
180 |
function STDFORMAT_stdfooter_tabular($uiarray, $sddate, $sdtime)
|
181 |
{
|
182 |
|
183 |
HTMLFORMAT_echo_push_nl("<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\">");
|
184 |
HTMLFORMAT_echo_push_nl("<tr>");
|
185 |
HTMLFORMAT_echo_push_nl("<td align=\"center\">");
|
186 |
HTMLFORMAT_echo_push_nl("<font size=\"2\">");
|
187 |
HTMLFORMAT_echo_noop_nl(STDFORMAT_stdfooter_string($uiarray, $sddate, $sdtime));
|
188 |
HTMLFORMAT_echo_pull_nl("</font>");
|
189 |
HTMLFORMAT_echo_pull_nl("</td>");
|
190 |
HTMLFORMAT_echo_pull_nl("</tr>");
|
191 |
HTMLFORMAT_echo_pull_nl("</table>");
|
192 |
}
|
193 |
//
|
194 |
//--------------------------------------------------------------------------------------------------------------
|
195 |
//End of $RCSfile: stdformat.inc,v $.
|
196 |
//--------------------------------------------------------------------------------------------------------------
|
197 |
?>
|