+ Changed generating last post and post count in forum and topic.php

+ Deleted not used template file: post_add_body.tpl
+ Replaced MCP images

git-svn-id: https://svn.pioder.pl/uf-svn/uF@21 72ec579a-5ced-4fa4-82f3-afba5d98df2f
This commit is contained in:
pioder
2009-05-03 21:00:21 +00:00
parent b1f37b6ea5
commit c2ba3eb804
70 changed files with 371 additions and 395 deletions

View File

@@ -23,16 +23,16 @@ class DataBase
$db = new mysqli(DB_HOST, DB_USER, DB_PASS);
if (mysqli_connect_errno() != 0)
{
message_die('CRITICAL',' Could not connect to database server.',$db->error);
message_die(CRITICAL,' Could not connect to database server.',$db->error);
}
if (!$db->set_charset("UTF8"))
{
message_die('CRITICAL', 'Could not set character set UTF-8', $db->error);
message_die(CRITICAL, 'Could not set character set UTF-8', $db->error);
}
if (!$db->select_db(DB_NAME))
{
message_die('CRITICAL',' Could not select database.', $db->error);
message_die(CRITICAL,' Could not select database.', $db->error);
}
}
@@ -59,12 +59,20 @@ class DataBase
function fetch($query)
{
return $query->fetch_array();
return $query->fetch_assoc();
}
function num_rows($query)
{
return $query->num_rows;
// return $query->num_rows;
if ($query===true || $query===false)
{
return 0;
}
else
{
return mysqli_num_rows($query);
}
}
function new_id($table)
@@ -91,7 +99,7 @@ class DataBase
case WARNINGS_TABLE: { $id = 'w_id'; break; }
}
$sql = "SELECT `$id` FROM $table ORDER BY `$id` DESC LIMIT 1";
$return_id = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Error with obtain last id.<br> File: db.php, Line: '.__LINE__));
$return_id = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Error with obtain last id.<br> File: db.php, Line: '.__LINE__));
$return_id = $return_id[$id];
$return_id = $return_id+1;
return $return_id;