Index: trunk/phase3/includes/WebRequest.php |
— | — | @@ -637,6 +637,18 @@ |
638 | 638 | } |
639 | 639 | } |
640 | 640 | } |
| 641 | + |
| 642 | + /* |
| 643 | + * Get data from $_SESSION |
| 644 | + */ |
| 645 | + function getSessionData( $key ) { |
| 646 | + if( !isset( $_SESSION[$key] ) ) |
| 647 | + return null; |
| 648 | + return $_SESSION[$key]; |
| 649 | + } |
| 650 | + function setSessionData( $key, $data ) { |
| 651 | + $_SESSION[$key] = $data; |
| 652 | + } |
641 | 653 | } |
642 | 654 | |
643 | 655 | /** |
— | — | @@ -652,7 +664,7 @@ |
653 | 665 | * fake GET/POST values |
654 | 666 | * @param $wasPosted Bool: whether to treat the data as POST |
655 | 667 | */ |
656 | | - function FauxRequest( $data, $wasPosted = false ) { |
| 668 | + function FauxRequest( $data, $wasPosted = false, $session ) { |
657 | 669 | if( is_array( $data ) ) { |
658 | 670 | $this->data = $data; |
659 | 671 | } else { |
— | — | @@ -660,7 +672,12 @@ |
661 | 673 | } |
662 | 674 | $this->wasPosted = $wasPosted; |
663 | 675 | $this->headers = array(); |
| 676 | + $this->session = $session; |
664 | 677 | } |
| 678 | + |
| 679 | + function notImplemented( $method ) { |
| 680 | + throw new MWException( "{$method}() not implemented" ); |
| 681 | + } |
665 | 682 | |
666 | 683 | function getText( $name, $default = '' ) { |
667 | 684 | # Override; don't recode since we're using internal data |
— | — | @@ -680,15 +697,24 @@ |
681 | 698 | } |
682 | 699 | |
683 | 700 | function getRequestURL() { |
684 | | - throw new MWException( 'FauxRequest::getRequestURL() not implemented' ); |
| 701 | + $this->notImplemented( __METHOD__ ); |
685 | 702 | } |
686 | 703 | |
687 | 704 | function appendQuery( $query ) { |
688 | | - throw new MWException( 'FauxRequest::appendQuery() not implemented' ); |
| 705 | + $this->notImplemented( __METHOD__ ); |
689 | 706 | } |
690 | 707 | |
691 | 708 | function getHeader( $name ) { |
692 | 709 | return isset( $this->headers[$name] ) ? $this->headers[$name] : false; |
693 | 710 | } |
694 | 711 | |
| 712 | + function getSessionData( $key ) { |
| 713 | + if( !isset( $this->session[$key] ) ) |
| 714 | + return null; |
| 715 | + return $this->session[$key]; |
| 716 | + } |
| 717 | + function setSessionData( $key, $data ) { |
| 718 | + $this->notImplemented( __METHOD__ ); |
| 719 | + } |
| 720 | + |
695 | 721 | } |