### Informationen zum Plugin ###
function overview_info()
{
return array(
"name" => "Overview",
"title" => "Overview",
"description" => "Displays a box on the index page that shows different infomations about your board.",
"website" => "http://www.mybboard.de",
"author" => "MyBBoard.de",
"authorsite" => "http://www.mybboard.de",
"version" => "3.0.4",
);
}
### Aktivierung ###
function overview_activate()
{
global $db;
// Variablen für dieses Plugin einfügen
require MYBB_ROOT."inc/adminfunctions_templates.php";
find_replace_templatesets("index", '#{\$header}(\r?)\n#', "{\$header}\n{\$overview}\n");
find_replace_templatesets("index", '#{\$footer}(\r?)\n#', "{\$footer}\n{\$overview_body}\n");
find_replace_templatesets("index", '#<body>(\r?)\n#', "<body{\$overview_body_onload}>\n");
find_replace_templatesets("index", '#{\$headerinclude}(\r?)\n#', "{\$headerinclude}\n{\$overview_headerinclude}\n");
// Templates von dieses Plugin entfernen
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='index_overview'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='index_overview_column_newmembers'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='index_overview_column_newmembers_row'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='index_overview_column_topposters'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='index_overview_column_topposters_row'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='index_overview_column_newthreads'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='index_overview_column_newthreads_row'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='index_overview_column_mostreplies'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='index_overview_column_mostreplies_row'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='index_overview_column_favouritethreads'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='index_overview_column_favouritethreads_row'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='index_overview_column_newposts'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='index_overview_column_newposts_row'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='index_overview_message'");
// Einstellungsgruppen löschen
$query = $db->query("SELECT gid FROM ".TABLE_PREFIX."settinggroups WHERE name='Overview'");
$g = $db->fetch_array($query);
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE gid='".$g['gid']."'");
// Einstellungen löschen
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE gid='".$g['gid']."'");
// Rebuilt settings.php
rebuild_settings();
}
### Funktionen ###
function overview()
{
global $db, $mybb, $cache, $templates, $theme, $lang, $overview;
// Sortierung auslesen und Daten ausgeben
$orderquery = $db->query("SELECT name from ".TABLE_PREFIX."settings WHERE name IN ('overview_do_newestusers','overview_do_topposters','overview_do_newestthreads','overview_do_mostreplies','overview_do_favouritethreads','overview_do_newestposts') ORDER BY value ASC");
while ($order = $db->fetch_array($orderquery)) {
$overview_content .= call_user_func($order['name']);
}
// Nachricht zeigen?
if($mybb->settings['overview_trow_message_onoff'] == "yes") {
$overview_message = do_htmlentities($mybb->settings['overview_trow_message']);
e v a l("\$trow_message = \"".$templates->get("index_overview_message")."\";");
}
// Template laden
e v a l("\$overview = \"".$templates->get("index_overview")."\";");
}
}
// Daten für neueste Benutzer aus Datenbank auslesen
$query1 = $db->query("SELECT username,postnum,uid,usergroup,displaygroup FROM ".TABLE_PREFIX."users ORDER BY uid DESC LIMIT 0,".$mybb->settings['overview_max']."");
// Daten ausgeben
while ($newest_members = $db->fetch_array($query1)) {
$uid = $newest_members['uid'];
$username = overview_usernamestyle(do_htmlentities($newest_members['username']), $newest_members['usergroup'], $newest_members['displaygroup']);
$postnum = $newest_members['postnum'];
e v a l("\$newmembers_row .= \"".$templates->get("index_overview_column_newmembers_row")."\";");
}
e v a l("\$column_newmembers = \"".$templates->get("index_overview_column_newmembers")."\";");
}
return $column_newmembers;
}
// Top Poster zeigen?
function overview_do_topposters() {
global $mybb, $db, $templates, $theme, $lang, $trow;
// Daten für Top Poster aus Datenbank auslesen
$query2 = $db->query ("SELECT username,postnum,uid,usergroup,displaygroup FROM ".TABLE_PREFIX."users ORDER BY postnum DESC LIMIT 0,".$mybb->settings['overview_max']."");
// Daten ausgeben
while ($topposters = $db->fetch_array($query2)) {
$uid = $topposters['uid'];
$username = overview_usernamestyle(do_htmlentities($topposters['username']), $topposters['usergroup'], $topposters['displaygroup']);
$postnum = $topposters['postnum'];
e v a l("\$topposters_row .= \"".$templates->get("index_overview_column_topposters_row")."\";");
}
e v a l("\$column_topposters = \"".$templates->get("index_overview_column_topposters")."\";");
}
return $column_topposters;
}
// Neueste Themen zeigen?
function overview_do_newestthreads() {
global $mybb, $db, $templates, $theme, $lang, $trow, $unviewwhere, $parser;
// Daten für neueste Themen aus Datenbank auslesen
$query3 = $db->query ("SELECT subject,username,uid,tid,replies FROM ".TABLE_PREFIX."threads WHERE visible='1' ".get_unviewable()." ORDER BY dateline DESC LIMIT 0,".$mybb->settings['overview_max']."");
// Daten für Themen mit meisten Antworten aus Datenbank auslesen
$query4 = $db->query ("SELECT subject,tid,replies FROM ".TABLE_PREFIX."threads WHERE visible='1' ".get_unviewable()." ORDER BY replies DESC LIMIT 0,".$mybb->settings['overview_max']."");
$tid = $most_replies['tid'];
$subject = do_htmlentities(overview_limitsubject($parser->parse_badwords($most_replies['subject']), $mybb->settings['overview_subjects_lenght']));
$replies = $most_replies['replies'];
e v a l("\$mostreplies_row .= \"".$templates->get("index_overview_column_mostreplies_row")."\";");
}
e v a l("\$column_mostreplies = \"".$templates->get("index_overview_column_mostreplies")."\";");
}
return $column_mostreplies;
}
// Beliebteste Themen zeigen?
function overview_do_favouritethreads() {
global $mybb, $db, $templates, $theme, $lang, $trow, $unviewwhere, $parser;
// Daten für beliebteste Themen aus Datenbank auslesen
$query5 = $db->query("SELECT subject,tid,views FROM ".TABLE_PREFIX."threads WHERE visible='1' ".get_unviewable()." ORDER BY views DESC LIMIT 0,".$mybb->settings['overview_max']."");
$tid = $favourite_threads['tid'];
$subject = do_htmlentities(overview_limitsubject($parser->parse_badwords($favourite_threads['subject']), $mybb->settings['overview_subjects_lenght']));
$views = $favourite_threads['views'];
e v a l("\$favouritethreads_row .= \"".$templates->get("index_overview_column_favouritethreads_row")."\";");
}
e v a l("\$column_favouritethreads = \"".$templates->get("index_overview_column_favouritethreads")."\";");
}
return $column_favouritethreads;
}
// Neueste Beiträge zeigen?
function overview_do_newestposts() {
global $mybb, $db, $templates, $theme, $lang, $trow, $unviewwhere, $parser;
// Daten für neueste Themen aus Datenbank auslesen
$query6 = $db->query ("SELECT subject,username,uid,pid,tid FROM ".TABLE_PREFIX."posts WHERE visible='1' ".get_unviewable()." ORDER BY dateline DESC LIMIT 0,".$mybb->settings['overview_max']."");
Bu forumda yeni başlıklar açamazsınız Bu forumdaki başlıklara cevap veremezsiniz Bu forumdaki mesajlarınızı değiştiremezsiniz Bu forumdaki mesajlarınızı silemezsiniz Bu forumdaki anketlerde oy kullanamazsınız