20.08.2017, 11:33
Jak dodać status online tak jak na SS
[attachment=12487]
[attachment=12487]
Kod PHP:
<?php
/**
* MyBB 1.8
* Member of the Month 2.0 stworzony przez ConeralSanders2 edytowany przez SeNioR
*/
// Disallow direct access to this file for security reasons
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("global_start", "usermiesiaca");
function usermiesiaca_info()
{
return array(
"name" => "UĹĽytkownik miesiÄ…ca",
"description" => "Plugin wyświetla użytkownika miesiąca",
"website" => "",
"author" => "ConeralSanders2 & <a href=\"http://webmasteruj.pl\">SeNioR</a>",
'codename' => "usermiesiaca",
"authorsite" => "",
"version" => "3.0",
"guid" => "",
"compatibility" => "*"
);
}
function usermiesiaca_install()
{
global $settings, $mybb, $db, $lang;
$lang->load("forum_user_miesiaca");
if($db->field_exists("usermiesiaca", "users"))
{
$db->write_query("ALTER TABLE ".TABLE_PREFIX."users DROP `usermiesiaca`");
}
$lang->load("forum_user_miesiaca");
$usermiesiaca_group = array(
"gid" => "NULL",
"name" => "usermiesiaca",
"title" => "{$lang->usermiesiaca}",
"description" => "{$lang->usermiesiaca_desc}",
"disporder" => "3",
"isdefault" => "no",
);
$db->insert_query("settinggroups", $usermiesiaca_group);
$gid = $db->insert_id();
$usermiesiaca_setting_1 = array(
"sid" => "NULL",
"name" => "usermiesiacawinner",
"title" => "{$lang->usermiesiaca_fwinner}",
"description" => "{$lang->usermiesiaca_desc_fwinner}",
"optionscode" => "text",
"value" => "",
"disporder" => "3",
"gid" => intval($gid),
);
$usermiesiaca_setting_2 = array(
"sid" => "NULL",
"name" => "usermiesiacawimg",
"title" => "{$lang->usermiesiaca_fimg}",
"description" => "{$lang->usermiesiaca_desc_fimg}",
"optionscode" => "text",
"value" => "",
"disporder" => "5",
"gid" => intval($gid),
);
$usermiesiaca_setting_3 = array(
"sid" => "NULL",
"name" => "usermiesiacawid",
"title" => "{$lang->usermiesiaca_fwid}",
"description" => "{$lang->usermiesiaca_desc_fwid}",
"optionscode" => "text",
"value" => "",
"disporder" => "4",
"gid" => intval($gid),
);
$usermiesiaca_setting_4 = array(
"sid" => "NULL",
"name" => "usermiesiaca_show",
"title" => "{$lang->usermiesiaca_show}",
"description" => "{$lang->usermiesiaca_desc_show}",
"optionscode" => "yesno",
"value" => "no",
"disporder" => "0",
"gid" => intval($gid),
);
$db->insert_query("settings", $usermiesiaca_setting_1);
$db->insert_query("settings", $usermiesiaca_setting_2);
$db->insert_query("settings", $usermiesiaca_setting_3);
$db->insert_query("settings", $usermiesiaca_setting_4);
$db->write_query("ALTER TABLE ".TABLE_PREFIX."users ADD `usermiesiaca` int NOT NULL default 0");
rebuild_settings();
}
function usermiesiaca_is_installed()
{
global $db;
if($db->field_exists("usermiesiaca", "users"))
{
return true;
}
return false;
}
function usermiesiaca_activate()
{
global $db;
include MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("index", "#".preg_quote("{\$boardstats}")."#i", "{\$boardstats}\r\n{\$usermiesiaca}");
}
function usermiesiaca_deactivate()
{
global $db;
include MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("index", "#".preg_quote("\r\n{\$usermiesiaca}")."#i", "", 0);
}
function usermiesiaca_uninstall()
{
global $db;
if($db->field_exists("usermiesiaca", "users"))
{
$db->write_query("ALTER TABLE ".TABLE_PREFIX."users DROP `usermiesiaca`");
}
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='usermiesiacawinner'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='usermiesiacawimg'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='usermiesiacawid'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='usermiesiaca_show'");
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='usermiesiaca'");
rebuild_settings();
$db->delete_query("templates", "title = 'usermiesiaca'");
}
function usermiesiaca()
{
/* DODATKOWE */
/* miesiÄ…c */
$miesiace = array('01' => 'Styczeń', '02' => 'Luty', '03' => 'Marzec', '04' => 'Kwiecień', '05' => 'Maj', '06' => 'Czerwiec', '07' => 'Lipiec', '08' =>'Sierpień', '09' => 'Wrzesień', '10' => 'Październik', '11' => 'Listopad', '12' => 'Grudzień');
$data = $miesiace[date('m')].' '.date('Y').'';
global $mybb, $db, $usermiesiaca, $theme, $lang;
$lang->load('user_miesiaca');
if ($mybb->settings['usermiesiaca_show'] == 0)
{
return true;
}
else
{
/* avatar i id */
$id_usera = $mybb->settings['usermiesiacawid'];
$av = get_user("$id_usera");
/* lang do koncowki post posty postow */
if ($av['postnum'] == 1){
$postow = 'post';
}
elseif($av['postnum'] == 2 or $av['postnum'] == 3 or $av['postnum'] == 4){
$postow = 'posty';
}
else{
$postow = 'postĂłw';
}
/* lang do koncowki temat tematy tematow */
if ($av['threadnum'] == 1){
$tematow = 'temat';
}
elseif($av['threadnum'] == 2 or $av['threadnum'] == 3 or $av['threadnum'] == 4){
$tematow = 'tematy';
}
else{
$tematow = 'tematĂłw';
}
/* lang do koncowki temat tematy tematow */
if ($av['reputation'] == 1){
$punktow = 'punkt';
}
elseif($av['reputation'] == 2 or $av['reputation'] == 3 or $av['reputation'] == 4){
$punktow = 'punkty';
}
else{
$punktow = 'punktów';
}
if ($mybb->settings['usermiesiacawimg'] == NULL){
$obrazek = '';
}
else{
$obrazek = "<img alt=\"{$mybb->settings['usermiesiacawinner']}\" style=\"vertical-align:middle; width:16px; height:16px;\" src=\"{$mybb->settings['usermiesiacawimg']}\">";
}
if ($av['avatar'] == NULL){
$avataros = 'http://i1.webmasteruj.pl/avatar.png';
}
else{
$avataros = "{$av['avatar']}";
}
$usermiesiaca="
<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder border_table\" style=\"clear: both\">
<tr>
<td class=\"thead_sidebox\" colspan=\"1\">
<img src=\"images/carbon/korona.png\" style=\"margin-right: 7px;float: left;\"> {$lang->usermiesiaca_title}
</td>
</tr>
<tr>
<td class=\"trow2\">
<img title=\"{$mybb->settings['usermiesiacawinner']}\" alt=\"{$mybb->settings['usermiesiacawinner']}\" style=\"float:left; width:68px; height:68px; border: 2px solid #008000; margin-right: 5px; margin-left: 5px; \" src=\" {$avataros}\">
<a href=\"member.php?action=profile&uid={$mybb->settings['usermiesiacawid']}\">{$mybb->settings['usermiesiacawinner']}</a> {$obrazek}
<span style=\"float:right;\"><strong><span class=\"prefix\" style=\" background-color: rgb(0,128,0);\">{$data}</strong></span>
<br>
<br>
<br>
<br>
<br>
<div align=\"center\" style=\"margin-top: 3px;\">
<div style=\"width: 100%; background-color: green; height: 1px; float: center;\"></div>
<strong><span class=\"prefix\" style=\" background-color: rgb(0,128,0);\"> {$av['postnum']} {$postow}</strong> </span><strong><span class=\"prefix\" style=\" background-color: rgb(0,128,0);\">{$av['threadnum']} {$tematow} </strong></span> <span class=\"prefix\" style=\" background-color: rgb(0,128,0);\"><strong>{$av['reputation']} reputacji </span></strong>
</div>
</td>
</tr>
</table>
";
}
}
?>