MyBB.de Forum

Normale Version: Plugin: Zeige unbeantwortete Themen
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Seiten: 1 2 3
okay ich hatte noch einges zu ändern mich MYBB_ROOT. dann gings... also ist aktiviert, das problem ist ich sehe nichts im header bzw da wo es sein sollte... ?? :~
ich poste mal das plugin rein wie es jetzt aussieht:

Zitat:<?php
/**
* Mod Name: Show Unanwsered Threads
* Copyright Zaher1988 - http://techex.techindo.com
*/


function sua_info()
{
return array(
"name" => "Zeige unbeantwortete Themen",
"description" => "Zeigt alle Themen ohne Antworten.",
"website" => "http://www.thetechex.net",
"author" => "Zaher1988",
"authorsite" => "mailto:zaher1988@gmail.com",
"version" => "1.0",
);
}

function sua_activate()
{

global $db, $mybb, $lang, $templates;

$language = $mybb->settings['bblanguage'];
$tlurl = MYBB_ROOT."inc/languages/deutsch_du/global.lang.php";

//edit txt file
$fh = fopen($tlurl, "r") or cperror("Could not open file!"); //OPEN FILE
$data = fread($fh, filesize($tlurl)) or cperror("Could not read file!"); //MAKE TEMPORARY STRING
fclose($fh); //CLOSE FILE AGAIN
$newdata = preg_replace('#'.preg_quote('$l[\'welcome_todaysposts\']').'#','$l[\'welcome_unanswered\'] = "View Unanswered Threads";
$l[\'welcome_todaysposts\']',$data); //REPLACE IN STRING
$fw = fopen($tlurl, "w") or cperror('Could not open file!'); //OPEN FILE AGAIN
$fb = fwrite($fw, $newdata) or cperror('Could not write to file'); //WRITE STRING TO FILE
fclose($fw); //CLOSE FILE AGAIN

//Let's edit search

$fh = fopen(MYBB_ROOT.'/search.php', "r") or cperror("Could not open file!"); //OPEN FILE
$data = fread($fh, filesize(MYBB_ROOT.'/search.php')) or cperror("Could not read file!"); //MAKE TEMPORARY STRING
fclose($fh); //CLOSE FILE AGAIN
$newdata = preg_replace('#'.preg_quote('elseif($mybb->input[\'action\'] == "do_search")').'#','elseif($mybb->input[\'action\'] == "unanswered")
{
$wheresql = "1=1";
$wheresql .= " AND t.replies=\'0\'";

$searcharray = array(
"uid" => $mybb->user[\'uid\'],
"dateline" => time(),
"ipaddress" => $ipaddress,
"wheresql" => addslashes($wheresql),
"lookin" => "p.message",
"showposts" => 1
);
$db->insert_query(TABLE_PREFIX."searchlog", $searcharray);
$plugins->run_hooks("search_do_search_process");
$sid = $db->insert_id();
eval("\\\$redirect = \"".$templates->get("redirect_searchresults")."\";");
redirect("search.php?action=results&sid=$sid", $lang->redirect_searchresults);
}
elseif($mybb->input[\'action\'] == "do_search")',$data); //REPLACE IN STRING
$fw = fopen(MYBB_ROOT.'/search.php', "w") or cperror('Could not open file!'); //OPEN FILE AGAIN
$fb = fwrite($fw, $newdata) or cperror('Could not write to file'); //WRITE STRING TO FILE
fclose($fw); //CLOSE FILE AGAIN

require MYBB_ROOT."/inc/adminfunctions_templates.php";

find_replace_templatesets("header_welcomeblock_member", '#'.preg_quote('<a href="search.php?action=getdaily">$lang->welcome_todaysposts</a> |').'#', '<a href="search.php?action=getdaily">$lang->welcome_todaysposts</a> | <a href="search.php?action=unanswered">\$lang->welcome_unanswered</a> |');

}


function sua_deactivate()
{

global $db, $mybb, $lang, $templates;
$language = $mybb->settings['bblanguage'];
$tlurl = MYBB_ROOT."inc/languages/deutsch_du/global.lang.php";

//edit txt file
$fh = fopen($tlurl, "r") or cperror("Could not open file!"); //OPEN FILE
$data = fread($fh, filesize($tlurl)) or cperror("Could not read file!"); //MAKE TEMPORARY STRING
fclose($fh); //CLOSE FILE AGAIN
$newdata = preg_replace('#'.preg_quote('$l[\'welcome_unanswered\'] = "Unbeantwortete Themen";
$l[\'welcome_todaysposts\']').'#','$l[\'welcome_todaysposts\']',$data); //REPLACE IN STRING
$fw = fopen($tlurl, "w") or cperror('Could not open file!'); //OPEN FILE AGAIN
$fb = fwrite($fw, $newdata) or cperror('Could not write to file'); //WRITE STRING TO FILE
fclose($fw); //CLOSE FILE AGAIN


//Remove Sad

$fh = fopen(MYBB_ROOT.'/search.php', "r") or cperror("Could not open file!"); //OPEN FILE
$data = fread($fh, filesize(MYBB_ROOT.'/search.php')) or cperror("Could not read file!"); //MAKE TEMPORARY STRING
fclose($fh); //CLOSE FILE AGAIN
$newdata = preg_replace('#'.preg_quote('elseif($mybb->input[\'action\'] == "unanswered")
{
$wheresql = "1=1";
$wheresql .= " AND t.replies=\'0\'";

$searcharray = array(
"uid" => $mybb->user[\'uid\'],
"dateline" => time(),
"ipaddress" => $ipaddress,
"wheresql" => addslashes($wheresql),
"lookin" => "p.message",
"showposts" => 1
);
$db->insert_query(TABLE_PREFIX."searchlog", $searcharray);
$plugins->run_hooks("search_do_search_process");
$sid = $db->insert_id();
eval("\\\$redirect = \"".$templates->get("redirect_searchresults")."\";");
redirect("search.php?action=results&sid=$sid", $lang->redirect_searchresults);
}
elseif($mybb->input[\'action\'] == "do_search")').'#','elseif($mybb->input[\'action\'] == "do_search")',$data); //REPLACE IN STRING
$fw = fopen('./search.php', "w") or cperror('Could not open file!'); //OPEN FILE AGAIN
$fb = fwrite($fw, $newdata) or cperror('Could not write to file'); //WRITE STRING TO FILE
fclose($fw); //CLOSE FILE AGAIN

require MYBB_ROOT."/inc/adminfunctions_templates.php";

find_replace_templatesets("header_welcomeblock_member", '#'.preg_quote('<a href="search.php?action=getdaily">$lang->welcome_todaysposts</a> | <a href="search.php?action=unanswered">$lang->welcome_unanswered</a> |').'#', '<a href="search.php?action=getdaily">$lang->welcome_todaysposts</a> |');
}

?>

vlt kann mir jemand sagen was ich ändern muss damit es oben erscheint
Hallo reisender,

versuche es einmal mit dieser Änderung:

gehe in "Admin-CP > Templates > dein Template-Set > Seitenkopf Templates > header_welcomeblock_member" und ersetze
Code:
                <a href="{$mybb->settings['bburl']}/search.php?action=getnew">{$lang->welcome_newposts}</a> | <a href="{$mybb->settings['bburl']}/search.php?action=getdaily">{$lang->welcome_todaysposts}</a> | <a href="{$mybb->settings['bburl']}/private.php">{$lang->welcome_pms}</a> {$lang->welcome_pms_usage}
durch
Code:
                <a href="{$mybb->settings['bburl']}/search.php?action=getnew">{$lang->welcome_newposts}</a> | <a href="{$mybb->settings['bburl']}/search.php?action=getdaily">{$lang->welcome_todaysposts}</a> | <a href="search.php?action=unanswered">{$lang->welcome_unanswered}</a> | <a href="{$mybb->settings['bburl']}/private.php">{$lang->welcome_pms}</a> {$lang->welcome_pms_usage}
Also wenn ich das dahintue zeigt es mir nur die Suchfunktion an...irgendwas ist da schief gelaufen oder?

kannst du mir da nochmal helfen?
Hast du die beiliegende Datei "Readme.doc" gelesen und die Anweisungen befolgt bzw. wurden die Änderungen in der Datei "search.php" ausgeführt?
ja hab ich da steht ja nur dass ich cmod auf 777 stellen soll...das hab ich...aber vlt hat es ja nichts geändert in der search.php wie beim header..kann das sein?

denn ich habs nochmal dekativiert und aktiviert..nichts
Wurde in der Datei "search.php" dieser Code-Block eingefügt?
PHP-Code:
elseif($mybb->input['action'] == "unanswered")
{
    
$where_sql "1=1";
    
$where_sql .= " AND t.replies='0'";
    
    
$sid md5(uniqid(microtime(), 1));
    
$searcharray = array(
        
"sid" => $db->escape_string($sid),
        
"uid" => $mybb->user['uid'],
        
"dateline" => time(),
        
"ipaddress" => $db->escape_string($session->ipaddress),
        
"threads" => '',
        
"posts" => '',
        
"searchtype" => "titles",
        
"resulttype" => "threads",
        
"querycache" => $db->escape_string($where_sql),
    );

    
$plugins->run_hooks("search_do_search_process");
    
$db->insert_query("searchlog"$searcharray);
    
redirect("search.php?action=results&sid=".$sid$lang->redirect_searchresults);

nein leider nicht...muss ich den irgendwo bestimmtes einfügen oder kann ich das einfach rein damit?
Suche die Zeile
PHP-Code:
elseif($mybb->input[\'action\'] == "do_search" && $mybb->request_method == "post") 
und ersetze sie durch
PHP-Code:
elseif($mybb->input['action'] == "unanswered")
{
    
$where_sql "1=1";
    
$where_sql .= " AND t.replies='0'";
    
    
$sid md5(uniqid(microtime(), 1));
    
$searcharray = array(
        
"sid" => $db->escape_string($sid),
        
"uid" => $mybb->user['uid'],
        
"dateline" => time(),
        
"ipaddress" => $db->escape_string($session->ipaddress),
        
"threads" => '',
        
"posts" => '',
        
"searchtype" => "titles",
        
"resulttype" => "threads",
        
"querycache" => $db->escape_string($where_sql),
    );

    
$plugins->run_hooks("search_do_search_process");
    
$db->insert_query("searchlog"$searcharray);
    
redirect("search.php?action=results&sid=".$sid$lang->redirect_searchresults);
}
elseif(
$mybb->input[\'action\'] == "do_search" && $mybb->request_method == "post") 
nein klappt nicht dann bekomme ich eine weise seite
Kannst du bitte einmal die Datei "search.php" als Datei anhängen?
Seiten: 1 2 3