PageRenderTime 41ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/bugzilla/index.php

http://xepec.googlecode.com/
PHP | 258 lines | 210 code | 33 blank | 15 comment | 18 complexity | c1423ac9125172d0efd2cb83a02c3e5f MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?
  2. include ("../config.php");
  3. include ("../core.php");
  4. function bugs_counter()
  5. {
  6. include "../config.php";
  7. $re = mysql_query( "SELECT COUNT(*) FROM bugzilla", $dbcnx);
  8. if (!$re) exit("db error");
  9. $numrows = mysql_result($re,0);
  10. mysql_close($dbcnx);
  11. return $numrows;
  12. //else return FALSE;
  13. }
  14. function bugs_add($place,$autor,$email,$comment)
  15. {
  16. include "../config.php";
  17. $date = date("c");
  18. $re = mysql_query( "INSERT INTO bugzilla VALUES (0,'$place', '$autor', '$email', '$comment','$date',0,0)", $dbcnx);
  19. if (!$re) {echo("?????? ? ???????? xepec.ru");mysql_close($dbcnx); return FALSE;}
  20. mysql_close($dbcnx);
  21. return TRUE;
  22. }
  23. function bugs_show($id)
  24. {
  25. include "../config.php";
  26. $re = mysql_query( "SELECT * FROM bugzilla WHERE id = '$id'", $dbcnx);
  27. $arr = mysql_fetch_array($re);
  28. if (!$re) {echo("?????? ? ???????? xepec.ru"); return FALSE;}
  29. mysql_close($dbcnx);
  30. return $arr;
  31. }
  32. function convert_problem_type($type)
  33. {
  34. switch ($type)
  35. {
  36. case 1:
  37. $place_text="???????????";
  38. break;
  39. case 2:
  40. $place_text="???? ?? ????";
  41. break;
  42. case 3:
  43. $place_text="?????? ????????????";
  44. break;
  45. case 4:
  46. $place_text="??????????";
  47. break;
  48. case 5:
  49. $place_text="????";
  50. break;
  51. case 6:
  52. $place_text="??????";
  53. break;
  54. case 7:
  55. $place_text="??????????";
  56. break;
  57. case 8;
  58. $place_text="??????...";
  59. break;
  60. }
  61. return $place_text;
  62. }
  63. $title = "????????";
  64. $act=$_GET['act'];
  65. $subnav = "
  66. <ul>
  67. <li><a href=\"/\">?? ???????</a></li>
  68. </ul>";
  69. $extras = "
  70. <h2>??????????</h2>
  71. <p> <a href=\"#\">Open Web Design</a><br />
  72. <a rel=\"nofollow\" href=\"http://validator.w3.org/check?uri=referer\">XHTML 1.0 Strict</a><br />
  73. <a rel=\"nofollow\" href=\"http://jigsaw.w3.org/css-validator/check/referer\">Valid CSS</a>
  74. </p>
  75. <p>???? ???????????? ??????? 0.1</p>
  76. <hr />".$text_1;
  77. if((isset($act)==FALSE) or $act == NULL ) $act='show';
  78. switch ($act)
  79. {
  80. case "show":
  81. $subnav = "
  82. <ul>
  83. <li><a href=\"/\">?? ???????</a></li>
  84. <li><a href=\"index.php?act=add\">???????? ??????</a></li>
  85. </ul>";
  86. $text=$text."<h2>?????? ??????</h2>";
  87. $text=$text."
  88. <table border=\"1\" id=\"table_slim\">
  89. <tr align=\"center\" bgcolor=\"#ffaeae\">
  90. <td>&nbsp;#&nbsp;</td> <td>????? ????????</td><td>?????</td><td>???????????</td><td>?????</td><td>??????? ??? ???????????</td><td>???? ???????????</td>
  91. </tr>";
  92. for ($i=1; $i<bugs_counter()+1;$i++)
  93. {
  94. $arr=bugs_show($i);
  95. if ($arr['6'] == "0") {$arr['6'] = "??? ?? ??????????";$arr['7'] = "&nbsp;";}
  96. if ($ch_color == TRUE) { $color="eef2f2"; $ch_color=FALSE;} else {$color="f2e5ff"; $ch_color=TRUE;}
  97. $text=$text."
  98. <tr bgcolor=\"#".$color."\">
  99. <td align=\"center\">".$i."</td><td align=\"center\">".convert_problem_type($arr['1'])."</td><td align=\"center\"><a href=\"mailto:".$arr['3']."\">".$arr['2']."</a></td><td>".$arr['4']."</td><td>".$arr['5']."</td><td align=\"center\">".$arr['6']."</td><td>".$arr['7']."</td>
  100. </tr>";
  101. }
  102. $text=$text."</table>";
  103. break;
  104. case "add":
  105. $title = "???????? ?? ??????";
  106. $text=$text."
  107. <h1>????? ?????? ?? ??????</h1>
  108. <h2>??????...</h2>
  109. <p>
  110. ??? ???????? ??????, ??????????, ???????? ??? ?????????? ? ???. ? ?????? ??????????????? ?????????? ???? ?????????? ??????? ??????????, ??? ??? ?????????? ?? ??? ????? ??? ?????? ? ?????.
  111. </p>
  112. <style type=\"text/css\">
  113. .td1 {
  114. float: right;
  115. }
  116. .imp {
  117. color: red;
  118. }
  119. </style>
  120. <form action=\"index.php?act=add-ok\" method=\"post\" enctype=\"multipart/form-data\">
  121. <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
  122. <tr>
  123. <td class=\"td1\">????? ??????: </td>
  124. <td>
  125. <select name=\"place\">
  126. <option value=\"1\">???????????</option>
  127. <option value=\"2\">???? ?? ????</option>
  128. <option value=\"3\">?????? ????????????</option>
  129. <option value=\"4\">??????????</option>
  130. <option value=\"5\">????</option>
  131. <option value=\"6\">??????</option>
  132. <option value=\"7\">??????????</option>
  133. <option value=\"8\">??????...</option>
  134. </select>
  135. </td>
  136. </tr>
  137. <tr>
  138. <td>&nbsp;</td>
  139. <td colspan=\"2\">&nbsp;</td>
  140. </tr>
  141. <tr>
  142. <td class=\"td1\">??????????&nbsp;??&nbsp;?????????: </td>
  143. <td colspan=\"2\">???????? ??????? ????????: ?? ???????????? ???? - ?????????? ????, ?? ???????????? ????? - ????? ?????<br />
  144. <textarea cols=\"70\" rows=\"10\" name=\"comment\" id=\"comment\"></textarea></td>
  145. </tr>";
  146. if(isset($_COOKIE['xepec_nic'])) //??????????? ???? ???????????? ???????????, ?? ?? ????? ?????????? ??? ??
  147. {
  148. $nic = $_COOKIE['xepec_nic'];// ????? ??? ??? ?? ?????
  149. $uname=uname_get(do_check()); // ???????? ?????? ? ????? ? ???????????? ?? id ?? ?????
  150. $url=$uname['email'];//????? ?? ??????? ?????? ?????
  151. $text=$text."
  152. <tr>
  153. <td class=\"td1\">???????:</td>
  154. <td><a href=\"mailto:".$url."\">".$nic."</a></td>
  155. </tr>
  156. ";
  157. }
  158. else // ???? ?? ???????????? ?? ??????????? ?? ?????????? ??? ??
  159. {
  160. # $text=$text."
  161. # <tr>
  162. # <td class=\"td1\">???????:</td>
  163. # <td><input type=\"text\" size=\"20\" maxlength=\"100\" id=\"nic\" name=\"nic\" value=\"\"/>
  164. # ????? ??????? ???? ?? ????????????? ?? ?????, ?? ??? ??? ???
  165. # </td>
  166. # </tr>
  167. # <tr>
  168. # <td class=\"td1\">E-mail:</td>
  169. # <td><input type=\"text\" size=\"20\" maxlength=\"100\" id=\"mail\" name=\"mail\" value=\"\"/>
  170. # ??? ???????? ?????, ??????? ?? ????? :)
  171. # </td>
  172. # </tr>";
  173. $text=$text."
  174. <tr>
  175. <td class=\"td1\"></td>
  176. <td><p>??????? ????? ????? ????? ?????, ? ???? ???????? ?????????????????? ????? ????????? ????? ?? ??????. ? ?????? ? ??? ??? ??????????? ????????? ????????, ????????????????? ??? ????????????? ? ??????????? ??????))</p></td>
  177. </tr>";
  178. }
  179. $text=$text."
  180. </table>
  181. <p><input type=\"submit\" name=\"send\" id=\"send\" value=\"??????????...\" /></p>
  182. </form>";
  183. break;
  184. case "add-ok":
  185. $title = "?????? ??????????";
  186. $subnav = "
  187. <ul>
  188. <li><a href=\"/\">?? ???????</a></li>
  189. <li><a href=\"index.php?act=show\">??? ??????</a></li>
  190. <li><a href=\"index.php?act=add\">???????? ???</a></li>
  191. </ul>";
  192. $place = 0;
  193. $place = $_POST['place'];
  194. if(preg_match("|^[1-8]{1}$|i",$place)) $s='1';
  195. $autor = $_POST['nic'];
  196. $autor = htmlentities($autor, ENT_NOQUOTES, "UTF-8");
  197. //TODO: ????????? ????????????? ??????? ? ?????? ???? ???????? ? ??????. ? ?????? ??????? ????? ???????????? ???????
  198. $email = $_POST['mail'];
  199. $email = htmlentities($email, ENT_NOQUOTES, "UTF-8");
  200. $comment = $_POST['comment'];
  201. $comment = htmlentities($comment, ENT_NOQUOTES, "UTF-8");
  202. if ($comment != NULL and isset($_COOKIE['xepec_nic']))
  203. {
  204. bugs_add($place,$autor,$email,$comment);
  205. $text=$text."<h2>??????? ?? ?????????? ?????? ?? ??? ?????? ?? ??????????</h2>";
  206. $text=$text."
  207. <table border=\"1\">
  208. <tr>
  209. <td>&nbsp;#&nbsp;</td> <td>????? ????????</td><td>?????</td><td>???????????</td><td>?????</td>
  210. </tr>
  211. <tr>
  212. <td>&nbsp;".bugs_counter()."</td><td>".convert_problem_type($place)."</td><td><a href=\"mailto:".$email."\">".$autor."</a></td><td>".$comment."</td><td>".date("c")."</td>
  213. </tr>
  214. </table>";
  215. }
  216. else
  217. {
  218. $text=$text."<h2>??????)), <a href=\"http://xepec.ru/reg\">???????</a></h2>";
  219. }
  220. break;
  221. }
  222. $index_and_no_login = TRUE;
  223. $content = $text;
  224. include ("../theme.php");
  225. ?>