<?php
/**
* Ostatnie zmiany
* Copyright 2010 Tomasz Knapik, All Rights Reserved
* Website: http://venoch.trrp.pl
*/
define('IN_MYBB', 1);
require "./global.php";
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;
$parser_options = array(
"allow_html" => 1,
"allow_mycode" => 1,
"allow_smilies" => 1,
"allow_imgcode" => 1,
"allow_videocode" => 1,
"filter_badwords" => 1
);
if($mybb->user['usergroup']==4 || $mybb->user['usergroup']==8)
{
if(!empty($mybb->input['uid']) && $mybb->input['action']=="delete")
{
$db->query("DELETE FROM mybb_changes WHERE uid='".$mybb->input['uid']."'");
header("Location: changes.php");
$mybb->input['action']=null;
}
if(!empty($_POST['submitchange']))
{
if(empty($_POST['title']))
{
$warnings.="<li>Nie wpisałeś tytułu! </li>";
}
if(empty($_POST['content']))
{
$warnings.="<li>Nie uzupełniłeś treści zmiany!</li>";
}
if(!empty($_POST['title']) && !empty($_POST['content']))
{
$_POST['title']=$db->escape_string($_POST['title']);
$_POST['content']=$db->escape_string($_POST['content']);
$_POST['cat']=$db->escape_string($_POST['cat']);
$data=date("Y-m-d H:i:s");
$db->query("INSERT INTO mybb_changes(title,cat,content,author,date) VALUES('".$_POST['title']."','".$_POST['cat']."','".$_POST['content']."','".$mybb->user['uid']."','".$data."')");
$_POST=null;
}
}
}
$SQL=$db->query("SELECT * FROM mybb_changes GROUP BY uid DESC LIMIT 15");
if($db->num_rows($SQL)>0)
{
while($row=$db->fetch_array($SQL))
{
if($row['cat']==1)
{
$row['cat2']="
<span style=\"background-color: #E7A100; color: #FFF; font-size: 11px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; margin-left: 5px; margin-top: 2px; padding: 2px;\"><span style=\"font-weight: bold; font-size: 12px;\">Forum</span><span></span></span>";
$row['cat3']="forum";
}
elseif($row['cat']==2)
{
$row['cat2']="<span style=\"background-color: #E7A100; color: #FFF; font-size: 11px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; margin-left: 5px; margin-top: 2px; padding: 2px;\"><span style=\"font-weight: bold; font-size: 12px;\">Serwer/Skrypt</span><span></span></span>";
$row['cat3']="serwer/skrypt";
}
else
{
$row['cat2']="<span style=\"background-color: #E7A100; color: #FFF; font-size: 11px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; margin-left: 5px; margin-top: 2px; padding: 2px;\"><span style=\"font-weight: bold; font-size: 12px;\">Inne</span><span></span></span>";
$row['cat3']="inne";
}
$row['date']=strtotime($row['date']);
$row['datef']=my_date($mybb->settings['dateformat'], $row['date']);
$row['timef']=my_date($mybb->settings['timeformat'], $row['date']);
$_uid = $row['author'];
$wynik = $db->query("SELECT avatar FROM mybb_users where uid=$_uid");
if ($r2 = $db->fetch_array($wynik)) {
$avatar = $r2['avatar'];
}
$author=StyleUsernames::GetUser($row['author']);
$authorlink=get_profile_link($row['author']);
$row['content'] = $parser->parse_message($row['content'], $parser_options);
$changes.="
<tr>
<td class=\"tcat\" colspan=\"4\">".$row['cat2']." <strong>".$row['title']."</strong></td><td></td><td></td>
</tr>
<tr>
<td style=\"border-right: ridge\"><img src=\"".$avatar."\" height=\"80\" width=\"120\"/><br/><strong>Dodał:
</strong> <a href=\"".$authorlink."\">".$author."</a><br/><strong>Data:</strong> ".$row['datef'].", ".$row['timef']."<br/></td> <td align=\"left\" valign=\"top\">".$row['content']."</td>
</tr>
<tr>
<td></td> <td></td> <td></td>
</tr>";
if($mybb->user['usergroup']==4 || $mybb->user['usergroup']==8)
{
$changes.="<tr><td class=\"trow1\" colspan=\"4\" ><a href=\"changes.php?uid=".$row['uid']."&action=delete\"><img src=\"images/imperial/english/pm_delete.gif\" title=\"Skasuj ten wpis\"></a></td></tr>";
}
}
}
else
{
$changes.="<tr><td class=\"trow1\" colspan=\"3\"><div class=\"notice\"><p><em>Brak zmian wyświetlenia.</em></p></div></td></tr>";
}
if($mybb->user['usergroup']==4 || $mybb->user['usergroup']==8)
{
$admin.="<form action=\"changes.php\" method=\"post\">";
$admin.="<br /><table border=\"0\" cellspacing=\"".$theme['borderwidth']."\" cellpadding=\"".$theme['tablespace']."\" class=\"tborder\" style=\"float: center;width: 60%;\">";
$admin.="<tr><td class=\"#\"><hr></td></tr>";
$admin.="<tr><td class=\"#\"><strong>Dodaj nową zmianę</strong></td></tr>";
$admin.="<tr><td class=\"trow1\"><select name=\"cat\"><option value=\"1\">Forum</option><option value=\"2\">Serwer/Skrypt</option><option value=\"3\">Inne</option></select><br/><input type=\"text\" name=\"title\"/><br/><textarea name=\"content\" rows=\"8\" cols=\"45\"></textarea></td></tr>";
$admin.="<tr><td class=\"trow1\"><input type=\"submit\" name=\"submitchange\" value=\"Dodaj\" class=\"button\"/></td></tr>";
$admin.="</table></form>";
}
else
{
$admin=null;
}
add_breadcrumb("Zmiany", "changes.php");
eval("\$changes = \"".$templates->get("changes")."\";");
output_page($changes);
?>