You are viewing Revision 2 of Script_Flow

This page will attempt to explain the process flow of the Aneuch script. It might be useful to both contributors to the mainline Aneuch source, as well as plugin developers.

  • Init
    This is the very first subroutine called. It calls the following:
    • InitScript
      Determines $Url, $ShortUrl, $ScriptName and $ShortScriptName
    • InitConfig
      Executes $ConfFile (default 'config.pl'), which sets user-configured variables
    • InitVars
      Initializes default variables. If a variable was set in the previous step (InitConfig) it will not be over-written. This is also where several "special" things get declared via: RegCommand, RegAdminPage, RegPostAction, RegSpecialPage
      • InitDirs
        Initializes directories (if this is the first time Aneuch is ran)
    • LoadPlugins
      This is where all plugins get loaded. Plugins should end in the extensions '.pl' or '.pm', and be in the $PluginDir directory.
    • DoPostInit
      Calls any sub that has been registered using RegPostInitSub.
  • DoRequest
    Handles the current request. The following are called as part of this:
    • IsBlocked
      Checks if the current user is blocked.
      • ErrorPage
        If the user is blocked, call ErrorPage with a 403 error.
    • DoSurgeProtection
      If this returns true, call:
      • ErrorPage
        Called with 503 error.
    • ReadIn
      Checks if the script is getting POST data.
      • DoPosting
        If ReadIn return true (1), call DoPosting.
        • If the 'doing' element of the submitted data exists in %PostingActions, then execute it.
    • CanView
      Checks if the user can view ($SiteMode < 3, or authenticated). If not, redirect to login page.
    • Checks if the "do" parameter is "random", and if so, execute $Comands{'random'}.
    • Check if page requested (or if a command, if the command is defined), and if not, set $HTTPStatus to 404 error.
    • If the command is 'revision', check if the requested page revision exists, and if not, set $HTTPStatus to 404 error.
    • DoHeader
      This prints out everything that belongs to the theme's header.
    • If a command is being called (GetParam('do')), and it is defined, execute the command.
    • OR if the page does not exist, send out the contents of $NewPage (default 'It appears that there is nothing here.')
    • OR if the page does exist, and Markup exists:
      • Markup
        Send the text from $Page to Markup, which should return properly formatted HTML.
        • MarkupBuildLink
          Takes any text between two ['s and two ]'s and returns an HTML anchor element (<a>).
    • IF Markup does not exist:
      • Send the text from $Page out to the browser
    • DoSpecialPage
      If the current $Page matches something defined via RegSpecialPage, execute its associated subroutine.
    • DoFooter
      This prints out everything that belongs to the theme's footer.
  • DoVisit
    Records the details of the current browse request to $VisitorLog
  • DoMaint
    Calls any subroutines defined to %MaintActions, which are used to clean up temp files, $VisitorLog, etc.