/** * Log a user action to the database. * @param string $action. * @param string $fulldesc The full description of the event [optional]. */ public static function Log($action, $fulldesc = false) { if (!$fulldesc) { $fulldesc = $action; } // Also addin the source URL, as that may change and reveal important information. if (isset($_SERVER['HTTP_HOST'])) { $fulldesc .= "\n" . 'Source URL: ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; if (isset($_SERVER['HTTP_REFERER'])) { $fulldesc .= "\n" . 'Referrer URL: ' . $_SERVER['HTTP_REFERER']; } } else { $fulldesc .= "\nN/a"; } $log = Model_Log::Create(); $log['userid'] = Typeframe::User()->get('userid'); $log['ipaddress'] = @$_SERVER['REMOTED_ADDR']; $log['package'] = Typeframe::CurrentPage() ? Typeframe::CurrentPage()->application()->package() : ''; $log['application'] = Typeframe::CurrentPage() ? Typeframe::CurrentPage()->application()->name() : ''; $log['action'] = $action; $log['logdate'] = Typeframe::Now(); $log['fulldesc'] = $fulldesc; $log->save(); }