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

Go to the source code of this file.

Functions

if(get_magic_quotes_gpc()) authenticateSQL ($username, $password)
 authenticate ($username, $password)
 authenticateContact ($username, $password)
 db_read_column ($column, $table, $id)
 permission_name ($permissionid)
 software_name ($softwareid)
 product_name ($id)
 sit_error_handler ($errno, $errstr, $errfile, $errline, $errcontext)
 debug_log ($logentry, $debugmodeonly=FALSE)
 send_email ($to, $from, $subject, $body, $replyto='', $cc='', $bcc='')
 global_signature ()
 dashboard_do ($context, $row=0, $dashboardid=0)
 show_dashboard_component ($row, $dashboardid)
 is_dashlet_installed ($dashlet)
 show_form_errors ($formname)
 clear_form_errors ($formname)
 clear_form_data ($formname)
 schedule_actions_due ()
 schedule_action_started ($action)
 schedule_action_done ($doneaction, $success=TRUE)
 session_regenerate ()
 application_url ()
 setup_user_triggers ($userid)
 application_version_string ()
 database_schema_version ()
 populate_syslang ()
 create_report ($data, $output= 'table', $filename= 'report.csv')
 add_charting_library ($library)
 check_install_status ()
 convert_string_null_safe ($string)
if(is_array($CONFIG['plugins'])) plugin_register ($context, $action)
 plugin_do ($context, $optparams=FALSE)

Variables

 if (realpath(__FILE__)==realpath($_SERVER['SCRIPT_FILENAME']))
