MyBB.de Forum
SQL-Problem im Plugin - Druckversion

+- MyBB.de Forum (https://www.mybb.de/forum)
+-- Forum: Anpassungen (https://www.mybb.de/forum/forum-47.html)
+--- Forum: Plugin-Diskussionen (https://www.mybb.de/forum/forum-38.html)
+--- Thema: SQL-Problem im Plugin (/thread-11383.html)



SQL-Problem im Plugin - derdemo - 29.10.2008

Hallo,

habe mir Version 1.1.1 des Plugin "Thema Erledigt" auf einem mybboard 1.4.3 ohne Fehlermeldung installiert und aktiviert.

Button zu drücken "Erledigt" wird auch richtig eingeblendet, jedoch ändert sich nichts... nach dem betätigen...

Ursache ist (soweit ich das kontrolliert habe...) das der Status in der DB nicht auf 1 geändert wird.
Wenn ich den Status per Hand auf 1 setzte, wird auch das Statusicon richtig angezeigt.


jemand eine Idee, was ich noch machen kann ?

Gruß Demo


RE: SQL-Problem im Plugin - Michael - 29.10.2008

Kannst du einen Testaccount anlegen und mir die Daten per PN schicken? Danke!


RE: SQL-Problem im Plugin - derdemo - 29.10.2008

Hallo Michael,

wovon benötigst du einen Testaccount ?

mybboard ? ftp ? sql.. Wink


RE: SQL-Problem im Plugin - Michael - 30.10.2008

Das Problem wird vom URL-Rewriting verursacht. Kontrolliere bitte deine Regeln in der .htaccess.


RE: SQL-Problem im Plugin - derdemo - 31.10.2008

Danke für die Info,

ich werde dann einmal sehen, woran es genau liegt...

Gruß Dennis
Ok konnte das Problem lösen, indem ich in .htaccess

folgende Zeilen hinzugefügt habe:

Code:
RewriteRule ^(.*)Thema-erledigt-([0-9]+).html(.*)$ showthread.php?tid=$2&marksolved=1
RewriteRule ^(.*)Thema-nicht-erledigt-([0-9]+).html(.*)$ showthread.php?tid=$2&marksolved=0



und die threadsolved.php wie folgt geändert habe...

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&ouml;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>&nbsp;";
        }
        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>&nbsp;";
        }
    }
}
?>


Gruß und Danke noch einmal !

Smile