Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/bouncer:master commit in: php/inc/, php/admin/, php/lib/
Date: Tue, 30 Jan 2018 18:16:28
Message-Id: 1517330005.7502757bdae610d26b53d14c01aec68b17e9fbc3.grknight@gentoo
1 commit: 7502757bdae610d26b53d14c01aec68b17e9fbc3
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 30 16:33:25 2018 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 30 16:33:25 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/bouncer.git/commit/?id=7502757b
7
8 Silence Notices with defaults and reference removals
9
10 php/admin/index.php | 1 +
11 php/admin/locations.php | 2 +-
12 php/admin/os.php | 3 ++-
13 php/admin/products.php | 1 +
14 php/admin/regions.php | 1 +
15 php/admin/users.php | 2 +-
16 php/inc/footer.php | 3 +--
17 php/lib/forms.php | 24 ++++++++++++------------
18 php/lib/list.php | 3 ++-
19 php/lib/util.php | 23 +++++++++++------------
20 10 files changed, 33 insertions(+), 30 deletions(-)
21
22 diff --git a/php/admin/index.php b/php/admin/index.php
23 index e8feaec..aceae66 100644
24 --- a/php/admin/index.php
25 +++ b/php/admin/index.php
26 @@ -103,6 +103,7 @@ form_end();
27
28 echo '<h2>Add a Mirror</h2>';
29 form_start();
30 +$posts = ['mirror_name' => '', 'region_id' => '', 'mirror_baseurl' => '', 'mirror_rating' => ''];
31 include_once(INC.'/forms/mirror.php');
32 form_submit('add-submit','','button1','Add Mirror');
33 form_end();
34
35 diff --git a/php/admin/locations.php b/php/admin/locations.php
36 index e868d1a..138cff1 100644
37 --- a/php/admin/locations.php
38 +++ b/php/admin/locations.php
39 @@ -92,9 +92,9 @@ form_end();
40
41 echo '<h2>Add a Location</h2>';
42 form_start();
43 +$posts = ['product_id' => '','os_id' =>'', 'location_path' => ''];
44 include_once(INC.'/forms/location.php');
45 form_submit('add-submit','','button1','Add Location');
46 form_end();
47
48 require_once(FOOTER);
49 -?>
50
51 diff --git a/php/admin/os.php b/php/admin/os.php
52 index 72bb383..731d405 100644
53 --- a/php/admin/os.php
54 +++ b/php/admin/os.php
55 @@ -92,9 +92,10 @@ form_end();
56
57 echo '<h2>Add a OS</h2>';
58 form_start();
59 +$posts = ['os_name'=>'', 'os_priority'=>'']; //sane defaults
60 include_once(INC.'/forms/os.php');
61 form_submit('add-submit','','button1','Add OS');
62 form_end();
63
64 require_once(FOOTER);
65 -?>
66 +
67
68 diff --git a/php/admin/products.php b/php/admin/products.php
69 index cdc20ec..962a3cd 100644
70 --- a/php/admin/products.php
71 +++ b/php/admin/products.php
72 @@ -93,6 +93,7 @@ form_end();
73
74 echo '<h2>Add a Product</h2>';
75 form_start();
76 +$posts = ['product_name'=>'', 'product_priority'=>'']; //sane defaults
77 include_once(INC.'/forms/product.php');
78 form_submit('add-submit','','button1','Add Product');
79 form_end();
80
81 diff --git a/php/admin/regions.php b/php/admin/regions.php
82 index 0709e43..f2b6b54 100644
83 --- a/php/admin/regions.php
84 +++ b/php/admin/regions.php
85 @@ -93,6 +93,7 @@ form_end();
86
87 echo '<h2>Add a Region</h2>';
88 form_start();
89 +$posts = ['region_name'=>'', 'region_priority'=>''];
90 include_once(INC.'/forms/region.php');
91 form_submit('add-submit','','button1','Add Region');
92 form_end();
93
94 diff --git a/php/admin/users.php b/php/admin/users.php
95 index 4926117..4814f0d 100644
96 --- a/php/admin/users.php
97 +++ b/php/admin/users.php
98 @@ -96,9 +96,9 @@ form_end();
99
100 echo '<h2>Add a User</h2>';
101 form_start();
102 +$posts = ['username'=>'', 'user_firstname'=>'', 'user_lastname'=>'', 'user_email'=>'']; //sane defaults
103 include_once(INC.'/forms/user.php');
104 form_submit('add-submit','','button1','Add User');
105 form_end();
106
107 require_once(FOOTER);
108 -?>
109
110 diff --git a/php/inc/footer.php b/php/inc/footer.php
111 index efa17e7..ef9d0fe 100644
112 --- a/php/inc/footer.php
113 +++ b/php/inc/footer.php
114 @@ -14,11 +14,10 @@ if (!empty($nav)) {
115 }
116 ?>
117 <div id="footer">
118 -<p class="copyright">Copyright &copy; 2005 The Gentoo Foundation, portions Copyright &copy; 1998-2004 The Mozilla Organization</p>
119 +<p class="copyright">Copyright &copy; 2005-2018 The Gentoo Foundation, portions Copyright &copy; 1998-2004 The Mozilla Organization</p>
120 </div>
121 </div>
122 </body>
123 </html>
124 <?php
125 ob_end_flush();
126 -?>
127
128 diff --git a/php/lib/forms.php b/php/lib/forms.php
129 index e435181..3ef2c5c 100644
130 --- a/php/lib/forms.php
131 +++ b/php/lib/forms.php
132 @@ -11,23 +11,23 @@
133 * @param bool $slashes default to false, this parameter indicate if stripslashes is desired, usually use for magic qoutes
134 * @return mixed $str cleaned for HTML
135 */
136 -function clean_out($str, $slashes=FALSE)
137 -{
138 +function clean_out($str, $slashes=FALSE)
139 +{
140 if (is_array($str))
141 {
142 foreach ($str as $key => $val)
143 {
144 - $str[$key] =& clean_out($val, $slashes);
145 + $str[$key] = clean_out($val, $slashes);
146 }
147 }
148 else
149 {
150 if ($slashes)
151 - $str =& trim(htmlentities(stripslashes($str)));
152 + $str = trim(htmlentities(stripslashes($str)));
153 else
154 - $str =& trim(htmlentities($str));
155 + $str = trim(htmlentities($str));
156 }
157 -
158 +
159 return $str;
160 }
161
162 @@ -44,18 +44,18 @@ function clean_in($str, $single_quotes=FALSE, $decode=FALSE)
163 {
164 foreach ($str as $key => $val)
165 {
166 - $str[$key] =& clean_in($val, $single_quotes);
167 + $str[$key] = clean_in($val, $single_quotes);
168 }
169 }
170 else
171 {
172 if (get_magic_quotes_gpc() === 1)
173 {
174 - $str =& trim($str);
175 + $str = trim($str);
176 }
177 - else
178 + else
179 {
180 - $str =& addslashes(trim($str));
181 + $str = addslashes(trim($str));
182 }
183 if ($single_quotes) {
184 $str = "'" . $str . "'";
185 @@ -77,9 +77,9 @@ function array_days($month='',$year='')
186 {
187 $days = Array();
188 $num = 1;
189 -
190 +
191 // get total number of days of a particular month if given a month and year
192 - if (!empty($month) && !empty($year) && is_numeric($month)
193 + if (!empty($month) && !empty($year) && is_numeric($month)
194 && is_numeric($year) && $month > 0 && $month < 13)
195 {
196 $days_inmonth = (int) date("t", strtotime($year."-".$month."-01"));
197
198 diff --git a/php/lib/list.php b/php/lib/list.php
199 index 9f480bc..8424ae3 100644
200 --- a/php/lib/list.php
201 +++ b/php/lib/list.php
202 @@ -109,6 +109,7 @@
203 */
204 function show_list($list,$headers,$type='checkbox',$actions=null,$form_id=null,$sortable=true,$selected=null)
205 {
206 + $count = 0;
207 if ( is_array($list) && count($list)>0 && is_array($headers) )
208 {
209 if ( $type!='simple' && !empty($_GET['sort']) && !empty($_GET['order']) )
210 @@ -215,7 +216,7 @@ function show_headers($headers,$type,$sortable=true)
211 if ($type!='simple'&&$count==0)
212 {
213 echo "\n".'<th> </th>';
214 - next;
215 + continue;
216 }
217 elseif($sortable)
218 {
219
220 diff --git a/php/lib/util.php b/php/lib/util.php
221 index 8f8e1e4..fa95114 100644
222 --- a/php/lib/util.php
223 +++ b/php/lib/util.php
224 @@ -35,7 +35,7 @@ function set_msg($str=null)
225 */
226 function show_msg($class='msg')
227 {
228 - if (is_array($_SESSION['messages']) && count($_SESSION['messages']) > 0)
229 + if (isset($_SESSION['messages']) && is_array($_SESSION['messages']) && count($_SESSION['messages']) > 0)
230 {
231 echo ($class !== NULL) ? '<div class="'.$class.'">' : '';
232 echo '<ul>';
233 @@ -282,31 +282,31 @@ function array_order_by(&$array, $key=null, $order=null, $retain_keys=TRUE, $cas
234
235 return $temp_return_arr;
236 }
237 -
238 +
239 if (empty($array) || is_null($key))
240 return $array;
241 -
242 +
243 if (!array_key_exists($key, reset($array)))
244 return $array;
245 -
246 - $order =& strtolower($order);
247 +
248 + $order = strtolower($order);
249 if ($order == '' || ($order != 'asc' && $order != 'desc'))
250 $order = 'asc';
251 -
252 +
253 // construct an array that will be used to order the keys
254 foreach($array as $row_key => $row)
255 {
256 $x[$row_key] = $row[$key];
257 }
258 -
259 +
260 if ($case_sensitive)
261 natsort($x);
262 else
263 natcasesort($x);
264 -
265 +
266 if ($order == 'desc')
267 - $x =& array_reverse($x, TRUE);
268 -
269 + $x = array_reverse($x, TRUE);
270 +
271 // now use those keys to order the original array
272 foreach($x as $row_key => $uselessvalue)
273 {
274 @@ -315,8 +315,7 @@ function array_order_by(&$array, $key=null, $order=null, $retain_keys=TRUE, $cas
275 else
276 $return_arr[] =& $array[$row_key];
277 }
278 -
279 +
280 return $return_arr;
281 }
282
283 -?>