Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
MySource Class Reference
Inheritance diagram for MySource:
MySource_Object

Public Member Functions

 __construct ()
 
 __destruct ()
 
 init ()
 
 start ()
 
 replaceKeyword (&$content, $additional_replacements=Array())
 
 setGlobalDefine ($index, $value)
 
 unsetGlobalDefine ($index)
 
 getGlobalDefine ($index, $default=NULL)
 
 isGlobalDefineSet ($index)
 
 paintLogin ($heading, $msg)
 
 paintPasswordChange ($heading, $msg)
 
 setupUser ()
 
 _processGlobalActions ()
 
 loginPublicUser ()
 
 loginUser (User $user, $invoking_user_full_name= '')
 
 setCurrentUser (User $user)
 
 restoreCurrentUser ()
 
 getUniqueSessionKey ()
 
 getUniqueSOAPSessionKey ()
 
 generateLoginKey ($force_new_key=FALSE)
 
 loginKey ()
 
 getSessionHandlerClassName ()
 
 _findValidSessionExpiry ($session_prefs)
 
 currentUser ($user)
 
 currentUserId ()
 
getPublicUser ()
 
 userRoot ($user=NULL)
 
 userSystemAdmin ($user=NULL)
 
 userPublic ($user=NULL)
 
 getUserPrefs ($asset_type=NULL, $pref=NULL, $value_only=TRUE)
 
 getContextId ()
 
 changeContext ($contextid)
 
 restoreContext ()
 
 getAllContexts ($force_reload=FALSE)
 
 insertContextData ($contextid)
 
 deleteContextData ($contextid)
 
 getAlternateContext ()
 
getMessagingService ()
 
getFileVersioning ()
 
getHipoHerder ()
 
getMetadataManager ()
 
getWorkflowManager ()
 
getEventManager ()
 
getTagManager ()
 
getTriggerManager ()
 
getLogManager ()
 
 getDejaVu ()
 
 setRunLevel ($run_level)
 
 restoreRunLevel ()
 
 getRunLevel ()
 
 runLevelEnables ($security_system)
 
 changeDatabaseConnection ($conn, $oci_force_new=FALSE)
 
 restoreDatabaseConnection ($force_reconnect=FALSE)
 
 doTransaction ($type)
 
 printRollbackWarning ()
 
 constructRollbackWhereClause ($where='', $table_alias=NULL, $prefix='WHERE', $is_table_alias=TRUE)
 
 acquireLock ($lockid, $source_lockid='', $expires=0)
 
 releaseLock ($lockid)
 
 updateLock ($lockid, $expires=0)
 
 getLockInfo ($lockid, $full_chain=FALSE, $check_expires=TRUE, $allow_only_one=TRUE)
 
 addMessage ($msg)
 
 messages ()
 
 datetime ($timestamp=NULL)
 
 date ($timestamp=NULL)
 
 time ($timestamp=NULL)
 
 getInstalledPackages ()
 
 broadcastTriggerEvent ($event_name, &$broadcaster, $parameters=NULL)
 
 _getHeaders ()
 
 authRedirect ()
 
 _generateAttributeImage ($text)
 
 _translateMatrixURL (&$content)
 
 _translatePerformanceModeURL (&$content)
 
- Public Member Functions inherited from MySource_Object
 MySource_Object ()
 
 __sleep ()
 
 __wakeup ()
 

Data Fields

 $db
 
 $backend
 
 $am
 
 $tm
 
 $pm
 
 $lm
 
 $log_manager
 
 $user = NULL
 
 $frontend_asset
 
- Data Fields inherited from MySource_Object
 $_tmp
 

Protected Member Functions

 _setApacheNotes ()
 
 _sendHTTPHeaders (&$asset)
 
 _loginHttpAuthenticatedUser ()
 
 _authenticateHttpUser ()
 
 _updateSessionCookie ()
 
 _clearSession ()
 
 _logSecurityMsg ($code, $extra_replacements=Array(), $failed_login=FALSE)
 
 _paintNotFoundAsset (Asset $asset, Site $site)
 

