/[dtapublic]/to_be_filed/webprojs/php_libraries/php_library/fboprime/parx.inc
ViewVC logotype

Contents of /to_be_filed/webprojs/php_libraries/php_library/fboprime/parx.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 35 - (show annotations) (download)
Sat Oct 8 23:35:33 2016 UTC (7 years, 5 months ago) by dashley
File size: 5586 byte(s)
Initial commit.
1 <?php
2 //$Header: /hl/cvsroots/gpl01/gpl01/webprojs/fboprime/sw/phplib/parx.inc,v 1.4 2006/11/05 18:06:55 dashley Exp $
3 //********************************************************************************
4 //parx.inc--FboPrime Parameter and Cookie Processing of Parameters Not Required
5 // By Day View Scheduler
6 //
7 //Copyright (C) 2006 David T. Ashley
8 //
9 //This program is free software; you can redistribute it and/or
10 //modify it under the terms of the GNU General Public License
11 //as published by the Free Software Foundation; either version 2
12 //of the License, or (at your option) any later version.
13 //
14 //This program is distributed in the hope that it will be useful,
15 //but WITHOUT ANY WARRANTY; without even the implied warranty of
16 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 //GNU General Public License for more details.
18 //
19 //You should have received a copy of the GNU General Public License
20 //along with this program; if not, write to the Free Software
21 //Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //********************************************************************************
23 //This file contains functions that carefully control GET/POST input parameters
24 //and cookies and bring them into the global variable space.
25 //
26 //The most conservative approach is to restrict such parameters to a language,
27 //i.e. to confine the form they may have.
28 //--------------------------------------------------------------------------------
29 require_once("par.inc");
30 //
31 //--------------------------------------------------------------------------------
32 //
33 //For more documentation, please see par.inc.
34 //
35 //--------------------------------------------------------------------------------
36 //Obtains the resourceidx parameter and assigns it to the variable
37 //$PAR_resourceidx if it exists. If it does not exist, the value of FALSE
38 //is assigned.
39 //
40 function PAR_get_resourceidx()
41 {
42 global $PAR_resourceidx;
43
44 if ((! isset($_GET["resourceidx"])) && (! isset($_POST["resourceidx"])))
45 {
46 $PAR_resourceidx = FALSE;
47 return;
48 }
49 else if (isset($_POST["resourceidx"])) //Post gets precedence--arbitrary choice.
50 {
51 $starting_point = $_POST["resourceidx"];
52 }
53 else if (isset($_GET["resourceidx"]))
54 {
55 $starting_point = $_GET["resourceidx"];
56 }
57
58 //Trim all disallowed characters.
59 $starting_point = STRFUNC_force_into_subset($starting_point, "0123456789");
60
61 //Strip off any leading zeros.
62 while ((strlen($starting_point) > 1) && (SubStr($starting_point, 0, 1) == "0"))
63 $starting_point = SubStr($starting_point, 1);
64
65 //Convert/cast it to an integer if possible, else signal failure with
66 //FALSE.
67 if (is_numeric($starting_point))
68 $starting_point = (int)$starting_point;
69 else
70 $starting_point = FALSE;
71
72 //Assign final value.
73 $PAR_resourceidx = $starting_point;
74 }
75 //
76 //--------------------------------------------------------------------------------
77 //Obtains the useridx parameter and assigns it to the variable
78 //$PAR_useridx if it exists. If it does not exist, the value of FALSE
79 //is assigned.
80 //
81 function PAR_get_useridx()
82 {
83 global $PAR_useridx;
84
85 if ((! isset($_GET["useridx"])) && (! isset($_POST["useridx"])))
86 {
87 $PAR_useridx = FALSE;
88 return;
89 }
90 else if (isset($_POST["useridx"])) //Post gets precedence--arbitrary choice.
91 {
92 $starting_point = $_POST["useridx"];
93 }
94 else if (isset($_GET["useridx"]))
95 {
96 $starting_point = $_GET["useridx"];
97 }
98
99 //Trim all disallowed characters.
100 $starting_point = STRFUNC_force_into_subset($starting_point, "0123456789");
101
102 //Strip off any leading zeros.
103 while ((strlen($starting_point) > 1) && (SubStr($starting_point, 0, 1) == "0"))
104 $starting_point = SubStr($starting_point, 1);
105
106 //Convert/cast it to an integer if possible, else signal failure with
107 //FALSE.
108 if (is_numeric($starting_point))
109 $starting_point = (int)$starting_point;
110 else
111 $starting_point = FALSE;
112
113 //Assign final value.
114 $PAR_useridx = $starting_point;
115 }
116 //
117 //--------------------------------------------------------------------------------
118 //Determines whether the commitbuttonpressed parameter is present and assigns
119 //the variable $PAR_commitbuttonpressed FALSE if it does not exist or TRUE if it
120 //does not exist.
121 //
122 function PAR_get_commitbuttonpressed()
123 {
124 global $PAR_commitbuttonpressed;
125
126 if (isset($_GET["commitbuttonpressed"]) || isset($_POST["commitbuttonpressed"]))
127 {
128 $PAR_commitbuttonpressed = TRUE;
129 }
130 else
131 {
132 $PAR_commitbuttonpressed = FALSE;
133 }
134 }
135 //
136 //--------------------------------------------------------------------------------
137 //Determines whether the addbuttonpressed parameter is present and assigns
138 //the variable $PAR_addbuttonpressed FALSE if it does not exist or TRUE if it
139 //does not exist.
140 //
141 function PAR_get_addbuttonpressed()
142 {
143 global $PAR_addbuttonpressed;
144
145 if (isset($_GET["addbuttonpressed"]) || isset($_POST["addbuttonpressed"]))
146 {
147 $PAR_addbuttonpressed = TRUE;
148 }
149 else
150 {
151 $PAR_addbuttonpressed = FALSE;
152 }
153 }
154 //
155 //--------------------------------------------------------------------------------
156 //End of $RCSfile: parx.inc,v $.
157 //--------------------------------------------------------------------------------
158 ?>

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25