17.08.2016, 18:12
Mój plugin się nie wyświetla na forum...
Kod:
Kod:
Kod PHP:
<?php
/**
* MyBB 1.8
* Copyright 2010 MyBB Group, All Rights Reserved
*
* Website: https://webboard.pl
*
* Author: CezPlayer
* Created: 08/12/2014
* Version: 1.0
*/
if(!defined("IN_MYBB"))
die("This file cannot be accessed directly.");
if (!defined("PLUGINLIBRARY"))
define("PLUGINLIBRARY", MYBB_ROOT."inc/plugins/pluginlibrary.php");
$plugins->add_hook('global_start', 'reminder');
function reminder_info() {
return array(
"name" => "Przypomnienie",
"description" => "Ten plugin przypomina uzytkownikowi o zrobieniu jakiejs czynnosci.",
"website" => "http://hmybboard.pl",
"author" => "CezPlayer",
"authorsite" => "http://forumreklamowe.ct8.pl",
"version" => "1.0",
"compatibility" => "18*"
);
}
function reminder_activate() {
global $mybb, $db;
if (!file_exists(PLUGINLIBRARY)) {
flash_message($lang->myalerts_pluginlibrary_missing, "error");
admin_redirect("index.php?module=config-plugins");
}
$PL or require_once PLUGINLIBRARY;
if ((int) $PL->version < 9) {
flash_message('This plugin requires PluginLibrary 9 or newer', 'error');
admin_redirect('index.php?module=config-plugins');
}
$stylesheet = "@import url(http://fonts.googleapis.com/css?family=Ubuntu:400,700);
@import url(http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css);
.reminder {
background: rgba(0,0,0,0.85);
width: 1000px;
padding: 28px 23px 28px 23px;
position: fixed;
top:80%;
right: 30px;
font-family: 'Ubuntu', sans-serif;
font-size: 13px;
color: #fff;
text-align: left;
opacity: 0.7;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
}
.reminder i.fa.fa-close {
height: 20px;
width: 20px;
position: absolute;
top: 8px;
right: 8px;
text-align: center;
line-height: 20px;
font-size: 16px;
cursor: pointer;
}";
$PL->stylesheet('reminder.css', $stylesheet);
$reminder_group = array(
'name' => 'Przypomnienie',
'title' => 'Ustawienia Przypomnienia',
'description' => "Tu możesz zmieniać ustawienia przypomnienia.",
'disporder' => 1,
'isdefault' => 0
);
$gid = $db->insert_query("settinggroups", $reminder_group);
$reminder_1 = array(
"name" => "reminder_1",
"title" => "Pokazywac?",
"description" => "Pokazywac przypomnienie na forum?",
"optionscode" => "yesno",
"value" => 1,
"disporder" => 1,
"gid" => $gid
);
$db->insert_query("settings", $reminder_1);
$reminder_2 = array(
"name" => "reminder_2",
"title" => "Wiadomosc",
"description" => "Tutaj wpisz wiadomosc, ktora bedzie sie wyswietlala w przypomnieniu.",
"optionscode" => "textarea",
"value" => 'Drogi uzytkowniku! Nie zapomnij sie zapoznac z regulaminem Naszego forum!',
"disporder" => 2,
"gid" => $gid
);
$db->insert_query("settings", $reminder_2);
$reminder_3 = array(
"name" => "reminder_3",
"title" => "Czas wyswietlania sie przypomnienia (w sekundach).",
"description" => "Tutaj wpisz, jak dlugo ma sie wyswietlac przypomnienie.",
"optionscode" => "text",
"value" => '3600',
"disporder" => 3,
"gid" => $gid
);
$db->insert_query("settings", $reminder_3);
$reminder_4 = array(
"name" => "reminder",
"title" => "Kto widzi przypomnienie?",
"description" => "Ktora grupa widzi przypomnienie?.",
"optionscode" => "text",
"value" => '1',
"disporder" => 4,
"gid" => $gid
);
$db->insert_query("settings", $reminder_4);
rebuild_settings();
$templatearray = array(
"tid" => "NULL",
"title" => 'reminder',
"template" => $db->escape_string('<div class="guest_warn"><i class="fa fa-close"></i>{$message}</div>
<script type="text/javascript">
$(document).ready(function() {
$(".reminder").fadeIn("slow");
$(".reminder i.fa.fa-close").click(function() {
$(".reminder").fadeOut("slow");
$.post(document.location.href, {cookie_reminder: 1});
});
});
</script>'),
"sid" => "-1",
);
$db->insert_query("templates", $templatearray);
require_once MYBB_ROOT.'inc/adminfunctions_templates.php';
find_replace_templatesets('headerinclude', '#'.preg_quote('{$stylesheets}').'#i','{$stylesheets} {$reminder}');
}
function reminder_deactivate() {
global $db;
if (!file_exists(PLUGINLIBRARY)) {
flash_message($lang->myalerts_pluginlibrary_missing, "error");
admin_redirect("index.php?module=config-plugins");
}
$PL or require_once PLUGINLIBRARY;
$PL->stylesheet_delete('reminder.css');
$db->delete_query("settinggroups", "name = 'reminder'");
$db->delete_query('settings', 'name IN (\'reminder_1\',\'reminder_2\',\'reminder_3\',\'reminder_4\')');
rebuild_settings();
$db->delete_query('templates', 'title IN (\'reminder\') AND sid=\'-1\'');
require_once MYBB_ROOT."inc/adminfunctions_templates.php";
find_replace_templatesets('headerinclude', '#'.preg_quote('{$reminder}').'#i', '', 0);
}
function reminder() {
global $mybb, $db, $lang, $templates, $reminder, $theme;
$message = $mybb->settings['reminder_2'];
if ($mybb->user['usergroup'] == $mybb->settings['reminder_4']) {
if($mybb->settings['reminder_1'] == 1) {
if(isset($_POST['cookie_reminder'])) {
setcookie("isclosed", "1", time()+$mybb->settings['reminder_3']);
}
if($_COOKIE['isclosed'] != 1) {
eval("\$reminder = \"".$templates->get('reminder')."\";");
}
}
}
}
?>