You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
engelsystem/includes/model/LogEntries_model.php

39 lines
951 B
PHTML

12 years ago
<?php
/**
* Creates a log entry.
11 years ago
*
12 years ago
* @param $nick Username
11 years ago
* @param $message Log
* Message
12 years ago
*/
function LogEntry_create($nick, $message) {
return sql_query("INSERT INTO `LogEntries` SET `timestamp`='" . sql_escape(time()) . "', `nick`='" . sql_escape($nick) . "', `message`='" . sql_escape($message) . "'");
12 years ago
}
12 years ago
/**
* Returns log entries with maximum count of 10000.
12 years ago
*/
function LogEntries() {
return sql_select("SELECT * FROM `LogEntries` ORDER BY `timestamp` DESC LIMIT 10000");
}
/**
* Returns log entries filtered by a keyword
*/
function LogEntries_filter($keyword) {
if ($keyword == "") {
return LogEntries();
}
return sql_select("SELECT * FROM `LogEntries` WHERE `nick` LIKE '%" . sql_escape($keyword) . "%' OR `message` LIKE '%" . sql_escape($keyword) . "%' ORDER BY `timestamp` DESC");
}
/**
* Delete all log entries.
*/
function LogEntries_clear_all() {
return sql_query("TRUNCATE `LogEntries`");
}
?>