/functions/global.php

Description

global.php

This includes code to update < 4.1.0 globals to the newer format It also has some session register functions that work across various php versions.

Includes
require_once (SM_PATH.'config/config.php') (line 92)
require_once (SM_PATH.'functions/strings.php') (line 91)

Bring in the config file We need $session_name config.php $version depends on strings.php.

strings.php sets $PHP_SELF.

Constants
SQ_COOKIE = 4 (line 23)
SQ_FORM = 6 (line 25)
SQ_GET = 1 (line 20)
SQ_INORDER = 0 (line 19)

Set constants

SQ_POST = 2 (line 21)
SQ_SERVER = 5 (line 24)
SQ_SESSION = 3 (line 22)
Functions
check_php_version (line 160)

returns true if current php version is at mimimum a.b.c

Called: check_php_version(4,1)

bool check_php_version ([mixed $a = '0'], [mixed $b = '0'], [mixed $c = '0'])
check_sm_version (line 181)

returns true if the current internal SM version is at minimum a.b.c These are plain integer comparisons, as our internal version is constructed by us, as an array of 3 ints.

Called: check_sm_version(1,3,3)

bool check_sm_version ([mixed $a = 0], [mixed $b = 0], [mixed $c = 0])
sqgetGlobalVar (line 296)

Search for the var $name in $_SESSION, $_POST, $_GET, $_COOKIE, or $_SERVER and set it in provided var.

If $search is not provided, or == SQ_INORDER, it will search $_SESSION, then $_POST, then $_GET. Otherwise, use one of the defined constants to look for a var in one place specifically.

Note: $search is an int value equal to one of the constants defined above.

example: sqgetGlobalVar('username',$username,SQ_SESSION); -- no quotes around last param!

  • return: whether variable is found.
bool sqgetGlobalVar (mixed $name, mixed &$value, [mixed $search = SQ_INORDER])
sqsession_destroy (line 362)

Deletes an existing session, more advanced than the standard PHP session_destroy(), it explicitly deletes the cookies and global vars.

void sqsession_destroy ()
sqsession_is_active (line 401)

Function to verify a session has been started. If it hasn't

start a session up. php.net doesn't tell you that $_SESSION (even though autoglobal), is not created unless a session is started, unlike $_POST, $_GET and such

void sqsession_is_active ()
sqsession_is_registered (line 258)

Checks to see if a variable has already been registered in the session.

  • return: whether the var has been registered
bool sqsession_is_registered (string $name)
  • string $name: the name of the var to check
sqsession_register (line 221)

Add a variable to the session.

void sqsession_register (mixed $var, string $name)
  • mixed $var: the variable to register
  • string $name: the name to refer to this variable
sqsession_unregister (line 239)

Delete a variable from the session.

void sqsession_unregister (string $name)
  • string $name: the name of the var to delete
sqstripslashes (line 202)

Recursively strip slashes from the values of an array.

void sqstripslashes (mixed &$array)

Documentation generated on Sat, 07 Oct 2006 16:31:25 +0300 by phpDocumentor 1.3.0RC6