This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | // |
||
3 | // SourceForge: Breaking Down the Barriers to Open Source Development |
||
4 | // Copyright 1999-2000 (c) The SourceForge Crew |
||
5 | // http://sourceforge.net |
||
6 | // |
||
7 | // |
||
8 | |||
9 | function html_feedback_top($feedback) { |
||
10 | echo $GLOBALS['HTML']->feedback($GLOBALS['feedback']); |
||
11 | } |
||
12 | |||
13 | function html_feedback_bottom($feedback) { |
||
14 | echo $GLOBALS['HTML']->feedback($GLOBALS['feedback']); |
||
15 | } |
||
16 | |||
17 | function html_a_group($grp) { |
||
18 | $pm = ProjectManager::instance(); |
||
19 | print '<A /project/?group_id='.$grp.'>' . $pm->getProject($grp)->getPublicName() . '</A>'; |
||
20 | } |
||
21 | |||
22 | function html_blankimage($height,$width) { |
||
23 | return html_image('blank.png',array('height'=>$height,'width'=>$width,'alt'=>' ')); |
||
24 | } |
||
25 | |||
26 | function html_image($src,$args,$display=1) { |
||
27 | GLOBAL $img_size; |
||
28 | $return = ('<IMG src="'.util_get_dir_image_theme().$src.'"'); |
||
29 | $purifier = Codendi_HTMLPurifier::instance(); |
||
30 | reset($args); |
||
31 | while(list($k,$v) = each($args)) { |
||
32 | $return .= ' '.$purifier->purify($k).'="'.$purifier->purify($v).'"'; |
||
33 | } |
||
34 | |||
35 | // ## insert a border tag if there isn't one |
||
36 | if (!isset($args['border']) || !$args['border']) $return .= (" border=0"); |
||
37 | |||
38 | // ## if no height AND no width tag, insert em both |
||
39 | if ((!isset($args['height']) || !$args['height']) && |
||
40 | (!isset($args['width']) || !$args['width'])) { |
||
41 | /* Check to see if we've already fetched the image data */ |
||
42 | if($img_size){ |
||
43 | if((!isset($img_size[$src]) || !$img_size[$src]) && is_file($GLOBALS['sys_urlroot'].util_get_dir_image_theme().$src)){ |
||
44 | $img_size[$src] = @getimagesize($GLOBALS['sys_urlroot'].util_get_dir_image_theme().$src); |
||
45 | } |
||
46 | } else { |
||
47 | if(is_file($GLOBALS['sys_urlroot'].util_get_dir_image_theme().$src)){ |
||
48 | $img_size[$src] = @getimagesize($GLOBALS['sys_urlroot'].util_get_dir_image_theme().$src); |
||
49 | } |
||
50 | } |
||
51 | $return .= ' width="' . $img_size[$src][0].'" height="'.$img_size[$src][1].'"'; |
||
52 | } |
||
53 | |||
54 | // ## insert alt tag if there isn't one |
||
55 | if (!isset($args['alt']) || !$args['alt']) $return .= ' alt="'.$purifier->purify($src).'"'; |
||
56 | |||
57 | $return .= ('>'); |
||
58 | if ($display) { |
||
59 | print $return; |
||
60 | } else { |
||
61 | return $return; |
||
62 | } |
||
63 | } |
||
64 | |||
65 | function html_get_timezone_popup($selected = 0) { |
||
66 | $GLOBALS['HTML']->includeFooterJavascriptFile('/scripts/jstimezonedetect/jstz.min.js'); |
||
67 | $GLOBALS['HTML']->includeFooterJavascriptFile('/scripts/tuleap/timezone.js'); |
||
68 | $renderer = TemplateRendererFactory::build()->getRenderer(ForgeConfig::get('codendi_dir') .'/src/templates/account/'); |
||
69 | return $renderer->renderToString('timezone', new Account_TimezoneSelectorPresenter($selected)); |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * html_get_language_popup() - Pop up box of supported languages |
||
74 | * |
||
75 | * @param object BaseLanguage object |
||
76 | * @param string The title of the popup box |
||
77 | * @param string Which element of the box is to be selected |
||
78 | */ |
||
79 | function html_get_language_popup ($Language,$title='language_id',$selected='xzxzxz') { |
||
80 | $hp = Codendi_HTMLPurifier::instance(); |
||
81 | $html = '<select name="'. $hp->purify($title) .'">'; |
||
82 | foreach($GLOBALS['Language']->getLanguages() as $code => $lang) { |
||
83 | $select = ($selected == $code) ? 'selected="selected"' : ''; |
||
84 | $html .= '<option value="'. $hp->purify($code, CODENDI_PURIFIER_CONVERT_HTML) .'" '. $select .'>'; |
||
85 | $html .= $hp->purify($lang, CODENDI_PURIFIER_CONVERT_HTML); |
||
86 | $html .= '</option>'; |
||
87 | } |
||
88 | $html .= '</select>'; |
||
89 | return $html; |
||
90 | } |
||
91 | |||
92 | |||
93 | function html_build_list_table_top ($title_arr,$links_arr=false,$mass_change=false,$full_width=true, $id=null, $class=null, $cellspacing=1, $cellpadding=2) { |
||
94 | |||
95 | /* |
||
96 | Takes an array of titles and builds |
||
97 | The first row of a new table |
||
98 | |||
99 | Optionally takes a second array of links for the titles |
||
100 | */ |
||
101 | $purifier = Codendi_HTMLPurifier::instance(); |
||
102 | $return = ' |
||
103 | <TABLE '; |
||
104 | if ($full_width) $return.='WIDTH="100%" '; |
||
105 | if($id) $return .='id="'.$purifier->purify($id).'"'; |
||
106 | if($class) $return .=' class="'.$purifier->purify($class).'" '; |
||
107 | $return .= 'BORDER="0" CELLSPACING="'. $purifier->purify($cellspacing) .'" CELLPADDING="'. $purifier->purify($cellpadding) .'"> |
||
108 | <TR class="boxtable">'; |
||
109 | |||
110 | if ($mass_change) $return .= '<TD class="boxtitle">Select?</TD>'; |
||
111 | $count=count($title_arr); |
||
112 | if ($links_arr) { |
||
113 | for ($i=0; $i<$count; $i++) { |
||
114 | if (empty($links_arr[$i])) { |
||
115 | $return .= '<td class="boxtitle">' . $purifier->purify($title_arr[$i]) . '</td>'; |
||
116 | } else { |
||
117 | $return .= ' |
||
118 | <TD class="boxtitle"><a class=sortbutton href="' . $links_arr[$i] . '">' . $purifier->purify($title_arr[$i]) . '</A></TD>'; |
||
119 | } |
||
120 | } |
||
121 | } else { |
||
122 | for ($i=0; $i<$count; $i++) { |
||
123 | $return .= ' |
||
124 | <TD class="boxtitle">'.$purifier->purify($title_arr[$i]).'</TD>'; |
||
125 | } |
||
126 | } |
||
127 | return $return.'</TR>'; |
||
128 | } |
||
129 | |||
130 | //deprecated |
||
131 | function util_get_alt_row_color ($i) { |
||
132 | return html_get_alt_row_color ($i); |
||
133 | } |
||
134 | |||
135 | //function util_get_alt_row_color ($i) { |
||
136 | function html_get_alt_row_color ($i) { |
||
137 | GLOBAL $HTML; |
||
138 | if ($i % 2 == 0) { |
||
139 | return 'boxitem'; |
||
140 | } else { |
||
141 | return 'boxitemalt'; |
||
142 | } |
||
143 | } |
||
144 | |||
145 | function html_build_select_box_from_array ($vals,$select_name,$checked_val='xzxz',$samevals = 0) { |
||
146 | /* |
||
147 | Takes one array, with the first array being the "id" or value |
||
148 | and the array being the text you want displayed |
||
149 | |||
150 | The second parameter is the name you want assigned to this form element |
||
151 | |||
152 | The third parameter is optional. Pass the value of the item that should be checked |
||
153 | */ |
||
154 | |||
155 | $purifier = Codendi_HTMLPurifier::instance(); |
||
156 | $return = ' |
||
157 | <SELECT NAME="'. $purifier->purify($select_name) .'" id="'. $purifier->purify($select_name) .'">'; |
||
158 | |||
159 | foreach ($vals as $value => $label) { |
||
160 | if ( $samevals ) { |
||
161 | $return .= '<OPTION VALUE="' . $purifier->purify($label) . '""'; |
||
162 | if ($label == $checked_val) { |
||
163 | $return .= ' SELECTED'; |
||
164 | } |
||
165 | } else { |
||
166 | $return .= '<OPTION VALUE="' . $purifier->purify($value) .'"'; |
||
167 | if ($value == $checked_val) { |
||
168 | $return .= ' SELECTED'; |
||
169 | } |
||
170 | } |
||
171 | $return .= '>'. $purifier->purify($label) .'</OPTION>'; |
||
172 | } |
||
173 | $return .= ' |
||
174 | </SELECT>'; |
||
175 | |||
176 | return $return; |
||
177 | } |
||
178 | |||
179 | /** |
||
180 | * @deprecated This function miss some purifications voluntary. Please, DO NOT USE it anymore ! |
||
181 | */ |
||
182 | function html_build_select_box_from_arrays ( |
||
183 | $vals, |
||
184 | $texts, |
||
185 | $select_name, |
||
186 | $checked_val='xzxz', |
||
187 | $show_100=true, |
||
188 | $text_100='', |
||
189 | $show_any=false, |
||
190 | $text_any='', |
||
191 | $show_unchanged=false, |
||
192 | $text_unchanged='', |
||
193 | $purify_level=CODENDI_PURIFIER_CONVERT_HTML, |
||
194 | $show_unknown_value = true |
||
195 | ) { |
||
196 | global $Language; |
||
197 | $return = ''; |
||
198 | $isAValueSelected = false; |
||
199 | $hp = Codendi_HTMLPurifier::instance(); |
||
200 | |||
201 | /* |
||
202 | |||
203 | The infamous '100 row' has to do with the |
||
204 | SQL Table joins done throughout all this code. |
||
205 | There must be a related row in users, categories, etc, and by default that |
||
206 | row is 100, so almost every pop-up box has 100 as the default |
||
207 | Most tables in the database should therefore have a row with an id of 100 in it |
||
208 | so that joins are successful |
||
209 | |||
210 | There is now another infamous row called the Any row. It is not |
||
211 | in any table as opposed to 100. it's just here as a convenience mostly |
||
212 | when using select boxes in queries (bug, task,...). The 0 value is reserved |
||
213 | for Any and must not be used in any table. |
||
214 | |||
215 | Params: |
||
216 | |||
217 | Takes two arrays, with the first array being the "id" or value |
||
218 | and the other array being the text you want displayed |
||
219 | |||
220 | The third parameter is the name you want assigned to this form element |
||
221 | |||
222 | The fourth parameter is optional. Pass the value of the item that should be checked |
||
223 | |||
224 | The fifth parameter is an optional boolean - whether or not to show the '100 row' |
||
225 | |||
226 | The sixth parameter is optional - what to call the '100 row' defaults to none |
||
227 | The 7th parameter is an optional boolean - whether or not to show the 'Any row' |
||
228 | |||
229 | The 8th parameter is optional - what to call the 'Any row' defaults to nAny */ |
||
230 | |||
231 | // Position default values for special menu items |
||
232 | if ($text_100 == '') { $text_100 = $Language->getText('global','none'); } |
||
233 | if ($text_any == '') { $text_any = $Language->getText('global','any'); } |
||
234 | if ($text_unchanged == '') { $text_unchanged = $Language->getText('global','unchanged'); } |
||
235 | |||
236 | if ( is_array($checked_val) ) { |
||
237 | $return .= ' |
||
238 | <SELECT id="'.$select_name.'" NAME="'.$select_name.'[]" MULTIPLE SIZE="6">'; |
||
239 | } else { |
||
240 | $return .= ' |
||
241 | <SELECT id="'.$select_name.'" NAME="'.$select_name.'">'; |
||
242 | } |
||
243 | |||
244 | /* |
||
245 | Put in the Unchanged box |
||
246 | */ |
||
247 | if ($show_unchanged) { |
||
248 | $return .= '<OPTION VALUE="'.$hp->purify($text_unchanged).'" SELECTED>'.$hp->purify($text_unchanged, $purify_level).'</OPTION>'; |
||
249 | $isAValueSelected = true; |
||
250 | } |
||
251 | |||
252 | //we don't always want the default any row shown |
||
253 | if ($show_any) { |
||
254 | if ( is_array($checked_val) ) { |
||
255 | if ( in_array(0,$checked_val) ) { |
||
256 | $selected = "SELECTED"; |
||
257 | $isAValueSelected = true; |
||
258 | } else { |
||
259 | $selected = ""; |
||
260 | } |
||
261 | } else { |
||
262 | $selected = ( $checked_val == 0 ? 'SELECTED':''); |
||
263 | if ($checked_val == 0) { |
||
264 | $isAValueSelected = true; |
||
265 | } |
||
266 | } |
||
267 | $return .= '<OPTION VALUE="0" '.$selected.'>'.$hp->purify($text_any, $purify_level).'</OPTION>'; |
||
268 | } |
||
269 | |||
270 | //we don't always want the default 100 row shown |
||
271 | if ($show_100) { |
||
272 | if ( is_array($checked_val) ) { |
||
273 | if ( in_array(100,$checked_val) ) { |
||
274 | $selected = "SELECTED"; |
||
275 | $isAValueSelected = true; |
||
276 | } else { |
||
277 | $selected = ""; |
||
278 | } |
||
279 | } else { |
||
280 | $selected = ( $checked_val == 100 ? 'SELECTED':''); |
||
281 | if ($checked_val == 100) { |
||
282 | $isAValueSelected = true; |
||
283 | } |
||
284 | } |
||
285 | $return .= '<OPTION VALUE="100" '.$selected.'>'.$hp->purify($text_100,$purify_level).'</OPTION>'; |
||
286 | } |
||
287 | |||
288 | $rows=count($vals); |
||
289 | if (count($texts) != $rows) { |
||
290 | $return .= 'ERROR - uneven row counts'; |
||
291 | } |
||
292 | |||
293 | for ($i=0; $i<$rows; $i++) { |
||
294 | // uggh - sorry - don't show the 100 row and Any row |
||
295 | // if it was shown above, otherwise do show it |
||
296 | if ( (($vals[$i] != '100') && ($vals[$i] != '0')) || |
||
297 | ($vals[$i] == '100' && !$show_100) || |
||
298 | ($vals[$i] == '0' && !$show_any) ) { |
||
299 | $return .= ' |
||
300 | <OPTION VALUE="'.$hp->purify($vals[$i]).'"'; |
||
301 | if ( is_array($checked_val) ) { |
||
302 | if ( in_array($vals[$i],$checked_val) ) { |
||
303 | $return .= ' SELECTED'; |
||
304 | $isAValueSelected = true; |
||
305 | } |
||
306 | } else { |
||
307 | if ($vals[$i] == $checked_val) { |
||
308 | $return .= ' SELECTED'; |
||
309 | $isAValueSelected = true; |
||
310 | } |
||
311 | } |
||
312 | $return .= '>'.$hp->purify($texts[$i],$purify_level).'</OPTION>'; |
||
313 | } |
||
314 | } |
||
315 | if ($show_unknown_value && ($checked_val && $checked_val != 'xzxz' && ! $isAValueSelected)) { |
||
316 | $return .= '<OPTION VALUE="'.$hp->purify($checked_val).'" SELECTED>'.$hp->purify($Language->getText('include_html','unknown_value'),$purify_level).'</OPTION>'; |
||
317 | } |
||
318 | $return .= ' |
||
319 | </SELECT>'; |
||
320 | return $return; |
||
321 | } |
||
322 | |||
323 | function html_build_select_box ( |
||
324 | $result, |
||
325 | $name, |
||
326 | $checked_val="xzxz", |
||
327 | $show_100=true, |
||
328 | $text_100='', |
||
329 | $show_any=false, |
||
330 | $text_any='', |
||
331 | $show_unchanged=false, |
||
332 | $text_unchanged='', |
||
333 | $purify_level=CODENDI_PURIFIER_CONVERT_HTML, |
||
334 | $show_unknown_value = true |
||
335 | ) { |
||
336 | global $Language; |
||
337 | /* |
||
338 | Takes a result set, with the first column being the "id" or value |
||
339 | and the second column being the text you want displayed |
||
340 | |||
341 | The second parameter is the name you want assigned to this form element |
||
342 | |||
343 | The third parameter is optional. Pass the value of the item that should be checked |
||
344 | |||
345 | The fourth parameter is an optional boolean - whether or not to show the '100 row' |
||
346 | |||
347 | The fifth parameter is optional - what to call the '100 row' defaults to none |
||
348 | */ |
||
349 | |||
350 | // Position default values for special menu items |
||
351 | if ($text_100 == '') { $text_100 = $Language->getText('global','none'); } |
||
352 | if ($text_any == '') { $text_any = $Language->getText('global','any'); } |
||
353 | if ($text_unchanged == '') { $text_unchanged = $Language->getText('global','unchanged'); } |
||
354 | |||
355 | return html_build_select_box_from_arrays( |
||
0 ignored issues
–
show
|
|||
356 | util_result_column_to_array($result,0), |
||
357 | util_result_column_to_array($result,1), |
||
358 | $name, |
||
359 | $checked_val, |
||
360 | $show_100, |
||
361 | $text_100, |
||
362 | $show_any, |
||
363 | $text_any, |
||
364 | $show_unchanged, |
||
365 | $text_unchanged, |
||
366 | $purify_level, |
||
367 | $show_unknown_value |
||
368 | ); |
||
369 | } |
||
370 | |||
371 | function html_build_multiple_select_box($result,$name,$checked_array,$size='8',$show_100=true,$text_100='', $show_any=false,$text_any='',$show_unchanged=false,$text_unchanged='',$show_value=true, $purify_level=CODENDI_PURIFIER_CONVERT_HTML, $disabled = false) { |
||
372 | if (is_array($result)) { |
||
373 | $array =& $result; |
||
374 | } else { |
||
375 | $array = array(); |
||
376 | while($row = db_fetch_array($result)) { |
||
377 | $array[] = array('value' => $row[0], 'text' => $row[1]); |
||
378 | } |
||
379 | } |
||
380 | return html_build_multiple_select_box_from_array($array,$name,$checked_array,$size,$show_100,$text_100, $show_any,$text_any,$show_unchanged,$text_unchanged,$show_value, $purify_level, $disabled); |
||
381 | } |
||
382 | function html_build_multiple_select_box_from_array($array,$name,$checked_array,$size='8',$show_100=true,$text_100='', $show_any=false,$text_any='',$show_unchanged=false,$text_unchanged='',$show_value=true, $purify_level=CODENDI_PURIFIER_CONVERT_HTML, $disabled = false) { |
||
383 | global $Language; |
||
384 | /* |
||
385 | Takes a result set, with the first column being the "id" or value |
||
386 | and the second column being the text you want displayed |
||
387 | |||
388 | The second parameter is the name you want assigned to this form element |
||
389 | |||
390 | The third parameter is an array of checked values; |
||
391 | |||
392 | The fourth parameter is optional. Pass the size of this box |
||
393 | |||
394 | Fifth to eigth params determine whether to show None and Any |
||
395 | |||
396 | Ninth param determine whether to show numeric values next to |
||
397 | the menu label (default true for backward compatibility |
||
398 | */ |
||
399 | $hp = Codendi_HTMLPurifier::instance(); |
||
400 | |||
401 | // Position default values for special menu items |
||
402 | if ($text_100 == '') { $text_100 = $Language->getText('global','none'); } |
||
403 | if ($text_any == '') { $text_any = $Language->getText('global','any'); } |
||
404 | if ($text_unchanged == '') { $text_unchanged = $Language->getText('global','unchanged'); } |
||
405 | $disabled = $disabled ? 'disabled="disabled"' : ''; |
||
406 | |||
407 | $checked_count=count($checked_array); |
||
408 | // echo '-- '.$checked_count.' --'; |
||
409 | $id = str_replace('[]', '', $name); |
||
410 | $return = ' |
||
411 | <SELECT NAME="'.$hp->purify($name).'" id="'.$hp->purify($id).'" MULTIPLE SIZE="'.$hp->purify($size).'" '. $disabled .'>'; |
||
412 | |||
413 | /* |
||
414 | Put in the Unchanged box |
||
415 | */ |
||
416 | if ($show_unchanged) |
||
417 | $return .= "\n".'<OPTION VALUE="'.$hp->purify($text_unchanged).'" SELECTED>'.$hp->purify($text_unchanged,$purify_level).'</OPTION>'; |
||
418 | |||
419 | /* |
||
420 | Put in the Any box |
||
421 | */ |
||
422 | if ($show_any) { |
||
423 | $return .= ' |
||
424 | <OPTION VALUE="0"'; |
||
425 | for ($j=0; $j<$checked_count; $j++) { |
||
426 | if ($checked_array[$j] == '0') { |
||
427 | $return .= ' SELECTED'; |
||
428 | } |
||
429 | } |
||
430 | $return .= '>'.$hp->purify($text_any,$purify_level).'</OPTION>'; |
||
431 | } |
||
432 | |||
433 | /* |
||
434 | Put in the default NONE box |
||
435 | */ |
||
436 | if ($show_100) { |
||
437 | $return .= ' |
||
438 | <OPTION VALUE="100"'; |
||
439 | for ($j=0; $j<$checked_count; $j++) { |
||
440 | if ($checked_array[$j] == '100') { |
||
441 | $return .= ' SELECTED'; |
||
442 | } |
||
443 | } |
||
444 | $return .= '>'.$hp->purify($text_100,$purify_level).'</OPTION>'; |
||
445 | } |
||
446 | |||
447 | foreach($array as $row) { |
||
448 | $val = $row['value']; |
||
449 | if ($val != '100') { |
||
450 | $return .= ' |
||
451 | <OPTION VALUE="'.$hp->purify($val).'"'; |
||
452 | /* |
||
453 | Determine if it's checked |
||
454 | */ |
||
455 | for ($j=0; $j<$checked_count; $j++) { |
||
456 | if ($val == $checked_array[$j]) { |
||
457 | $return .= ' SELECTED'; |
||
458 | } |
||
459 | } |
||
460 | $return .= '>'.$hp->purify(($show_value?$val.'-':'').substr($row['text'],0,60),$purify_level). '</OPTION>'; |
||
461 | } |
||
462 | } |
||
463 | $return .= ' |
||
464 | </SELECT>'; |
||
465 | return $return; |
||
466 | } |
||
467 | |||
468 | function html_buildpriority_select_box ($name='priority', $checked_val='5') { |
||
469 | /* |
||
470 | Return a select box of standard priorities. |
||
471 | The name of this select box is optional and so is the default checked value |
||
472 | */ |
||
473 | global $Language; |
||
474 | $purifier = Codendi_HTMLPurifier::instance(); |
||
475 | ?> |
||
476 | <SELECT NAME="<?php echo $purifier->purify($name); ?>"> |
||
477 | <OPTION VALUE="1"<?php if ($checked_val=="1") {echo " SELECTED";} ?>>1 - <?php echo $Language->getText('include_html','lowest'); ?></OPTION> |
||
478 | <OPTION VALUE="2"<?php if ($checked_val=="2") {echo " SELECTED";} ?>>2</OPTION> |
||
479 | <OPTION VALUE="3"<?php if ($checked_val=="3") {echo " SELECTED";} ?>>3</OPTION> |
||
480 | <OPTION VALUE="4"<?php if ($checked_val=="4") {echo " SELECTED";} ?>>4</OPTION> |
||
481 | <OPTION VALUE="5"<?php if ($checked_val=="5") {echo " SELECTED";} ?>>5 - <?php echo $Language->getText('include_html','medium'); ?></OPTION> |
||
482 | <OPTION VALUE="6"<?php if ($checked_val=="6") {echo " SELECTED";} ?>>6</OPTION> |
||
483 | <OPTION VALUE="7"<?php if ($checked_val=="7") {echo " SELECTED";} ?>>7</OPTION> |
||
484 | <OPTION VALUE="8"<?php if ($checked_val=="8") {echo " SELECTED";} ?>>8</OPTION> |
||
485 | <OPTION VALUE="9"<?php if ($checked_val=="9") {echo " SELECTED";} ?>>9 - <?php echo $Language->getText('include_html','highest'); ?></OPTION> |
||
486 | </SELECT> |
||
487 | <?php |
||
488 | |||
489 | } |
||
490 | |||
491 | function html_buildcheckboxarray($options,$name,$checked_array) { |
||
492 | $option_count = count($options); |
||
493 | $checked_count = count($checked_array); |
||
494 | $purifier = Codendi_HTMLPurifier::instance(); |
||
495 | |||
496 | for ($i=1; $i<=$option_count; $i++) { |
||
497 | echo ' |
||
498 | <BR><INPUT type="checkbox" name="'.$purifier->purify($name).'" value="'.$i.'"'; |
||
499 | for ($j=0; $j<$checked_count; $j++) { |
||
500 | if ($i == $checked_array[$j]) { |
||
501 | echo ' CHECKED'; |
||
502 | } |
||
503 | } |
||
504 | echo '> '.$purifier->purify($options[$i]); |
||
505 | } |
||
506 | } |
||
507 | |||
508 | /*! @function site_user_header |
||
509 | @abstract everything required to handle security and |
||
510 | add navigation for user pages like /my/ and /account/ |
||
511 | @param params array() must contain $user_id |
||
512 | @result text - echos HTML to the screen directly |
||
513 | */ |
||
514 | function site_header($params) { |
||
515 | GLOBAL $HTML; |
||
516 | /* |
||
517 | Check to see if active user |
||
518 | Check to see if logged in |
||
519 | */ |
||
520 | |||
521 | if (isset($params['group'])) { |
||
522 | $pm = ProjectManager::instance(); |
||
523 | $project=$pm->getProject($params['group']); |
||
524 | if ($project->isTemplate()) { |
||
525 | $GLOBALS['Response']->addFeedback('warning', $GLOBALS['Language']->getText('include_layout','template_warning')); |
||
526 | } |
||
527 | } |
||
528 | echo $HTML->header($params); |
||
529 | echo html_feedback_top($GLOBALS['feedback']); |
||
530 | } |
||
531 | |||
532 | function site_footer($params) { |
||
533 | GLOBAL $HTML; |
||
534 | echo html_feedback_bottom($GLOBALS['feedback']); |
||
535 | $HTML->footer($params); |
||
536 | } |
||
537 | |||
538 | |||
539 | /*! @function site_project_header |
||
540 | @abstract everything required to handle security and state checks for a project web page |
||
541 | @param params array() must contain $toptab and $group |
||
542 | @result text - echos HTML to the screen directly |
||
543 | */ |
||
544 | function site_project_header($params) { |
||
545 | GLOBAL $HTML, $Language; |
||
546 | |||
547 | /* |
||
548 | Check to see if active |
||
549 | Check to see if private (if private check if user_ismember) |
||
550 | */ |
||
551 | |||
552 | $group_id=$params['group']; |
||
553 | |||
554 | //get the project object |
||
555 | $pm = ProjectManager::instance(); |
||
556 | $project=$pm->getProject($group_id); |
||
557 | |||
558 | //group doesn't exist |
||
559 | if ($project->isError()) { |
||
560 | exit_error($Language->getText('include_html','invalid_g'),$Language->getText('include_html','g_not_exist')); |
||
561 | } |
||
562 | |||
563 | //group is private |
||
564 | if (! $project->isPublic() && isset($params['user_has_special_access']) && ! $params['user_has_special_access']) { |
||
565 | //if its a private group, you must be a member of that group |
||
566 | session_require(array('group'=>$group_id)); |
||
567 | } |
||
568 | |||
569 | //for dead projects must be member of admin project |
||
570 | if (!$project->isActive()) { |
||
571 | //only SF group can view non-active, non-holding groups |
||
572 | session_require(array('group'=>'1')); |
||
573 | } |
||
574 | |||
575 | if (isset($params['pv']) && $params['pv'] != 0) { |
||
576 | // Printer version: no right column, no tabs... |
||
577 | echo $HTML->pv_header($params); |
||
578 | } else { |
||
579 | site_header($params); |
||
580 | } |
||
581 | } |
||
582 | |||
583 | /*! @function site_project_footer |
||
584 | @abstract currently a simple shim that should be on every project page, |
||
585 | rather than a direct call to site_footer() or theme_footer() |
||
586 | @param params array() empty |
||
587 | @result text - echos HTML to the screen directly |
||
588 | */ |
||
589 | function site_project_footer($params) { |
||
590 | GLOBAL $HTML; |
||
591 | |||
592 | if (isset($params['pv']) && $params['pv'] != 0) { |
||
593 | // Printer version |
||
594 | echo $HTML->pv_footer($params); |
||
595 | } else { |
||
596 | echo html_feedback_bottom($GLOBALS['feedback']); |
||
597 | echo $HTML->footer($params); |
||
598 | } |
||
599 | } |
||
600 | |||
601 | |||
602 | function html_display_boolean($value,$true_value='Yes',$false_value='No') { |
||
603 | global $Language; |
||
604 | |||
605 | // Position default values for special menu items |
||
606 | if (!isset($true_value)) { $true_value = $Language->getText('global','yes'); } |
||
607 | if (!isset($false_value)) { $false_value = $Language->getText('global','no'); } |
||
608 | if ( ($value == 1)||($value == true) ) { |
||
609 | echo $true_value; |
||
610 | } else { |
||
611 | echo $false_value; |
||
612 | } |
||
613 | } |
||
614 | |||
615 | function html_trash_image($alt) { |
||
616 | $purifier = Codendi_HTMLPurifier::instance(); |
||
617 | return '<img src="'.util_get_image_theme("ic/trash.png").'" '. |
||
618 | 'height="16" width="16" border="0" alt="'.$purifier->purify($alt).'" title="'.$purifier->purify($alt).'">'; |
||
619 | } |
||
620 | |||
621 | function html_trash_link($link, $warn, $alt) { |
||
622 | $purifier = Codendi_HTMLPurifier::instance(); |
||
623 | return '<a href="'.$link.'" onClick="return confirm(\''.$purifier->purify($warn, CODENDI_PURIFIER_JS_QUOTE).'\')">'.html_trash_image($alt).'</a>'; |
||
624 | } |
||
625 | |||
626 | /** |
||
627 | * |
||
628 | * Returns a date operator field |
||
629 | * |
||
630 | * @param value: initial value |
||
631 | * @param ro: if true, the field is read-only |
||
632 | * |
||
633 | * @return string |
||
634 | */ |
||
635 | function html_select_operator($name='', $value='', $ro=false) { |
||
636 | if ($ro) { |
||
637 | $html = htmlspecialchars($value); |
||
638 | } else { |
||
639 | $html = '<select name="'.$name.'">'. |
||
640 | '<option value="1"'.(($value == '1') ? 'selected="selected"':'').'>></option>'. |
||
641 | '<option value="0"'.(($value == '0') ? 'selected="selected"':'').'>=</option>'. |
||
642 | '<option value="-1"'.(($value == '-1') ? 'selected="selected"':'').'><</option>'. |
||
643 | '</select>'; |
||
644 | } |
||
645 | return($html); |
||
646 | } |
||
647 | |||
648 | /** |
||
649 | * Returns a date field |
||
650 | * |
||
651 | * @param value: initial value |
||
652 | * @param size: the field size |
||
653 | * @param maxlength: the max field size |
||
654 | * @param ro: if true, the field is read-only |
||
655 | * |
||
656 | * @return string |
||
657 | */ |
||
658 | function html_field_date($field_name='', |
||
659 | $value='', |
||
660 | $ro=false, |
||
661 | $size='10', |
||
662 | $maxlength='10', |
||
663 | $form_name='artifact_form', |
||
664 | $today=false) { |
||
665 | if ($ro) { |
||
666 | $html = $value; |
||
667 | } |
||
668 | else { |
||
669 | $html = $GLOBALS['HTML']->getDatePicker('field_'.$field_name, $field_name, $value, $size, $maxlength); |
||
670 | } |
||
671 | return($html); |
||
672 | } |
||
673 | |||
674 | function html_time_ago($time, $include_seconds = false) { |
||
675 | $hp = Codendi_HTMLPurifier::instance(); |
||
676 | return '<span title="'. format_date($GLOBALS['Language']->getText('system', 'datefmt'), $time) .'">'. $hp->purify(util_time_ago_in_words($time, $include_seconds), CODENDI_PURIFIER_CONVERT_HTML) .'</span>'; |
||
0 ignored issues
–
show
The function
util_time_ago_in_words() has been deprecated with message: Use DateHelper::timeAgoInWords() instead
This function has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead. ![]() |
|||
677 | } |
||
678 | |||
679 | ?> |
||
680 |
This function has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.