Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 17th, 2012  |  syntax: None  |  size: 4.14 KB  |  hits: 37  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /**
  3.  * Ostatnie zmiany
  4.  * Copyright 2010 Tomasz Knapik, All Rights Reserved
  5.  * Website: http://venoch.trrp.pl
  6.  */
  7. define('IN_MYBB', 1);
  8. require "./global.php";
  9. require_once MYBB_ROOT."inc/class_parser.php";
  10. $parser = new postParser;
  11. $parser_options = array(
  12.         "allow_html" => 1,
  13.         "allow_mycode" => 1,
  14.         "allow_smilies" => 1,
  15.         "allow_imgcode" => 1,
  16.         "allow_videocode" => 1,
  17.         "filter_badwords" => 1
  18. );
  19. if($mybb->user['usergroup']==4 || $mybb->user['usergroup']==8)
  20. {
  21.         if(!empty($mybb->input['uid']) && $mybb->input['action']=="delete")
  22.         {
  23.                 $db->query("DELETE FROM mybb_changes WHERE uid='".$mybb->input['uid']."'");
  24.                 header("Location: changes.php");
  25.                 $mybb->input['action']=null;
  26.         }
  27.         if(!empty($_POST['submitchange']))
  28.         {
  29.                 if(empty($_POST['title']))
  30.                 {
  31.                         $warnings.="<li>Nie wpisałeś tytułu!</li>";
  32.                 }
  33.                 if(empty($_POST['content']))
  34.                 {
  35.                         $warnings.="<li>Nie uzupełniłeś treści zmiany!</li>";
  36.                 }
  37.                 if(!empty($_POST['title']) && !empty($_POST['content']))
  38.                 {
  39.                         $_POST['title']=$db->escape_string($_POST['title']);
  40.                         $_POST['content']=$db->escape_string($_POST['content']);
  41.                         $_POST['cat']=$db->escape_string($_POST['cat']);
  42.                         $data=date("Y-m-d H:i:s");
  43.                         $db->query("INSERT INTO mybb_changes(title,cat,content,author,date) VALUES('".$_POST['title']."','".$_POST['cat']."','".$_POST['content']."','".$mybb->user['uid']."','".$data."')");
  44.                         $_POST=null;
  45.                 }
  46.         }
  47. }
  48. $SQL=$db->query("SELECT * FROM mybb_changes GROUP BY uid DESC LIMIT 15");
  49. if($db->num_rows($SQL)>0)
  50. {
  51.         while($row=$db->fetch_array($SQL))
  52.         {
  53.                 if($row['cat']==1)
  54.                 {
  55.                         $row['cat2']="Forum";
  56.                         $row['cat3']="forum";
  57.                 }
  58.                 elseif($row['cat']==2)
  59.                 {
  60.                         $row['cat2']="Serwer/Skrypt";
  61.                         $row['cat3']="serwer/skrypt";
  62.                 }
  63.                 else
  64.                 {
  65.                         $row['cat2']="Inne";
  66.                         $row['cat3']="inne";
  67.                 }
  68.                 $row['date']=strtotime($row['date']);
  69.                 $row['datef']=my_date($mybb->settings['dateformat'], $row['date']);
  70.                 $row['timef']=my_date($mybb->settings['timeformat'], $row['date']);
  71.                 $author=StyleUsernames::GetUser($row['author']);        
  72.                 $authorlink=get_profile_link($row['author']);
  73.                 $row['content'] = $parser->parse_message($row['content'], $parser_options);
  74.                 $changes.="<tr><td class=\"tcat\" colspan=\"4\"><strong>".$row['title']."</strong></td></tr><tr><td class=\"trow1\"><strong>Kategoria:</strong> ".$row['cat2']."</td><td class=\"trow1\"><strong>Data:</strong> ".$row['datef'].", ".$row['timef']."</td><td class=\"trow1\" colspan=\"2\"><strong>Dodał:</strong> <a href=\"".$authorlink."\">".$author."</a></td></tr><tr><td class=\"trow1\" colspan=\"30\">".$row['content']."</td></tr>";
  75.                 if($mybb->user['usergroup']==4 || $mybb->user['usergroup']==8)
  76.                 {
  77.                         $changes.="<tr><td class=\"trow1\" colspan=\"4\"><a href=\"changes.php?uid=".$row['uid']."&action=delete\"><img src=\"images/deletechanges.png\">&nbsp;Skasuj ten wpis &raquo;</a></td></tr>";
  78.                 }      
  79.         }
  80. }
  81. else
  82. {
  83.         $changes.="<tr><td class=\"trow1\" colspan=\"3\"><div class=\"notice\"><p><em>Brak zmian wyświetlenia.</em></p></div></td></tr>";
  84. }
  85. if($mybb->user['usergroup']==4 || $mybb->user['usergroup']==8)
  86. {
  87.         $admin.="<form action=\"changes.php\" method=\"post\">";
  88.         $admin.="<br /><table border=\"0\" cellspacing=\"".$theme['borderwidth']."\" cellpadding=\"".$theme['tablespace']."\" class=\"tborder\" style=\"float: center;width: 60%;\">";
  89.         $admin.="<tr><td class=\"thead\"><strong>Formularz dodawania zmian:</strong></td></tr>";
  90.         $admin.="<tr><td class=\"trow1\"><strong>Tytuł:</strong> <input type=\"text\" name=\"title\" size=\"80\" /></td></tr>";
  91.         $admin.="<tr><td class=\"trow1\"><strong>Kategoria:</strong> <select name=\"cat\"><option value=\"1\">Forum</option><option value=\"2\">Serwer/Skrypt</option><option value=\"3\">Inne</option></select></td></tr>";
  92.         $admin.="<tr><td class=\"trow1\"><strong>Treść:</strong><br /><textarea name=\"content\" rows=\"10\" cols=\"80\"></textarea></td></tr>";
  93.         $admin.="<tr><td class=\"trow1\"><input type=\"submit\" name=\"submitchange\" value=\"Dodaj\" /></td></tr>";
  94.         $admin.="</table></form>";
  95. }
  96. else
  97. {
  98.         $admin=null;
  99. }
  100. add_breadcrumb("Zmiany", "changes.php");
  101. eval("\$changes = \"".$templates->get("changes")."\";");
  102. output_page($changes);
  103. ?>