forked from GithubBackups/tinyib
Add missing addLogs function
This function is required when migrating between databases.
This commit is contained in:
parent
57704531cf
commit
7c6cf64d4d
@ -184,6 +184,11 @@ function getLogs($offset, $limit) {
|
|||||||
return convertLogsToSQLStyle($rows);
|
return convertLogsToSQLStyle($rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function allLogs() {
|
||||||
|
$rows = $GLOBALS['db']->selectWhere(LOGS_FILE, NULL, -1, new OrderBy(LOG_TIMESTAMP, ASCENDING, INTEGER_COMPARISON));
|
||||||
|
return convertLogsToSQLStyle($rows);
|
||||||
|
}
|
||||||
|
|
||||||
function convertLogsToSQLStyle($logs, $single = false) {
|
function convertLogsToSQLStyle($logs, $single = false) {
|
||||||
$newlogs = array();
|
$newlogs = array();
|
||||||
foreach ($logs as $l) {
|
foreach ($logs as $l) {
|
||||||
|
@ -147,6 +147,17 @@ function getLogs($offset, $limit) {
|
|||||||
return $logs;
|
return $logs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function allLogs() {
|
||||||
|
$logs = array();
|
||||||
|
$result = mysql_query("SELECT * FROM `" . TINYIB_DBLOGS . "` ORDER BY `timestamp` ASC");
|
||||||
|
if ($result) {
|
||||||
|
while ($log = mysql_fetch_assoc($result)) {
|
||||||
|
$logs[] = $log;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $logs;
|
||||||
|
}
|
||||||
|
|
||||||
function insertLog($log) {
|
function insertLog($log) {
|
||||||
mysql_query("INSERT INTO `" . TINYIB_DBLOGS . "` (`timestamp`, `account`, `message`) VALUES ('" . mysql_real_escape_string($log['timestamp']) . "', '" . mysql_real_escape_string($log['account']) . "', '" . mysql_real_escape_string($log['message']) . "')");
|
mysql_query("INSERT INTO `" . TINYIB_DBLOGS . "` (`timestamp`, `account`, `message`) VALUES ('" . mysql_real_escape_string($log['timestamp']) . "', '" . mysql_real_escape_string($log['account']) . "', '" . mysql_real_escape_string($log['message']) . "')");
|
||||||
}
|
}
|
||||||
|
@ -168,6 +168,18 @@ function getLogs($offset, $limit) {
|
|||||||
return $logs;
|
return $logs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function allLogs() {
|
||||||
|
global $link;
|
||||||
|
$logs = array();
|
||||||
|
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBLOGS . "` ORDER BY `timestamp` ASC");
|
||||||
|
if ($result) {
|
||||||
|
while ($log = mysqli_fetch_assoc($result)) {
|
||||||
|
$logs[] = $log;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $logs;
|
||||||
|
}
|
||||||
|
|
||||||
function insertLog($log) {
|
function insertLog($log) {
|
||||||
global $link;
|
global $link;
|
||||||
mysqli_query($link, "INSERT INTO `" . TINYIB_DBLOGS . "` (`timestamp`, `account`, `message`) VALUES ('" . mysqli_real_escape_string($link, $log['timestamp']) . "', '" . mysqli_real_escape_string($link, $log['account']) . "', '" . mysqli_real_escape_string($link, $log['message']) . "')");
|
mysqli_query($link, "INSERT INTO `" . TINYIB_DBLOGS . "` (`timestamp`, `account`, `message`) VALUES ('" . mysqli_real_escape_string($link, $log['timestamp']) . "', '" . mysqli_real_escape_string($link, $log['account']) . "', '" . mysqli_real_escape_string($link, $log['message']) . "')");
|
||||||
|
@ -124,6 +124,15 @@ function getLogs($offset, $limit) {
|
|||||||
return $logs;
|
return $logs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function allLogs() {
|
||||||
|
$logs = array();
|
||||||
|
$results = pdoQuery("SELECT * FROM " . TINYIB_DBLOGS . " ORDER BY timestamp ASC");
|
||||||
|
while ($row = $results->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$logs[] = $row;
|
||||||
|
}
|
||||||
|
return $logs;
|
||||||
|
}
|
||||||
|
|
||||||
function insertLog($log) {
|
function insertLog($log) {
|
||||||
global $dbh;
|
global $dbh;
|
||||||
$stm = $dbh->prepare("INSERT INTO " . TINYIB_DBLOGS . " (timestamp, account, message) VALUES (?, ?, ?)");
|
$stm = $dbh->prepare("INSERT INTO " . TINYIB_DBLOGS . " (timestamp, account, message) VALUES (?, ?, ?)");
|
||||||
|
@ -128,6 +128,15 @@ function getLogs($offset, $limit) {
|
|||||||
return $logs;
|
return $logs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function allLogs() {
|
||||||
|
$logs = array();
|
||||||
|
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBLOGS . " ORDER BY timestamp ASC"), SQLITE_ASSOC);
|
||||||
|
foreach ($result as $log) {
|
||||||
|
$logs[] = $log;
|
||||||
|
}
|
||||||
|
return $logs;
|
||||||
|
}
|
||||||
|
|
||||||
function insertLog($log) {
|
function insertLog($log) {
|
||||||
sqlite_query($GLOBALS["db"], "INSERT INTO " . TINYIB_DBLOGS . " (timestamp, account, message) VALUES ('" . sqlite_escape_string($log['timestamp']) . "', '" . sqlite_escape_string($log['account']) . "', '" . sqlite_escape_string($log['message']) . "')");
|
sqlite_query($GLOBALS["db"], "INSERT INTO " . TINYIB_DBLOGS . " (timestamp, account, message) VALUES ('" . sqlite_escape_string($log['timestamp']) . "', '" . sqlite_escape_string($log['account']) . "', '" . sqlite_escape_string($log['message']) . "')");
|
||||||
}
|
}
|
||||||
|
@ -147,6 +147,16 @@ function getLogs($offset, $limit) {
|
|||||||
return $logs;
|
return $logs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function allLogs() {
|
||||||
|
global $db;
|
||||||
|
$logs = array();
|
||||||
|
$result = $db->query("SELECT * FROM " . TINYIB_DBLOGS . " ORDER BY timestamp ASC");
|
||||||
|
while ($log = $result->fetchArray()) {
|
||||||
|
$logs[] = $log;
|
||||||
|
}
|
||||||
|
return $logs;
|
||||||
|
}
|
||||||
|
|
||||||
function insertLog($log) {
|
function insertLog($log) {
|
||||||
global $db;
|
global $db;
|
||||||
$db->exec("INSERT INTO " . TINYIB_DBLOGS . " (timestamp, account, message) VALUES ('" . $db->escapeString($log['timestamp']) . "', '" . $db->escapeString($log['account']) . "', '" . $db->escapeString($log['message']) . "')");
|
$db->exec("INSERT INTO " . TINYIB_DBLOGS . " (timestamp, account, message) VALUES ('" . $db->escapeString($log['timestamp']) . "', '" . $db->escapeString($log['account']) . "', '" . $db->escapeString($log['message']) . "')");
|
||||||
|
@ -108,7 +108,7 @@ if (!$result->fetchArray()) {
|
|||||||
if (function_exists('insertPost')) {
|
if (function_exists('insertPost')) {
|
||||||
function migrateAccount($account) {
|
function migrateAccount($account) {
|
||||||
global $db;
|
global $db;
|
||||||
$db->exec("INSERT INTO " . TINYIB_DBACCOUNTS . " (id, username, password, role, lastactive) VALUES (" . $db->escapeString($account['id']) . ", '" . $db->escapeString($account['username']) . "', " . $db->escapeString($account['password']) . ", " . $db->escapeString($account['role']) . ", '" . $db->escapeString($account['lastactive']) . "')");
|
$db->exec("INSERT INTO " . TINYIB_DBACCOUNTS . " (id, username, password, role, lastactive) VALUES (" . $db->escapeString($account['id']) . ", '" . $db->escapeString($account['username']) . "', '" . $db->escapeString($account['password']) . "', " . $db->escapeString($account['role']) . ", '" . $db->escapeString($account['lastactive']) . "')");
|
||||||
}
|
}
|
||||||
|
|
||||||
function migrateBan($ban) {
|
function migrateBan($ban) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user