Protected Attributes

 $_db_conns = Array()
 
 $_db_stack = Array()
 
 $_run_level_stack = Array()
 
 $_context_stack = Array()
 
 $ms
 
 $mm
 
 $hh
 
 $wm
 
 $fv
 
 $em
 
 $tag_manager
 
 $trigger_manager
 
 $_user_is_root = FALSE
 
 $_user_is_sys_admin = FALSE
 
 $_user_is_public = TRUE
 
 $_msgs
 
 $_global_defines
 
 $_deja_vu
 

Detailed Description

Definition at line 38 of file mysource.inc.

Constructor & Destructor Documentation

__construct ( )

Constructor

Definition at line 217 of file mysource.inc.

__destruct ( )

Destructor

Attempts to save locale manager in Deja Vu to improve performance.

Returns
void

Definition at line 231 of file mysource.inc.

Member Function Documentation

_authenticateHttpUser ( )
protected

Check the user authentication. If the user is authenticated then it assigns the user and returns TRUE else returns FALSE

Returns
void public

Definition at line 2058 of file mysource.inc.

_clearSession ( )
protected

Clear the user's session of all data

Returns
void private

Definition at line 2532 of file mysource.inc.

_findValidSessionExpiry (   $session_prefs)

Find the largest valid session expiry for the current user

Parameters
array$session_prefsAn array of all the current preferences
Returns
array public

Definition at line 2456 of file mysource.inc.

_generateAttributeImage (   $text)

Generates a attribute image

Parameters
string$textThe text of the image
Returns
void public

Definition at line 4197 of file mysource.inc.

_getHeaders ( )

Replacement function that allows request headers to be taken from CGI

Returns
array private

Definition at line 4063 of file mysource.inc.

_loginHttpAuthenticatedUser ( )
protected

Try to login a user who has already been HTTP-authenticated by some external mechanism

Returns
void public

Definition at line 2024 of file mysource.inc.

_logSecurityMsg (   $code,
  $extra_replacements = Array(),
  $failed_login = FALSE 
)
protected

Log a message to do with system security (logging in / out)

Parameters
string$codeThe message code for the message
array$extra_replacementsExtra keyword replacements to use in the message (user_name is already there)
boolean$failed_loginstatus of the log in process
Returns
void private

Definition at line 2555 of file mysource.inc.

_paintNotFoundAsset ( Asset  $asset,
Site  $site 
)
protected

Paint a Not Found page

This function will print the HTTP 404 header, any necessary headers for the sending of Cacheable Headers, and then the "Not Found" asset itself. This will typically be the "Not Found" asset of the site, but may have been set to something else (eg. the "Archived Asset" 404 link).

Parameters
Asset$assetThe asset that represents the Not Found page
Site$siteThe site that has set the Not Found page
Returns
void

Definition at line 4091 of file mysource.inc.

_processGlobalActions ( )

Processes any global actions that need to be taken care of

Returns
void private

Definition at line 1439 of file mysource.inc.

_sendHTTPHeaders ( $asset)
protected

Sends appropiate HTTP Headers based on the system config

Parameters
object&$assetthe asset being processed
Returns
void private

Definition at line 928 of file mysource.inc.

_setApacheNotes ( )
protected

Sets the Apache Request Notes with the set information filled on the the Apache Configuration Screen

Returns
void private

Definition at line 896 of file mysource.inc.

_translateMatrixURL ( $content)

Replace "./?a=xx" URLs by their respective full URLs

Parameters
string&$contentThe content to replace ./a=xx urls in
Returns
void private

Definition at line 4280 of file mysource.inc.

_translatePerformanceModeURL ( $content)

Replace all URLs with performance suffix and target = _top

Parameters
string&$contentThe entire matrix output content
Returns
void private

Definition at line 4309 of file mysource.inc.

_updateSessionCookie ( )
protected

Update the session cookie with the appropriate expiry time given the kind of user we are

