/bugzilla/index.php
PHP | 258 lines | 210 code | 33 blank | 15 comment | 18 complexity | c1423ac9125172d0efd2cb83a02c3e5f MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
- <?
- include ("../config.php");
- include ("../core.php");
- function bugs_counter()
- {
- include "../config.php";
-
- $re = mysql_query( "SELECT COUNT(*) FROM bugzilla", $dbcnx);
- if (!$re) exit("db error");
-
- $numrows = mysql_result($re,0);
-
- mysql_close($dbcnx);
- return $numrows;
- //else return FALSE;
- }
- function bugs_add($place,$autor,$email,$comment)
- {
- include "../config.php";
- $date = date("c");
-
- $re = mysql_query( "INSERT INTO bugzilla VALUES (0,'$place', '$autor', '$email', '$comment','$date',0,0)", $dbcnx);
- if (!$re) {echo("?????? ? ???????? xepec.ru");mysql_close($dbcnx); return FALSE;}
-
- mysql_close($dbcnx);
- return TRUE;
- }
- function bugs_show($id)
- {
- include "../config.php";
-
- $re = mysql_query( "SELECT * FROM bugzilla WHERE id = '$id'", $dbcnx);
- $arr = mysql_fetch_array($re);
- if (!$re) {echo("?????? ? ???????? xepec.ru"); return FALSE;}
-
- mysql_close($dbcnx);
- return $arr;
- }
- function convert_problem_type($type)
- {
- switch ($type)
- {
- case 1:
- $place_text="???????????";
- break;
- case 2:
- $place_text="???? ?? ????";
- break;
- case 3:
- $place_text="?????? ????????????";
- break;
- case 4:
- $place_text="??????????";
- break;
- case 5:
- $place_text="????";
- break;
- case 6:
- $place_text="??????";
- break;
- case 7:
- $place_text="??????????";
- break;
- case 8;
- $place_text="??????...";
- break;
- }
- return $place_text;
- }
- $title = "????????";
- $act=$_GET['act'];
- $subnav = "
- <ul>
- <li><a href=\"/\">?? ???????</a></li>
- </ul>";
- $extras = "
- <h2>??????????</h2>
- <p> <a href=\"#\">Open Web Design</a><br />
- <a rel=\"nofollow\" href=\"http://validator.w3.org/check?uri=referer\">XHTML 1.0 Strict</a><br />
- <a rel=\"nofollow\" href=\"http://jigsaw.w3.org/css-validator/check/referer\">Valid CSS</a>
- </p>
- <p>???? ???????????? ??????? 0.1</p>
- <hr />".$text_1;
- if((isset($act)==FALSE) or $act == NULL ) $act='show';
- switch ($act)
- {
- case "show":
- $subnav = "
- <ul>
- <li><a href=\"/\">?? ???????</a></li>
- <li><a href=\"index.php?act=add\">???????? ??????</a></li>
- </ul>";
- $text=$text."<h2>?????? ??????</h2>";
- $text=$text."
- <table border=\"1\" id=\"table_slim\">
- <tr align=\"center\" bgcolor=\"#ffaeae\">
- <td> # </td> <td>????? ????????</td><td>?????</td><td>???????????</td><td>?????</td><td>??????? ??? ???????????</td><td>???? ???????????</td>
- </tr>";
- for ($i=1; $i<bugs_counter()+1;$i++)
- {
- $arr=bugs_show($i);
- if ($arr['6'] == "0") {$arr['6'] = "??? ?? ??????????";$arr['7'] = " ";}
- if ($ch_color == TRUE) { $color="eef2f2"; $ch_color=FALSE;} else {$color="f2e5ff"; $ch_color=TRUE;}
-
- $text=$text."
- <tr bgcolor=\"#".$color."\">
- <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>
- </tr>";
-
- }
- $text=$text."</table>";
-
- break;
- case "add":
- $title = "???????? ?? ??????";
- $text=$text."
- <h1>????? ?????? ?? ??????</h1>
- <h2>??????...</h2>
- <p>
- ??? ???????? ??????, ??????????, ???????? ??? ?????????? ? ???. ? ?????? ??????????????? ?????????? ???? ?????????? ??????? ??????????, ??? ??? ?????????? ?? ??? ????? ??? ?????? ? ?????.
- </p>
- <style type=\"text/css\">
- .td1 {
- float: right;
- }
-
- .imp {
- color: red;
- }
- </style>
- <form action=\"index.php?act=add-ok\" method=\"post\" enctype=\"multipart/form-data\">
- <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
- <tr>
- <td class=\"td1\">????? ??????: </td>
- <td>
- <select name=\"place\">
- <option value=\"1\">???????????</option>
- <option value=\"2\">???? ?? ????</option>
- <option value=\"3\">?????? ????????????</option>
- <option value=\"4\">??????????</option>
- <option value=\"5\">????</option>
- <option value=\"6\">??????</option>
- <option value=\"7\">??????????</option>
- <option value=\"8\">??????...</option>
- </select>
- </td>
- </tr>
- <tr>
- <td> </td>
- <td colspan=\"2\"> </td>
- </tr>
- <tr>
- <td class=\"td1\">?????????? ?? ?????????: </td>
- <td colspan=\"2\">???????? ??????? ????????: ?? ???????????? ???? - ?????????? ????, ?? ???????????? ????? - ????? ?????<br />
- <textarea cols=\"70\" rows=\"10\" name=\"comment\" id=\"comment\"></textarea></td>
- </tr>";
- if(isset($_COOKIE['xepec_nic'])) //??????????? ???? ???????????? ???????????, ?? ?? ????? ?????????? ??? ??
- {
- $nic = $_COOKIE['xepec_nic'];// ????? ??? ??? ?? ?????
- $uname=uname_get(do_check()); // ???????? ?????? ? ????? ? ???????????? ?? id ?? ?????
- $url=$uname['email'];//????? ?? ??????? ?????? ?????
- $text=$text."
- <tr>
- <td class=\"td1\">???????:</td>
- <td><a href=\"mailto:".$url."\">".$nic."</a></td>
- </tr>
- ";
- }
- else // ???? ?? ???????????? ?? ??????????? ?? ?????????? ??? ??
- {
- # $text=$text."
- # <tr>
- # <td class=\"td1\">???????:</td>
- # <td><input type=\"text\" size=\"20\" maxlength=\"100\" id=\"nic\" name=\"nic\" value=\"\"/>
- # ????? ??????? ???? ?? ????????????? ?? ?????, ?? ??? ??? ???
- # </td>
- # </tr>
- # <tr>
- # <td class=\"td1\">E-mail:</td>
- # <td><input type=\"text\" size=\"20\" maxlength=\"100\" id=\"mail\" name=\"mail\" value=\"\"/>
- # ??? ???????? ?????, ??????? ?? ????? :)
- # </td>
- # </tr>";
- $text=$text."
- <tr>
- <td class=\"td1\"></td>
- <td><p>??????? ????? ????? ????? ?????, ? ???? ???????? ?????????????????? ????? ????????? ????? ?? ??????. ? ?????? ? ??? ??? ??????????? ????????? ????????, ????????????????? ??? ????????????? ? ??????????? ??????))</p></td>
- </tr>";
- }
- $text=$text."
- </table>
- <p><input type=\"submit\" name=\"send\" id=\"send\" value=\"??????????...\" /></p>
- </form>";
- break;
- case "add-ok":
- $title = "?????? ??????????";
- $subnav = "
- <ul>
- <li><a href=\"/\">?? ???????</a></li>
- <li><a href=\"index.php?act=show\">??? ??????</a></li>
- <li><a href=\"index.php?act=add\">???????? ???</a></li>
- </ul>";
- $place = 0;
- $place = $_POST['place'];
- if(preg_match("|^[1-8]{1}$|i",$place)) $s='1';
- $autor = $_POST['nic'];
- $autor = htmlentities($autor, ENT_NOQUOTES, "UTF-8");
-
- //TODO: ????????? ????????????? ??????? ? ?????? ???? ???????? ? ??????. ? ?????? ??????? ????? ???????????? ???????
- $email = $_POST['mail'];
- $email = htmlentities($email, ENT_NOQUOTES, "UTF-8");
- $comment = $_POST['comment'];
- $comment = htmlentities($comment, ENT_NOQUOTES, "UTF-8");
-
- if ($comment != NULL and isset($_COOKIE['xepec_nic']))
- {
- bugs_add($place,$autor,$email,$comment);
- $text=$text."<h2>??????? ?? ?????????? ?????? ?? ??? ?????? ?? ??????????</h2>";
- $text=$text."
- <table border=\"1\">
- <tr>
- <td> # </td> <td>????? ????????</td><td>?????</td><td>???????????</td><td>?????</td>
- </tr>
- <tr>
- <td> ".bugs_counter()."</td><td>".convert_problem_type($place)."</td><td><a href=\"mailto:".$email."\">".$autor."</a></td><td>".$comment."</td><td>".date("c")."</td>
- </tr>
- </table>";
- }
- else
- {
- $text=$text."<h2>??????)), <a href=\"http://xepec.ru/reg\">???????</a></h2>";
- }
- break;
- }
- $index_and_no_login = TRUE;
- $content = $text;
- include ("../theme.php");
- ?>