Administrator Logging

There are two forms of administrator logging in Continuum CMS:

  • logging of what pages an administrator views in the Control Center
  • logging of what actions that an administrator makes.

Both forms of logging are reported in “Admin Stats” in the Utilities module.

Logging views

The logging of what pages an administrator views is handled automatically by Continuum CMS in the public_html/jadu/includes/ session_header.php file. This file should be included in all Control Center scripts and therefore page logging is something that can be considered as “built-in”.

Logging actions

Administrator action logging concerns the actions administrators make on Control Center pages, for example creating, updating or deleting an item of content. It is the responsibility of the developer to add appropriate action logging to the database interaction functions.

Functions for logging administrator actions are located in the jadu/utilities/JaduAdminPageActions.php.

Three constants are provided to represent the three different types of actions that can be recorded:

  • ADMIN_SUBMIT_NEW
  • ADMIN_SUBMIT_UPDATE
  • ADMIN_SUBMIT_DELETE

These constants are analogous to the SQL verbs insert, update and delete respectively and should be used in the functions that make the corresponding queries.

The newAdminPageAction function should be used to log a page action. This function has the following signature:

newAdminPageAction ($action, $dbTable, $title)

The parameters of this function should be used as follows:

  • $action: ADMIN_SUBMIT_NEW, ADMIN_SUBMIT_UPDATE or ADMIN_SUBMIT_DELETE
  • $dbTable: the database table that has been updated
  • `$title: a string to describe the content

Examples of the function in use can be found in many files in the jadu directory. Here is how it is used in the newBlog($blog) function:

function newBlog($blog)
{
    global $db;

    $query = "INSERT INTO " . BLOG_TABLE .
                "(allowComments, title, moderateComments, " .
                "templateID, dateCreated, description, ".
                "adminID, friendlyURL, adminEmail, adminPassword, ".
                "itemsPerPage, enableFeed, private, useTaxonomy, " .
                "dateFormat, archiveFormat, socialNetworkingLinks, ".
                "postNotificationEmail, commentNotificationEmail, ".
                "allowPostByEmail, live) VALUES (" .
                intval($blog->allowComments) . ", " .
                $db->qstr($blog->title) . ", " .
                intval($blog->moderateComments) . ", " .
                intval($blog->templateID) . ", " .
                $db->DBTimeStamp(time()) . ", " .
                $db->qstr($blog->description) . ", " .
                intval($blog->adminID) . ", " .
                $db->qstr($blog->friendlyURL) . ", " .
                $db->qstr($blog->adminEmail) . ", " .
                $db->qstr(sha1($blog->adminPassword)) . ", " .
                intval($blog->itemsPerPage) . ", " .
                intval($blog->enableFeed) . ", " .
                intval($blog->private) . ", " .
                intval($blog->useTaxonomy) . ", " .
                $db->qstr($blog->dateFormat) . ", " .
                $db->qstr($blog->archiveFormat) . ", " .
                intval($blog->socialNetworkingLinks) . ", " .
                $db->qstr($blog->postNotificationEmail) . ", " .
                intval($blog->commentNotificationEmail) . ", " .
                intval($blog->allowPostByEmail) . ", " .
                intval($blog->live) . ")";

    $db->Execute($query);
    deleteTableCache(BLOG_TABLE);
    $blogID = $db->Insert_ID();
    newAdminPageAction(ADMIN_SUBMIT_NEW, BLOG_TABLE, "Blogs: $blog->title");
    return $blogID;
}

results matching ""

    No results matching ""