User management for the world wide web

Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

Php.php

00001 <?php
00002 
00003 require_once("GenieGate/View.php");
00004 
00005 
00013 class GenieGate_View_Php extends GenieGate_View {
00014   
00016   var $page;
00017 
00022   var $shell_template;
00023 
00030   function GenieGate_View_Php($page, $tpl = FALSE){
00031     if($tpl){
00032       $this->shell_template = $tpl;
00033     }    
00034     $this->page = $page;
00035   }
00036 
00037   function display(){
00038     if($this->shell_template){
00039       include($this->shell_template);     
00040     }else{
00041       include($this->page);
00042     }
00043   }
00044 
00052   function input($name,$value = "",$sz = 20,$type = "TEXT"){
00053     printf("<INPUT NAME=\"$name\" TYPE=\"$type\" SIZE=\"$sz\" VALUE=\"%s\">",htmlentities($value));
00054   }
00061   function passThrough($skip = array()){
00062       if($_SERVER[REQUEST_METHOD] == "GET"){
00063           $this->_pass_vars($_GET,$skip);
00064       }else{
00065           $this->_pass_vars($_POST,$skip);
00066       }
00067   }
00068   function _pass_vars(&$assoc,&$skip){
00069       foreach($assoc as $k => $v){
00070           if(! in_array($k,$skip)){
00071               if(is_array($v)){
00072                   $nm = $k . "[]"; // Attempt to deal with multiple values.
00073                   foreach($v as $av){
00074                       $this->_escape_input($nm,$av);
00075                   }
00076               }else{
00077                   $this->_escape_input($k,$v);
00078               }
00079           }
00080       }
00081   }
00082   function _escape_input($name,$val){
00083         $name = htmlentities($name);
00084         $val = htmlentities($val);
00085         $val = str_replace("\n", "&#10;",$val); // Attempt to deal with \r's and \n's.           
00086         $val = str_replace("\r", "&#13;",$val);
00087         $this->input($name,$val,0,"HIDDEN");
00088   }
00089 }
00090 ?>

DoxyGen Documentation generated by DoxyGen