ich werde dann einmal sehen, woran es genau liegt...
Code:
<?php
/*
Plugin "Thread solved" 1.1
2008 (c) MyBBoard.de
*/
// Disallow direct access to this file for security reasons
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("forumdisplay_thread", "threadsolved");
$plugins->add_hook("search_results_thread", "threadsolved");
//$plugins->add_hook("search_results_post", "threadsolved");
$plugins->add_hook("showthread_linear", "threadsolved");
$plugins->add_hook("showthread_threaded", "threadsolved");
function threadsolved_info() {
return array(
"name" => "Thema erledigt",
"description" => "Themen können als erledigt markiert werden.",
"website" => "https://www.mybb.de",
"author" => "MyBBoard.de",
"authorsite" => "https://www.mybb.de",
"version" => "1.1.1",
);
}
function threadsolved_install() {
global $db;
if(!$db->field_exists('threadsolved', "threads")) {
$db->query("ALTER TABLE `".TABLE_PREFIX."threads` ADD `threadsolved` INT( 1 ) NOT NULL DEFAULT '0';");
}
}
function threadsolved_uninstall() {
global $db;
$db->query("ALTER TABLE `".TABLE_PREFIX."threads` DROP `threadsolved`;");
}
function threadsolved_activate() {
require MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("forumdisplay_thread", '#{\$gotounread}#', "{\$gotounread} {\$threadsolved} ");
find_replace_templatesets("search_results_threads_thread", '#{\$gotounread}#', "{\$gotounread} {\$threadsolved} ");
find_replace_templatesets("search_results_posts_post", '#{\$lang->post_thread}#', "{\$lang->post_thread} {\$threadsolved}");
find_replace_templatesets("showthread", '#<strong>{\$thread#', "{\$threadsolved} <strong>{\$thread");
find_replace_templatesets("showthread", '#{\$newreply}#', "{\$threadsolved_button}{\$newreply}");
}
function threadsolved_deactivate() {
require MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("forumdisplay_thread", '# {\$threadsolved} #', "", 0);
find_replace_templatesets("search_results_threads_thread", '# {\$threadsolved} #', "", 0);
find_replace_templatesets("search_results_posts_post", '# {\$threadsolved}#', "", 0);
find_replace_templatesets("showthread", '#{\$threadsolved} #', "", 0);
find_replace_templatesets("showthread", '#{\$threadsolved_button}#', "", 0);
}
function threadsolved_is_installed() {
global $db;
if($db->field_exists('threadsolved', "threads")) {
return true;
} else {
return false;
}
}
function threadsolved() {
global $threadsolved, $thread, $post, $templates, $mybb, $threadsolved_button, $db, $theme;
if($mybb->user['uid'] != 0 && ($mybb->user['uid'] == $thread['uid'] || $mybb->user['usergroup'] == "4" || $mybb->user['usergroup'] == "3")) {
if($mybb->input['marksolved'] == "1") {
$db->query("UPDATE ".TABLE_PREFIX."threads SET threadsolved = '1' WHERE tid = '".$thread['tid']."';");
$thread['threadsolved'] = "1";
}
if($mybb->input['marksolved'] == "0") {
$db->query("UPDATE ".TABLE_PREFIX."threads SET threadsolved = '0' WHERE tid = '".$thread['tid']."';");
$thread['threadsolved'] = "0";
}
}
$threadsolved = $threadsolved_button = "";
if($thread['threadsolved'] == "1") {
$threadsolved = "<img src=\"images/solved.png\" border=\"0\" alt=\"\" style=\"vertical-align: middle;\" />";
}
if(basename($_SERVER['PHP_SELF']) == "showthread.php") {
if($thread['threadsolved'] != "1" && ($mybb->user['uid'] != 0 && ($mybb->user['uid'] == $thread['uid'] || $mybb->user['usergroup'] == "4" || $mybb->user['usergroup'] == "3"))) {
$threadsolved_button = "<a href=\"Thema-erledigt-".$thread['tid'].".html\"><img src=\"".$theme['imglangdir']."/solved.gif\" border=\"0\" alt=\"\" /></a> ";
}
if($thread['threadsolved'] == "1" && ($mybb->user['uid'] != 0 && ($mybb->user['uid'] == $thread['uid'] || $mybb->user['usergroup'] == "4" || $mybb->user['usergroup'] == "3"))) {
$threadsolved_button = "<a href=\"Thema-nicht-erledigt-".$thread['tid'].".html\"><img src=\"".$theme['imglangdir']."/notsolved.gif\" border=\"0\" alt=\"\" /></a> ";
}
}
}
?>