/
core_helper_API.php
677 lines (605 loc) · 19.8 KB
/
core_helper_API.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
<?php
# Mantis - a php based bugtracking system
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
# This program is distributed under the terms and conditions of the GPL
# See the files README and LICENSE for details
# --------------------------------------------------------
# $Revision: 1.52 $
# $Author: vboctor $
# $Date: 2002-07-07 06:28:14 $
#
# $Id: core_helper_API.php,v 1.52 2002-07-07 06:28:14 vboctor Exp $
# --------------------------------------------------------
###########################################################################
# Helper API
###########################################################################
# These are miscellaneous functions to help the package
# --------------------
# updates the last_updated field
function bug_date_update( $p_bug_id ) {
global $g_mantis_bug_table;
$c_bug_id = (integer)$p_bug_id;
$query ="UPDATE $g_mantis_bug_table ".
"SET last_updated=NOW() ".
"WHERE id='$c_bug_id'";
return db_query( $query );
}
# --------------------
# updates the last_modified field
function bugnote_date_update( $p_bugnote_id ) {
global $g_mantis_bugnote_table;
$c_bugnote_id = (integer)$p_bugnote_id;
$query ="UPDATE $g_mantis_bugnote_table ".
"SET last_modified=NOW() ".
"WHERE id='$c_bugnote_id'";
return db_query( $query );
}
# --------------------
# Returns the record of the specified bug
function get_bug_row( $p_bug_id ) {
global $g_mantis_bug_table;
$c_bug_id = (integer)$p_bug_id;
# get info
$query ="SELECT * ".
"FROM $g_mantis_bug_table ".
"WHERE id='$c_bug_id' ".
"LIMIT 1";
return db_query( $query );
}
# --------------------
# Returns the extended record of the specified bug, this includes
# the bug text fields
# @@@ include reporter name and handler name, the problem is that
# handler can be 0, in this case no corresponding name will be
# found. Use equivalent of (+) in Oracle.
function get_bug_row_ex( $p_bug_id ) {
global $g_mantis_bug_table, $g_mantis_bug_text_table;
$c_bug_id = (integer)$p_bug_id;
# get info
$query ="SELECT b.*, bt.*, b.id as id ".
"FROM $g_mantis_bug_table b, $g_mantis_bug_text_table bt ".
"WHERE b.id='$c_bug_id' AND b.bug_text_id = bt.id ".
"LIMIT 1";
return db_query( $query );
}
# --------------------
# Returns the specified field value of the specified bug
function get_bug_field( $p_bug_id, $p_field_name ) {
global $g_mantis_bug_table;
$c_bug_id = (integer)$p_bug_id;
# get info
$query ="SELECT $p_field_name ".
"FROM $g_mantis_bug_table ".
"WHERE id='$c_bug_id' ".
"LIMIT 1";
$result = db_query( $query );
return db_result( $result, 0 );
}
# --------------------
# Returns the specified field value of the specified bug text
function get_bug_text_field( $p_bug_id, $p_field_name ) {
global $g_mantis_bug_text_table;
$t_bug_text_id = get_bug_field( $p_bug_id, 'bug_text_id' );
# get info
$query ="SELECT $p_field_name ".
"FROM $g_mantis_bug_text_table ".
"WHERE id='$t_bug_text_id' ".
"LIMIT 1";
$result = db_query( $query );
return db_result( $result, 0 );
}
# --------------------
# Returns the specified field value of the specified bug text
function get_file_field( $p_file_id, $p_field_name ) {
global $g_mantis_bug_file_table;
# get info
$query ="SELECT $p_field_name ".
"FROM $g_mantis_bug_file_table ".
"WHERE id='$p_file_id' ".
"LIMIT 1";
$result = db_query( $query );
return db_result( $result, 0 );
}
# --------------------
# converts a 1 value to X
# converts a 0 value to a space
function trans_bool( $p_num ) {
if ( 0 == $p_num ) {
return ' ';
} else {
return 'X';
}
}
# --------------------
# check to see if bug exists
# if it doesn't exist then redirect to the main page
# otherwise let execution continue undisturbed
function check_bug_exists( $p_bug_id ) {
global $g_mantis_bug_table;
$c_bug_id = (integer)$p_bug_id;
$query ="SELECT COUNT(*) ".
"FROM $g_mantis_bug_table ".
"WHERE id='$c_bug_id'";
$result = db_query( $query );
if ( 0 == db_result( $result, 0, 0 ) ) {
print_header_redirect( 'main_page.php' );
}
}
# --------------------
# allows bug deletion :
# delete the bug, bugtext, bugnote, and bugtexts selected
# used in bug_delete.php & mass treatments
function delete_bug( $p_id, $p_bug_text_id ) {
global $g_mantis_bug_file_table, $g_mantis_bug_table, $g_mantis_bug_text_table,
$g_mantis_bugnote_table, $g_mantis_bugnote_text_table, $g_mantis_bug_history_table,
$g_file_upload_method ;
email_bug_deleted($p_id);
$c_id = (integer)$p_id;
$c_bug_text_id = (integer)$p_bug_text_id;
# Delete the bug entry
$query = "DELETE
FROM $g_mantis_bug_table
WHERE id='$c_id'";
$result = db_query($query);
# Delete the corresponding bug text
$query = "DELETE
FROM $g_mantis_bug_text_table
WHERE id='$c_bug_text_id'";
$result = db_query($query);
# Delete the bugnote text items
$query = "SELECT bugnote_text_id
FROM $g_mantis_bugnote_table
WHERE bug_id='$c_id'";
$result = db_query($query);
$bugnote_count = db_num_rows( $result );
for ($i=0;$i<$bugnote_count;$i++){
$row = db_fetch_array( $result );
$t_bugnote_text_id = $row['bugnote_text_id'];
# Delete the corresponding bugnote texts
$query = "DELETE
FROM $g_mantis_bugnote_text_table
WHERE id='$t_bugnote_text_id'";
$result2 = db_query( $query );
}
# Delete the corresponding bugnotes
$query = "DELETE
FROM $g_mantis_bugnote_table
WHERE bug_id='$c_id'";
$result = db_query($query);
if ( ( DISK == $g_file_upload_method ) || ( FTP == $g_file_upload_method ) ) {
# Delete files from disk
$query = "SELECT diskfile, filename
FROM $g_mantis_bug_file_table
WHERE bug_id='$c_id'";
$result = db_query($query);
$file_count = db_num_rows( $result );
# there may be more than one file
for ($i=0;$i<$file_count;$i++){
$row = db_fetch_array( $result );
file_delete_local ( $row['diskfile'] );
if ( FTP == $g_file_upload_method ) {
$ftp = file_ftp_connect();
file_ftp_delete ( $ftp, $row['filename'] );
file_ftp_disconnect( $ftp );
}
}
}
# Delete the corresponding files
$query = "DELETE
FROM $g_mantis_bug_file_table
WHERE bug_id='$c_id'";
$result = db_query($query);
# Delete the bug history
$query = "DELETE
FROM $g_mantis_bug_history_table
WHERE bug_id='$c_id'";
$result = db_query($query);
}
# --------------------
# check to see if bugnote exists
# if it doesn't exist then redirect to the main page
# otherwise let execution continue undisturbed
function check_bugnote_exists( $p_bugnote_id ) {
global $g_mantis_bugnote_table;
$c_bugnote_id = (integer)$p_bugnote_id;
$query ="SELECT COUNT(*) ".
"FROM $g_mantis_bugnote_table ".
"WHERE id='$c_bugnote_id'";
$result = db_query( $query );
if ( 0 == db_result( $result, 0, 0 ) ) {
print_header_redirect( 'main_page.php' );
}
}
# --------------------
# check to see if user exists
# if it doesn't exist then redirect to the main page
# otherwise let execution continue undisturbed
function check_user_exists( $p_user_id ) {
global $g_mantis_user_table;
$c_user_id = (integer)$p_user_id;
$query ="SELECT COUNT(*) ".
"FROM $g_mantis_user_table ".
"WHERE id='$c_user_id'";
$result = db_query( $query );
if ( 0 == db_result( $result, 0, 0 ) ) {
print_header_redirect( 'main_page.php' );
}
}
# --------------------
# check to see if project exists by id
# if it doesn't exist then redirect to the main page
# otherwise let execution continue undisturbed
function check_project_exists( $p_project_id ) {
global $g_mantis_project_table;
$c_project_id = (integer)$p_project_id;
$query ="SELECT COUNT(*) ".
"FROM $g_mantis_project_table ".
"WHERE id='$c_project_id'";
$result = db_query( $query );
if ( 0 == db_result( $result, 0, 0 ) ) {
print_header_redirect( 'main_page.php' );
}
}
# --------------------
# check to see if project exists by name
# if it doesn't exist then redirect to the main page
# otherwise let execution continue undisturbed
function is_duplicate_project( $p_name ) {
global $g_mantis_project_table;
$query ="SELECT COUNT(*) ".
"FROM $g_mantis_project_table ".
"WHERE name='$p_name'";
$result = db_query( $query );
return ( 0 != db_result( $result, 0, 0 ) );
}
# --------------------
# retrieve the number of open assigned bugs to a user in a project
function get_assigned_open_bug_count( $p_project_id, $p_cookie_str ) {
global $g_mantis_bug_table, $g_mantis_user_table, $g_project_cookie_val;
$c_project_id = (integer)$p_project_id;
$c_cookie_str = addslashes($p_cookie_str);
$query ="SELECT id ".
"FROM $g_mantis_user_table ".
"WHERE cookie_string='$c_cookie_str'";
$result = db_query( $query );
$t_id = db_result( $result );
if ( '0000000' == $g_project_cookie_val ) {
$t_where_prj = '';
} else {
$t_where_prj = "project_id='$c_project_id' AND";
}
$t_res = RESOLVED;
$t_clo = CLOSED;
$query ="SELECT COUNT(*) ".
"FROM $g_mantis_bug_table ".
"WHERE $t_where_prj ".
"status<>'$t_res' AND status<>'$t_clo' AND ".
"handler_id='$t_id'";
$result = db_query( $query );
return db_result( $result, 0, 0 );
}
# --------------------
# retrieve the number of open reported bugs by a user in a project
function get_reported_open_bug_count( $p_project_id, $p_cookie_str ) {
global $g_mantis_bug_table, $g_mantis_user_table, $g_project_cookie_val;
$c_project_id = (integer)$p_project_id;
$c_cookie_str = addslashes($p_cookie_str);
$query ="SELECT id ".
"FROM $g_mantis_user_table ".
"WHERE cookie_string='$c_cookie_str'";
$result = db_query( $query );
$t_id = db_result( $result );
if ( '0000000' == $g_project_cookie_val ) {
$t_where_prj = '';
} else {
$t_where_prj = "project_id='$c_project_id' AND";
}
$t_res = RESOLVED;
$t_clo = CLOSED;
$query ="SELECT COUNT(*) ".
"FROM $g_mantis_bug_table ".
"WHERE $t_where_prj ".
"status<>'$t_res' AND status<>'$t_clo' AND ".
"reporter_id='$t_id'";
$result = db_query( $query );
return db_result( $result, 0, 0 );
}
### --------------------
# process the $p_string and convert filenames in the format
# cvs:filename.ext or cvs:filename.ext:n.nn to a html link
function process_cvs_link( $p_string ) {
global $g_cvs_web;
return preg_replace( '/cvs:([^\.\s:,\?!]+(\.[^\.\s:,\?!]+)*)(:)?(\d\.[\d\.]+)?([\W\s])?/i',
'[CVS] <a href="'.$g_cvs_web.'\\1?rev=\\4" target="_new">\\1</a>\\5',
$p_string );
}
### --------------------
# process the $p_string and convert filenames in the format
# cvs:filename.ext or cvs:filename.ext:n.nn to a html link
function process_cvs_link_email( $p_string ) {
global $g_cvs_web;
return preg_replace( '/cvs:([^\.\s:,\?!]+(\.[^\.\s:,\?!]+)*)(:)?(\d\.[\d\.]+)?([\W\s])?/i',
'[CVS] '.$g_cvs_web.'\\1?rev=\\4\\5',
$p_string );
}
# --------------------
# process the $p_string and create links to bugs if warranted
# Uses the $g_bug_link_tag variable to determine the bug link tag
# eg. #45 or bug:76
# default is the # symbol. You may substitue any pattern you want.
function process_bug_link( $p_string ) {
global $g_bug_link_tag;
if ( ON == get_current_user_pref_field( 'advanced_view' ) ) {
return preg_replace("/$g_bug_link_tag([0-9]+)/",
"<a href=\"view_bug_advanced_page.php?f_id=\\1\">#\\1</a>",
$p_string);
} else {
return preg_replace("/$g_bug_link_tag([0-9]+)/",
"<a href=\"view_bug_page.php?f_id=\\1\">#\\1</a>",
$p_string);
}
}
# --------------------
# process the $p_string and convert bugs in this format #123 to a plain text link
function process_bug_link_email( $p_string ) {
global $g_bug_link_tag;
if ( ON == get_current_user_pref_field( 'advanced_view' ) ) {
return preg_replace("/$g_bug_link_tag([0-9]+)/",
"view_bug_advanced_page.php?f_id=\\1",
$p_string);
} else {
return preg_replace("/$g_bug_link_tag([0-9]+)/",
"view_bug_page.php?f_id=\\1",
$p_string);
}
}
# --------------------
# alternate color function
function alternate_colors( $p_num, $p_color1='', $p_color2='' ) {
global $g_primary_color1, $g_primary_color2;
if ( empty( $p_color1 ) ) {
$p_color1 = $g_primary_color1;
}
if ( empty( $p_color2 ) ) {
$p_color2 = $g_primary_color2;
}
if ( 1 == $p_num % 2 ) {
return $p_color1;
} else {
return $p_color2;
}
}
# --------------------
# get the color string for the given status
function get_status_color( $p_status ) {
global $g_status_enum_string, $g_status_colors;
# This code creates the appropriate variable name
# then references that color variable
# You could replace this with a bunch of if... then... else
# statements
$t_color_str = 'closed';
$t_arr = explode_enum_string( $g_status_enum_string );
$t_arr_count = count( $t_arr );
for ( $i=0;$i<$t_arr_count;$i++ ) {
$elem_arr = explode_enum_arr( $t_arr[$i] );
if ( $elem_arr[0] == $p_status ) {
# now get the appropriate translation
$t_color_str = $elem_arr[1];
break;
}
}
$t_color_variable_name = 'g_'.$t_color_str.'_color';
global $$t_color_variable_name;
if ( isset( $$t_color_variable_name ) ) {
return $$t_color_variable_name;
} elseif ( isset ( $g_status_colors[$t_color_str] ) ) {
return $g_status_colors[$t_color_str];
}
return '#ffffff';
}
# --------------------
# Get the default project of a user
function get_default_project( $p_user_id ) {
global $g_mantis_user_pref_table;
$c_user_id = (integer)$p_user_id;
$query ="SELECT default_project ".
"FROM $g_mantis_user_pref_table ".
"WHERE user_id='$c_user_id' ".
"LIMIT 1";
$result = db_query( $query );
return db_result( $result, 0, 0 );
}
# --------------------
# Get the string associated with the $p_enum value
function get_enum_to_string( $p_enum_string, $p_num ) {
$t_arr = explode_enum_string( $p_enum_string );
$enum_count = count( $t_arr );
for ($i=0;$i<$enum_count;$i++) {
$t_s = explode_enum_arr( $t_arr[$i] );
if ( $t_s[0] == $p_num ) {
return $t_s[1];
}
}
return '@null@';
}
# --------------------
# Breaks up an enum string into num:value elements
function explode_enum_string( $p_enum_string ) {
return explode( ',', $p_enum_string );
}
# --------------------
# Given one num:value pair it will return both in an array
# num will be first (element 0) value second (element 1)
function explode_enum_arr( $p_enum_elem ) {
return explode( ':', $p_enum_elem );
}
# --------------------
# Given a enum string and num, return the appropriate string
function get_enum_element( $p_enum_name, $p_val ) {
$g_var = 'g_'.$p_enum_name.'_enum_string';
$s_var = 's_'.$p_enum_name.'_enum_string';
global $$g_var, $$s_var;
# use the global enum string to search
$t_arr = explode_enum_string( $$g_var );
$t_arr_count = count( $t_arr );
for ( $i=0;$i<$t_arr_count;$i++ ) {
$elem_arr = explode_enum_arr( $t_arr[$i] );
if ( $elem_arr[0] == $p_val ) {
# now get the appropriate translation
return get_enum_to_string( $$s_var, $p_val );
}
}
return '@null@';
}
# --------------------
# Returns the number of bugntoes for the given bug_id
function get_bugnote_count( $p_id ) {
global $g_mantis_bugnote_table, $g_private_bugnote_threshold;
$c_id = (integer)$p_id;
if ( !access_level_check_greater_or_equal( $g_private_bugnote_threshold ) ) {
$t_restriction = 'AND view_state=' . PUBLIC;
} else {
$t_restriction = '';
}
$query ="SELECT COUNT(*) ".
"FROM $g_mantis_bugnote_table ".
"WHERE bug_id ='$c_id' $t_restriction";
$result = db_query( $query );
return db_result( $result, 0 );
}
# --------------------
# Returns the number of bugntoes for the given bug_id
function get_bugnote_field( $p_bugnote_id, $p_field_name ) {
global $g_mantis_bugnote_table;
$c_bugnote_id = (integer)$p_bugnote_id;
$query ="SELECT $p_field_name ".
"FROM $g_mantis_bugnote_table ".
"WHERE id ='$c_bugnote_id' ".
"LIMIT 1";
$result = db_query( $query );
return db_result( $result, 0 );
}
# --------------------
# Returns the specified field of the specified project
function get_project_field( $p_project_id, $p_field_name ) {
global $g_mantis_project_table;
$c_project_id = (integer)$p_project_id;
$query ="SELECT $p_field_name ".
"FROM $g_mantis_project_table ".
"WHERE id='$c_project_id' ".
"LIMIT 1";
$result = db_query( $query );
return db_result( $result, 0, 0 );
}
# --------------------
# Returns the specified field of the current project
function get_current_project_field( $p_field_name ) {
global $g_project_cookie_val;
return get_project_field ( $g_project_cookie_val, $p_field_name );
}
# --------------------
# Some proxies strip out HTTP_REFERER.
# This function helps determine which pages to redirect to
# based on site and user preference.
function get_view_redirect_url( $p_bug_id, $p_no_referer=0 ) {
global $HTTP_REFERER, $g_show_view;
if ( ( !isset( $HTTP_REFERER ) ) ||
( empty( $HTTP_REFERER ) ) ||
( 1 == $p_no_referer ) ) {
switch ( $g_show_view ) {
case BOTH:
if ( ON == get_current_user_pref_field( 'advanced_view' ) ) {
return 'view_bug_advanced_page.php?f_id='.$p_bug_id;
} else {
return 'view_bug_page.php?f_id='.$p_bug_id;
}
case SIMPLE_ONLY:
return 'view_bug_page.php?f_id='.$p_bug_id;
case ADVANCED_ONLY:
return 'view_bug_advanced_page.php?f_id='.$p_bug_id;
default:return 'view_bug_page.php?f_id='.$p_bug_id;
}
} else {
return $HTTP_REFERER;
}
}
# --------------------
# Some proxies strip out HTTP_REFERER.
# This function helps determine which pages to redirect to
# based on site and user preference.
function get_report_redirect_url( $p_no_referer=0 ) {
global $HTTP_REFERER, $g_show_report;
if ( ( !isset( $HTTP_REFERER ) ) ||
( empty( $HTTP_REFERER ) ) ||
( 1 == $p_no_referer ) ) {
switch( $g_show_report ) {
case BOTH:
if ( ON == get_current_user_pref_field( 'advanced_report' ) ) {
return 'report_bug_advanced_page.php';
} else {
return 'report_bug_page.php';
}
case SIMPLE_ONLY:
return 'report_bug_page.php';
case ADVANCED_ONLY:
return 'report_bug_advanced_page.php';
default:return 'report_bug_page.php';
}
} else {
return $HTTP_REFERER;
}
}
# --------------------
# Contributed by Peter Palmreuther
function mime_encode( $p_string='' ) {
$output = '';
for ( $i=0; $i<strlen( $p_string ); $i++ ) {
if (( ord( $p_string[$i] ) < 33 ) ||
( ord( $p_string[$i] ) > 127 ) ||
( eregi( "[\%\[\]\{\}\(\)]", $p_string[$i] ) )) {
$output .= sprintf( '%%%02X', ord( $p_string[$i] ) );
} else {
$output .= $p_string[$i];
}
}
return( $output );
}
# --------------------
# File type check
function file_type_check( $p_file_name ) {
global $g_allowed_files, $g_disallowed_files;
# grab extension
$t_ext_array = explode( '.', $p_file_name );
$last_position = count( $t_ext_array )-1;
$t_extension = $t_ext_array[$last_position];
# check against disallowed files
$t_disallowed_arr = explode_enum_string( $g_disallowed_files );
foreach ( $t_disallowed_arr as $t_val ) {
if ( $t_val == $t_extension ) {
return false;
}
}
# check against allowed files
$t_allowed_arr = explode_enum_string( $g_allowed_files );
# if the allowed list is populated then the file must be in the list.
if ( empty( $g_allowed_files ) ) {
return true;
}
foreach ( $t_allowed_arr as $t_val ) {
if ( $t_val == $t_extension ) {
return true;
}
}
return false;
}
# --------------------
# This function checks to see if a variable is set
# if it is not then it assigns the default value
# otherwise it does nothing
function check_varset( &$p_var, $p_default_value ) {
if ( !isset( $p_var ) ) {
$p_var = $p_default_value;
}
}
# --------------------
?>