Note: this function must be called before any other cookies are set or it will clear their set-cookie headers

Returns
void public

Definition at line 2390 of file mysource.inc.

acquireLock (   $lockid,
  $source_lockid = '',
  $expires = 0 
)

Attempts to acquire a lock

returns TRUE on success or the error message on failure

Parameters
string$lockidthe id of the lock
string$source_lockidthe id of the lock that started this locking process
int$expireswhen the lock expires (timestamp or NULL) If expires is set to NULL, the lock will be acquired indefinitely (ie. it will never expire). If expires is set to zero, the lock will be acquired for the current time plus SQ_CONF_LOCK_LENGTH
Returns
mixed boolean|string public

Definition at line 3826 of file mysource.inc.

addMessage (   $msg)

Add a system message

Parameters
string$msgmessage
Returns
void public

Definition at line 3934 of file mysource.inc.

authRedirect ( )

Sees if an auth redirect is available, and then redirects if there is The redirect will be attempted on the same protocol (HTTP or HTTPS) that the original request was made on. If the URL being redirected to does not support the current protocol, it will use the protocol it can use instead.

Returns boolean FALSE if no redirect exists, otherwise this function will NOT return (as a result of exit() being called in do_redirect()).

Returns
boolean public

Definition at line 4144 of file mysource.inc.

broadcastTriggerEvent (   $event_name,
$broadcaster,
  $parameters = NULL 
)

Broadcast a trigger event

Parameters
string$event_namea valid trigger event name
object&$broadcasteran asset that broadcast the event
array$parametersan array of parameters that trigger conditions are expected to understand
Returns
boolean public

Definition at line 4042 of file mysource.inc.

changeContext (   $contextid)

Change the current context, and place it on the stack

Parameters
int$contextidThe ID of the context to change to
Returns
void

Definition at line 2812 of file mysource.inc.

changeDatabaseConnection (   $conn,
  $oci_force_new = FALSE 
)

Alter's which DB connection to use

Parameters
string$conn[db|db2] which DB connection to use
string$oci_force_newforce a new connection for oci
Returns
void public

Definition at line 3557 of file mysource.inc.

constructRollbackWhereClause (   $where = '',
  $table_alias = NULL,
  $prefix = 'WHERE',
  $is_table_alias = TRUE 
)

Given a WHERE clause, this function will append extra where conditions to the clause that allow selection of rollback entries based on the current rollback view mode settings

Parameters
string$wherea current where clause without WHERE on the front NOTE: if the string begins with WHERE, it will be stripped
string$table_aliasthe table alias to add entries for eg. SELECT * FROM asset a –> $table_alias is 'a' so rollback queries for table 'a' get added, otherwise the entries will not be prefixed with an alias
string$prefixthe prefix (eg 'WHERE' or 'AND') to put at the start of the condition
boolean$is_table_aliasTRUE if the specified alias is a table alias, FALSE if it is a column prefix
Returns
string public

Definition at line 3774 of file mysource.inc.

currentUser (   $user)

Returns TRUE if the passed user is the logged in user

Parameters
object$userthe user to check
Returns
boolean public

Definition at line 2581 of file mysource.inc.

currentUserId ( )

Returns the userid of the current user, or zero if none present

Returns
mixed int|string public

Definition at line 2594 of file mysource.inc.

date (   $timestamp = NULL)

Returns date string for the passed timestamp

Parameters
int$timestamptimestamp to format, if null uses current timestamp
Returns
string public

Definition at line 3980 of file mysource.inc.

datetime (   $timestamp = NULL)

Returns date time string for the passed timestamp

Parameters
int$timestamptimestamp to format, if null uses current timestamp
Returns
string public

Definition at line 3965 of file mysource.inc.

deleteContextData (   $contextid)

Deletes the information associated with a deleted context

Returns TRUE on success, FALSE on failure

Parameters
int$contextidThe ID of the condemned context
Returns
boolean

Definition at line 2918 of file mysource.inc.

doTransaction (   $type)

