<?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("forumdisplay_thread", "data_threads");
$plugins->add_hook("showthread_start", "data_temat");
$plugins->add_hook("showthread_start", "postow_w_temacie");
$plugins->add_hook("showthread_start", "avatar_autora_tematu");
$plugins->add_hook("forumdisplay_start", "aktywne_sortowanie");
$plugins->add_hook("forumdisplay_start", "opis_dzialuforum");
function baszar_info()
{
return array(
'name' => 'Dodatki do szablonu',
'description' => 'Plugin dodaje niezbędne dodatki do szablonów stworzonych przez baszara lub djhehe',
'website' => 'http://baszarmybb.xaa.pl',
'author' => 'baszaR',
'authorsite' => 'http://baszarmybb.xaa.pl',
'version' => '1.0.0',
'guid' => '',
'compatibility' => '16*'
);
}
function data_threads() {
global $mybb, $thread;
$thread['thread_data'] = date('d n Y', $thread['dateline']);
$data_miesiace = Array('Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Paź', 'Lis', 'Gru');
$data_czas = explode(" ", $thread['thread_data']);
$thread['thread_date'] = $data_czas[0]." ".$data_miesiace[$data_czas[1] - 1]." ".$data_czas[2];
}
function data_temat() {
global $mybb, $thread;
$thread['temat_data'] = date('d n Y', $thread['dateline']);
$thread['temat_godzina'] = my_date($mybb->settings['timeformat'], $thread['dateline']);
$data_miesiace = Array('Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Paź', 'Lis', 'Gru');
$data_czas = explode(" ", $thread['temat_data']);
$thread['temat_date'] = $data_czas[0]." ".$data_miesiace[$data_czas[1] - 1]." ".$data_czas[2];
}
function avatar_autora_tematu()
{
global $db, $thread;
$tid = $_GET['tid'];
$query = $db->simple_select("threads", "uid", "tid = $tid");
while($row = $db->fetch_array($query))
{
$id = $row['uid'];
}
$query_2 = $db->simple_select("users", "*", "uid=$id");
while($row2 = $db->fetch_array($query_2))
{
$avatar = $row2['avatar'];
$idusera = $row2['uid'];
$username = $row2['username'];
$username_group = $row2['usergroup'];
$username_display = $row2['displaygroup'];
}
$thread['avatar_started'] = '<a href="member.php?action=profile&uid='.$idusera.'"><img id="useravy_post" src="'.$avatar.'" alt="" /></a>';
$sformatowana = format_name($username, $username_group, $username_display);
$thread['username_started'] = '<a href="member.php?action=profile&uid='.$idusera.'">'.$sformatowana.'</a>';
}
function opis_dzialuforum()
{
global $db, $foruminfo;
$fid = $_GET['fid'];
}
function postow_w_temacie()
{
global $thread;
if($thread['replies'] == 0)
{
$thread['info_o_postach'] = "Brak odpowiedzi w tym temacie";
}
elseif($thread['replies'] == 1)
{
$thread['info_o_postach'] = $thread['replies']." odpowiedź w tym temacie";
}
elseif($thread['replies'] > 1)
{
$thread['info_o_postach'] = $thread['replies']." odpowiedzi w tym temacie";
}
}
function aktywne_sortowanie()
{
global $mybb, $viewsACTIVE, $startACTIVE, $lastpostACTIVE, $odpACTIVE;
switch($mybb->input['sortby'])
{
case "subject":
$sortfield = "subject";
break;
case "replies":
$sortfield = "replies";
$odpACTIVE = "class='na_thead'";
break;
case "views":
$sortfield = "views";
$viewsACTIVE = "class='na_thead'";
break;
case "starter":
$sortfield = "username";
break;
case "rating":
$t = "";
$sortfield = "averagerating";
$sortfield2 = ", t.totalratings DESC";
break;
case "started":
$sortfield = "dateline";
$startACTIVE = "class='na_thead'";
break;
default:
$sortby = "lastpost";
$sortfield = "lastpost";
$lastpostACTIVE = "class='na_thead'";
$mybb->input['sortby'] = "lastpost";
break;
}
}
?>