2007-05-11, 10:58 PM
I installed and tried to activate Musicalmidget's plugin (Downloads Section), but it refuses to activate. I get this message:
I'm currently using MyBB 1.2.6. Can anyone help me decipher this message?
Another problem with "Show Unanswered Threads" plugin by Zaher1988. I installed and literally followed the instructions. It activates but nothing is shown on the index page. I checked the global_lang.php and noticed that it added this line:
I appreciate your help.
Regards
MySQL error: 1050
Table 'mybb_downloadcategories' already exists
Query: CREATE TABLE `mybb_downloadcategories` ( cid smallint unsigned NOT NULL auto_increment, name varchar(120) NOT NULL default '', description text NOT NULL default '', visiblegroups text NOT NULL default '', submissiongroups text NOT NULL default '', disporder smallint unsigned NOT NULL default '0', downloads int(10) NOT NULL default '0', PRIMARY KEY (`cid`) ) TYPE=MyISAM;
I'm currently using MyBB 1.2.6. Can anyone help me decipher this message?
Another problem with "Show Unanswered Threads" plugin by Zaher1988. I installed and literally followed the instructions. It activates but nothing is shown on the index page. I checked the global_lang.php and noticed that it added this line:
$l['welcome_unanswered'] = "View Unanswered Threads";
But it doesn't seem to have done anything else in the global.php, search.php or the adminfunctions_templates.php which are referred to in the readme.doc or plugin script:<?php
/**
* Mod Name: Show Unanwsered Threads
* Copyright TECHEX - The Site
* http://www.thetechex.net
*/
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
function sua_info()
{
return array(
"name" => "Show Unanwsered Threads",
"description" => "It will show all threads with 0 replies.",
"website" => "http://www.thetechex.net",
"author" => "Zaher1988",
"authorsite" => "mailto:[email protected]",
"version" => "2.0",
);
}
function sua_activate()
{
global $db, $mybb, $lang, $templates;
$language = $mybb->settings['bblanguage'];
$tlurl = MYBB_ROOT."/inc/languages/english/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
$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/$language/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\'] = "View Unanswered Threads";
$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 :(
$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\'] == "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);
}').'#','',$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=unanswered">{$lang->welcome_unanswered}</a> |').'#', '',0);
}
?>
I appreciate your help.
Regards