Begin, Commit, or Rollback a transaction

Call as many times as you like. Ensures the transaction manager has been created.

Parameters
string$typethe type of transaction to do (begin, commit, rollback)
Returns
boolean public

Definition at line 3668 of file mysource.inc.

generateLoginKey (   $force_new_key = FALSE)

Generates a new login key and returns it

Parameters
boolean$force_new_keyif TRUE the key will regenerated even if there is already a value save in the session
Returns
string public

Definition at line 2333 of file mysource.inc.

getAllContexts (   $force_reload = FALSE)

Gets and caches information about all contexts

This could be just called from the database each time. This is being placed in a function to allow us to cache the info, as it's unlikely to change within a request.

If it's vital to get the latest context info, call with a parameter of TRUE to force reload.

Parameters
boolean$force_reloadIf TRUE, always reload data from the database. If FALSE, use cache if loaded.
Returns
void

Definition at line 2853 of file mysource.inc.

getAlternateContext ( )

Returns the context we should be using based on the settings on the Context Configuration screen

Returns the ID of the context that we should be using, or '0' (representing the default context) if none are appropriate.

Returns
int

Definition at line 2956 of file mysource.inc.

getContextId ( )

Get the current context ID in force

Todo:
Returns
int

Definition at line 2790 of file mysource.inc.

getDejaVu ( )

Get Deja Vu for that eerie "have me not met before?" feeling.

Always call this function to get Deja Vu, dont use $this->_deja_vu directly

Returns
object public

Definition at line 3448 of file mysource.inc.

& getEventManager ( )

Get the event manager so you can fire events

Always call this function to get the event manager, dont use $this->em directly

Returns
object public

Definition at line 3365 of file mysource.inc.

& getFileVersioning ( )

Get the file versioning object so you can add/remove/commit/checkout file versions

Always call this function to get the file versioning object, dont use $this->fv directly

Returns
object public

Definition at line 3289 of file mysource.inc.

getGlobalDefine (   $index,
  $default = NULL 
)

Get the value of a global define, or $default if the variable doesn't exist

Parameters
string$indexthe index of the variable
string$defaulta default value to return if $index not set
Returns
mixed int|float|string|boolean|array|object|void|NULL public

Definition at line 1112 of file mysource.inc.

& getHipoHerder ( )

Get the HIPO herder so you can queue and run HIPO jobs

Always call this function to get the HIPO herder, dont use $this->hh directly

Returns
object public

Definition at line 3308 of file mysource.inc.

getInstalledPackages ( )

Returns some information about the currently installed packages.

Returns the code name, version, name and description for each of the currently installed packages NOTE: do NOT ever cache the results of this function within the function because some parts of the install require the most up-to-date info about which packages are installed.

Returns
boolean public

Definition at line 4015 of file mysource.inc.

getLockInfo (   $lockid,
  $full_chain = FALSE,
  $check_expires = TRUE,
  $allow_only_one = TRUE 
)

Returns an array of information about the passed lock

Parameters
string | array$lockidthe id of the lock
boolean$full_chainreturn the info for every lock in the lock chain
boolean$check_expirescheck the expiry date and cleanup the lock if it has expired
boolean$allow_only_oneForce only one lock returned
Returns
array public

Definition at line 3907 of file mysource.inc.

& getLogManager ( )

Get the Log Manager

Returns
object public

Definition at line 3421 of file mysource.inc.

& getMessagingService ( )

Get the messaging service object so you can send/receive messages

Always call this function to get the messaging service, dont use $this->ms directly

Returns
object public

Definition at line 3270 of file mysource.inc.

& getMetadataManager ( )

Get the metadata manager so you can manage metadata in the system

Always call this function to get the metadata manager, dont use $this->mm directly

Returns
object public

Definition at line 3327 of file mysource.inc.

& getPublicUser ( )

Returns the userid of the public access user, if it exists in the system

Returns
string public

Definition at line 2613 of file mysource.inc.

getRunLevel ( )

Get the current run level

