File/program/main_admin.php

Description

/program/main_admin.php - workhorse for site maintenance

This file deals with the administrator interface program for site maintenance. It is included and called from /admin.php.

The work is done in main_admin().

Classes
Class Description
 class AdminOutput conveniently collect output
 class AdminSkin change the looks of the user interface
Constants
JOB_ACCOUNTMANAGER = accountmanager (line 55)

This is used to dispatch the account manager (users and groups)

JOB_CONFIGURATIONMANAGER = configurationmanager (line 58)

This is used to dispatch the configuration manager

JOB_FILEBROWSER = filebrowser (line 43)

This is used to dispatch the file manager in file browser mode (used with CKEditor and FCKeditor)

JOB_FILEMANAGER = filemanager (line 40)

This is used to dispatch the file manager

JOB_FLASHBROWSER = flashbrowser (line 49)

This is used to dispatch the file manager in flash browser mode (used with CKEditor and FCKeditor)

JOB_IMAGEBROWSER = imagebrowser (line 46)

This is used to dispatch the file manager in image browser mode (used with CKEditor and FCKeditor)

JOB_MODULEMANAGER = modulemanager (line 52)

This is used to dispatch the module manager

JOB_PAGEMANAGER = pagemanager (line 37)

This is used to dispatch the page manager

JOB_STARTCENTER = start (line 34)

This is used to dispatch the startcenter job

JOB_STATISTICS = statistics (line 61)

This is used to dispatch the statistics

JOB_TOOLS = tools (line 64)

This is used to dispatch the tool manager

JOB_UPDATE = update (line 67)

This is used to dispatch the update manager

Functions
add_javascript_popup_function (line 502)

add javascript code that implements a popup to the header part of the page

void add_javascript_popup_function ( &$output, [ $m = ''])
  • &$output
  • $m
add_javascript_select_url_function (line 555)

add javascript code that implements a url selection (used in integration with CKEditor/FCKeditor)

This adds a JavaScript-function to the currently generated output page which takes care of returning a URL from a file/image/flash browser to either the (older) FCKeditor or (newer) CKEditor. Since both editors use the same filebrowsers we need to discriminate betweek FCKeditor and CKEditor. This is done by looking at the parameters: the CKEditor provides the number of an anonymous function in the parameter 'CKEditorFuncNum'. If this parameter is set we use the (integer) value for the callback to CKEditor. If it is not set we assume the old interface with FCKeditor.

Note that our actual file browser is supposed to remember this parameter, otherwise the file browser will assume FCKeditor after navigating to another page within the file browser. See also filemanager.class.php We remember the parameter via a session variable which is easier than propagating this number by adding it to every link within the file browser. However, we do update this function number every time the parameter 'CKEditorFuncNum' is specified, ie. on the first call to a file browser from CKEditor, ie. whenerver the user starts browsing the server.

  • return: generated JavaScript-code added to HTML-headers
void add_javascript_select_url_function (object &$output, [string $m = ''])
  • object &$output: collects the html output
  • string $m: left margin for increased readability
admin_continue_session (line 418)

continue the session from the previous call OR exit

This tries to resume the session that was initiated before (when the user logged in succesfully). If the session cannot be resumed, we logout the user, show the login screen and exit. In other words: this routine guarantees that a valid session exists if and when this routine returns. If the routine returns, it returns the user_id.

  • return: on success the $user_id is returned else a logout + exit is forced
  • uses: dbsessionlib.php
  • uses: $CFG;
void|int admin_continue_session ()
admin_login (line 388)

perform a step in the login procedure

This routine may not return at all. If it returns, the user is logged in successfully and the return value is the user_id (unique identification for the user, pkey in users table). The steps in the login procedure are defined in loginlib.php.

  • return: if the function returns it returns an integer indicating the user_id
  • uses: loginlib.php
  • uses: $CFG
void|int admin_login (mixed $step)
  • mixed $step: the step in the login procedure
admin_logout_and_exit (line 366)

logout the user and exit

This logs out the user (ie kills the session) If there is an error (ie, there was no session in the first place) indicated by was_logout() returning, we unconditionally show a login dialog and exit. So, this routine never returns.

  • return: this function never returns
  • uses: loginlib.php
  • uses: $CFG
void admin_logout_and_exit ()
admin_show_login_and_exit (line 450)

show login dialog and exit

  • return: this function never returns
  • uses: loginlib.php
  • uses: $CFG
void admin_show_login_and_exit ([ $message = ''])
  • $message
get_current_skin (line 1728)

determine the default skin to use

This routine determines which skin to use in AdminOutput. It always returns a valid skin (using 'base' in case of error).

  • return: a valid skin name
  • uses: $_SESSION;
  • uses: $USER;
string get_current_skin ()
get_versioncheck_url (line 587)

construct URL for version check agains the project's website

this constructs the URL for checking the installed version against the current version on the project's website. The remote site will respond with a readable text and the user can decide to act on the information (or not). We don't want to force any upgrades etc.

  • return: URL which points to the project's version check routine
string get_versioncheck_url ()
job_start (line 302)

generate the start centre page

This is the handler for the start centre. This is the only handler that is NOT included from another file. Basically it shows a screen with hints on how to proceed with this program.

  • todo: this routine is a stub
void job_start (object &$output)
  • object &$output: output collector
main_admin (line 105)

main program for site maintenance

This is the main administrator program. First step is to deal with users logging in or out. If a user is not logged in, a login dialog is displayed. If a user is logged in but has no admin privileges, she is redirected to the public site (ie. index.php).

Once we have established that the user is an administrator, we setup an output collecting object and see what the user wants us to do by interpreting the parameter 'job'. If the user has access to the specified job, the corresponding code is included and the main routine of that handler is called. It is then the responsability of that handler to further decide what needs to be done. After the handler returns, the collected output is sent to the user. This includes the main navigation (i.e. links to the various 'managers') and also the menu and the content generated by the handler.

If the user has no privilege to access a particular manager, an error messate is displayed in both the message area and the content area. This makes it clear to the user that access is denied. Note that the inaccessible items are displayed in the main navigation via 'dimmed' (light-grey) links or black/white images. By showing these 'dimmed' links, the user will be aware that there is more that just what she is allowed to see. This is more transparent than suppressing items and keeping them secret.

  • return: generated page sent to user's browser
  • todo: should we cater for a special 'print' button + support for a special style sheet for media="print"?
  • uses: $USER;
  • uses: $LANGUAGE;
  • uses: $CFG;
void main_admin ()
non_admin_redirect_and_exit (line 469)

tell non-admin-user access denied and exit

this routine shows a supersimple screen for an intranet user (ie. someone without admin privileges) who accidently hit admin.php to go and look elsewhere by presenting a link to index.php or to admin.php?login=1.

  • return: this function never returns
  • uses: $CFG
void non_admin_redirect_and_exit ()

Documentation generated on Tue, 28 Jun 2016 19:10:19 +0200 by phpDocumentor 1.4.0