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
| <?php
class Subscribe
{ private $debug, $message ;
private static $step = 0, $start, $curr = 0, $end ;
private $disenabled = array ( false => "disabled" , true => "" ) ;
const disabled = "disabled" ;
const enabled = "" ;
private $self_host = array( "subscribe.php" , "subscribe1.php" , "subscribe2.php" , "subscribe3.php" ) ;
/**
* Some iterator functions
*
*/
static function key() {
return(self::$curr) ;
}
function current() {
}
function rewind() {
}
function null() {
}
static function next() {
user_error("next[".self::$curr."] - End[".self::$end."]" , E_USER_NOTICE) ;
if (self::$curr + 1 < self::$end)
self::$curr++ ;
user_error("next[".self::$curr."] - End[".self::$end."]" , E_USER_NOTICE) ;
return(self::$curr) ;
}
static function prev() {
if (self::$curr - 1 > 0)
self::$curr-- ;
return(self::$curr) ;
}
function valid() {
return( (self::$curr > 0) && (self::$curr < $this->end) ? true : false ) ;
}
/**
* Iterator functions
*
===================================================================================================================================/
/**
* Subscribe Constructor
*
*/
function __construct($start, $end, $debug=false)
{ $this->debug = $debug ;
self::$start = $start ;
self::$end = $end ;
self::$step = 0 ;
}
/**
* Subscribe Destructor
*
*/
function destruct()
{ }
/**
* Subscribe Executor
*
*/
function execute()
{
try { if ($this->debug)
print("+++++++++++construct[setScreen] started" . CRLF) ;
/**
* Subscribe beginning
* ===================
*/
$this->message = "Rentrez les données afin de vous inscrire à votre site" ;
if ( isset($_POST["subscribe_init" ]) OR isset($_POST["subscribe_city" ]) OR
isset($_POST["subscribe_captcha"]) OR isset($_POST["subscribe_confirm"]) )
$this->validate() ;
if (isset($_POST["subscribe_prev"]))
{ self::prev( ) ;
user_error("Browse[-1] Start[".self::$start."] - Curr[".self::key()."] - End[".self::$end."]", E_USER_NOTICE);
}
if (isset($_POST["subscribe_next"]))
{
user_error("Browse[+1] Start[".self::$start."] - Curr[".self::key()."] - End[".self::$end."]", E_USER_NOTICE);
self::next() ;
}
//
// Préparation affichage page
// ==========================
$this->screen = $_SESSION[SCREEN] ;
$this->title = $_SESSION[TITLE] ;
$this->subtitle = $_SESSION[SUBTITLE] ;
$this->form = $_SESSION[FORM] ;
$this->menu = $_SESSION[MENU] ;
$this->submenu = $_SESSION[SUBMENU] ;
$this->klimsg = $_SESSION[KLIMSG] ;
/**
* Subscribe ending
* ================
*/ } catch (Exception $E)
{
throw Skeleton::display_exception($E) ;
}
}
function validate()
{ print("validating....") ;
switch($this->step)
{ case 0 : break ;
case 1 : break ;
case 2 : break ;
case 3 : break ;
default: ;
}
return(true) ;
}
function getMessage()
{ return( $this->message ) ; }
function getSendAttr()
{ return( $this->disenabled[false]) ; }
function getHost()
{ return( $this->self_host[self::$step] ) ; }
}
$sub = new Subscribe(0,3) ;
$sub->execute() ;
//------------------------------------------------------------------------------------------------------------------------------------- //
?> |
Partager