Returns NULL if no run level has been set

Returns
mixed int|NULL public

Definition at line 3510 of file mysource.inc.

& getTagManager ( )

Get the tag manager

Always call this function to get the event manager, dont use $this->tm directly

Returns
object public

Definition at line 3384 of file mysource.inc.

& getTriggerManager ( )

Get the trigger manager so you can fire trigger events

Always call this function to get the trigger manager, dont use $this->wm directly

Returns
object public

Definition at line 3403 of file mysource.inc.

getUniqueSessionKey ( )

Returns a unique session key

the key can be used to strengthen the sending of the session id as a $_GET variable

Returns
string public

Definition at line 2283 of file mysource.inc.

getUniqueSOAPSessionKey ( )

Returns a unique session key

the key can be used to strengthen the sending of the session id as a $_GET variable

Returns
string public

Definition at line 2310 of file mysource.inc.

getUserPrefs (   $asset_type = NULL,
  $pref = NULL,
  $value_only = TRUE 
)

Get user preferences (user specific config settings) for the current user

Parameters
string$asset_typeAsset type whose preferences we want (leave NULL to get all prefs)
string$prefName of the preference var we want (leave NULL for all prefs for the asset type)
boolean$value_onlyIf TRUE, returns the value of the pref only, rather than all its details
Returns
mixed array|string|boolean public

Definition at line 2696 of file mysource.inc.

& getWorkflowManager ( )

Get the workflow manager so you can manage workflow in the system

Always call this function to get the workflow manager, dont use $this->wm directly

Returns
object public

Definition at line 3346 of file mysource.inc.

init ( )

This initialises all the objects that we need to use, the reason that we can't do this in the constructor is that the Asset_Manager uses the DB in it's constructor in order to load the asset types but if initialise the Asset_Manager in our constructor we don't exist and therefore cannot be accessed to get the DB for the Asset_Manager to use

Returns
void public

Definition at line 258 of file mysource.inc.

insertContextData (   $contextid)

Copies the attribute data for a new contextid from the default

Returns TRUE on success, FALSE on failure

Parameters
int$contextidThe ID of the new context
Returns
boolean

Definition at line 2881 of file mysource.inc.

isGlobalDefineSet (   $index)

Check if a globally defined variable has been set

Parameters
string$indexthe index of the variable
Returns
boolean public

Definition at line 1128 of file mysource.inc.

loginKey ( )

Returns the current login key

Returns
string public

Definition at line 2353 of file mysource.inc.

loginPublicUser ( )

Log in the public user

Returns
void public

Definition at line 1855 of file mysource.inc.

loginUser ( User  $user,
  $invoking_user_full_name = '' 
)

Log in the specified user, setting the session etc as appropriate

SHOULD BE USED WITH CAUTION - the assumption is that this user has already been authenticated

Parameters
User$userThe user object to log in
string$invoking_user_full_nameThe name of the user who has invoked the login (only used from the "Login As..." function)
Returns
void public

Definition at line 2101 of file mysource.inc.

messages ( )

Returns the system messages, array(string)

Returns
array public

Definition at line 3947 of file mysource.inc.

paintLogin (   $heading,
  $msg 
)

Paints the login form, based upon which url we are currently at

Parameters
string$headinga heading to print on the form
string$msga msg to print with the form
Returns
void public

Definition at line 1147 of file mysource.inc.

paintPasswordChange (   $heading,
  $msg 
)

Paints the password change form, based upon which url we are currently at

Parameters
string$headinga heading to print on the form
string$msga msg to print with the form
Returns
void public

Definition at line 1247 of file mysource.inc.

printRollbackWarning ( )

Prints a warning box to let the user know that they are viewing the system in rollback mode Also includes the system time they are viewing and how long ago that was

Returns
void public

Definition at line 3709 of file mysource.inc.

releaseLock (   $lockid)

Release the passed lock

Parameters
string$lockidthe id of the lock to release
Returns
mixed boolean|string public

Definition at line 3850 of file mysource.inc.

