MyBB.de Forum
Plugin: Zeige unbeantwortete Themen - 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: Plugin: Zeige unbeantwortete Themen (/thread-1325.html)

Seiten: Seiten: 1 2 3


RE: Plugin: Zeige unbeantwortete Themen - reisender - 26.03.2009

bitteschön...

vlt kannst du ja auch mal das lugin oben anschauen ob man nicht eifach da was machen kann??
Hey ih habs hinbekommen...juhuuuuuuuuuuuuuuuuuuuuuuuuuuu Big Grin

schau so sieht jetzt der code aus und die suchfunktion geht auch und alles klappt

Zitat: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\'] = "Unbeantwortete Themen";
$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

$search_url = MYBB_ROOT."search.php";
$fh = fopen($search_url, "r") or cperror("Could not open file!"); //OPEN FILE
$data = fread($fh, filesize($search_url)) 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" && $mybb->request_method == "post")').'#','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(TABLE_PREFIX."searchlog", $searcharray);
redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults);
}
elseif($mybb->input[\'action\'] == "do_search" && $mybb->request_method == "post")',$data); //REPLACE IN STRING
$fw = fopen($search_url, "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(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=unanswered">$lang->welcome_unanswered</a> |').'#', '<a href="search.php?action=getdaily">$lang->welcome_todaysposts</a> |');
}