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 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746
|
<?php
/**
* Misc HTML functions
*
* SourceForge: Breaking Down the Barriers to Open Source Development
* Copyright 1999-2001 (c) VA Linux Systems
* http://sourceforge.net
*
* @version $Id: html.php 4780 2005-10-17 13:08:19Z danper $
*/
/**
* html_feedback_top() - Show the feedback output at the top of the page.
*
* @param string The feedback.
*/
function html_feedback_top($feedback) {
global $HTML;
echo $HTML->feedback($feedback);
}
/**
* make_user_link() - Make a username reference into a link to that users User page on SF.
*
* @param string The username of the user to link.
*/
function make_user_link($username) {
if (!strcasecmp($username,'Nobody') || !strcasecmp($username,'None')) {
return $username;
} else {
return '<a href="/users/'.$username.'">'.$username.'</a>' ;
}
}
/**
* html_feedback_top() - Show the feedback output at the bottom of the page.
*
* @param string The feedback.
*/
function html_feedback_bottom($feedback) {
global $HTML;
echo $HTML->feedback($feedback);
}
/**
* html_blankimage() - Show the blank spacer image.
*
* @param int The height of the image
* @param int The width of the image
*/
function html_blankimage($height,$width) {
return '<img src="/images/blank.png" width="' . $width . '" height="' . $height . '" alt="" />';
}
/**
* html_dbimage() - Show an image that is stored in the database
*
* @param int The id of the image to show
*/
function html_dbimage($id, $args=0) {
if (!$id) {
return '';
}
if (!$args) {
$args = array();
}
$sql="SELECT width,height,version ".
"FROM db_images WHERE id='$id'";
$result=db_query($sql);
$rows=db_numrows($result);
if (!$result || $rows < 1) {
return db_error();
} else {
return html_abs_image('/dbimage.php?id='.$id.'&v='.db_result($result,0,'version'),db_result($result,0,'width'),db_result($result,0,'height'),$args);
}
}
/**
* html_abs_image() - Show an image given an absolute URL.
*
* @param string URL
* @param int width of the image
* @param int height of the image
* @param array Any <img> tag parameters (i.e. 'border', 'alt', etc...)
*/
function html_abs_image($url, $width, $height, $args) {
$return = ('<img src="' . $url . '"');
reset($args);
while(list($k,$v) = each($args)) {
$return .= ' '.$k.'="'.$v.'"';
}
// ## insert a border tag if there isn't one
if (!isset($args['border'])) {
$return .= ' border="0"';
}
if (!isset($args['alt'])) {
$return .= ' alt=""';
}
// ## add image dimensions
$return .= " width=\"" . $width . "\"";
$return .= " height=\"" . $height . "\"";
$return .= (' />');
return $return;
}
/**
* html_image() - Build an image tag of an image contained in $src
*
* @param string The source location of the image
* @param int The width of the image
* @param int The height of the image
* @param array Any IMG tag parameters associated with this image (i.e. 'border', 'alt', etc...)
* @param bool DEPRECATED
*/
function html_image($src,$width,$height,$args,$display=1) {
global $sys_images_url,$sys_images_secure_url,$HTML;
$s = ((session_issecure()) ? $sys_images_secure_url : $sys_images_url );
return html_abs_image($s.$HTML->imgroot.$src, $width, $height, $args);
}
/**
* html_get_language_popup() - Pop up box of supported languages.
*
* @param object BaseLanguage object.
* @param string The title of the popup box.
* @param string Which element of the box is to be selected.
* @return string The html select box.
*/
function html_get_language_popup ($Language,$title='language_id',$selected='xzxz') {
$res=$Language->getLanguages();
return html_build_select_box ($res,$title,$selected,false);
}
/**
* html_get_theme_popup() - Pop up box of supported themes.
*
* @param string The title of the popup box.
* @param string Which element of the box is to be selected.
* @return string The html select box.
*/
function html_get_theme_popup ($title='theme_id',$selected='xzxz') {
$res=db_query("SELECT theme_id, fullname FROM themes WHERE enabled=true");
return html_build_select_box($res,$title,$selected,false);
}
/**
* html_get_ccode_popup() - Pop up box of supported country_codes.
*
* @param string The title of the popup box.
* @param string Which element of the box is to be selected.
* @return string The html select box.
*/
function html_get_ccode_popup ($title='ccode',$selected='xzxz') {
$res=db_query("SELECT ccode,country_name FROM country_code ORDER BY country_name");
return html_build_select_box ($res,$title,$selected,false);
}
/**
* html_get_timezone_popup() - Pop up box of supported Timezones.
* Assumes you have included Timezones array file.
*
* @param string The title of the popup box.
* @param string Which element of the box is to be selected.
* @return string The html select box.
*/
function html_get_timezone_popup ($title='timezone',$selected='xzxz') {
global $TZs;
if ($selected == 'xzxzxzx') {
$r = file ('/etc/timezone');
$selected = str_replace ("\n", '', $r[0]);
}
return html_build_select_box_from_arrays ($TZs,$TZs,$title,$selected,false);
}
/**
* html_build_select_box_from_assoc() - Takes one assoc array and returns a pop-up box.
*
* @param array An array of items to use.
* @param string The name you want assigned to this form element.
* @param string The value of the item that should be checked.
* @param boolean Whether we should swap the keys / names.
* @param bool Whether or not to show the '100 row'.
* @param string What to call the '100 row' defaults to none.
*/
function html_build_select_box_from_assoc ($arr,$select_name,$checked_val='xzxz',$swap=false,$show_100=false,$text_100='None') {
if ($swap) {
$keys=array_values($arr);
$vals=array_keys($arr);
} else {
$vals=array_values($arr);
$keys=array_keys($arr);
}
return html_build_select_box_from_arrays ($keys,$vals,$select_name,$checked_val,$show_100,$text_100);
}
/**
* html_build_select_box_from_array() - Takes one array, with the first array being the "id"
* or value and the array being the text you want displayed.
*
* @param array An array of items to use.
* @param string The name you want assigned to this form element.
* @param string The value of the item that should be checked.
*/
function html_build_select_box_from_array ($vals,$select_name,$checked_val='xzxz',$samevals = 0) {
$return = '
<select name="'.$select_name.'">';
$rows=count($vals);
for ($i=0; $i<$rows; $i++) {
if ( $samevals ) {
$return .= "\n\t\t<option value=\"" . $vals[$i] . "\"";
if ($vals[$i] == $checked_val) {
$return .= ' selected="selected"';
}
} else {
$return .= "\n\t\t<option value=\"" . $i .'"';
if ($i == $checked_val) {
$return .= ' selected="selection"';
}
}
$return .= '>'.htmlspecialchars($vals[$i]).'</option>';
}
$return .= '
</select>';
return $return;
}
/**
* html_build_radio_buttons_from_arrays() - Takes two arrays, with the first array being the "id" or value and the other
* array being the text you want displayed.
*
* The infamous '100 row' has to do with the SQL Table joins done throughout all this code.
* There must be a related row in users, categories, et , and by default that
* row is 100, so almost every pop-up box has 100 as the default
* Most tables in the database should therefore have a row with an id of 100 in it so that joins are successful
*
* @param array The ID or value
* @param array Text to be displayed
* @param string Name to assign to this form element
* @param string The item that should be checked
* @param bool Whether or not to show the '100 row'
* @param string What to call the '100 row' defaults to none
* @param bool Whether or not to show the 'Any row'
* @param string What to call the 'Any row' defaults to any
*/
function html_build_radio_buttons_from_arrays ($vals,$texts,$select_name,$checked_val='xzxz',$show_100=true,$text_100='none',$show_any=false,$text_any='any') {
global $Language;
if ($text_100=='none'){
$text_100=$Language->getText('include_html','none');
}
$return = '';
$rows=count($vals);
if (count($texts) != $rows) {
$return .= 'ERROR - uneven row counts';
}
//we don't always want the default Any row shown
if ($show_any) {
$return .= '
<input type="radio" name="'.$select_name.'" value=""'.(($checked_val=='') ? ' checked' : '').'> '. $text_any .'<br />';
}
//we don't always want the default 100 row shown
if ($show_100) {
$return .= '
<input type="radio" name="'.$select_name.'" value="100"'.(($checked_val==100) ? ' checked' : '').'> '. $text_100 .'<br />';
}
$checked_found=false;
for ($i=0; $i<$rows; $i++) {
// uggh - sorry - don't show the 100 row
// if it was shown above, otherwise do show it
if (($vals[$i] != '100') || ($vals[$i] == '100' && !$show_100)) {
$return .= '
<input type="radio" name="'.$select_name.'" value="'.$vals[$i].'"';
if ((string)$vals[$i] == (string)$checked_val) {
$checked_found=true;
$return .= ' checked';
}
$return .= '> '.htmlspecialchars($texts[$i]).'<br />';
}
}
//
// If the passed in "checked value" was never "SELECTED"
// we want to preserve that value UNLESS that value was 'xzxz', the default value
//
if (!$checked_found && $checked_val != 'xzxz' && $checked_val && $checked_val != 100) {
$return .= '
<input type="radio" value="'.$checked_val.'" checked> '.$Language->getText('include_html','no_change').'<br />';
}
return $return;
}
/**
* html_build_select_box_from_arrays() - Takes two arrays, with the first array being the "id" or value and the other
* array being the text you want displayed.
*
* The infamous '100 row' has to do with the SQL Table joins done throughout all this code.
* There must be a related row in users, categories, et , and by default that
* row is 100, so almost every pop-up box has 100 as the default
* Most tables in the database should therefore have a row with an id of 100 in it so that joins are successful
*
* @param array The ID or value
* @param array Text to be displayed
* @param string Name to assign to this form element
* @param string The item that should be checked
* @param bool Whether or not to show the '100 row'
* @param string What to call the '100 row' defaults to none
* @param bool Whether or not to show the 'Any row'
* @param string What to call the 'Any row' defaults to any
*/
function html_build_select_box_from_arrays ($vals,$texts,$select_name,$checked_val='xzxz',$show_100=true,$text_100='none',$show_any=false,$text_any='any') {
global $Language;
if ($text_100=='none'){
$text_100=$Language->getText('include_html','none');
}
$return = '';
$rows=count($vals);
if (count($texts) != $rows) {
$return .= 'ERROR - uneven row counts';
}
$return .= '
<select name="'.$select_name.'">';
//we don't always want the default Any row shown
if ($show_any) {
$return .= '
<option value=""'.(($checked_val=='') ? ' SELECTED' : '').'>'. $text_any .'</option>';
}
//we don't always want the default 100 row shown
if ($show_100) {
$return .= '
<option value="100"'.(($checked_val==100) ? ' SELECTED' : '').'>'. $text_100 .'</option>';
}
$checked_found=false;
for ($i=0; $i<$rows; $i++) {
// uggh - sorry - don't show the 100 row
// if it was shown above, otherwise do show it
if (($vals[$i] != '100') || ($vals[$i] == '100' && !$show_100)) {
$return .= '
<option value="'.$vals[$i].'"';
if ($vals[$i] == $checked_val) {
$checked_found=true;
$return .= ' selected="selected"';
}
$return .= '>'./*htmlspecialchars(*/$texts[$i]/*)*/.'</option>';
}
}
//
// If the passed in "checked value" was never "SELECTED"
// we want to preserve that value UNLESS that value was 'xzxz', the default value
//
if (!$checked_found && $checked_val != 'xzxz' && $checked_val && $checked_val != 100) {
$return .= '
<option value="'.$checked_val.'" selected="selected">'.$Language->getText('include_html','no_change').'</option>';
}
$return .= '
</select>';
return $return;
}
/**
* html_build_select_box() - Takes a result set, with the first column being the "id" or value and
* the second column being the text you want displayed.
*
* @param int The result set
* @param string Text to be displayed
* @param string The item that should be checked
* @param bool Whether or not to show the '100 row'
* @param string What to call the '100 row'. Defaults to none.
*/
function html_build_select_box ($result, $name, $checked_val="xzxz",$show_100=true,$text_100='none') {
global $Language;
if ($text_100=='none'){
$text_100=$Language->getText('include_html','none');
}
return html_build_select_box_from_arrays (util_result_column_to_array($result,0),util_result_column_to_array($result,1),$name,$checked_val,$show_100,$text_100);
}
/**
* html_build_multiple_select_box() - Takes a result set, with the first column being the "id" or value
* and the second column being the text you want displayed.
*
* @param int The result set
* @param string Text to be displayed
* @param string The item that should be checked
* @param int The size of this box
* @param bool Whether or not to show the '100 row'
*/
function html_build_multiple_select_box ($result,$name,$checked_array,$size='8',$show_100=true) {
global $Language;
$checked_count=count($checked_array);
$return .= '
<select name="'.$name.'" multiple="multiple" size="'.$size.'">';
if ($show_100) {
/*
Put in the default NONE box
*/
$return .= '
<option value="100"';
for ($j=0; $j<$checked_count; $j++) {
if ($checked_array[$j] == '100') {
$return .= ' selected="selected"';
}
}
$return .= '>'.$Language->getText('include_html','none').'</option>';
}
$rows=db_numrows($result);
for ($i=0; $i<$rows; $i++) {
if ((db_result($result,$i,0) != '100') || (db_result($result,$i,0) == '100' && !$show_100)) {
$return .= '
<option value="'.db_result($result,$i,0).'"';
/*
Determine if it's checked
*/
$val=db_result($result,$i,0);
for ($j=0; $j<$checked_count; $j++) {
if ($val == $checked_array[$j]) {
$return .= ' selected="selected"';
}
}
$return .= '>'. substr(db_result($result,$i,1),0,35). '</option>';
}
}
$return .= '
</select>';
return $return;
}
/**
* html_build_multiple_select_box_from_arrays() - Takes two arrays and builds a multi-select box
*
* @param array id of the field
* @param array Text to be displayed
* @param string id of the items selected
* @param string The item that should be checked
* @param int The size of this box
* @param bool Whether or not to show the '100 row'
*/
function html_build_multiple_select_box_from_arrays($ids,$texts,$name,$checked_array,$size='8',$show_100=true,$text_100='none') {
global $Language;
$checked_count=count($checked_array);
$return .='
<select name="'.$name.'" multiple="multiple" size="'.$size.'">';
if ($show_100) {
if ($text_100=='none') {
$text_100=$Language->getText('include_html','none');
}
/*
Put in the default NONE box
*/
$return .= '
<option value="100"';
for ($j=0; $j<$checked_count; $j++) {
if ($checked_array[$j] == '100') {
$return .= ' selected="selected"';
}
}
$return .= '>'.$text_100.'</option>';
}
$rows=count($ids);
for ($i=0; $i<$rows; $i++) {
if (( $ids[$i] != '100') || ($ids[$i] == '100' && !$show_100)) {
$return .='
<option value="'.$ids[$i].'"';
/*
Determine if it's checked
*/
$val=$ids[$i];
for ($j=0; $j<$checked_count; $j++) {
if ($val == $checked_array[$j]) {
$return .= ' selected="selected"';
}
}
$return .= '>'.$texts[$i].' </option>';
}
}
$return .= '
</select>';
return $return;
}
/**
* html_build_checkbox() - Render checkbox control
*
* @param name - name of control
* @param value - value of control
* @param checked - true if control should be checked
* @return html code for checkbox control
*/
function html_build_checkbox($name, $value, $checked) {
return '<input type="checkbox" name="'.$name.'"'
.' value="'.$value.'"'
.($checked ? 'checked="checked"' : '').'>';
}
/**
* html_get_priority_color() - Return the color value for the index that was passed in
* (defined in $sys_urlroot/themes/<selected theme>/theme.php)
*
* @param int Index
*/
function html_get_priority_color ($index) {
global $bgpri;
/* make sure that index is of appropriate type and range */
$index = (int)$index;
if ($index<1) {
$index=1;
} else if ($index>5) {
$index=5;
}
//return "prior$index";
return $bgpri[$index];
}
/**
* build_priority_select_box() - Wrapper for html_build_priority_select_box()
*
* @see html_build_priority_select_box()
*/
function build_priority_select_box ($name='priority', $checked_val='3', $nochange=false) {
echo html_build_priority_select_box ($name, $checked_val, $nochange);
}
/**
* html_build_priority_select_box() - Return a select box of standard priorities.
* The name of this select box is optional and so is the default checked value.
*
* @param string Name of the select box
* @param string The value to be checked
* @param bool Whether to make 'No Change' selected.
*/
function html_build_priority_select_box ($name='priority', $checked_val='3', $nochange=false) {
global $Language;
?>
<select name="<?php echo $name; ?>">
<?php if($nochange) { ?>
<option value="100"<?php if ($nochange) {echo " selected=\"selected\"";} ?>><?php echo $Language->getText('include_html','no_change') ?></option>
<?php } ?>
<option value="1"<?php if ($checked_val=="1") {echo " selected=\"selected\"";} ?>>1 - <?php echo $Language->getText('include_html','priority_lowest') ?></option>
<option value="2"<?php if ($checked_val=="2") {echo " selected=\"selected\"";} ?>>2</option>
<option value="3"<?php if ($checked_val=="3") {echo " selected=\"selected\"";} ?>>3</option>
<option value="4"<?php if ($checked_val=="4") {echo " selected=\"selected\"";} ?>>4</option>
<option value="5"<?php if ($checked_val=="5") {echo " selected=\"selected\"";} ?>>5 - <?php echo $Language->getText('include_html','priority_highest') ?></option>
</select>
<?php
}
/**
* html_buildcheckboxarray() - Build an HTML checkbox array.
*
* @param array Options array
* @param name Checkbox name
* @param array Array of boxes to be pre-checked
*/
function html_buildcheckboxarray($options,$name,$checked_array) {
$option_count=count($options);
$checked_count=count($checked_array);
for ($i=1; $i<=$option_count; $i++) {
echo '
<br /><input type="checkbox" name="'.$name.'" value="'.$i.'"';
for ($j=0; $j<$checked_count; $j++) {
if ($i == $checked_array[$j]) {
echo ' checked="checked"';
}
}
echo ' /> '.$options[$i];
}
}
/**
* site_user_header() - everything required to handle security and
* add navigation for user pages like /my/ and /account/
*
* @param array Must contain $user_id
*/
function site_header($params) {
GLOBAL $HTML;
/*
Check to see if active user
Check to see if logged in
*/
echo $HTML->header($params);
echo html_feedback_top($GLOBALS['feedback']);
}
/**
* site_footer() - Show the HTML site footer.
*
* @param array Footer params array
*/
function site_footer($params) {
GLOBAL $HTML;
$HTML->footer($params);
}
/**
* site_project_header() - everything required to handle
* security and state checks for a project web page
*
* @param params array() must contain $toptab and $group
*/
function site_project_header($params) {
GLOBAL $HTML;
/*
Check to see if active
Check to see if project rather than foundry
Check to see if private (if private check if user_ismember)
*/
$group_id=$params['group'];
//get the project object
$project =& group_get_object($group_id);
if (!$project || !is_object($project)) {
exit_error("GROUP PROBLEM","PROBLEM CREATING GROUP OBJECT");
} else if ($project->isError()) {
exit_error("Group Problem",$project->getErrorMessage());
}
//group is private
if (!$project->isPublic()) {
//if it's a private group, you must be a member of that group
session_require(array('group'=>$group_id));
}
//for dead projects must be member of admin project
if (!$project->isActive()) {
//only SF group can view non-active, non-holding groups
session_require(array('group'=>'1'));
}
$params['title']=$project->getPublicName().': '.$params['title'];
echo $HTML->header($params);
if(isset($GLOBALS['feedback'])) {
echo html_feedback_top($GLOBALS['feedback']);
}
// echo $HTML->project_tabs($params['toptab'],$params['group'],$params['tabtext']);
}
/**
* site_project_footer() - currently a simple shim
* that should be on every project page, rather than
* a direct call to site_footer() or theme_footer()
*
* @param params array() empty
*/
function site_project_footer($params) {
GLOBAL $HTML;
if(isset($GLOBALS['feedback'])) {
echo html_feedback_bottom($GLOBALS['feedback']);
}
echo $HTML->footer($params);
}
/**
* site_user_header() - everything required to handle security and
* add navigation for user pages like /my/ and /account/
*
* @param params array() must contain $user_id
*/
function site_user_header($params) {
GLOBAL $HTML,$Language;
/*
Check to see if active user
Check to see if logged in
*/
echo $HTML->header($params);
echo html_feedback_top((isset($GLOBALS['feedback']) ? $GLOBALS['feedback'] : ''));
echo ($HTML->beginSubMenu());
echo ($HTML->printSubMenu(
array($Language->getText('menu','my_personal_page'),
$Language->getText('menu','diary_notes'),
$Language->getText('menu','account_maintenance'),
$Language->getText('menu','register_project')),
array('/my/',
'/my/diary.php',
'/account/',
'/register/')));
plugin_hook ("usermenu", false) ;
echo ($HTML->endSubMenu());
}
/**
* site_user_footer() - currently a simple shim that should be on every user page,
* rather than a direct call to site_footer() or theme_footer()
*
* @param params array() empty
*/
function site_user_footer($params) {
GLOBAL $HTML;
echo html_feedback_bottom((isset($GLOBALS['feedback']) ? $GLOBALS['feedback'] : ''));
echo $HTML->footer($params);
}
/**
* html_clean_hash_string() - Remove noise characters from hex hash string
*
* Thruout SourceForge, URLs with hexadecimal hash string parameters
* are being sent via email to request confirmation of user actions.
* It was found that some mail clients distort this hash, so we take
* special steps to encode it in the way which help to preserve its
* recognition. This routine
*
* @param hashstr required hash parameter as received from browser
* @return pure hex string
*/
function html_clean_hash_string($hashstr) {
if (substr($hashstr,0,1)=="_") {
$hashstr = substr($hashstr, 1);
}
if (substr($hashstr, strlen($hashstr)-1, 1)==">") {
$hashstr = substr($hashstr, 0, strlen($hashstr)-1);
}
return $hashstr;
}
?>
|