replaceKeyword ( $content,
  $additional_replacements = Array() 
)

Highest level of keyword replacement is done here

Parameters
string&$contentthe text to replace keywords in
array$additional_replacementsextra replacements to add
Returns
void public

Definition at line 1042 of file mysource.inc.

restoreContext ( )

Restore the previous context from the stack

Returns
void

Definition at line 2824 of file mysource.inc.

restoreCurrentUser ( )

Reset the current user to the previously assigned user

SHOULD BE USED WITH CAUTION

Returns
boolean public

Definition at line 2246 of file mysource.inc.

restoreDatabaseConnection (   $force_reconnect = FALSE)

Restore the active DB connection to the previous one

Parameters
boolean$force_reconnectset to true for pcntl fork reconnect
Returns
void public

Definition at line 3645 of file mysource.inc.

restoreRunLevel ( )

Restore the run level to the previously set one

Returns
void public

Definition at line 3490 of file mysource.inc.

runLevelEnables (   $security_system)

Check if the current run level enables a particular security sub-system

Parameters
int$security_systemone of the SQ_SECURITY_* constants thats represents the security sub-system we want to check is enabled
Returns
void public

Definition at line 3532 of file mysource.inc.

setCurrentUser ( User  $user)

Sets the current user of the system to be the specified user

SHOULD BE USED WITH CAUTION - no authentication is done inside here This is generally to be used by scripts etc - the session is not updated with the new user's details

Parameters
User$userthe user to make current
Returns
boolean public

Definition at line 2211 of file mysource.inc.

setGlobalDefine (   $index,
  $value 
)

Set a new global define, or overwrite the value of an existing one

Parameters
string$indexthe index of the variable
string$valuethe value of the variable
Returns
void public

Definition at line 1079 of file mysource.inc.

setRunLevel (   $run_level)

Set the current run level

Parameters
int$run_levela combination of any of the SQ_SECURITY_* constants that determine which security sub-systems will be enabled (can also use the SQ_RUN_LEVEL_* constants as short-cuts)
Returns
void public

Definition at line 3477 of file mysource.inc.

setupUser ( )

Set up the current user, reading from the session and checking that conditions are satisfied

Returns
void public

Definition at line 1315 of file mysource.inc.

start ( )

From here is where everything else happens, it starts the ball rolling

Returns
void public

Definition at line 530 of file mysource.inc.

time (   $timestamp = NULL)

Returns time string for the passed timestamp

Parameters
int$timestamptimestamp to format, if null uses current timestamp
Returns
string public

Definition at line 3995 of file mysource.inc.

unsetGlobalDefine (   $index)

Unset a global define

Parameters
string$indexthe index of the variable
Returns
void public

Definition at line 1096 of file mysource.inc.

updateLock (   $lockid,
  $expires = 0 
)

Updates the expiry date of the lock

If the current lock is being held indefinitely (ie. expires = NULL), the lock expiry time will not be updated but the function will return TRUE. You must release an indefinite lock before updating its expiry date. returns TRUE on success, error message on failure

Parameters
string$lockidthe id of the lock
int$expireswhen the lock expires (timestamp or NULL)
Returns
mixed boolean|string public

Definition at line 3880 of file mysource.inc.

userPublic (   $user = NULL)

Is the passed/current user the public user?

Parameters
object$userthe user object you want to test for root access
Returns
boolean public

Definition at line 2676 of file mysource.inc.

userRoot (   $user = NULL)

Is the passed/current user the root user?

Parameters
object$userthe user object you want to test for root access
Returns
boolean public

Definition at line 2629 of file mysource.inc.

userSystemAdmin (   $user = NULL)

Does the passed/current user have effective system administrator access?

To have system administrator access you must be a user with backend access (in default authentication, this translates to a Backend User or above), and be a member of the system administrators group

Parameters
object$userthe user object you want to test for sysadmin access
Returns
boolean public

Definition at line 2651 of file mysource.inc.


The documentation for this class was generated from the following file: