bis jetz sieht der Code so aus. ist aber noch lange nicht Final. Genau so wie das Template ist bsi jetz nut mal ein Test. Das ganz wird im moment noch von Hand eingebunden. (also das es angezeigt wird)
Code:
#
<?php
/**
*
* A plugin which shows the latest posts. - for MyBB 1.4.4
* Copyright © 2009 by Michi26206
*
* Plugin by Michi26206
* Website: http://www.hdw-computer-forum.de
*
*/
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook('index_start','latest_posts');
function latest_posts_info()
{
return array(
"name" => "Latest Post Plugin",
"description" => "Fügt eine Übersichtsbox auf der Startseite ein, die über neueste Mitglieder, Themen und Beiträge informiert.",
"website" => "http://www.hdw-computer-forum.de",
"author" => "Michi26206 - HDW-Computer-Forum",
"authorsite" => "http://www.hdw-computer-forum.de",
"version" => "1.0",
"compatibility" => "14*",
);
}
function latest_posts_activate() {
global $db;
require MYBB_ROOT."./inc/adminfunctions_templates.php";
$latest_posts_group = array(
"gid" => "NULL",
"name" => "Latest Post Plugin",
"title" => "Latest Post Plugin",
"description" => "",
"disporder" => "1",
"isdefault" => "no",
);
$db->insert_query("settinggroups", $latest_posts_group);
$gid = $db->insert_id();
$latest_posts_1 = array(
"sid" => "NULL",
"name" => "show_latest_posts",
"title" => "Latest News Plugin anzeigen?",
"description" => "Soll das Latest News Plugin angezeigt werden?",
"optionscode" => "yesno",
"value" => "yes",
"disporder" => "2",
"gid" => intval($gid),
);
$latest_posts_2 = array(
"sid" => "NULL",
"name" => "latest_posts_forum",
"title" => "Forumsid/s",
"description" => "In welchem Forum/ in welchen Foren befindet/befinden sich die News? Trennung merher IDs durch ein Komma.",
"optionscode" => "text",
"value" => "0",
"disporder" => "3",
"gid" => intval($gid),
);
$latest_posts_3 = array(
"sid" => "NULL",
"name" => "latest_posts_max",
"title" => "Anzahl der zu zeigenden News",
"description" => "Wie viele News sollen gezeigt werden?",
"optionscode" => "text",
"value" => "5",
"disporder" => "4",
"gid" => intval($gid),
);
$db->insert_query("settings", $latest_posts_1);
$db->insert_query("settings", $latest_posts_2);
$db->insert_query("settings", $latest_posts_3);
$new_templates['latest_posts_plugin'] = "<br/><table cellSpacing=\"0\" cellPadding=\"0\" border=\"0\">
<tr>
<td>\$latestposterlink</td>
</tr>
</table><br/>";
// Insert new templates
foreach($new_templates as $title => $template) {
$db->query("INSERT INTO `".TABLE_PREFIX."templates` VALUES (NULL, '$title', '$template', '-1', '120', '', '1157735635')");
}
}
function latest_posts()
{
global $forum_query, $thread_list, $db, $mybb, $cache, $templates, $lang, $templates;
if($mybb->settings['show_latest_posts'] == '1') {
$forum_query = $db->query("SELECT * FROM ".TABLE_PREFIX."forums WHERE fid='".$mybb->settings['latest_posts_forum']."'");
if($forum = $db->fetch_array($forum_query)) {
$thread_forum = $forum['name'];
}
$latestpostdate = my_date($mybb->settings['dateformat'],$thread['dateline']);
$latestposttime = my_date($mybb->settings['timeformat'],$thread['dateline']);
if($thread['uid'] == 0) {
$latestposterlink = $thread['username'];
}
else {
$latestposterlink ='<td><img src="images/latest/username." style="vertical-align: middle;"><a target="_blank" href="'.
$mybb->settings['bburl'].'/member.php?action=profile&uid='.
$thread['uid'].'">'.$thread['username'].'</a></td>';
}
eval("\$latest_posts_plugin = \"".$templates->get("latest_posts_plugin")."\";");
}
}
?>