1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
<?php
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("build_forumbits_forum", "prefixesonindex_start");
$plugins->add_hook("thread_prefixes_start", "prefixesonindex_start");
function prefixesonindex_info()
{
return array(
"name" => "POI",
"description" => "Put the t prefix on the forum index.",
"website" => "",
"author" => "Solstice",
"authorsite" => "",
"version" => "1.0.5",
"guid" => "*",
"compatibility" => "16*"
);
}
function prefixesonindex_activate()
{
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("forumbit_depth2_forum", "#".preg_quote("<td class=\"{\$bgcolor}\" valign=\"top\" align=\"right\" style=\"white-space: nowrap\">{\$lastpost}</td>")."#i", "<td class=\"{\$bgcolor}\" valign=\"top\" align=\"left\" style=\"white-space: nowrap\">{\$lastpost}</td>");
find_replace_templatesets("forumbit_depth2_forum_lastpost", "#".preg_quote("<a href=\"{\$lastpost_link}\" title=\"{\$full_lastpost_subject}\"><strong>{\$lastpost_subject}</strong></a>")."#i", "{\$forum['lastpost_prefix']} <a href=\"{\$lastpost_link}\" title=\"{\$full_lastpost_subject}\"><strong>{\$lastpost_subject}</strong></a>");
find_replace_templatesets("forumbit_depth2_forum_lastpost", "#<br(.*?)</span>#ism", "<br />{\$lang->by} <strong>{\$lastpost_profilelink}</strong><br />{\$lastpost_date} {\$lastpost_time}</span>");
}
function prefixesonindex_deactivate()
{
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("forumbit_depth2_forum", "#".preg_quote("<td class=\"{\$bgcolor}\" valign=\"top\" align=\"left\" style=\"white-space: nowrap\">{\$lastpost}</td>")."#i", "<td class=\"{\$bgcolor}\" valign=\"top\" align=\"right\" style=\"white-space: nowrap\">{\$lastpost}</td>", 0);
find_replace_templatesets("forumbit_depth2_forum_lastpost", "#".preg_quote("{\$forum['lastpost_prefix']} <a href=\"{\$lastpost_link}\" title=\"{\$full_lastpost_subject}\"><strong>{\$lastpost_subject}</strong></a>")."#i", "<a href=\"{\$lastpost_link}\" title=\"{\$full_lastpost_subject}\"><strong>{\$lastpost_subject}</strong></a>", 0);
find_replace_templatesets("forumbit_depth2_forum_lastpost", "#<br(.*?)</span>#ism", "<br />{\$lastpost_date} {\$lastpost_time}<br />{\$lang->by} {\$lastpost_profilelink}</span>", 0);
}
function prefixesonindex_start(&$forum) {
global $cache,$prefixes;
$lastpost_prefix = "";
$thread = get_thread($forum['lastposttid']);
$prefix_cache = $cache->read("prefixes");
if($thread['prefix'] > 0 && $prefix_cache[$thread['prefix']])
{
$prefix = $prefix_cache[$thread['prefix']];
$forum['lastpost_prefix'] = "{$thread['prefix']}";
}
}
?>
|