Overview   Package   Tree   Index 
Tv2 documentation
PREV  NEXT FRAMES  NO FRAME 
SUMMARY:  FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

pyramid-framework
Class ctlHttpProtocol


class ctlHttpProtocol

Protocol abstraction for pyramid-framework. It may look as total bloat, but really it is very useful.

Authors:
Emilis Dambauskas (emilis@gildija.lt)
Version:
$Id: ctlHttpProtocol.class.php,v 1.3 2003/11/07 14:18:52 lunaticlt Exp $
Copyright:
2002–2003 Emilis Dambauskas under Artistic license

Field Summary
private array$client
Client vars
private array$commands
Commands (HTTP headers)
private string$cookien
Cookie name
private object$db
Link to the database
private array$protocol
Protocol vars
private array$request
Request vars
private string$scookie
Session cookie name
private array$server
Server vars
private array$session
Session vars
private string$sid
Session id
private integer$slifetime
Session lifetime (defaults to 1200 s = 20 min.
private string$stable
Session table name

Constructor Summary
void ctlHttpProtocol()
Constructor.

Method Summary
boolean delClientVar(string $name)
Removes variable on client
boolean delSessionVar(string $name)
Removes variable from session
void emptyClientVars()
Removes all client variables
void emptySessionVars()
Removes all variables from session
boolean endSession()
Ends session
private boolean error(string $msg)
Sends an error to the error handler
array getAllRequestVars()
Returns all request variables as an associative array
mixed getClientVar(string $name)
Returns a client var
mixed getRequestVar(string $name)
Returns request variable value
mixed getServerVar(string $name)
Returns server variable value
mixed getSessionVar(string $name)
Returns session variable value
boolean loadSession()
Loads session status and variables
void output(string $content)
Outputs data, saves session, etc.
boolean outputFile(string $fname, string $disp)
Outputs local system file with correct headers, saves session, etc.
boolean regClientVar(string $name, mixed& $var)
Registers an external variable as client variable.
boolean regSessionVar(string $name, mixed& $var)
Registers an external variable as session variable.
boolean saveSession()
Saves session status and variables
void sendCommand(string $cmd)
Use this instead of header() function - adds header to a stack (so it won't conflict with cookies)
boolean setClientVar(string $name, [mixed $value])
Sets variable on client (cookie)
boolean setSessionVar(string $name, [mixed $value])
Sets session variable
void start()
Starts sessions, fills variable arrays
boolean startSession()
Starts a session


Field Detail

client

private array $client

Client vars


commands

private array $commands

Commands (HTTP headers)


cookien

private string $cookien

Cookie name


db

private object $db

Link to the database


protocol

private array $protocol

Protocol vars


request

private array $request

Request vars


scookie

private string $scookie

Session cookie name


server

private array $server

Server vars


session

private array $session

Session vars


sid

private string $sid

Session id


slifetime

private integer $slifetime

Session lifetime (defaults to 1200 s = 20 min.)


stable

private string $stable

Session table name


Constructor Detail

ctlHttpProtocol()

void ctlHttpProtocol()

Constructor. Fills attributes with values either from global $config or with default values.

Uses the global variables:
$config, db

Method Detail

delClientVar()

boolean delClientVar(string $name)

Removes variable on client

Parameters:
name - variable name
Returns:
TRUE

delSessionVar()

boolean delSessionVar(string $name)

Removes variable from session

Parameters:
name - variable name
Returns:
TRUE

emptyClientVars()

void emptyClientVars()

Removes all client variables


emptySessionVars()

void emptySessionVars()

Removes all variables from session


endSession()

boolean endSession()

Ends session

Returns:
TRUE on success, FALSE on failure

error()

private boolean error(string $msg)

Sends an error to the error handler

Parameters:
msg - Error message
Returns:
always FALSE
Uses the global variables:
errors

getAllRequestVars()

array getAllRequestVars()

Returns all request variables as an associative array

Returns:
associative array of variables indexed by their names

getClientVar()

mixed getClientVar(string $name)

Returns a client var

Parameters:
name - variable name
Returns:
whatever the variable value is

getRequestVar()

mixed getRequestVar(string $name)

Returns request variable value

Parameters:
name - variable name
Returns:
whatever the value is

getServerVar()

mixed getServerVar(string $name)

Returns server variable value

Parameters:
name - variable name
Returns:
whatever the variable value is

getSessionVar()

mixed getSessionVar(string $name)

Returns session variable value

Parameters:
name - variable name
Returns:
whatever the value is

loadSession()

boolean loadSession()

Loads session status and variables

Returns:
TRUE on success, FALSE on failure

output()

void output(string $content)

Outputs data, saves session, etc.

Parameters:
content - Data for outputing

outputFile()

boolean outputFile(string $fname, string $disp)

Outputs local system file with correct headers, saves session, etc.

Parameters:
fname - file name (NOTE: '../' is replaced for security reasons)
disp - Content-Disposition type (default attachment)
Returns:
TRUE on success, FALSE on failure
Uses the global variables:
ctlMimeType, ENGINE_DIR

regClientVar()

boolean regClientVar(string $name, mixed& $var)

Registers an external variable as client variable. Usefull for keeping client variable up to date automatically.

Parameters:
name - variable name
var - Reference to external variable
Returns:
TRUE

regSessionVar()

boolean regSessionVar(string $name, mixed& $var)

Registers an external variable as session variable. Usefull for keeping session variable up to date automatically.

Parameters:
name - variable name
var - variable
Returns:
TRUE

saveSession()

boolean saveSession()

Saves session status and variables

Returns:
TRUE on success, FALSE on failure

sendCommand()

void sendCommand(string $cmd)

Use this instead of header() function - adds header to a stack (so it won't conflict with cookies)

Parameters:
cmd - HTTP header

setClientVar()

boolean setClientVar(string $name, [mixed $value])

Sets variable on client (cookie)

Parameters:
name - variable name
value - Variable value
Returns:
TRUE

setSessionVar()

boolean setSessionVar(string $name, [mixed $value])

Sets session variable

Parameters:
name - variable name
value - variable value
Returns:
TRUE

start()

void start()

Starts sessions, fills variable arrays


startSession()

boolean startSession()

Starts a session

Returns:
TRUE on success, FALSE on failure

 Overview   Package   Tree   Index 
Tv2 documentation
PREV  NEXT FRAMES  NO FRAME 
SUMMARY:  FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Submit a bug

This document was generated by phpdocgen 0.17-rc3.
Copyright © 2002-03 Stéphane GALLAND (under the GNU General Public License)