Support Incident Tracker GIT4.x
journal.inc.php File Reference

Go to the source code of this file.

Functions

if(realpath(__FILE__)==realpath($_SERVER['SCRIPT_FILENAME'])) journal ($loglevel, $event, $bodytext, $journaltype, $refid)

Function Documentation

if (realpath(__FILE__)==realpath($_SERVER['SCRIPT_FILENAME'])) journal ( loglevel,
event,
bodytext,
journaltype,
refid 
)

Inserts an entry into the Journal table and marks the user online

Author:
Ivan Lucas, Kieran Hogg
Parameters:
int$loglevelThe log level required for this event to be logged
string$eventText title for the event
string$bodytextText describing the event in detail
int$journaltypeOne of the defined journal types
int$refidAn ID to relate to data, the table this ID is for depends on the journal type used
Returns:
TRUE success, entry logged, FALSE failure. entry not logged
Note:
Produces an audit log

Definition at line 30 of file journal.inc.php.

References $bodytext, $CONFIG, $dbJournal, $result, $sql, and E_USER_WARNING.

Referenced by authenticate(), authenticateSQL(), delete_signature(), and display_update_page().

{
    global $CONFIG, $sit, $dbJournal;
    // Journal Types
    // 1 = Logon/Logoff
    // 2 = Support Incidents
    // 3 = -Unused-
    // 4 = Sites
    // 5 = Contacts
    // 6 = Admin
    // 7 = User Management

    // Logging Level
    // 0 = No logging
    // 1 = Minimal Logging
    // 2 = Normal Logging
    // 3 = Full Logging
    // 4 = Max Debug Logging

    $bodytext = mysql_real_escape_string($bodytext);
    if ($loglevel <= $CONFIG['journal_loglevel'])
    {
        $sql  = "INSERT INTO `{$dbJournal}` ";
        $sql .= "(userid, event, bodytext, journaltype, refid) ";
        $sql .= "VALUES ('{$_SESSION['userid']}', '{$event}', '{$bodytext}', '{$journaltype}', '{$refid}') ";
        $result = mysql_query($sql);
        if (mysql_error()) trigger_error(mysql_error(),E_USER_WARNING);
        return TRUE;
    }
    else
    {
        // Below minimum log level - do nothing
        return FALSE;
    }
}