if(!extension_loaded('mysql'))
trigger_error('SiT requires
the php/mysql module
E_USER_ERROR
if(!extension_loaded('imap')
AND $CONFIG['enable_inbound_mail']==
'POP/IMAP') if(version_compare(PHP_VERSION,"5.0.0","
<")) trigger_error('INFO some
features may not work properly
register_globals
register_globals on 
Error
if(!extension_loaded('imap')
AND $CONFIG['enable_inbound_mail']==
'POP/IMAP') if(version_compare(PHP_VERSION,"5.0.0","
<")) trigger_error('INFO some
features may not work properly
register_globals
register_globals on there are
potential security risks
involved with leaving it as it
is Stopping SiT 
now

Function Documentation

add_charting_library ( library)

Function to add a additional charting library to SiT! Please use this function rather than manually adjusting the array, prevents plugins accidentally corrupting the array

Parameters:
String$libraryThe library to add
Author:
Paul Heaney

Definition at line 1214 of file functions.inc.php.

References $CONFIG.

{
    global $CONFIG;

    $CONFIG['available_charts'][] = $library;
}
application_url ( )

Outputs the full base url of the install, e.g. http://www.example.com/

Returns:
string base url of the install
Author:
Kieran Hogg

Definition at line 964 of file functions.inc.php.

References $_SERVER, $CONFIG, and $url.

Referenced by dashboard_clock_display(), tms_backup_menu(), and tms_log_menu().

{
    global $CONFIG;
    if (empty($CONFIG['application_uriprefix']))
    {
        $url = parse_url($_SERVER['HTTP_REFERER']);
        if ($_SERVER['HTTPS'] == 'off' OR empty($_SERVER['HTTPS']))
        {
            $baseurl = "http://";
        }
        else
        {
            $baseurl = "https://";
        }
        $baseurl .= "{$_SERVER['HTTP_HOST']}";
    }
    else
    {
        $baseurl = "{$CONFIG['application_uriprefix']}";
    }
    $baseurl .= "{$CONFIG['application_webpath']}";

    return $baseurl;
}
application_version_string ( )

Function to return currently running SiT! version

Returns:
String - Currently running application version

Definition at line 1040 of file functions.inc.php.

References $application_version_string.

authenticate ( username,
password 
)

Authenticate a user

Author:
Lea Anthony
Parameters:
string$username,.Username
string$password,.Password
Returns:
an integer to indicate whether the user authenticated against any authentication backends
Return values:
boolfalse the credentials were wrong or the user was not found.
booltrue to indicate user is authenticated and allowed to continue.

Definition at line 154 of file functions.inc.php.

References $CONFIG, $obj, $password, $result, $sql, $username, authenticateLDAP(), debug_log(), E_USER_ERROR, E_USER_WARNING, elseif, and journal().

Referenced by login().

{
    global $CONFIG;
    $toReturn = false;

    if (!empty($username) AND !empty($password))
    {
        $sql = "SELECT id, password, status, user_source FROM `{$GLOBALS['dbUsers']}` WHERE username = '{$username}'";
        $result = mysql_query($sql);
        if (mysql_error()) trigger_error(mysql_error(),E_USER_WARNING);
        if (mysql_num_rows($result) == 1)
        {
            // Exist in SiT DB
            $obj = mysql_fetch_object($result);
            if ($obj->user_source == 'sit')
            {
                if (md5($password) == $obj->password AND $obj->status != 0) $toReturn = true;
                else $toReturn = false;
            }
            elseif ($obj->user_source == 'ldap')
            {
                // Auth against LDAP and sync
                $toReturn =  authenticateLDAP(stripslashes($username), $password, $obj->id);
                if ($toReturn === -1)
                {
                    // Communication with LDAP server failed
                    if ($CONFIG['ldap_allow_cached_password'])
                    {
                        // Use cached password
                        if (md5($password) == $obj->password AND $obj->status != 0) $toReturn = true;
                        else $toReturn = false;
                    }
                    else
                    {
                        $toReturn = false;
                    }
                }
                elseif ($toReturn)
                {
                    $toReturn = true;
                }
                else
                {
                    $toReturn = false;
                }
            }
        }
        elseif (mysql_num_rows($result) > 1)
        {
            // Multiple this should NEVER happen
            trigger_error("Username not unique", E_USER_ERROR);
            $toReturn = false;
        }
        else
        {
            // Don't exist, check LDAP etc
            if ($CONFIG['use_ldap'])
            {
                $toReturn =  authenticateLDAP($username, $password);
                if ($toReturn === -1) $toReturn = false;
            }
        }

        if ($toReturn)
        {
            journal(CFG_LOGGING_MAX,'User Authenticated',"{$username} authenticated from " . getenv('REMOTE_ADDR'),CFG_JOURNAL_LOGIN,0);
            debug_log ("Authenticate: User authenticated",TRUE);
        }
        else
        {
            debug_log ("authenticate: User NOT authenticated",TRUE);
        }
    }
    else
    {
        debug_log ("Blank username or password for user thus denying access");
        $toReturn = false;
    }

    return $toReturn;
}
authenticateContact ( username,
password 
)

Definition at line 237 of file functions.inc.php.

References $CONFIG, $obj, $password, $result, $sql, $username, authenticateLDAP(), debug_log(), E_USER_ERROR, E_USER_WARNING, and elseif.

{
    debug_log ("authenticateContact called");
    global $CONFIG;
    $toReturn = false;

    if (!empty($username) AND !empty($password))
    {
        $sql = "SELECT id, password, contact_source, active FROM `{$GLOBALS['dbContacts']}` WHERE username = '{$username}'";
        $result = mysql_query($sql);
        if (mysql_error()) trigger_error(mysql_error(),E_USER_WARNING);
        if (mysql_num_rows($result) == 1)
        {
            debug_log ("Authenticate: Just one contact in db");
            // Exists in SiT DB
            $obj = mysql_fetch_object($result);
            if ($obj->contact_source == 'sit')
            {
                if ((md5($password) == $obj->password OR $password == $obj->password) AND $obj->active == 'true') $toReturn = true;
                else $toReturn = false;
            }
            elseif ($obj->contact_source == 'ldap')
            {
                // Auth against LDAP and sync
                $toReturn =  authenticateLDAP($username, $password, $obj->id, false);
                if ($toReturn === -1)
                {
                    // Communication with LDAP server failed
                    if ($CONFIG['ldap_allow_cached_password'])
                    {
                        debug_log ("LDAP connection failed, using cached password");
                        // Use cached password
                        if ((md5($password) == $obj->password OR $password == $obj->password) AND $obj->active == 'true') $toReturn = true;
                        else $toReturn = false;
                        debug_log ("Cached contact {$toReturn} {$password}");

                    }
                    else
                    {
                        debug_log ("Cached passwords are not enabled");
                        $toReturn = false;
                    }
                }
                elseif ($toReturn)
                {
                    $toReturn = true;
                }
                else
                {
                    $toReturn = false;
                }
            }
            else
            {
                debug_log ("Source SOMETHING ELSE this shouldn't happen'");
                $toReturn = false;
            }
        }
        elseif (mysql_num_rows($result) > 1)
        {
            debug_log ("Multiple");
            // Multiple this should NEVER happen
            trigger_error($GLOBALS['strUsernameNotUnique'], E_USER_ERROR);
            $toReturn = false;
        }
        else
        {
            debug_log ("Authenticate: No matching contact '$username' found in db");
            // Don't exist, check LDAP etc
            if ($CONFIG['use_ldap'] AND !empty($CONFIG['ldap_customer_group']))
            {
                $toReturn =  authenticateLDAP($username, $password, 0, false);
                if ($toReturn === -1) $toReturn = false;
            }
        }
    }
    else
    {
        debug_log ("Blank username or password for user thus denying access");
        $toReturn = false;
    }

    debug_log ("authenticateContact returning {$toReturn}");
    return $toReturn;
}
if (get_magic_quotes_gpc()) authenticateSQL ( username,
password 
)

Authenticate a user with a username/password pair

Author:
Ivan Lucas
Parameters:
string$username,.A username
string$password,.A password (non-md5)
Returns:
an integer to indicate whether the user authenticated against the database
Return values:
int0 the credentials were wrong or the user was not found.
int1 to indicate user is authenticated and allowed to continue.

Definition at line 113 of file functions.inc.php.

References $_SESSION, $dbUsers, $password, $result, $sql, E_USER_WARNING, and journal().

{
    global $dbUsers;

    $password = md5($password);
    if ($_SESSION['auth'] == TRUE)
    {
        // Already logged in
        return 1;
    }

    // extract user
    $sql  = "SELECT id FROM `{$dbUsers}` ";
    $sql .= "WHERE username = '{$username}' AND password = '{$password}' AND status != 0 ";
    // a status of 0 means the user account is disabled
    $result = mysql_query($sql);
    if (mysql_error()) trigger_error(mysql_error(),E_USER_WARNING);

    // return appropriate value
    if (mysql_num_rows($result) == 0)
    {
        mysql_free_result($result);
        return 0;
    }
    else
    {
        journal(CFG_LOGGING_MAX,'User Authenticated',"{$username} authenticated from " . getenv('REMOTE_ADDR'),CFG_JOURNAL_LOGIN,0);
        return 1;
    }
}
check_install_status ( )

Checks the environment for SiT requirements

Author:
Paul Heaney
Returns:
Status The status of SiT

Definition at line 1227 of file functions.inc.php.

References $s.

{
    $s = new Status();
    $s->mysql_check();
    $s->add_extension_check('mysql', 'PHP MySQL Driver', INSTALL_FATAL);
    $s->add_extension_check('mbstring', 'PHP Multibyte', INSTALL_FATAL);
    $s->add_extension_check('ldap', 'PHP LDAP', INSTALL_WARN);
    $s->add_extension_check('imap', 'PHP IMAP', INSTALL_WARN);
    $s->add_extension_check('zlib', 'PHP Zlib Compression', INSTALL_FATAL);
    $s->add_extension_check('session', 'PHP Session', INSTALL_FATAL);
    $s->add_extension_check('pcre', 'PHP Regular Expression', INSTALL_FATAL);

    return $s;
}
clear_form_data ( formname)

Cleans form data by clearing the formdata array in the users session

Author:
Kieran Hogg
Parameters:
string$formname,.The form name to clear.
Returns:
nothing

Definition at line 811 of file functions.inc.php.

References $_SESSION.

Referenced by process_new_contact(), and show_new_contact().

{
    unset($_SESSION['formdata'][$formname]);
}
clear_form_errors ( formname)

Cleans form errors by clearing the formerrors array in the users session

Author:
Kieran Hogg
Parameters:
string$formname,.The form name to clear.
Returns:
nothing

Definition at line 799 of file functions.inc.php.

References $_SESSION.

Referenced by display_update_page(), process_new_contact(), show_edit_site(), and show_new_contact().

{
    unset($_SESSION['formerrors'][$formname]);
}
convert_string_null_safe ( string)

Makes a string suitable for database insertion where NUll is possible. It checks to see if the string is empty if so returns Null else the string enclosed in quotes

Author:
Paul Heaney
Parameters:
String$stringthe string to be checked
Returns:
String either "Null" or "'$string'"

Definition at line 1250 of file functions.inc.php.

Referenced by process_new_contact().

{
    if ($string == '') return 'Null';
    else return "'{$string}'";
}

// -------------------------- // -------------------------- // --------------------------
// leave this section at the bottom of functions.inc.php ================================

// Evaluate and Load plugins
if (is_array($CONFIG['plugins']))
{
    foreach ($CONFIG['plugins'] AS $plugin)
    {
        $plugin = trim($plugin);
        // Remove any dots
        $plugin = str_replace('.','',$plugin);
        // Remove any slashes
        $plugin = str_replace('/','',$plugin);

        $plugini18npath = APPLICATION_PLUGINPATH . "{$plugin}". DIRECTORY_SEPARATOR . "i18n". DIRECTORY_SEPARATOR;
        $pluginfilename = APPLICATION_PLUGINPATH . $plugin . DIRECTORY_SEPARATOR . "{$plugin}.php";
        if ($plugin != '')
        {
            if (file_exists($pluginfilename))
            {
                include ($pluginfilename);
                // Load i18n if it exists
                if (file_exists($plugini18npath))
                {
                    @include ("{$plugini18npath}{$CONFIG['default_i18n']}.inc.php");
                    if (!empty($_SESSION['lang'])
                        AND $_SESSION['lang'] != $CONFIG['default_i18n'])
                    {
                        @include ("{$plugini18npath}{$_SESSION['lang']}.inc.php");
                    }

                    // TODO We should parse the folder for other languages rather than just include
                    // If syslang and user lang isn't found we fall back to en-GB
                    if (!file_exists("{$plugini18npath}{$CONFIG['default_i18n']}.inc.php") AND (!file_exists("{$plugini18npath}{$_SESSION['lang']}.inc.php")))
                    {
                        @include ("{$plugini18npath}en-GB.inc.php");
                    }
                }
            }
            else
            {
                // Only trigger a warning if headers are sent
                // No need to break whole pages
                if (headers_sent())
                {
                    trigger_error("Plugin '{$plugin}' could not be found.", E_USER_WARNING);
                }
            }
        }
    }
}
create_report ( data,
output = 'table',
filename = 'report.csv' 
)

Outputs a table or csv file based on csv-based array

Author:
Kieran Hogg
Parameters:
array$dataArray of data, see
Note:
for format
Parameters:
string$ouputWhether to show a table or create a csv file
Returns:
string $html The html to produce the output
Note:
format: $array[] = 'Colheader1,Colheader2'; $array[] = 'data1,data2';

Definition at line 1152 of file functions.inc.php.

References $data, $output, beginsWith(), colheader(), and user_alert().

{
    $data = explode("\n", $data);
    if ($output == 'table')
    {
        $html = "\n<table class='maintable'><tr>\n";
        $headers = explode(',', $data[0]);
        $rows = sizeof($headers);
        foreach ($headers as $header)
        {
            $html .= colheader($header, $header);
        }
        $html .= "</tr>";

        if (sizeof($data) == 1)
        {
            $html .= "<tr><td rowspan='{$rows}'>" . user_alert($GLOBALS['strNoRecords'], E_USER_NOTICE) . "</td></tr>";
        }
        else
        {
            // use 1 -> sizeof as we've already done one row
            for ($i = 1; $i < sizeof($data); $i++)
            {
                $html .= "<tr>";
                $values = explode(',', $data[$i]);
                foreach ($values as $value)
                {
                    $html .= "<td>$value</td>";
                }
                $html .= "</tr>";
            }
        }
        $html .= "</table>";
    }
    else
    {
        $html = header("Content-type: text/csv\r\n");
        $html .= header("Content-disposition-type: attachment\r\n");
        $html .= header("Content-disposition: filename={$filename}");

        foreach ($data as $line)
        {
            if (!beginsWith($line, "\""))
            {
                    $line = "\"".str_replace(",", "\",\"",$line)."\"\r\n";
            }

            $html .= $line;
        }
    }

    return $html;
}
dashboard_do ( context,
row = 0,
dashboardid = 0 
)

Wrapper function to call dashboard_*_do() within a dashlet plugin See dashlet() for more information

Author:
Ivan Lucas
Parameters:
string$context
string$row
string$dashboardid

Definition at line 711 of file functions.inc.php.

References $action, and $context.

Referenced by show_dashboard_component().

{
    global $DASHBOARDCOMP;
    $dashletid = "{$row}-{$dashboardid}";
    $action = $DASHBOARDCOMP[$context];
    if ($action != NULL || $action != '')
    {
        if (function_exists($action)) $action($dashletid);
    }
}
database_schema_version ( )

Returns the currently running schema version

Author:
Paul Heaney
Returns:
String - currently running schema version

Definition at line 1052 of file functions.inc.php.

References $result, $return, $sql, and E_USER_WARNING.

{
    $return = '';
    $sql = "SELECT `schemaversion` FROM `{$GLOBALS['dbSystem']}` WHERE id = 0";
    $result = mysql_query($sql);
    if (mysql_error())
    {
        trigger_error("MySQL Query Error ".mysql_error(), E_USER_WARNING);
        $return = FALSE;
    }

    if (mysql_num_rows($result) > 0)
    {
        list($return) = mysql_fetch_row($result);
    }

    return $return;
}
db_read_column ( column,
table,
id 
)

Returns a specified column from a specified table in the database given an ID primary key

Author:
Ivan Lucas
Parameters:
string$columna database column
string$tablea database table
int$idthe primary key / id column
Returns:
A column from the database
Note:
it's not always efficient to read a single column at a time, but when you only need one column, this is handy

Definition at line 334 of file functions.inc.php.

References $result, $sql, and E_USER_WARNING.

Referenced by closingstatus_name(), contact_email(), contact_fax(), contact_phone(), contact_siteid(), contact_username(), contract_product(), contract_slaid(), contract_slatag(), holding_email_update_id(), incident_ccemail(), incident_contact(), incident_externalemail(), incident_externalengineer(), incident_externalid(), incident_maintid(), incident_owner(), incident_priority(), incident_slaid(), incident_status(), incident_timeofnextaction(), incident_title(), incident_towner(), incidents_remaining(), maintenance_siteid(), permission_name(), product_name(), site_name(), site_salesperson(), site_salespersonid(), site_telephone(), user_accepting(), user_email(), user_holiday_entitlement(), user_holiday_resetdate(), user_message(), user_mobile(), user_password(), user_phone(), user_signature(), user_status(), user_status_name(), and userstatus_name().

{
    $sql = "SELECT `{$column}` FROM `{$table}` WHERE id ='$id' LIMIT 1";
    $result = mysql_query($sql);
    if (mysql_error()) trigger_error("MySQL Query Error ".mysql_error(), E_USER_WARNING);
    if (mysql_num_rows($result) == 0)
    {
        $column = FALSE;
    }
    else
    {
        list($column) = mysql_fetch_row($result);
    }
    return $column;
}
debug_log ( logentry,
debugmodeonly = FALSE 
)

Write an entry to the configured error logfile

Author:
Ivan Lucas
Parameters:
string$logentry,.A line, or lines to write to the log file (with newlines
)
bool$debugmodeonly,.Only write an entry if debug mode is TRUE
Return values:
boolTRUE log entry written
boolFALSE log entry not written

Definition at line 568 of file functions.inc.php.

References $_SERVER, $CONFIG, and E_USER_WARNING.

Referenced by Trigger::__construct(), Mailbox::archiveEmail(), authenticate(), authenticateContact(), authenticateLDAP(), cmi_create_table(), Mailbox::connect(), Mailbox::deleteEmail(), draw_calendar(), get_user_config_vars(), User::getSOAPArray(), Incident::getSOAPArray(), ldap_getDetails(), ldap_storeDetails(), ldapCheckObjectExists(), ldapGroupBrowse(), ldapImportCustomerFromEmail(), ldapNamingContexts(), ldapOpen(), list_incidents(), Mailbox::messageBody(), replace_vars(), saction_ldapSync(), saction_SetUserStatus(), saction_tms_backup(), saction_tms_backup_purge(), schedule_actions_due(), send_email(), set_user_status(), sit_error_handler(), and user_count_holidays().

{
    global $CONFIG;
    if ($debugmodeonly === FALSE
        OR ($debugmodeonly === TRUE AND $CONFIG['debug'] == TRUE))
    {
        $logentry = $_SERVER["SCRIPT_NAME"] . ' ' .$logentry;

        if (substr($logentry, -1) != "\n") $logentry .= "\n";
        if (!empty($CONFIG['error_logfile']))
        {
            if (file_exists($CONFIG['error_logfile']))
            {
                if (is_writable($CONFIG['error_logfile']))
                {
                    $fp = fopen($CONFIG['error_logfile'], 'a+');
                    if ($fp)
                    {
                        fwrite($fp, date('c').' '.$logentry);
                        fclose($fp);
                    }
                    else
                    {
                        echo "<p class='error'>Could not log message to error_logfile</p>";
                        trigger_error("Could not log message to error_logfile", E_USER_NOTICE);
                        return FALSE;
                    }
                    return TRUE;
                }
                else
                {
                    trigger_error("Debug log file (error_logfile) [{$CONFIG['error_logfile']}] not writable", E_USER_WARNING);
                }
            }
            else
            {
                trigger_error("Debug log file (error_logfile) [{$CONFIG['error_logfile']}] not found", E_USER_WARNING);
            }
        }
        else
        {
            return FALSE;
        }
    }
    else return TRUE;
}
global_signature ( )

Return a global signature chosen at random

Author:
Ivan Lucas
Note:
This is inefficient SQL but shouldn't be too much of a problem since there are usually a low number records in this table.

Definition at line 693 of file functions.inc.php.

References $result, $signature, and $sql.

{
    $sql = "SELECT signature FROM `{$GLOBALS['dbEmailSig']}` ORDER BY RAND() LIMIT 1";
    $result = mysql_query($sql);
    list($signature) = mysql_fetch_row($result);
    mysql_free_result($result);
    return $signature;
}
is_dashlet_installed ( dashlet)

Checks to see if a dashlet is installed

Author:
Paul Heaney
Parameters:
String$dashletThe name of the dashlet
Return values:
boolTRUE installed
boolFALSE not installed

Definition at line 751 of file functions.inc.php.

References $result, $sql, and E_USER_WARNING.

{
    $sql = "SELECT id FROM `{$GLOBALS['dbDashboard']}` WHERE name = '{$dashlet}'";
    $result = mysql_query($sql);
    if (mysql_error()) trigger_error("MySQL Query Error ".mysql_error(), E_USER_WARNING);
    if (mysql_num_rows($result) == 1)
    {
        return TRUE;
    }
    else
    {
        return FALSE;
    }
}
permission_name ( permissionid)
Author:
Ivan Lucas
Note:
: Requires permission names to be i18n strings in the database table

Definition at line 355 of file functions.inc.php.

References $dbPermissions, and db_read_column().

{
    global $dbPermissions;
    $name = db_read_column('name', $dbPermissions, $permissionid);
    if (empty($name)) $name = $GLOBALS['strUnknown'];
    else $name = $GLOBALS["{$name}"];
    return $name;
}
plugin_do ( context,
optparams = FALSE 
)

Call a plugin function that handles a given context

Author:
Ivan Lucas
Parameters:
string$context- Plugin context,
string$optparms- Optional parameters
Return values:
mixed- Whatever the plugin function returns
Note:
This function calls a plugin function or multiple plugin functions, if they exist. see http://sitracker.org/wiki/CreatingPlugins for help and a list of contexts

Definition at line 1335 of file functions.inc.php.

References $context, and elseif.

Referenced by draw_chart(), generate_row(), give_overview(), process_new_contact(), show_edit_site(), show_new_contact(), and trigger_action_to_html().

{
    global $PLUGINACTIONS;

    // Make global variables available to plugins, careful not overwrite vars
    // used in plugin_do function scope (Mantis 1433)
    foreach ($GLOBALS as $key => $val)
    {
        if ($key != 'context' AND $key != 'optparams' AND $key != 'PLUGINACTIONS')
        {
            global $$key;
        }
    }
    $rtnvalue = '';
    if (is_array($PLUGINACTIONS[$context]))
    {
        foreach ($PLUGINACTIONS[$context] AS $pluginaction)
        {
            // Call Variable function (function with variable name)
            if ($optparams)
            {
                $rtn = $pluginaction($optparams);
            }
            else
            {
                $rtn = $pluginaction();
            }

            // Append return value
            if (is_array($rtn) AND is_array($rtnvalue))
            {
                array_push($rtnvalue, $rtn);
            }
            elseif (is_array($rtn) AND !is_array($rtnvalue))
            {
                $rtnvalue=array(); array_push($rtnvalue, $rtn);
            }
            else
            {
                $rtnvalue .= $rtn;
            }
        }
    }
    return $rtnvalue;
}


// ** Place no more function defs below this **


// These are the modules that we are dependent on, without these something
// or everything will fail, so let's throw an error here.
// Check that the correct modules are loaded
if (!extension_loaded('mysql')) trigger_error('SiT requires the php/mysql module', E_USER_ERROR);
if (!extension_loaded('imap') AND $CONFIG['enable_inbound_mail'] == 'POP/IMAP')
{
    trigger_error('SiT requires the php IMAP extension to recieve incoming mail (even for POP or MTA methods!).'
                .' If you don\'t use incoming email you can set $CONFIG[\'enable_inbound_mail\'] to false', E_USER_NOTICE);
}
if (is_array($CONFIG['plugins'])) plugin_register ( context,
action 
)

Register a plugin context handler function

Author:
Ivan Lucas
Parameters:
string$context- A valid plugin context
string$action- Your plugin context handler function name
Note:
see http://sitracker.org/wiki/CreatingPlugins for help and a list of contexts

Definition at line 1317 of file functions.inc.php.

References $action, and $context.

{
    global $PLUGINACTIONS;
    $PLUGINACTIONS[$context][] = $action;
}
populate_syslang ( )

Populates $_SESSION['syslang], system language strings

Author:
Kieran Hogg
See also:
See also populate_syslang2() which is a copy of this function

Definition at line 1078 of file functions.inc.php.

References $_SESSION, $CONFIG, $file, $SYSLANG, and E_USER_ERROR.

{
    global $CONFIG;

    // Populate $SYSLANG with first the native lang and then the system lang
    // This is so that we have a complete language file
    $nativefile = APPLICATION_I18NPATH . "en-GB.inc.php";
    $file = APPLICATION_I18NPATH . "{$CONFIG['default_i18n']}.inc.php";

    if (file_exists($nativefile))
    {
        $fh = fopen($nativefile, "r");

        $theData = fread($fh, filesize($nativefile));
        fclose($fh);
        $nativelines = explode("\n", $theData);

        if (file_exists($file))
        {
            $fh = fopen($file, "r");
            $theData = fread($fh, filesize($file));
            fclose($fh);
            $lines = explode("\n", $theData);
        }
        else
        {
            trigger_error("Language file specified in \$CONFIG['default_i18n'] can't be found", E_USER_ERROR);
            $lines = $nativelines;
        }

       foreach ($nativelines as $values)
        {
            $badchars = array("$", "\"", "\\", "<?php", "?>");
            $values = trim(str_replace($badchars, '', $values));
            if (mb_substr($values, 0, 3) == "str")
            {
                $vars = explode("=", $values);
                $vars[0] = trim($vars[0]);
                $vars[1] = trim(substr_replace($vars[1], "",-2));
                $vars[1] = substr_replace($vars[1], "",0, 1);
                $SYSLANG[$vars[0]] = $vars[1];
            }
        }
        foreach ($lines as $values)
        {
            $badchars = array("$", "\"", "\\", "<?php", "?>");
            $values = trim(str_replace($badchars, '', $values));
            if (mb_substr($values, 0, 3) == "str")
            {
                $vars = explode("=", $values);
                $vars[0] = trim($vars[0]);
                $vars[1] = trim(substr_replace($vars[1], "",-2));
                $vars[1] = substr_replace($vars[1], "",0, 1);
                $SYSLANG[$vars[0]] = $vars[1];
            }
        }

        $_SESSION['syslang'] = $SYSLANG;
    }
    else
    {
        trigger_error("Native language file 'en-GB' can't be found", E_USER_ERROR);
    }
}
product_name ( id)

Returns a string representing the name of the given product.

Returns:
Returns an empty string if the product does not exist.

Definition at line 404 of file functions.inc.php.

References $id, and db_read_column().

{
    return db_read_column('name', $GLOBALS['dbProducts'], $id);
}
schedule_action_done ( doneaction,
success = TRUE 
)

Mark a schedule action as done

Author:
Ivan Lucas
Parameters:
string$doneaction,.Name of scheduled action
bool$success,.Was the run successful, TRUE = Yes, FALSE = No

Definition at line 917 of file functions.inc.php.

References $dbScheduler, $now, $sql, and E_USER_ERROR.

{
    global $now;
    global $dbScheduler;

    if ($success != TRUE)
    {
        $t = new TriggerEvent('TRIGGER_SCHEDULER_TASK_FAILED', array('schedulertask' => $doneaction));
    }

    $nowdate = date('Y-m-d H:i:s', $now);
    $sql = "UPDATE `{$dbScheduler}` SET lastran = '$nowdate' ";
    if ($success == FALSE) $sql .= ", success=0, status='disabled' ";
    else $sql .= ", success=1 ";
    $sql .= "WHERE action = '{$doneaction}'";
    mysql_query($sql);
    if (mysql_error())
    {
        trigger_error(mysql_error(),E_USER_ERROR);
        return FALSE;
    }
    if (mysql_affected_rows() > 0) return TRUE;
    else return FALSE;
}
schedule_action_started ( action)

Marks a schedule action as started

Author:
Paul Heaney
Parameters:
string$action,.Name of scheduled action
Returns:
boolean Success of update

Definition at line 892 of file functions.inc.php.

References $now, $sql, and E_USER_ERROR.

{
    global $now;

    $nowdate = date('Y-m-d H:i:s', $now);

    $sql = "UPDATE `{$GLOBALS['dbScheduler']}` SET laststarted = '$nowdate' ";
    $sql .= "WHERE action = '{$action}'";
    mysql_query($sql);
    if (mysql_error())
    {
        trigger_error(mysql_error(),E_USER_ERROR);
        return FALSE;
    }
    if (mysql_affected_rows() > 0) return TRUE;
    else return FALSE;
}
schedule_actions_due ( )

Finds out which scheduled tasks should be run right now Ensures that a task cannot start until the previous iteration has completed

Author:
Ivan Lucas, Paul Heaney
Returns:
array

Definition at line 823 of file functions.inc.php.

References $action, $actions, $dbScheduler, $now, $result, $sql, debug_log(), and E_USER_WARNING.

{
    global $now;
    global $dbScheduler;

    $actions = FALSE;
    // Interval
    $sql = "SELECT * FROM `{$dbScheduler}` WHERE `status` = 'enabled' AND type = 'interval' ";
    $sql .= "AND UNIX_TIMESTAMP(start) <= $now AND (UNIX_TIMESTAMP(end) >= $now OR UNIX_TIMESTAMP(end) = 0) ";
    $sql .= "AND IF(UNIX_TIMESTAMP(lastran) > 0, UNIX_TIMESTAMP(lastran) + `interval`, 0) <= $now ";
    $sql .= "AND IF(UNIX_TIMESTAMP(laststarted) > 0, UNIX_TIMESTAMP(lastran), -1) <= IF(UNIX_TIMESTAMP(laststarted) > 0, UNIX_TIMESTAMP(laststarted), 0)";
    $result = mysql_query($sql);
    if (mysql_error()) trigger_error(mysql_error(),E_USER_WARNING);
    if (mysql_num_rows($result) > 0)
    {
        while ($action = mysql_fetch_object($result))
        {
            $actions[$action->action] = $actions->params;
        }
    }

    // Month
    $sql = "SELECT * FROM `{$dbScheduler}` WHERE `status` = 'enabled' AND type = 'date' ";
    $sql .= "AND UNIX_TIMESTAMP(start) <= $now AND (UNIX_TIMESTAMP(end) >= $now OR UNIX_TIMESTAMP(end) = 0) ";
    $sql .= "AND ((date_type = 'month' AND (DAYOFMONTH(CURDATE()) > date_offset OR (DAYOFMONTH(CURDATE()) = date_offset AND CURTIME() >= date_time)) ";
    $sql .= "AND DATE_FORMAT(CURDATE(), '%Y-%m') != DATE_FORMAT(lastran, '%Y-%m') ) ) ";  // not run this month
    $sql .= "AND IF(UNIX_TIMESTAMP(lastran) > 0, UNIX_TIMESTAMP(lastran) + `interval`, 0) <= $now ";
    $sql .= "AND IF(UNIX_TIMESTAMP(laststarted) > 0, UNIX_TIMESTAMP(lastran), -1) <= IF(UNIX_TIMESTAMP(laststarted) > 0, UNIX_TIMESTAMP(laststarted), 0)";
    $result = mysql_query($sql);
    if (mysql_error()) trigger_error(mysql_error(),E_USER_WARNING);
    if (mysql_num_rows($result) > 0)
    {
        while ($action = mysql_fetch_object($result))
        {
            $actions[$action->action] = $actions->params;
        }
    }

    // Year TODO CHECK
    $sql = "SELECT * FROM `{$dbScheduler}` WHERE `status` = 'enabled' ";
    $sql .= "AND type = 'date' AND UNIX_TIMESTAMP(start) <= $now ";
    $sql .= "AND (UNIX_TIMESTAMP(end) >= $now OR UNIX_TIMESTAMP(end) = 0) ";
    $sql .= "AND ((date_type = 'year' AND (DAYOFYEAR(CURDATE()) > date_offset ";
    $sql .= "OR (DAYOFYEAR(CURDATE()) = date_offset AND CURTIME() >= date_time)) ";
    $sql .= "AND DATE_FORMAT(CURDATE(), '%Y') != DATE_FORMAT(lastran, '%Y') ) ) ";  // not run this year
    $sql .= "AND IF(UNIX_TIMESTAMP(lastran) > 0, UNIX_TIMESTAMP(lastran) + `interval`, 0) <= $now ";
    $sql .= "AND IF(UNIX_TIMESTAMP(laststarted) > 0, UNIX_TIMESTAMP(lastran), -1) <= IF(UNIX_TIMESTAMP(laststarted) > 0, UNIX_TIMESTAMP(laststarted), 0)";
    $result = mysql_query($sql);
    if (mysql_error()) trigger_error(mysql_error(),E_USER_WARNING);
    if (mysql_num_rows($result) > 0)
    {
        while ($action = mysql_fetch_object($result))
        {
            $actions[$action->action] = $actions->params;
        }
    }

    if (is_array($actions)) debug_log('Scheduler actions due: '.implode(', ',array_keys($actions)));

    return $actions;
}
send_email ( to,
from,
subject,
body,
replyto = '',
cc = '',
bcc = '' 
)

Send an email from SiT

Parameters:
string$to,.Destination email address
string$from,.Source email address
string$subject,.Email subject line
string$body,.Email body text
string$replyto,.(optional) Address to send reply to
string$cc,.(optional) Carbon copy address
string$bcc,.(optional) Blind carbon copy address
Returns:
The return value from PHP mail() function or TRUE when in Demo mode
Note:
Returns TRUE but does not actually send mail when SiT is in Demo mode

Definition at line 628 of file functions.inc.php.

References $application_version_string, $CONFIG, $from, debug_log(), E_USER_WARNING, and elseif.

{
    global $CONFIG, $application_version_string;

    if ($CONFIG['outbound_email_newline'] == 'CRLF')
    {
        $crlf = "\r\n";
    }
    else
    {
        $crlf = "\n";
    }

    if (empty($to)) trigger_error('Empty TO address in email', E_USER_WARNING);

    $extra_headers  = '';
    if (!empty($replyto)) $extra_headers .= "Reply-To: {$replyto}" . $crlf;
    if (!empty($email_cc))
    {
        $extra_headers .= "CC: {$cc}" . $crlf;
    }
    if (!empty($email_bcc))
    {
        $extra_headers .= "BCC: {$bcc}" . $crlf;
    }
    if (!empty($CONFIG['support_email']))
    {
        $extra_headers .= "Errors-To: {$CONFIG['support_email']}" . $crlf;
    }
    $extra_headers .= "X-Mailer: {$CONFIG['application_shortname']} {$application_version_string}/PHP " . phpversion() . $crlf;
    $extra_headers .= "X-Originating-IP: {$_SERVER['REMOTE_ADDR']}" . $crlf;
//     $extra_headers .= "\r\n";

    if ($CONFIG['demo'])
    {
        $rtnvalue = TRUE;
    }
    elseif ($CONFIG['enable_outbound_email'] == false)
    {
        $rtnvalue = TRUE;
        debug_log("Outgoing email disabled, no mail is sent");
    }
    else
    {
        // $rtnvalue = mail($to, $subject, $body, $extra_headers);

        $mime = new MIME_mail($from, $to, html_entity_decode($subject), '', $extra_headers, $mailerror);
        $mime -> attach($body, '', "text/plain; charset={$GLOBALS['i18ncharset']}", $CONFIG['outbound_email_encoding'], 'inline');

        // actually send the email
        $rtnvalue = $mime -> send_mail();
        if (!empty($mailerror)) debug_log("Outoing email error: {$mailerror}");
    }

    return $rtnvalue;
}
session_regenerate ( )

Update the current session id with a newly generated one

Author:
Ivan Lucas
Note:
Wrap the php function for different versions of php

Definition at line 948 of file functions.inc.php.

{
    if (function_exists('session_regenerate_id'))
    {
        if (!version_compare(phpversion(),"5.1.0",">=")) session_regenerate_id(FALSE);
        else session_regenerate_id();
    }
}
setup_user_triggers ( userid)

Sets up default triggers for new users or upgraded users

Parameters:
int$useridID of the user
Returns:
bool TRUE on success, FALSE if not
Author:
Kieran Hogg

Definition at line 997 of file functions.inc.php.

References $return, $sql, $userid, and E_USER_ERROR.

Referenced by User::add().

{
    $return = TRUE;
    $userid = intval($userid);
    if ($userid != 0)
    {
        $sqls[] = "INSERT INTO `{$GLOBALS['dbTriggers']}` (`triggerid`, `userid`, `action`, `template`, `parameters`, `checks`)
                VALUES('TRIGGER_INCIDENT_ASSIGNED', {$userid}, 'ACTION_NOTICE', 'NOTICE_INCIDENT_ASSIGNED', '', '{userid} == {$userid}');";
        $sqls[] = "INSERT INTO `{$GLOBALS['dbTriggers']}` (`triggerid`, `userid`, `action`, `template`, `parameters`, `checks`)
                VALUES('TRIGGER_SIT_UPGRADED', {$userid}, 'ACTION_NOTICE', 'NOTICE_SIT_UPGRADED', '', '');";
        $sqls[] = "INSERT INTO `{$GLOBALS['dbTriggers']}` (`triggerid`, `userid`, `action`, `template`, `parameters`, `checks`)
                VALUES('TRIGGER_INCIDENT_CLOSED', {$userid}, 'ACTION_NOTICE', 'NOTICE_INCIDENT_CLOSED', '', '{userid} == {$userid}');";
        $sqls[] = "INSERT INTO `{$GLOBALS['dbTriggers']}` (`triggerid`, `userid`, `action`, `template`, `parameters`, `checks`)
                VALUES('TRIGGER_INCIDENT_NEARING_SLA', {$userid}, 'ACTION_NOTICE', 'NOTICE_INCIDENT_NEARING_SLA', '',
                '{ownerid} == {$userid} OR {townerid} == {$userid}');";
        $sqls[] = "INSERT INTO `{$GLOBALS['dbTriggers']}` (`triggerid`, `userid`, `action`, `template`, `parameters`, `checks`)
                VALUES('TRIGGER_LANGUAGE_DIFFERS', {$userid}, 'ACTION_NOTICE', 'NOTICE_LANGUAGE_DIFFERS', '', '');";


        foreach ($sqls AS $sql)
        {
            mysql_query($sql);
            if (mysql_error())
            {
                trigger_error("MySQL Query Error ".mysql_error(), E_USER_ERROR);
                $return = FALSE;
            }
        }
    }
    else
    {
        trigger_error("setup_user_triggers() Invalid userid '{$userid}' specified", E_USER_NOTICE);
        $return = FALSE;
    }

    return $return;
}
show_dashboard_component ( row,
dashboardid 
)

Output a dashboard component

Author:
Ivan Lucas
Parameters:
string$row
string$dashboardid

Definition at line 729 of file functions.inc.php.

References $dashboardid, $dbDashboard, $obj, $result, $sql, dashboard_do(), and E_USER_WARNING.

{
    global $dbDashboard;
    $sql = "SELECT name FROM `{$dbDashboard}` WHERE enabled = 'true' AND id = '$dashboardid'";
    $result = mysql_query($sql);
    if (mysql_error()) trigger_error(mysql_error(),E_USER_WARNING);

    if (mysql_num_rows($result) == 1)
    {
        $obj = mysql_fetch_object($result);
        dashboard_do("dashboard_".$obj->name, 'db_'.$row, $dashboardid);
    }
}
show_form_errors ( formname)

Shows errors from a form, if any

Author:
Kieran Hogg
Returns:
string. HTML of the form errors stored in the users session

Definition at line 772 of file functions.inc.php.

References $_SESSION, $error, E_USER_ERROR, and user_alert().

Referenced by display_update_page(), show_edit_site(), and show_new_contact().

{
    if ($_SESSION['formerrors'][$formname])
    {
        foreach ($_SESSION['formerrors'][$formname] as $error)
        {

            if (mb_substr(trim($error), 0, 1) != "<")
            {
                $html .= user_alert($error, E_USER_ERROR);
            }
            else
            {
                $html .= $error;
            }
        }
    }
    return $html;
}
sit_error_handler ( errno,
errstr,
errfile,
errline,
errcontext 
)

Handle a PHP triggered error

Author:
Ivan Lucas
Note:
Not called directly but triggered by PHP's own error handling and the trigger_error function.
Parameters as per http://www.php.net/set_error_handler
This function is not internationalised in order that bugs can be reported to developers and still be sure that they will be understood

Definition at line 420 of file functions.inc.php.

References $class, $CONFIG, $siterrors, debug_log(), E_USER_ERROR, E_USER_WARNING, elseif, and user_permission().

{
    global $CONFIG, $sit, $siterrors;

    // if error has been supressed with an @
    if (error_reporting() == 0)
    {
        return;
    }

    $errortype = array(
    E_ERROR           => 'Fatal Error',
    E_WARNING         => 'Warning',
    E_PARSE           => 'Parse Error',
    E_NOTICE          => 'Notice',
    E_CORE_ERROR      => 'Core Error',
    E_CORE_WARNING    => 'Core Warning',
    E_COMPILE_ERROR   => 'Compile Error',
    E_COMPILE_WARNING => 'Compile Warning',
    E_USER_ERROR      => 'Application Error',
    E_USER_WARNING    => 'Application Warning',
    E_USER_NOTICE     => 'Application Notice');

    if (defined('E_STRICT')) $errortype[E_STRICT] = 'Strict Runtime notice';

    $trace_errors = array(E_ERROR, E_USER_ERROR);

    $user_errors = E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE;
    $system_errors = E_ERROR | E_WARNING | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING;
    $warnings = E_WARNING | E_USER_WARNING | E_CORE_WARNING | E_COMPILE_WARNING;
    $notices = E_NOTICE | E_USER_NOTICE;

    if (($errno & $user_errors) OR ($errno & $system_errors))
    {
        if (empty($CONFIG['error_logfile']) === FALSE AND is_writable($CONFIG['error_logfile']) === TRUE)
        {
            $displayerrors = FALSE;
        }
        else
        {
            $displayerrors = TRUE;
        }

        if ($errno & $notices) $class = 'info';
        elseif ($errno & $warnings) $class = 'warning';
        else $class = 'error';

        $backtrace = debug_backtrace();
        if (php_sapi_name() != 'cli')
        {
            $tracelog = '';
            if ($displayerrors)
            {
                echo "<p class='{$class}'><strong>{$errortype[$errno]} [{$errno}]</strong><br />";
                if ($errno != E_USER_NOTICE)
                {
                    echo "{$errstr} in {$errfile} @ line {$errline}";
                }
                else
                {
                    echo "{$errstr}";
                }
                if ($CONFIG['debug']) echo "<br /><strong>Backtrace</strong>:";
            }

            foreach ($backtrace AS $trace)
            {
                if (!empty($trace['file']))
                {
                    if ($CONFIG['debug'] AND $displayerrors)
                    {
                        echo "<br />{$trace['file']} @ line {$trace['line']}";
                    }

                    $tracelog .= "{$trace['file']} @ line {$trace['line']}";
                    if (!empty($trace['function']))
                    {
                        $tracelog .= " {$trace['function']}()";
                        if ($displayerrors) echo " {$trace['function']}() ";
//                         foreach ($trace['args'] AS $arg)
//                         {
//                             echo "$arg &bull; ";
//                         }
                    }
                    $tracelog .= "\n";
                }
            }
            if ($errno != E_NOTICE)
            {
                $logentry = " {$errortype[$errno]} [{$errno}] {$errstr} (in line {$errline} of file {$errfile})\n";
            }

            if ($errno == E_ERROR
                || $errno == E_USER_ERROR
                || $errno == E_CORE_ERROR
                || $errno == E_CORE_WARNING
                || $errno == E_COMPILE_ERROR
                || $errno == E_COMPILE_WARNING)
            {
                $logentry .= "\n[CONTEXT-BEGIN]\n".print_r($errcontext, TRUE)."\n[CONTEXT-END]\n----------\n\n";
                $siterrors++;
            }

            debug_log($logentry);
            if ($displayerrors)
            {
                echo "</p>";
                // Tips, to help diagnose errors
                if (strpos($errstr, 'Unknown column') !== FALSE OR
                    preg_match("/Table '(.*)' doesn't exist/", $errstr))
                {
                    echo "<p class='tip'>The SiT schema may need updating to fix this problem.";
                    if (user_permission($sit[2], PERM_ADMIN)) echo "Visit <a href='setup.php'>Setup</a>"; // Only show this to admin
                    echo "</p>";
                }

                if (strpos($errstr, 'headers already sent') !== FALSE)
                {
                    echo "<p class='tip'>This warning may be caused by a problem that occurred before the ";
                    echo "page was displayed, or sometimes by a syntax error or ";
                    echo "extra whitespace in your config file.</p>";
                }

                if (strpos($errstr, 'You have an error in your SQL syntax') !== FALSE OR
                    strpos($errstr, 'Query Error Incorrect table name') !== FALSE)
                {
                    echo "<p class='tip'>You may have found a bug in SiT, please <a href=\"{$CONFIG['bugtracker_url']}\">report it</a>.</p>";
                }
            }
        }
        else
        {
            debug_log("ERROR: {$errortype[$errno]} {$errstr} in {$errfile} at line {$errline}\n");
            if (!empty($tracelog)) debug_log("ERROR: Backtrace:\n{$tracelog}\n");
        }
    }
}
software_name ( softwareid)

Get the name associated with software ID / skill ID

Author:
Ivan Lucas
Parameters:
int$softwareid
Returns:
string. Skill/Software Name
Note:
Software was renamed skills for v3.30

Definition at line 372 of file functions.inc.php.

References $dbSoftware, $now, $result, $sql, $strEndOfLife, $strEOL, and mysql2date().

Referenced by portal_incident_table().

{
    global $now, $dbSoftware, $strEOL, $strEndOfLife;

    $sql = "SELECT * FROM `{$dbSoftware}` WHERE id = '{$softwareid}'";
    $result = mysql_query($sql);
    if (mysql_num_rows($result) >= 1)
    {
        $software = mysql_fetch_object($result);
        $lifetime_end = mysql2date($software->lifetime_end);
        if ($lifetime_end > 0 AND $lifetime_end < $now)
        {
            $name = "<span class='deleted'>{$software->name}</span> (<abbr title='{$strEndOfLife}'>{$strEOL}</abbr>)";
        }
        else
        {
            $name = $software->name;
        }
    }
    else
    {
        $name = $GLOBALS['strUnknown'];
    }

    return $name;
}

Variable Documentation

if (!extension_loaded('mysql')) trigger_error('SiT requires the php/mysql module' E_USER_ERROR

Definition at line 1388 of file functions.inc.php.

if (!extension_loaded('imap') AND $CONFIG['enable_inbound_mail']== 'POP/IMAP') if (version_compare(PHP_VERSION,"5.0.0","<")) trigger_error('INFO some features may not work properly register_globals register_globals on Error

Definition at line 1394 of file functions.inc.php.

if(realpath(__FILE__)==realpath($_SERVER['SCRIPT_FILENAME']))

Definition at line 23 of file functions.inc.php.

if (!extension_loaded('imap') AND $CONFIG['enable_inbound_mail']== 'POP/IMAP') if (version_compare(PHP_VERSION,"5.0.0","<")) trigger_error('INFO some features may not work properly register_globals register_globals on there are potential security risks involved with leaving it as it is Stopping SiT now

Definition at line 1394 of file functions.inc.php.

Referenced by countUp(), and getToday().