Changeset 2973108
- Timestamp:
- 09/29/2023 07:02:10 PM (2 years ago)
- Location:
- weblibrarian/trunk
- Files:
-
- 7 edited
-
WebLibrarian.php (modified) (8 diffs)
-
includes/WEBLIB_Collection_Admin.php (modified) (35 diffs)
-
includes/WEBLIB_PatronRecord_Admin.php (modified) (9 diffs)
-
includes/WEBLIB_Statistics_Admin.php (modified) (2 diffs)
-
includes/WEBLIB_Users_Admin.php (modified) (3 diffs)
-
includes/admin_page_classes.php (modified) (5 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
weblibrarian/trunk/WebLibrarian.php
r2955420 r2973108 4 4 * Plugin URI: http://www.deepsoft.com/WebLibrarian 5 5 * Description: A plugin that implements a web-based library catalog and circulation System 6 * Version: 3.5.8. 36 * Version: 3.5.8.4 7 7 * Author: Robert Heller 8 8 * Author URI: http://www.deepsoft.com/ … … 284 284 // AJAX callbacks 285 285 function UpdatePatronID() { 286 $userid = $_REQUEST['userid'];287 $patronid = $_REQUEST['patronid'];286 $userid = sanitize_text_field($_REQUEST['userid']); 287 $patronid = sanitize_text_field($_REQUEST['patronid']); 288 288 $xml_response = '<?xml version="1.0" ?>'; 289 289 … … 313 313 wp_die( __('You do not have sufficient permissions to access this page.','weblibrarian') ); 314 314 } 315 $searchname = $_REQUEST['searchname'];315 $searchname = sanitize_text_field($_REQUEST['searchname']); 316 316 $xml_response = '<?xml version="1.0" ?>'; 317 317 … … 341 341 } 342 342 function PlaceHoldOnItem() { 343 $barcode = $_REQUEST['barcode'];343 $barcode = sanitize_text_field($_REQUEST['barcode']); 344 344 $xml_response = '<?xml version="1.0" ?>'; 345 345 346 346 if (current_user_can('manage_circulation') && isset($_REQUEST['patronid'])) { 347 $patronid = $_REQUEST['patronid'];347 $patronid = sanitize_text_field($_REQUEST['patronid']); 348 348 } else { 349 349 $patronid = get_user_meta(wp_get_current_user()->ID,'PatronID',true); … … 399 399 } 400 400 function RenewItem() { 401 $barcode = $_REQUEST['barcode'];401 $barcode = sanitize_text_field($_REQUEST['barcode']); 402 402 $xml_response = '<?xml version="1.0" ?>'; 403 403 … … 492 492 if ( isset($content_func) && is_string($content_func) ) 493 493 do_action( "admin_head_{$content_func}" ); 494 $tab = isset($_REQUEST['tab'])? $_REQUEST['tab']:'links';494 $tab = isset($_REQUEST['tab'])?sanitize_text_field($_REQUEST['tab']):'links'; 495 495 496 496 ?></head> … … 552 552 wp_die("Opps too late"); 553 553 } 554 $dataselection = $_REQUEST['dataselection'];554 $dataselection = sanitize_text_field($_REQUEST['dataselection']); 555 555 556 556 //file_put_contents("php://stderr","*** WebLibrarian::ExportLibraryData: dataselection = $dataselection\n"); … … 608 608 } 609 609 610 $year = isset( $_REQUEST['year'] ) ? $_REQUEST['year']: date('Y',time());611 $month = isset( $_REQUEST['month'] ) ? $_REQUEST['month']: date('m',time());610 $year = isset( $_REQUEST['year'] ) ? sanitize_text_field($_REQUEST['year']) : date('Y',time()); 611 $month = isset( $_REQUEST['month'] ) ? sanitize_text_field($_REQUEST['month']) : date('m',time()); 612 612 $MonthNames = 613 613 array('Month Totals','January','February','March','April','May','June', -
weblibrarian/trunk/includes/WEBLIB_Collection_Admin.php
r2955407 r2973108 51 51 } 52 52 function search_box($text, $input_id) { 53 if ( empty( $_REQUEST['s']) && !$this->has_items() ) return;53 if ( empty( sanitize_text_field($_REQUEST['s']) ) && !$this->has_items() ) return; 54 54 55 55 $input_id = $input_id . '-search-input'; 56 56 57 if ( ! empty( $_REQUEST['orderby']) )58 echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby']) . '" />';59 if ( ! empty( $_REQUEST['order']) )60 echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order']) . '" />';61 $field = isset ($_REQUEST['f']) ? $_REQUEST['f']: 'title';57 if ( ! empty( sanitize_text_field($_REQUEST['orderby']) ) ) 58 echo '<input type="hidden" name="orderby" value="' . esc_attr( sanitize_text_field($_REQUEST['orderby']) ) . '" />'; 59 if ( ! empty( sanitize_text_field($_REQUEST['order']) ) ) 60 echo '<input type="hidden" name="order" value="' . esc_attr( sanitize_text_field($_REQUEST['order']) ) . '" />'; 61 $field = isset ($_REQUEST['f']) ? sanitize_text_field($_REQUEST['f']) : 'title'; 62 62 ?> 63 63 <p class="search-box"> … … 70 70 'ISBN' => 'isbn', 71 71 'Keyword' => 'keyword') as $l => $f) { 72 ?><option value="<?php echo $f; ?>"<?php72 ?><option value="<?php echo esc_attr($f); ?>"<?php 73 73 if ($f == $field) {echo ' selected="selected"';} 74 74 ?>><?php echo $l; ?></option> … … 165 165 166 166 function column_cb ($item) { 167 return '<input type="checkbox" name="checked[]" value="'. $item.'" />';167 return '<input type="checkbox" name="checked[]" value="'.esc_attr($item).'" />'; 168 168 } 169 169 function column_title ($item) { … … 181 181 admin_url('admin.php')).'">'. 182 182 __('View','weblibrarian')."</a>", 183 'delete' => '<a href="'.add_query_arg(array('page' => $_REQUEST['page'],183 'delete' => '<a href="'.add_query_arg(array('page' => sanitize_text_field($_REQUEST['page']), 184 184 'action' => 'delete', 185 185 'barcode' => $item), … … 208 208 function current_action() { 209 209 210 if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'])211 return $_REQUEST['action'];212 213 if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'])214 return $_REQUEST['action2'];210 if ( isset( $_REQUEST['action'] ) && -1 != sanitize_text_field($_REQUEST['action']) ) 211 return sanitize_text_field($_REQUEST['action']); 212 213 if ( isset( $_REQUEST['action2'] ) && -1 != sanitize_text_field($_REQUEST['action2']) ) 214 return sanitize_text_field($_REQUEST['action2']); 215 215 } 216 216 … … 220 220 switch ($action) { 221 221 case 'delete': 222 if ( isset($_REQUEST['checked']) && !empty( $_REQUEST['checked'])) {223 foreach ( $_REQUEST['checked']as $thebarcode ) {222 if ( isset($_REQUEST['checked']) && !empty(sanitize_text_field($_REQUEST['checked']))) { 223 foreach ( sanitize_text_field($_REQUEST['checked']) as $thebarcode ) { 224 224 WEBLIB_ItemInCollection::DeleteItemByBarCode($thebarcode); 225 225 WEBLIB_ItemInCollection::DeleteKeywordsByBarCode($thebarcode); 226 226 } 227 227 } else if ( isset($_REQUEST['barcode']) ) { 228 WEBLIB_ItemInCollection::DeleteItemByBarCode( $_REQUEST['barcode']);229 WEBLIB_ItemInCollection::DeleteKeywordsByBarCode( $_REQUEST['barcode']);228 WEBLIB_ItemInCollection::DeleteItemByBarCode(sanitize_text_field($_REQUEST['barcode'])); 229 WEBLIB_ItemInCollection::DeleteKeywordsByBarCode(sanitize_text_field($_REQUEST['barcode'])); 230 230 } 231 231 break; … … 255 255 $this->process_bulk_action(); 256 256 257 $search = isset( $_REQUEST['s'] ) ? $_REQUEST['s']: '';258 $field = isset( $_REQUEST['f'] ) ? $_REQUEST['f']: 'title';259 $orderby = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby']: 'barcode';257 $search = isset( $_REQUEST['s'] ) ? sanitize_text_field($_REQUEST['s']) : ''; 258 $field = isset( $_REQUEST['f'] ) ? sanitize_text_field($_REQUEST['f']) : 'title'; 259 $orderby = isset( $_REQUEST['orderby'] ) ? sanitize_text_field($_REQUEST['orderby']) : 'barcode'; 260 260 if ( empty( $orderby ) ) $orderby = 'barcode'; 261 $order = isset( $_REQUEST['order'] ) ? $_REQUEST['order']: 'ASC';261 $order = isset( $_REQUEST['order'] ) ? sanitize_text_field($_REQUEST['order']) : 'ASC'; 262 262 if ( empty( $order ) ) $order = 'ASC'; 263 263 … … 350 350 $item = $this->getitemfromform(''); 351 351 if ($message == '') { 352 $barcode = isset($_REQUEST['barcode']) ? $_REQUEST['barcode']: '';352 $barcode = isset($_REQUEST['barcode']) ? sanitize_text_field($_REQUEST['barcode']) : ''; 353 353 $newbarcode = $item->store($barcode); 354 354 $keywords = $this->getkeywordsfromform(); … … 370 370 } else if ( isset($_REQUEST['updateitem']) && 371 371 isset($_REQUEST['barcode']) ) { 372 $message = $this->checkiteminform( $_REQUEST['barcode']);373 $item = $this->getitemfromform( $_REQUEST['barcode']);372 $message = $this->checkiteminform(sanitize_text_field($_REQUEST['barcode'])); 373 $item = $this->getitemfromform(sanitize_text_field($_REQUEST['barcode'])); 374 374 if ($message == '') { 375 375 $item->store(); … … 392 392 $this->viewkeywords = $item->keywordsof(); 393 393 } else { 394 $this->viewmode = isset($_REQUEST['mode']) ? $_REQUEST['mode']: 'add';395 $this->viewbarcode = isset($_REQUEST['barcode']) ? $_REQUEST['barcode']: '';394 $this->viewmode = isset($_REQUEST['mode']) ? sanitize_text_field($_REQUEST['mode']) : 'add'; 395 $this->viewbarcode = isset($_REQUEST['barcode']) ? sanitize_text_field($_REQUEST['barcode']) : ''; 396 396 switch ($this->viewmode) { 397 397 case 'edit': … … 438 438 if ( isset($_REQUEST['paged']) ) { 439 439 $paged = sanitize_text_field($_REQUEST['paged']); 440 ?><input type="hidden" name="paged" value="<?php echo $paged; ?>" /><?php440 ?><input type="hidden" name="paged" value="<?php echo esc_attr($paged); ?>" /><?php 441 441 } 442 442 if ( isset($_REQUEST['screen-options-apply']) ) { 443 443 $screenopts = sanitize_text_field($_REQUEST['screen-options-apply']); 444 ?><input type="hidden" name="screen-options-apply" value="<?php echo $screenopts; ?>" /><?php444 ?><input type="hidden" name="screen-options-apply" value="<?php echo esc_attr($screenopts); ?>" /><?php 445 445 } 446 446 if ( isset($_REQUEST['wp_screen_options']['option']) ) { 447 447 $wpscreenoptsopt = sanitize_text_field($_REQUEST['wp_screen_options']['option']); 448 ?><input type="hidden" name="wp_screen_options[option]" value="<?php echo $wpscreenoptsopt; ?>" /><?php448 ?><input type="hidden" name="wp_screen_options[option]" value="<?php echo esc_attr($wpscreenoptsopt); ?>" /><?php 449 449 } 450 450 if ( isset($_REQUEST['wp_screen_options']['value']) ) { 451 451 $wpscreenoptsval = sanitize_text_field($_REQUEST['wp_screen_options']['value']); 452 ?><input type="hidden" name="wp_screen_options[value]" value="<?php echo $wpscreenoptsval; ?>" /><?php452 ?><input type="hidden" name="wp_screen_options[value]" value="<?php echo esc_attr($wpscreenoptsval); ?>" /><?php 453 453 } 454 454 if ($this->viewmode == 'view') { … … 464 464 style="width:75%;" 465 465 maxlength="16" 466 value="<?php echo stripslashes($this->viewbarcode); ?>"<?php466 value="<?php echo esc_attr(stripslashes($this->viewbarcode)); ?>"<?php 467 467 if ($this->viewmode != 'add') { 468 468 echo ' readonly="readonly"'; … … 474 474 style="width:75%;" 475 475 maxlength="128" 476 value="<?php echo stripslashes($this->viewitem->title()); ?>"<?php echo $ro; ?> /></td></tr>476 value="<?php echo esc_attr(stripslashes($this->viewitem->title())); ?>"<?php echo $ro; ?> /></td></tr> 477 477 <tr valign="top"> 478 478 <th scope="row"><label for="itemauthor" style="width:20%;"><?php _e('Author:','weblibrarian'); ?></label></th> … … 481 481 style="width:75%;" 482 482 maxlength="64" 483 value="<?php echo stripslashes($this->viewitem->author()); ?>"<?php echo $ro; ?> /></td></tr>483 value="<?php echo esc_attr(stripslashes($this->viewitem->author())); ?>"<?php echo $ro; ?> /></td></tr> 484 484 <tr valign="top"> 485 485 <th scope="row"><label for="subject" style="width:20%;"><?php _e('Subject:','weblibrarian'); ?></label></th> … … 488 488 style="width:75%;" 489 489 maxlength="128" 490 value="<?php echo stripslashes($this->viewitem->subject()); ?>"<?php echo $ro; ?> /></td></tr>490 value="<?php echo esc_attr(stripslashes($this->viewitem->subject())); ?>"<?php echo $ro; ?> /></td></tr> 491 491 <tr valign="top"> 492 492 <th scope="row"><label for="description" style="width:20%;"><?php _e('Description:','weblibrarian'); ?></label></th> … … 495 495 style="width:75%);" 496 496 rows="5" cols="64" 497 <?php echo $ro; ?>><?php echo stripslashes($this->viewitem->description()); ?></textarea></td></tr>497 <?php echo $ro; ?>><?php echo esc_attr(stripslashes($this->viewitem->description())); ?></textarea></td></tr> 498 498 <tr valign="top"> 499 499 <th scope="row"><label for="itemcategory" style="width:20%;"><?php _e('Category:','weblibrarian'); ?></label></th> … … 502 502 style="width:75%;" 503 503 maxlength="36" 504 value="<?php echo stripslashes($this->viewitem->category()); ?>"<?php echo $ro; ?> /></td></tr>504 value="<?php echo esc_attr(stripslashes($this->viewitem->category())); ?>"<?php echo $ro; ?> /></td></tr> 505 505 <tr valign="top"> 506 506 <th scope="row"><label for="media" style="width:20%;"><?php _e('Media:','weblibrarian'); ?></label></th> … … 509 509 style="width:75%;" 510 510 maxlength="36" 511 value="<?php echo stripslashes($this->viewitem->media()); ?>"<?php echo $ro; ?> /></td></tr>511 value="<?php echo esc_attr(stripslashes($this->viewitem->media())); ?>"<?php echo $ro; ?> /></td></tr> 512 512 <tr valign="top"> 513 513 <th scope="row"><label for="publisher" style="width:20%;"><?php _e('Publisher:','weblibrarian'); ?></label></th> … … 523 523 style="width:75%;" 524 524 maxlength="36" 525 value="<?php echo stripslashes($this->viewitem->publocation()); ?>"<?php echo $ro; ?> /></td></tr>525 value="<?php echo esc_attr(stripslashes($this->viewitem->publocation())); ?>"<?php echo $ro; ?> /></td></tr> 526 526 <tr valign="top"> 527 527 <th scope="row"><label for="pubdate" style="width:20%;"><?php _e('Publish Date:','weblibrarian'); ?></label></th> … … 530 530 style="width:75%;" 531 531 maxlength="40" 532 value="<?php echo $this->viewitem->pubdate(); ?>"<?php echo $ro; ?> /></td></tr>532 value="<?php echo esc_attr($this->viewitem->pubdate()); ?>"<?php echo $ro; ?> /></td></tr> 533 533 <tr valign="top"> 534 534 <th scope="row"><label for="edition" style="width:20%;"><?php _e('Edition:','weblibrarian'); ?></label></th> … … 537 537 style="width:75%;" 538 538 maxlength="36" 539 value="<?php echo stripslashes($this->viewitem->edition()); ?>"<?php echo $ro; ?> /></td></tr>539 value="<?php echo esc_attr(stripslashes($this->viewitem->edition())); ?>"<?php echo $ro; ?> /></td></tr> 540 540 <tr valign="top"> 541 541 <th scope="row"><label for="isbn" style="width:20%;"><?php _e('ISBN:','weblibrarian'); ?></label></th> … … 544 544 style="width:75%;" 545 545 maxlength="20" 546 value="<?php echo stripslashes($this->viewitem->isbn()); ?>"<?php echo $ro; ?> /></td></tr>546 value="<?php echo esc_attr(stripslashes($this->viewitem->isbn())); ?>"<?php echo $ro; ?> /></td></tr> 547 547 <tr valign="top"> 548 548 <th scope="row"><label for="type" style="width:20%;"><?php _e('Type:','weblibrarian'); ?></label></th> … … 552 552 name="type" 553 553 style="width:75%;" 554 value="<?php echo stripslashes($this->viewitem->type()); ?>"554 value="<?php echo esc_attr(stripslashes($this->viewitem->type())); ?>" 555 555 readonly="readonly" /><?php 556 556 } else { … … 560 560 if ($existingtype == '') $existingtype = $alltypes[0]; 561 561 foreach ($alltypes as $atype) { 562 ?><option value="<?php echo $atype; ?>"<?php562 ?><option value="<?php echo esc_attr($atype); ?>"<?php 563 563 if ($atype == $existingtype) echo ' selected="selected"'; 564 ?>><?php echo $atype; ?></option><?php564 ?>><?php echo esc_html($atype); ?></option><?php 565 565 } 566 566 ?></select><?php … … 572 572 style="width:75%;" 573 573 maxlength="256" 574 value="<?php echo stripslashes($this->viewitem->thumburl()); ?>"<?php echo $ro; ?> /></td></tr>574 value="<?php echo esc_attr(stripslashes($this->viewitem->thumburl())); ?>"<?php echo $ro; ?> /></td></tr> 575 575 <tr valign="top"> 576 576 <th scope="row"><label for="callnumber" style="width:20%;"><?php _e('Call Number:','weblibrarian'); ?></label></th> … … 579 579 style="width:75%;" 580 580 maxlength="36" 581 value="<?php echo stripslashes($this->viewitem->callnumber()); ?>"<?php echo $ro; ?> /></td></tr>581 value="<?php echo esc_attr(stripslashes($this->viewitem->callnumber())); ?>"<?php echo $ro; ?> /></td></tr> 582 582 <tr valign="top"> 583 583 <td colspan="2" width="100%"> … … 592 592 ?><textarea id="itemedit-keyword-list" name="keywordlist" 593 593 rows="3" cols="20" class="the-keywords"<?php echo $ro; ?> ><?php 594 echo implode(',', $this->viewkeywords); ?></textarea><?php594 echo implode(',',esc_html($this->viewkeywords)); ?></textarea><?php 595 595 if ($this->viewmode != 'view') { 596 596 ?></div><div class="hide-if-no-js"> … … 648 648 $result = ''; 649 649 if ($this->viewmode == 'add') { 650 $newbarcode = $_REQUEST['barcode'];650 $newbarcode = sanitize_text_field($_REQUEST['barcode']); 651 651 if ($newbarcode != '') { 652 652 if (!preg_match('/^[a-zA-Z0-9]+$/',$newbarcode) || strlen($barcode) > 16) { … … 655 655 } 656 656 } 657 if ( $_REQUEST['title']== '') {657 if (sanitize_text_field( $_REQUEST['title'] ) == '') { 658 658 $result .= '<br /><span id="error">'.__('Title is invalid','weblibrarian').'</span>'; 659 659 } 660 if ( $_REQUEST['itemauthor']== '') {660 if (sanitize_text_field($_REQUEST['itemauthor']) == '') { 661 661 $result .= '<br /><span id="error">'.__('Author is invalid','weblibrarian').'</span>'; 662 662 } 663 if ( $_REQUEST['subject']== '') {663 if (sanitize_text_field($_REQUEST['subject']) == '') { 664 664 $result .= '<br /><span id="error">'.__('Subject is invalid','weblibrarian').'</span>'; 665 665 } 666 WEBLIB_Patrons_Admin::ValidHumanDate( $_REQUEST['pubdate'],$dummy,__('Publication Date','weblibrarian'),$result);667 if ( $_REQUEST['type']== '') {666 WEBLIB_Patrons_Admin::ValidHumanDate(sanitize_text_field($_REQUEST['pubdate']),$dummy,__('Publication Date','weblibrarian'),$result); 667 if (sanitize_text_field($_REQUEST['type']) == '') { 668 668 $result .= '<br /><span id="error">'.__('Type is invalid','weblibrarian').'</span>'; 669 669 } … … 674 674 { 675 675 $item = new WEBLIB_ItemInCollection($barcode); 676 $item->set_title( $_REQUEST['title']);677 $item->set_author( $_REQUEST['itemauthor']);678 $item->set_subject( $_REQUEST['subject']);679 $item->set_description( $_REQUEST['description']);680 $item->set_category( $_REQUEST['itemcategory']);681 $item->set_media( $_REQUEST['media']);682 $item->set_publisher( $_REQUEST['publisher']);683 $item->set_publocation( $_REQUEST['publocation']);684 if (WEBLIB_Patrons_Admin::ValidHumanDate( $_REQUEST['pubdate'],$thepubdate,'Publication Date',$error)) {676 $item->set_title(sanitize_text_field($_REQUEST['title'])); 677 $item->set_author(sanitize_text_field($_REQUEST['itemauthor'])); 678 $item->set_subject(sanitize_text_field($_REQUEST['subject'])); 679 $item->set_description(sanitize_text_field($_REQUEST['description'])); 680 $item->set_category(sanitize_text_field($_REQUEST['itemcategory'])); 681 $item->set_media(sanitize_text_field($_REQUEST['media'])); 682 $item->set_publisher(sanitize_text_field($_REQUEST['publisher'])); 683 $item->set_publocation(sanitize_text_field($_REQUEST['publocation'])); 684 if (WEBLIB_Patrons_Admin::ValidHumanDate(sanitize_text_field($_REQUEST['pubdate']),$thepubdate,'Publication Date',$error)) { 685 685 $item->set_pubdate($thepubdate); 686 686 } 687 $item->set_edition( $_REQUEST['edition']);688 $item->set_isbn( $_REQUEST['isbn']);689 $item->set_type( $_REQUEST['type']);690 $item->set_thumburl( $_REQUEST['thumburl']);691 $item->set_callnumber( $_REQUEST['callnumber']);687 $item->set_edition(sanitize_text_field($_REQUEST['edition'])); 688 $item->set_isbn(sanitize_text_field($_REQUEST['isbn'])); 689 $item->set_type(sanitize_text_field($_REQUEST['type'])); 690 $item->set_thumburl(sanitize_text_field($_REQUEST['thumburl'])); 691 $item->set_callnumber(sanitize_text_field($_REQUEST['callnumber'])); 692 692 return $item; 693 693 } … … 695 695 function getkeywordsfromform() 696 696 { 697 return explode(',', $_REQUEST['keywordlist']);697 return explode(',',sanitize_text_field($_REQUEST['keywordlist'])); 698 698 } 699 699 … … 717 717 if (!isset($_REQUEST['doupload']) ) return ''; 718 718 $filename = $_FILES['file_name']['tmp_name']; 719 $use_csv_headers = $_REQUEST['use_csv_header'];720 $field_sep = stripslashes( $_REQUEST['field_sep']);721 $enclose_char = stripslashes( $_REQUEST['enclose_char']);719 $use_csv_headers = sanitize_text_field($_REQUEST['use_csv_header']); 720 $field_sep = stripslashes(sanitize_text_field($_REQUEST['field_sep'])); 721 $enclose_char = stripslashes(sanitize_text_field($_REQUEST['enclose_char'])); 722 722 /*$escape_char = stripslashes($_REQUEST['escape_char']);*/ 723 723 $result = WEBLIB_ItemInCollection::upload_csv($filename,$use_csv_headers, … … 728 728 function display_bulk_upload_form($returnURL) { 729 729 if ( isset($_REQUEST['paged']) ) { 730 ?><input type="hidden" name="paged" value="<?php echo $_REQUEST['paged']?>" /><?php730 ?><input type="hidden" name="paged" value="<?php echo esc_attr(sanitize_text_field($_REQUEST['paged'])) ?>" /><?php 731 731 } 732 732 if ( isset($_REQUEST['screen-options-apply']) ) { 733 ?><input type="hidden" name="screen-options-apply" value="<?php echo $_REQUEST['screen-options-apply']?>" /><?php733 ?><input type="hidden" name="screen-options-apply" value="<?php echo esc_attr(sanitize_text_field($_REQUEST['screen-options-apply'])) ?>" /><?php 734 734 } 735 735 if ( isset($_REQUEST['wp_screen_options']['option']) ) { 736 ?><input type="hidden" name="wp_screen_options[option]" value="<?php echo $_REQUEST['wp_screen_options']['option']?>" /><?php736 ?><input type="hidden" name="wp_screen_options[option]" value="<?php echo esc_attr(sanitize_text_field($_REQUEST['wp_screen_options']['option'])) ?>" /><?php 737 737 } 738 738 if ( isset($_REQUEST['wp_screen_options']['value']) ) { 739 ?><input type="hidden" name="wp_screen_options[value]" value="<?php echo $_REQUEST['wp_screen_options']['value']?>" /><?php739 ?><input type="hidden" name="wp_screen_options[value]" value="<?php echo esc_attr(sanitize_text_field($_REQUEST['wp_screen_options']['value'])) ?>" /><?php 740 740 } 741 741 ?><p><label for="file_name"><?php _e('CSV File:','weblibrarian'); ?></label> 742 742 <input type="file" id="file_name" name="file_name" 743 value="<?php echo $_REQUEST['file_name']; ?>" /></p>743 value="<?php echo esc_attr(sanitize_text_field($_REQUEST['file_name'])); ?>" /></p> 744 744 <p><label for="use_csv_header"><?php _e('Use CSV Header?','weblibrarian'); ?></label> 745 745 <input type="checkbox" name="use_csv_header" id="use_csv_header" … … 749 749 <select id="field_sep" name="field_sep"> 750 750 <option value="," <?php if (!isset($_REQUEST['field_sep']) || 751 $_REQUEST['field_sep']== ',') {751 sanitize_text_field($_REQUEST['field_sep']) == ',') { 752 752 echo 'selected="selected"'; 753 753 } ?>>,</option> 754 754 <option value="<?php echo "\t"; ?>" <?php 755 755 if (isset($_REQUEST['field_sep']) && 756 $_REQUEST['field_sep']== "\t") {756 sanitize_text_field($_REQUEST['field_sep']) == "\t") { 757 757 echo 'selected="selected"'; 758 758 } ?>><?php _e('TAB','weblibrarian'); ?></option> … … 762 762 <option value='<?php echo '"'; ?>' <?php 763 763 if (!isset($_REQUEST['enclose_char']) || 764 $_REQUEST['enclose_char']== '"') {764 sanitize_text_field($_REQUEST['enclose_char']) == '"') { 765 765 echo 'selected="selected"'; 766 766 } ?>>"</option> 767 767 <option value="'" <?php 768 768 if (isset($_REQUEST['enclose_char']) && 769 $_REQUEST['enclose_char']== "'") {769 sanitize_text_field($_REQUEST['enclose_char']) == "'") { 770 770 echo 'selected="selected"'; 771 771 } ?>>'</option> -
weblibrarian/trunk/includes/WEBLIB_PatronRecord_Admin.php
r2754185 r2973108 206 206 } 207 207 function current_action() { 208 if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'])209 return $_REQUEST['action'];210 211 if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'])212 return $_REQUEST['action2'];208 if ( isset( $_REQUEST['action'] ) && -1 != sanitize_text_field($_REQUEST['action']) ) 209 return sanitize_text_field($_REQUEST['action']); 210 211 if ( isset( $_REQUEST['action2'] ) && -1 != sanitize_text_field($_REQUEST['action2']) ) 212 return sanitize_text_field($_REQUEST['action2']); 213 213 } 214 214 … … 217 217 switch ($action) { 218 218 case 'removehold': 219 if ( isset($_REQUEST['checked']) && !empty( $_REQUEST['checked'])) {220 foreach ( $_REQUEST['checked']as $theitem ) {219 if ( isset($_REQUEST['checked']) && !empty(sanitize_text_field($_REQUEST['checked']))) { 220 foreach ( sanitize_text_field($_REQUEST['checked']) as $theitem ) { 221 221 WEBLIB_HoldItem::DeleteHeldItemByBarcodeAndPatronId($theitem, 222 222 $this->patronid); … … 224 224 } else if ( isset($_REQUEST['barcode']) ) { 225 225 WEBLIB_HoldItem::DeleteHeldItemByBarcodeAndPatronId( 226 $_REQUEST['barcode'],$this->patronid);226 sanitize_text_field($_REQUEST['barcode']),$this->patronid); 227 227 } 228 228 break; … … 233 233 $message = ''; 234 234 $this->process_bulk_action(); 235 $orderby = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby']: 'barcode';235 $orderby = isset( $_REQUEST['orderby'] ) ? sanitize_text_field($_REQUEST['orderby']) : 'barcode'; 236 236 if ( empty( $orderby ) ) $orderby = 'barcode'; 237 $order = isset( $_REQUEST['order'] ) ? $_REQUEST['order']: 'ASC';237 $order = isset( $_REQUEST['order'] ) ? sanitize_text_field($_REQUEST['order']) : 'ASC'; 238 238 if ( empty( $order ) ) $order = 'ASC'; 239 239 // Deal with columns … … 328 328 } 329 329 function current_action() { 330 if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'])331 return $_REQUEST['action'];332 333 if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'])334 return $_REQUEST['action2'];330 if ( isset( $_REQUEST['action'] ) && -1 != sanitize_text_field($_REQUEST['action']) ) 331 return sanitize_text_field($_REQUEST['action']); 332 333 if ( isset( $_REQUEST['action2'] ) && -1 != sanitize_text_field($_REQUEST['action2']) ) 334 return sanitize_text_field($_REQUEST['action2']); 335 335 } 336 336 … … 338 338 $message = ''; 339 339 $action = $this->current_action(); 340 if ( isset($_REQUEST['action']) && $_REQUEST['action']!= -1 ) {341 $theaction = $_REQUEST['action'];342 } else if ( isset($_REQUEST['action2']) && $_REQUEST['action2']!= -1 ) {343 $theaction = $_REQUEST['action2'];340 if ( isset($_REQUEST['action']) && sanitize_text_field($_REQUEST['action']) != -1 ) { 341 $theaction = sanitize_text_field($_REQUEST['action']); 342 } else if ( isset($_REQUEST['action2']) && sanitize_text_field($_REQUEST['action2']) != -1 ) { 343 $theaction = sanitize_text_field($_REQUEST['action2']); 344 344 } else { 345 345 $theaction = 'none'; … … 349 349 if ( isset($_REQUEST['barcode']) ) { 350 350 $m = WEBLIB_OutItem::RenewByBarcodeAndPatronID( 351 $_REQUEST['barcode'],$this->patronid);351 sanitize_text_field($_REQUEST['barcode']),$this->patronid); 352 352 if (preg_match('/ Renewed\.$/',$m)) { 353 353 $message .= '<p>'.$m.'</p>'; … … 356 356 } 357 357 } else { 358 foreach ( $_REQUEST['checked']as $barcode ) {358 foreach ( sanitize_text_field($_REQUEST['checked']) as $barcode ) { 359 359 $m = WEBLIB_OutItem::RenewByBarcodeAndPatronID( 360 360 $barcode,$this->patronid); … … 374 374 $message = ''; 375 375 $message = $this->process_bulk_action(); 376 $orderby = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby']: 'barcode';376 $orderby = isset( $_REQUEST['orderby'] ) ? sanitize_text_field($_REQUEST['orderby']) : 'barcode'; 377 377 if ( empty( $orderby ) ) $orderby = 'barcode'; 378 $order = isset( $_REQUEST['order'] ) ? $_REQUEST['order']: 'ASC';378 $order = isset( $_REQUEST['order'] ) ? sanitize_text_field($_REQUEST['order']) : 'ASC'; 379 379 if ( empty( $order ) ) $order = 'ASC'; 380 380 -
weblibrarian/trunk/includes/WEBLIB_Statistics_Admin.php
r1747278 r2973108 126 126 function extra_tablenav( $which ) { 127 127 if ($which == 'top') { 128 ?><input type="hidden" name="year" value="<?php echo $this->year; ?>" />129 <input type="hidden" name="month" value="<?php echo $this->month; ?>" /><?php128 ?><input type="hidden" name="year" value="<?php echo esc_attr($this->year); ?>" /> 129 <input type="hidden" name="month" value="<?php echo esc_attr($this->month); ?>" /><?php 130 130 } 131 131 … … 157 157 $this->check_permissions(); 158 158 $message = ''; 159 $this->year = isset($_REQUEST['year']) ? $_REQUEST['year']: date('Y',time());160 $this->month = isset($_REQUEST['month']) ? $_REQUEST['month']: date('m',time());159 $this->year = isset($_REQUEST['year']) ? sanitize_text_field($_REQUEST['year']) : date('Y',time()); 160 $this->month = isset($_REQUEST['month']) ? sanitize_text_field($_REQUEST['month']) : date('m',time()); 161 161 162 162 if ( isset($_REQUEST['filter_top']) ) { 163 $this->year = isset($_REQUEST['year_top']) ? $_REQUEST['year_top']: $this->year;164 $this->month = isset($_REQUEST['month_top']) ? $_REQUEST['month_top']: $this->month;163 $this->year = isset($_REQUEST['year_top']) ? sanitize_text_field($_REQUEST['year_top']) : $this->year; 164 $this->month = isset($_REQUEST['month_top']) ? sanitize_text_field($_REQUEST['month_top']) : $this->month; 165 165 } else if ( isset($_REQUEST['filter_bottom']) ) { 166 $this->year = isset($_REQUEST['year_bottom']) ? $_REQUEST['year_bottom']: $this->year;167 $this->month = isset($_REQUEST['month_bottom']) ? $_REQUEST['month_bottom']: $this->month;166 $this->year = isset($_REQUEST['year_bottom']) ? sanitize_text_field($_REQUEST['year_bottom']) : $this->year; 167 $this->month = isset($_REQUEST['month_bottom']) ? sanitize_text_field($_REQUEST['month_bottom']) : $this->month; 168 168 } 169 169 //file_put_contents("php://stderr","*** WEBLIB_Statistics_Admin::prepare_items: this->year = $this->year\n"); -
weblibrarian/trunk/includes/WEBLIB_Users_Admin.php
r1747278 r2973108 126 126 $message = ''; 127 127 if ( isset( $_REQUEST['setid']) ) { 128 $patronid = $_REQUEST['patronid'];129 $user_id = $_REQUEST['user_id'];128 $patronid = sanitize_text_field($_REQUEST['patronid']); 129 $user_id = sanitize_text_field($_REQUEST['user_id']); 130 130 $user = get_userdata($user_id); 131 131 $patron = new WEBLIB_Patron($patronid); … … 141 141 } 142 142 global $usersearch; 143 $usersearch = isset( $_REQUEST['s'] ) ? stripslashes( trim( $_REQUEST['s']) ) : '';143 $usersearch = isset( $_REQUEST['s'] ) ? stripslashes( trim( sanitize_text_field($_REQUEST['s']) ) ) : ''; 144 144 // Deal with columns 145 145 $columns = $this->get_columns(); // All of our columns … … 188 188 $patronid = 0; 189 189 if (isset($_REQUEST['patronid']) ) { 190 $patronid = $_REQUEST['patronid'];190 $patronid = sanitize_text_field($_REQUEST['patronid']); 191 191 $patron = new WEBLIB_Patron($patronid); 192 192 $error = ''; -
weblibrarian/trunk/includes/admin_page_classes.php
r1747834 r2973108 115 115 } 116 116 if ( isset($_REQUEST['saveoptions']) ) { 117 $new_public_key = (isset($_REQUEST['aws_public_key']))? $_REQUEST['aws_public_key']:'';118 $new_private_key = (isset($_REQUEST['aws_private_key']))? $_REQUEST['aws_private_key']:'';119 $new_regiondom = (isset($_REQUEST['aws_regiondom']))? $_REQUEST['aws_regiondom']:'';120 $new_associate_tag = (isset($_REQUEST['associate_tag']))? $_REQUEST['associate_tag']:'';117 $new_public_key = (isset($_REQUEST['aws_public_key']))?sanitize_text_field($_REQUEST['aws_public_key']):''; 118 $new_private_key = (isset($_REQUEST['aws_private_key']))?sanitize_text_field($_REQUEST['aws_private_key']):''; 119 $new_regiondom = (isset($_REQUEST['aws_regiondom']))?sanitize_text_field($_REQUEST['aws_regiondom']):''; 120 $new_associate_tag = (isset($_REQUEST['associate_tag']))?sanitize_text_field($_REQUEST['associate_tag']):''; 121 121 $message = ''; $valid = true; 122 122 if ($new_public_key == '' && $new_private_key == '' && $new_associate_tag == '') { … … 142 142 } 143 143 if ($valid) { 144 update_option('weblib_aws_public_key', $_REQUEST['aws_public_key']);145 update_option('weblib_aws_private_key', $_REQUEST['aws_private_key']);146 update_option('weblib_aws_regiondom', $_REQUEST['aws_regiondom']);147 update_option('weblib_associate_tag', $_REQUEST['associate_tag']);148 update_option('weblib_debugdb', $_REQUEST['debugdb']);144 update_option('weblib_aws_public_key',sanitize_text_field($_REQUEST['aws_public_key'])); 145 update_option('weblib_aws_private_key',sanitize_text_field($_REQUEST['aws_private_key'])); 146 update_option('weblib_aws_regiondom',sanitize_text_field($_REQUEST['aws_regiondom'])); 147 update_option('weblib_associate_tag',sanitize_text_field($_REQUEST['associate_tag'])); 148 update_option('weblib_debugdb',sanitize_text_field($_REQUEST['debugdb'])); 149 149 $message = '<p>'.__('Options Saved','weblibrarian').'</p>'; 150 150 } … … 166 166 <td><input type="text" id="aws_public_key" 167 167 name="aws_public_key" 168 value="<?php echo $aws_public_key; ?>"168 value="<?php echo esc_attr($aws_public_key); ?>" 169 169 style="width:75%" /></td></tr> 170 170 <tr valign="top"> … … 173 173 <td><input type="text" id="aws_private_key" 174 174 name="aws_private_key" 175 value="<?php echo $aws_private_key; ?>"175 value="<?php echo esc_attr($aws_private_key); ?>" 176 176 style="width:75%" /></td></tr> 177 177 <tr valign="top"> … … 214 214 <td><input type="text" id="associate_tag" 215 215 name="associate_tag" 216 value="<?php echo $associate_tag; ?>"216 value="<?php echo esc_attr($associate_tag); ?>" 217 217 style="width:75%" /></td></tr> 218 218 <tr valign="top"> -
weblibrarian/trunk/readme.txt
r2955420 r2973108 157 157 == Changelog == 158 158 159 = 3.5.8.4 = 160 161 Sanitize and Escape everything. 162 159 163 = 3.5.8.3 = 160 164
Note: See TracChangeset
for help on using the changeset viewer.