From: xf0r3m Date: Thu, 10 Aug 2023 10:35:10 +0000 (+0200) Subject: Przesłanie plików z publicznego repozytorium X-Git-Url: https://gitweb.morketsmerke.org/?a=commitdiff_plain;h=41858deba852fa2d79dc29f42d18b177862c1e75;p=bugtrack.git Przesłanie plików z publicznego repozytorium --- 41858deba852fa2d79dc29f42d18b177862c1e75 diff --git a/403.php b/403.php new file mode 100644 index 0000000..9e150ad --- /dev/null +++ b/403.php @@ -0,0 +1,3 @@ + diff --git a/404.php b/404.php new file mode 100644 index 0000000..0486b02 --- /dev/null +++ b/404.php @@ -0,0 +1,3 @@ + diff --git a/README.md b/README.md new file mode 100644 index 0000000..9f1d2d2 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# BugTrack + +Chcąc skorzystać z `btcli` należy skopiować plik do katalogu /usr/local/bin. +Następnie wskazać gdzie znajdują się pliki instancji BugTrack (zmienna `ROOT` +na samym początku pliku). diff --git a/btcli b/btcli new file mode 100755 index 0000000..b19fc57 --- /dev/null +++ b/btcli @@ -0,0 +1,344 @@ +#!/usr/bin/php -d log_errors=Off + 0 ) { + $n=1; + while ( $row = mysqli_fetch_row($result) ) { + echo $n . "\t#" . $row[0] . "\t"; + + $tableName = "product"; + $columnScheme = "name"; + $whereValue = "id = " . $row[1]; + $result2 = dbQuery($connection, $tableName, $columnScheme, $whereValue); + $prodName = getFieldValue($result2); + echo $prodName . "\t"; + + $tableName = "component"; + $columnScheme = "name"; + $whereValue = "id = " . $row[2]; + $result3 = dbQuery($connection, $tableName, $columnScheme, $whereValue); + $compName = getFieldValue($result3); + echo $compName . "\t"; + + echo $row[3] . "\t" . $row[4] . "\t" . $row[5] . "\t"; + $stateTbl = array("Przyjęty", "Potwierdzony", "W trakcie", "Zakończony", "Odrzucony"); + $index = $row[6]; + $state=$stateTbl[$index]; + + echo $state . "\n\n"; + $n++; + } + } + } + + function list_of_products($connection) { + $tableName = "product"; + $columnScheme = "name,description"; + $whereValue = "1=1"; + $result = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( mysqli_num_rows($result) > 0 ) { + $n=1; + while ( $row = mysqli_fetch_row($result) ) { + echo $n . "\t" . $row[0] . " (" . $row[1] . ")\n\n"; + $n++; + } + } + } + + function list_of_components($connection, $prodName) { + $tableName = "product"; + $columnScheme = "id"; + $whereValue = "name = '" . mysqli_real_escape_string($connection, htmlspecialchars($prodName)) . "'"; + $result = dbQuery($connection, $tableName, $columnScheme, $whereValue); + $prodId = getFieldValue($result); + $tableName = "component"; + $columnScheme = "name,description"; + $whereValue = "productId = " . intval($prodId); + $result = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( mysqli_num_rows($result) > 0 ) { + $n=1; + while ( $row = mysqli_fetch_row($result) ) { + echo $n . "\t" . $row[0] . " (" . $row[1] . ")\n\n"; + $n++; + } + } + } + + function submit_bug($connection, $product, $component, $typeof, $subject, $desc) { + $tableName = "product"; + $columnScheme = "id,description"; + $whereValue = "name = '" . mysqli_real_escape_string($connection, $product) . "'"; + $resultp = dbQuery($connection, $tableName, $columnScheme, $whereValue); + $productrow = mysqli_fetch_row($resultp); + $productId = $productrow[0]; + $productDesc = $productrow[1]; + + $tableName = "component"; + $columnScheme = "id,description"; + $whereValue = "name = '" . mysqli_real_escape_string($connection, $component) . "'"; + $resultc = dbQuery($connection, $tableName, $columnScheme, $whereValue); + $componentrow = mysqli_fetch_row($resultc); + $componentId = $componentrow[0]; + $componentDesc = $componentrow[1]; + + $tableName = "bug"; + $columnScheme = "productId,componentId,typeof,subject,description,state"; + $setValues = $productId . "," . $componentId . ",'" . mysqli_real_escape_string($connection, htmlspecialchars($typeof)) . "','" . mysqli_real_escape_string($connection, htmlspecialchars($subject)) . "','" . mysqli_real_escape_string($connection, htmlspecialchars($desc)) . "',0"; + $result = dbAdd($connection, $tableName, $columnScheme, $setValues); + if ( $result == true ) { + echo "Zgłoszenie zostało przyjęte. Niebawem pojawi się na stronie zgłoszonych problemów\n\n"; + } else { + var_dump($result); + } + + $tableName = "bug"; + $columnScheme = "id"; + $whereValue = "1=1 ORDER BY id DESC"; + $resulti = dbQuery($connection, $tableName, $columnScheme, $whereValue); + $bugId = getFieldValue($resulti); + + $tableName = "comment"; + $columnScheme = "bugId,user,date,content"; + $setValues = $bugId . ",'" . $_SERVER["USER"] . "','" . date("Y-m-d H:i:s") . "','Utworzono zgłoszenie.

Produkt: " . $product . " (" . $productDesc . ")
Komponent: " . $component . " (" . $componentDesc . ")
Rodzaj zgłoszenia: " . mysqli_real_escape_string($connection, htmlspecialchars($typeof)) . "
Temat: " . mysqli_real_escape_string($connection, htmlspecialchars($subject)) . "
Opis zgłoszenia: " . mysqli_real_escape_string($connection, htmlspecialchars($desc)) . "'"; + $resultk = dbAdd($connection, $tableName, $columnScheme, $setValues); + if ( $resultk == true ) { + echo "Zgłoszenie zostało również zapisane jako pierwszy komentarz\n\n"; + } else { + var_dump($resultk); + } + } + + function add_component($connection, $product, $name, $desc, $author) { + $tableName = "product"; + $columnScheme = "id"; + $whereValue = "name = '" . mysqli_real_escape_string($connection, htmlspecialchars($product)) . "'"; + $result = dbQuery($connection, $tableName, $columnScheme, $whereValue); + $productId = getFieldValue($result); + + $tableName = "component"; + $columnScheme = "productId,name,author,description"; + $setValues = $productId . ",'" . mysqli_real_escape_string($connection, htmlspecialchars($name)) . "','" . mysqli_real_escape_string($connection, htmlspecialchars($author)) . "','" . mysqli_real_escape_string($connection, htmlspecialchars($desc)) . "'"; + $resultc = dbAdd($connection, $tableName, $columnScheme, $setValues); + if ( $resultc == true ) { + echo "Komponent produktu " . $product . " został dodany.\n\n"; + } else { + var_dump($resultc); + } + } + + function add_product($connection, $name, $desc, $author) { + $tableName = "product"; + $columnScheme = "name,author,description"; + $setValues = "'" . mysqli_real_escape_string($connection, htmlspecialchars($name)) . "','" . mysqli_real_escape_string($connection, htmlspecialchars($author)) . "','" . mysqli_real_escape_string($connection, htmlspecialchars($desc)) . "'"; + $resultp = dbAdd($connection, $tableName, $columnScheme, $setValues); + if ( $resultp == true ) { + echo "Dodano produkt " . $name . "\n\n"; + } else { + var_dump($resultp); + } + } + + function show_states($state="all") { + if ( isset($state) ) { + $stateTbl = array('Przyjęty', 'Potwierdzony', 'W trakcie', 'Zakończony', 'Odrzucony', 'Do usunięcia'); + if ( $state == "all" ) { + for ( $i=0; $i < count($stateTbl); $i++ ) { + echo $i . "\t" . $stateTbl[$i] . "\n\n"; + } + } else { + return $stateTbl[$state]; + } + } + } + + + function change_state($connection, $bugId, $newState) { + if ( ( $newState < 0 ) || ( $newState > 5 ) ) { + return false; + } else if ( $newState == 5 ) { + $tableName = 'comment'; + $whereValue = 'bugId = ' . intval($bugId); + $resultk = dbDel($connection, $tableName, $whereValue); + if ( $resultk == "true" ) { + echo "Wszystkie komentarz powiązane ze zgłoszeniem zostały usunięte\n\n"; + } else { + var_dump($resultk); + } + $tableName = 'bug'; + $whereValue = 'id = ' . intval($bugId); + $result = dbDel($connection, $tableName, $whereValue); + if ( $result == true ) { + echo "Zgłoszenie zostało usunięte\n\n"; + } else { + var_dump($result); + } + } else { + $tableName = 'bug'; + $columnScheme = 'state'; + $setValue = 'state = ' . intval($newState); + $whereValue = 'id = ' . intval($bugId); + $results = dbQuery($connection, $tableName, $columnScheme, $whereValue); + $oldState = getFieldValue($results); + $oldStateTxt = show_states($oldState); + $newStateTxt = show_states($newState); + $result = dbUpdate($connection, $tableName, $setValue, $whereValue); + if ( $result == true ) { + echo "Status zgłoszenia został zmieniony\n\n"; + $tableName = 'comment'; + $columnScheme = 'bugId,user,date,content'; + $setValues = intval($bugId) . ",'" . $_SERVER['USER'] . "','" . date("Y-m-d H:i:s") . "','Status zgłoszenia został zmieniony z " . $oldStateTxt . " na " . $newStateTxt . "'"; + $resultk=dbAdd($connection, $tableName, $columnScheme, $setValues); + if ( $resultk == true ) { + echo "Zmiana status został uwzględniona w komentarzach\n\n"; + } else { + var_dump($resultk); + } + } else { + var_dump($result); + } + } + } + + function list_of_comments($connection, $bugId) { + $tableName = 'comment'; + $columnScheme = 'user,date,content'; + $whereValue = "bugId = " . intval($bugId); + $result = dbQuery($connection,$tableName,$columnScheme,$whereValue); + if ( mysqli_num_rows($result) > 0 ) { + while( $row = mysqli_fetch_row($result) ) { + echo $row[0] . ", " . $row[1] . " pisze...\n"; + echo $row[2] . "\n\n"; + } + } + } + + function add_comment($connection, $bugId, $content) { + $tableName = 'comment'; + $columnScheme = 'bugId,user,date,content'; + $setValues = intval($bugId) . ",'" . $_SERVER['USER'] . "','" . date("Y-m-d H:i:s") . "','" . mysqli_real_escape_string($connection,htmlspecialchars($content)) . "'"; + $result = dbAdd($connection, $tableName, $columnScheme, $setValues); + if ( $result == true ) { + echo "Komentarz został dodany.\n\n"; + } else { + var_dump($result); + } + } + + function del_component($connection, $prodName, $compName) { + $tableName = 'product'; + $columnScheme = 'id'; + $whereValue = "name = '" . mysqli_real_escape_string($connection, htmlspecialchars($prodName)) . "'"; + $result = dbQuery($connection, $tableName, $columnScheme, $whereValue); + $prodId = getFieldValue($result); + $tableName = 'component'; + $whereValue = "name = '" . mysqli_real_escape_string($connection,htmlspecialchars($compName)) . "' AND productId = " . intval($prodId); + $result = dbDel($connection, $tableName, $whereValue); + if ( $result == true ) { + echo "Komponent został usunięty\n\n"; + } else { + var_dump($result); + } + } + + function del_product($connection, $prodName) { + $tableName = "product"; + $columnScheme = "id"; + $whereValue = "name = '" . mysqli_real_escape_string($connection, htmlspecialchars($prodName)) . "'"; + $resulti = dbQuery($connection, $tableName, $columnScheme, $whereValue); + $prodId = getFieldValue($resulti); + + $tableName = "component"; + $whereValue = "productId = " . intval($prodId); + $result = dbDel($connection, $tableName, $whereValue); + if ( $result == true ) { + echo "Wszystkie komponenty powiązane z produktem zostały usunięte\n\n"; + $tableName = 'product'; + $whereValue = 'id = ' . intval($prodId); + $result = dbDel($connection, $tableName, $whereValue); + if ( $result == true ) { + echo "Produkt został usunięty\n\n"; + } else { + var_dump($result); + } + } else { + var_dump($result); + } + } + + function change_password($connection, $username, $newPasswd) { + $tableName = "user"; + $setValues = "passwd_hash = '" . password_hash($newPasswd, PASSWORD_DEFAULT) . "'"; + $whereValue = "username = '" . mysqli_real_escape_string($connection, htmlspecialchars($username)) . "'"; + $result = dbUpdate($connection, $tableName, $setValues, $whereValue); + if ( $result == true ) { + echo "Hasło zostało zmienione\n\n"; + } else { + var_dump($result); + } + } + + if ( isset($argv[1]) ) { + if ( $argv[1] == 'lb-all' ) { list_of_bugs($connection); } + if ( $argv[1] == 'lb-user' ) { list_of_bugs($connection, 'user'); } + if ( $argv[1] == 'lp' ) { list_of_products($connection); } + if ( $argv[1] == 'lc' ) { list_of_components($connection, $argv[2]); } + if ( $argv[1] == 'sb' ) { submit_bug($connection, $argv[2], $argv[3], $argv[4], $argv[5], $argv[6]); } + if ( $argv[1] == 'ap' ) { + if ( ! isset($argv[4]) ) { add_product($connection, $argv[2], $argv[3], $_SERVER['USER']); + } else { add_product($connection, $argv[2], $argv[3], $argv[4]); } + } + if ( $argv[1] == 'ac' ) { + if ( ! isset($argv[5]) ) { add_component($connection, $argv[2], $argv[3], $argv[4], $_SERVER['USER']); + } else { add_component($connection, $argv[2], $argv[3], $argv[4], $argv[5]); } + } + if ( $argv[1] == 'cs' ) { change_state($connection, $argv[2], $argv[3]); } + if ( $argv[1] == 'ss' ) { show_states(); } + if ( $argv[1] == 'ks' ) { list_of_comments($connection, $argv[2]); } + if ( $argv[1] == 'ka' ) { add_comment($connection, $argv[2], $argv[3]); } + if ( $argv[1] == 'dc' ) { del_component($connection, $argv[2], $argv[3]); } + if ( $argv[1] == 'dp' ) { del_product($connection, $argv[2]); } + if ( $argv[1] == 'cp' ) { change_password($connection, $argv[2], $argv[3]); } + } else { + if ( isset($_SERVER["SHELL"]) ) { + echo "btcli - BugTrack CLI for request management\n"; + echo "morketsmerke.org @ 2023\n"; + echo "This script requires running instance of BugTrack\n"; + echo "Options:\n"; + echo "\tlb-all - prints all submitted requests\n\n"; + echo "\tlb-user - prints submitted request except done or rejected tasks\n\n"; + echo "\tlp - prints all products defined on the platform\n\n"; + echo "\tlc - prints all components related with given product\n\n"; + echo "\tsb - submiting bug or \n\tenchancement request\n\n"; + echo "\tap [product_author] - adding new product to the \n\tplatform\n\n"; + echo "\tac [component_author] - adding new \n\tcomponent related with given product (product must exist before you create a component)\n\n"; + echo "\tcs - change request state (bug_id is the second column in \n\tlb-all/lb-user output)\n\n"; + echo "\tss - numeric state values reference (shows, which number is which state)\n\n"; + echo "\tks - prints all comments for given request\n\n"; + echo "\tks - writes a comment for given request\n\n"; + echo "\tdc - removes given component\n\n"; + echo "\tdp - removes give product with all related components\n\n"; + echo "\tcp - setting new password for given user\n\n"; + echo "Request removing:\n"; + echo "To remove some request just set them state 5, which means 'To delete'\n"; + echo "Setting state 5, causing request deletion\n"; + } else { + include($ROOT . '/403.php'); + } + } + #var_dump($_SERVER); +?> diff --git a/bugs.php b/bugs.php new file mode 100644 index 0000000..9cbdef1 --- /dev/null +++ b/bugs.php @@ -0,0 +1,23 @@ +
+
+

Zgłoszenia otwarte:

+
+
+ 0 AND state < 3 ORDER BY id DESC"; + presentListBugs($connection, $cond); +?> +
+
+ +
+
+

Zgłoszenia zamknięte:

+
+
+= 3 ORDER BY id DESC"; + presentListBugs($connection, $cond); +?> +
+
diff --git a/changelog.php b/changelog.php new file mode 100755 index 0000000..2032a44 --- /dev/null +++ b/changelog.php @@ -0,0 +1,286 @@ +Lista zmian dla wersji " . $version . " produktu " . $productName . " została pomyślnie wygenerowana"; + } else { + echo "
Lista zmian nie została wygenerowana
"; + } + } else { + echo "
Lista zmian dla wersji " . $version . " produktu " . $productName . " została pomyślnie wygenerowana
"; + } + + #echo $productName . " - wersja: " . $version . "
"; + + $msgTxt = $productName . " - wersja: " . $version . "\n"; + $msgMd = "##### " . $productName . " - wersja: *" . $version . "*\n"; + $msgHtml = "
" . $productName . "
  - wersja: " . $version . "

\n"; + + fwrite($fTxt, $msgTxt); + fwrite($fMd, $msgMd); + fwrite($fHTML, $msgHtml); + + $tableName = 'dictionary'; + $columnScheme = 'dictionary'; + $whereValue = 'productId = ' . $_POST['changelogProductId']; + $resultDict = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( mysqli_num_rows($resultDict) > 0 ) { + $dict=getFieldValue($resultDict); + $dictWords = explode(',', $dict); + } + + fwrite($fHTML, "
    \n"); + + $lp = 1; + foreach ( $_POST as $key => $value ) { + + if ( empty($value) ) { continue; } + if ( (preg_match('/changelogBugIdLC\d+/', $key) == 0) && (preg_match('/changelogBugId\d+/', $key) == 0) ) { + + if ( preg_match('/changelog/', $key) == 0 ) { + fwrite($fHTML, "
  1. \n"); + #echo "Sprawdź w słowniku: $key
    "; + $name = $key; + for ($i=0; $i < count($dictWords); $i++) { + if ( preg_match("/". $name . "=>/", $dictWords[$i]) == 1 ) { + $dictExpr = explode('=>', $dictWords[$i]); + if ( strlen($value) > 1 ) { + #echo $lp . ". " . $dictExpr[1] . "
      " . $value . "

    "; + + $msgTxt = $lp . ". " . $dictExpr[1] . "\n\t" . $value . "\n\n"; + $msgMd = $lp . ". " . $dictExpr[1] . "\n\t" . $value . "\n\n"; + $msgHtml = $dictExpr[1] . "
      " . $value . "

    \n"; + + fwrite($fTxt, $msgTxt); + fwrite($fMd, $msgMd); + fwrite($fHTML, $msgHtml); + + } else { + #echo $lp . ". " . $dictExpr[1] . "

    "; + + $msgTxt = $lp . ". " . $dictExpr[1] . "\n\n"; + $msgMd = $lp . ". " . $dictExpr[1] . "\n\n"; + $msgHtml = $dictExpr[1] . "

    \n"; + + fwrite($fTxt, $msgTxt); + fwrite($fMd, $msgMd); + fwrite($fHTML, $msgHtml); + + } + } + } + $lp++; + fwrite($fHTML, "
  2. \n"); + } + } + if ( preg_match('/changelogBugId\d+/', $key) == 1 ) { + fwrite($fHTML, "
  3. \n"); + #echo "Pobranie danych z bazy: $key
    "; + $tableName = 'bug'; + $columnScheme = "id,componentId,subject,description"; + $whereValue = "id = " . $value; + $resultBug = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( mysqli_num_rows($resultBug) > 0 ) { + $rowBug = mysqli_fetch_row($resultBug); + $tableName = "component"; + $columnScheme = "name"; + $whereValue = "id = " . $rowBug[1]; + $resultComp = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( mysqli_num_rows($resultComp) > 0 ) { + $compName = getFieldValue($resultComp); + } + #echo $lp . ". #" . $rowBug[0] . " - " . $compName . " - " . $rowBug[2] . "
    "; + + if ( ! empty($_SERVER['HTTPS']) ) { $serverProtocol = "https://"; } + else { $serverProtocol = "http://"; } + + $msgTxt = $lp . ". #" . $rowBug[0] . " - " . $compName . " - " . $rowBug[2] . "\n"; + $msgMd = $lp . ". [#" . $rowBug[0] . "](" . $serverProtocol . $_SERVER['SERVER_NAME'] . "/index.php?p=comments&bid=" . $rowBug[0] . ") - " . $compName . " - " . $rowBug[2] . "\n"; + $msgHtml = "#" . $rowBug[0] . " - " . $compName . " - " . $rowBug[2] . "
    \n"; + + fwrite($fTxt, $msgTxt); + fwrite($fMd, $msgMd); + fwrite($fHTML, $msgHtml); + + $content = array(); + #$content = formatTo80Cols($rowBug[3], "  ", "
    "); + $content = newFormatTo80Cols($rowBug[3], "  ", "
    "); + + foreach ( $content as $line ) { + #echo $line; + $msgHtml = $line . "\n"; + fwrite($fHTML, $msgHtml); + } + $content = newFormatTo80Cols($rowBug[3], "\t", "\n"); + #$content = formatTo80Cols($rowBug[3], "\t", "\n"); + foreach ( $content as $line ) { + fwrite($fTxt, $line); + fwrite($fMd, $line); + } + } + $assembledKey="changelogBugIdLC" . $value; + if ( isset($_POST[$assembledKey]) && ( $_POST[$assembledKey] === "1" ) ) { + + #echo "
    "; + + fwrite($fTxt, "\n"); + fwrite($fMd, "\n"); + fwrite($fHTML, "
    "); + + $tableName = "comment"; + $columnScheme = "id,content"; + $whereValue = "bugId = " . $value . " ORDER BY id DESC"; + $resultComment = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( mysqli_num_rows($resultComment) > 0 ) { + #mysqli_data_seek($resultComment, 1); + $commentRow = mysqli_fetch_row($resultComment); + while ( preg_match('/^Status\ zgłoszenia/', $commentRow[1]) == 1 ) { + $commentRow = mysqli_fetch_row($resultComment); + } + #echo $commentRow[1] . "
    "; + #$comment = formatTo80Cols($commentRow[1], "  ", "
    "); + $comment = newFormatTo80Cols($commentRow[1], "  ", "
    "); + foreach ( $comment as $commentLine ) { + if ( preg_match('/https/', $commentLine) == 1 ) { + $htmlSpecialChr = array("  ", "
    "); + $msgHtml = "  " . trim(str_replace($htmlSpecialChr,"", $commentLine)) . "
    \n"; + #echo $msgHtml; + } else { + #echo $commentLine; + $msgHtml = $commentLine . "\n"; + } + fwrite($fHTML, $msgHtml); + } + #$comment = formatTo80Cols($commentRow[1], "\t", "\n"); + $comment = newFormatTo80Cols($commentRow[1], "\t", "\n"); + foreach ( $comment as $commentLine ) { + if ( preg_match('/https/', $commentLine) == 1 ) { + $msgMd = "\t[" . trim($commentLine) . "](" . trim($commentLine) . ")\n"; + fwrite($fMd, $msgMd); + $msgTxt = "\t" . trim($commentLine) . "\n"; + fwrite($fTxt, $msgTxt); + } else { + fwrite($fMd, $commentLine); + fwrite($fTxt, $commentLine); + + } + } + } + #echo "Pobrać ostatni komentarz dla zgłoszenia: #" . $value . "
    "; + } + $lp++; + fwrite($fHTML, "
  4. \n"); + #echo "
    "; + + fwrite($fTxt, "\n"); + fwrite($fMd, "\n"); + fwrite($fHTML, "
    "); + } + + + } + + fwrite($fHTML, "
\n"); + + #echo "Uwagi:
"; + if ( ! empty($_POST["changelogComment"]) ) { + $msgTxt = "Uwagi:\n"; + $msgHtml = "Uwagi:
"; + + fwrite($fTxt, $msgTxt); + fwrite($fMd, $msgTxt); + fwrite($fHTML, $msgHtml); + + $notices = array(); + #$notices = formatTo80Cols($_POST["changelogComment"], "  ", "
"); + $notices = newFormatTo80Cols($_POST["changelogComment"], "  ", "
"); + foreach ( $notices as $line ) { + #echo $line; + fwrite($fHTML, $line); + } + #$notices = formatTo80Cols($_POST["changelogComment"], "\t", "\n"); + $notices = newFormatTo80Cols($_POST["changelogComment"], "\t", "\n"); + foreach ( $notices as $line ) { + fwrite($fTxt, $line); + fwrite($fMd, $line); + } + } + #echo $_POST["changelogComment"]; + fclose($fTxt); + fclose($fMd); + fclose($fHTML); + } + $tableName = "product"; + $columnScheme = "name"; + $whereValue = "id = " . $_GET["pid"]; + $resultName = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( mysqli_num_rows($resultName) ) { + $productName = getFieldValue($resultName); + } else { + echo "
Nie znaleziono produktu o takim identyfikatorze
"; + exit; + } + + echo "
+
+

Wygenerowane listy zmian dla: " . $productName . "

+
+
"; + + $tableName = "changelog"; + $columnScheme = "filepath"; + $whereValue = "productId = " . $_GET["pid"]; + $resultChangelogs = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( mysqli_num_rows($resultChangelogs) > 0 ) { + echo ""; + while ( $rowCh = mysqli_fetch_row($resultChangelogs) ) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + echo "
" . basename($rowCh[0]) . "
"; + } else { + echo "
Nie znaleziono żadnych list zmian pasujących do produktu
"; + } + echo "
+
+
+
+

Nowa lista zmian dla: " . $productName . "

+
+
"; + include('forms/changelogform.php'); +} else { + include("403.php"); +} +?> + diff --git a/changelogs/index.php b/changelogs/index.php new file mode 100755 index 0000000..43e69a1 --- /dev/null +++ b/changelogs/index.php @@ -0,0 +1,6 @@ + diff --git a/comments.php b/comments.php new file mode 100644 index 0000000..2685005 --- /dev/null +++ b/comments.php @@ -0,0 +1,34 @@ + 0 ) { + while ( $row = mysqli_fetch_row($result) ) { + echo "
"; + echo "
"; + echo "" . $row[0] . ", " . $row[1] . " pisze..."; + echo "
" . nl2br($row[2]) . "
"; + } + } + if ( session_status() != 2 ) { session_start(); } + if ( isset($_SESSION["username"]) ) { + echo "
+
+
+ + + +
+ +
+
"; + } +?> + diff --git a/db_conf.php b/db_conf.php new file mode 100644 index 0000000..5a3f081 --- /dev/null +++ b/db_conf.php @@ -0,0 +1,20 @@ +console.log('Połaczenie nie powiodło się'); + console.log(\"Nr błędu: " . mysqli_connect_errno() . "\"); + console.log(\"Błąd: " . mysqli_connect_error() . "\");"; + exit; + } else { + if ( ! isset($_SERVER["SHELL"]) ) { + echo ""; + } + } + +?> diff --git a/db_patch_59.sql b/db_patch_59.sql new file mode 100755 index 0000000..64d9dc6 --- /dev/null +++ b/db_patch_59.sql @@ -0,0 +1,25 @@ +use bugtrack; + +CREATE TABLE changelog ( + id int AUTO_INCREMENT PRIMARY KEY, + productId int, + version varchar(30), + filepath text, + FOREIGN KEY (productId) REFERENCES product(id) +); + +CREATE TABLE clform ( + id int AUTO_INCREMENT PRIMARY KEY, + productId int, + code text, + FOREIGN KEY (productId) REFERENCES product(id) +); + +CREATE TABLE dictionary ( + id int AUTO_INCREMENT PRIMARY KEY, + productId int, + clformId int, + dictionary text, + FOREIGN KEY (productId) REFERENCES product(id), + FOREIGN KEY (clformId) REFERENCES clform(id) +); diff --git a/forms/changelogform.php b/forms/changelogform.php new file mode 100755 index 0000000..6697533 --- /dev/null +++ b/forms/changelogform.php @@ -0,0 +1,59 @@ + +
+
+ + + + +
+ 0 ) { + $CLForm = getFieldValue($resultCLForm); + echo $CLForm; + } else { + echo "
Nie zdefiniowano kodu formularza dla produktu
"; + } + echo "
"; + $tableName = 'bug'; + $columnScheme = 'id,componentId,subject'; + $whereValue = 'productId = ' . $_GET['pid'] . " AND state = 3"; + $resultBugs = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( mysqli_num_rows($resultBugs) > 0 ) { + echo "
    "; + while ( $rowB = mysqli_fetch_row($resultBugs) ) { + echo "
  • "; + echo ""; + echo ""; + echo "
  • "; + } + echo "
"; + } + ?> +
+ + +
+ +
diff --git a/forms/chbugstate.php b/forms/chbugstate.php new file mode 100644 index 0000000..5244cbf --- /dev/null +++ b/forms/chbugstate.php @@ -0,0 +1,31 @@ +
+ +
+
+ +
+
+ +
+
+
diff --git a/forms/chpasswd.php b/forms/chpasswd.php new file mode 100644 index 0000000..632e48b --- /dev/null +++ b/forms/chpasswd.php @@ -0,0 +1,28 @@ +
+
+

Hasło:

+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+
diff --git a/forms/delcomponent.php b/forms/delcomponent.php new file mode 100644 index 0000000..9e72261 --- /dev/null +++ b/forms/delcomponent.php @@ -0,0 +1,6 @@ +
+
+ + +
+
diff --git a/forms/delproduct.php b/forms/delproduct.php new file mode 100644 index 0000000..15dadba --- /dev/null +++ b/forms/delproduct.php @@ -0,0 +1,6 @@ +
+
+ + +
+
diff --git a/forms/deluser.php b/forms/deluser.php new file mode 100644 index 0000000..1ea3d95 --- /dev/null +++ b/forms/deluser.php @@ -0,0 +1,6 @@ +
+
+ + +
+
diff --git a/forms/editcomponent.php b/forms/editcomponent.php new file mode 100644 index 0000000..7da7719 --- /dev/null +++ b/forms/editcomponent.php @@ -0,0 +1,6 @@ +
+
+ + +
+
diff --git a/forms/editproduct.php b/forms/editproduct.php new file mode 100644 index 0000000..922bdfa --- /dev/null +++ b/forms/editproduct.php @@ -0,0 +1,6 @@ +
+
+ + +
+
diff --git a/forms/newclform.php b/forms/newclform.php new file mode 100755 index 0000000..d6e7232 --- /dev/null +++ b/forms/newclform.php @@ -0,0 +1,30 @@ + 0 ) { + $row = mysqli_fetch_row($result); + $pid = $row[0]; + $product = $row[1]; + } +?> + +
+
+ +
Nowy formularz dla produktu:
+
+ +
+ + +
+ +
+ +
Nowy formularz dla produktu:
+ + +
+
diff --git a/forms/newcomponent.php b/forms/newcomponent.php new file mode 100644 index 0000000..7687575 --- /dev/null +++ b/forms/newcomponent.php @@ -0,0 +1,48 @@ +
+
+
Nowy komponent:
+ 0 ) { + $thereAreProducts = true; + } else { + $thereAreProducts = false; + } + ?> + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + + +
+
diff --git a/forms/newdictionary.php b/forms/newdictionary.php new file mode 100755 index 0000000..c05bad4 --- /dev/null +++ b/forms/newdictionary.php @@ -0,0 +1,31 @@ + 0 ) { + $rowP = mysqli_fetch_row($result); + $pid = $rowP[0]; + $product = $rowP[1]; + } +?> + +
+
+ +
Nowy słownik dla produktu:
+
+ + +
+ + +
+ +
+ +
Nowy słownik dla produktu:
+ + +
+
diff --git a/forms/newproduct.php b/forms/newproduct.php new file mode 100644 index 0000000..944af4e --- /dev/null +++ b/forms/newproduct.php @@ -0,0 +1,20 @@ +
+
+
Nowy produkt:
+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
diff --git a/forms/newuser.php b/forms/newuser.php new file mode 100644 index 0000000..acabfb4 --- /dev/null +++ b/forms/newuser.php @@ -0,0 +1,28 @@ +
+
+
Nowy użytkownik:
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+
diff --git a/forms/setpasswd.php b/forms/setpasswd.php new file mode 100644 index 0000000..caa63ce --- /dev/null +++ b/forms/setpasswd.php @@ -0,0 +1,10 @@ +
+
+ + + +
+
+ +
+
diff --git a/forms/slogan.php b/forms/slogan.php new file mode 100644 index 0000000..08bec74 --- /dev/null +++ b/forms/slogan.php @@ -0,0 +1,23 @@ +
+
+
Slogan strony głównej:
+ 0 ) { + $row = mysqli_fetch_row($result); + echo "
"; + echo "
"; + echo ""; + echo ""; + echo "
"; + echo ""; + echo "
"; + } else { + echo "
Nie znaleziono sloganu.
"; + } +?> +
+
diff --git a/frontpage.php b/frontpage.php new file mode 100644 index 0000000..d26334b --- /dev/null +++ b/frontpage.php @@ -0,0 +1,12 @@ + 0 ) { + $slogan = getFieldValue($result); + echo "

" . $slogan . "

"; + } else { + echo "
Nie znaleziono sloganu strony
"; + } +?> diff --git a/index.php b/index.php new file mode 100755 index 0000000..60ec915 --- /dev/null +++ b/index.php @@ -0,0 +1,80 @@ + + + + + + + + + + + + BugTrack - <?php echo $row[0]; ?> + + + + +
+
+ +
+
+ + + + diff --git a/install.sql b/install.sql new file mode 100644 index 0000000..070bfa3 --- /dev/null +++ b/install.sql @@ -0,0 +1,57 @@ +CREATE USER 'bugtrack'@'localhost' IDENTIFIED BY '1234Test1234#@'; +CREATE DATABASE bugtrack; +GRANT ALL ON bugtrack.* TO 'bugtrack'@'localhost'; + +use bugtrack; + +CREATE TABLE user ( + id int AUTO_INCREMENT PRIMARY KEY, + username varchar(30), + passwd_hash text, + role varchar(30) +); + +CREATE TABLE product ( + id int AUTO_INCREMENT PRIMARY KEY, + name varchar(30), + author varchar(60), + description text +); + +CREATE TABLE component ( + id int AUTO_INCREMENT PRIMARY KEY, + productId int, + name varchar(30), + author varchar(60), + description text, + FOREIGN KEY (productId) REFERENCES product(id) +); + +CREATE TABLE site ( + id int AUTO_INCREMENT PRIMARY KEY, + slogan text +); + +CREATE TABLE bug ( + id int AUTO_INCREMENT PRIMARY KEY, + productId int, + componentId int, + typeof varchar(60), + subject varchar(255), + description text, + state int, + FOREIGN KEY (productId) REFERENCES product(id), + FOREIGN KEY (componentId) REFERENCES component(id) +); + +CREATE TABLE comment ( + id int AUTO_INCREMENT PRIMARY KEY, + bugId int, + user varchar(60), + date varchar(60), + content text, + FOREIGN KEY (bugId) REFERENCES bug(id) +); + +INSERT INTO user (username, passwd_hash, role) VALUES ('xf0r3m', "$2y$10$MlbeMeXc3SCoxNftEiyM9OVcuaQcucHbizX4aI0QOZguBCUkZRO0q", 'admin'); +INSERT INTO site (slogan) VALUES ('Hello, World!'); diff --git a/library.php b/library.php new file mode 100644 index 0000000..3df56dc --- /dev/null +++ b/library.php @@ -0,0 +1,145 @@ + 0) ) { + if ( ! isset($_SERVER["SHELL"]) ) { + echo ""; + } + return true; + } else { + echo ""; + return false; + } +} + +function dbQuery($connection, $tableName, $columnScheme, $whereValue, $debug=0) { + $query = "SELECT " . $columnScheme . " FROM " . $tableName . " WHERE " . $whereValue; + if ( $debug == 1 ) { var_dump($query); } + $result = mysqli_query($connection, $query); + + if ( mysqliResult($connection, $result) ) { + return $result; + } else { + echo ""; + } + +} + +function getFieldValue($result) { + $row = mysqli_fetch_row($result); + return $row[0]; +} + +function dbUpdate($connection, $tableName, $setValue, $whereValue) { + $query = "UPDATE " . $tableName . " SET " . $setValue . " WHERE " . $whereValue; + $result = mysqli_query($connection, $query); + + if ( mysqliResult($connection, $result) ) { + return $result; + } else { + echo ""; + } + +} + +function dbAdd($connection, $tableName, $columnScheme, $setValues) { + $query = "INSERT INTO " . $tableName . " (" . $columnScheme . ") VALUES (" . $setValues . ");"; + $result = mysqli_query($connection, $query); + + if ( mysqliResult($connection, $result) ) { + return $result; + } else { + echo ""; + } +} + +function dbDel($connection, $tableName, $whereValue) { + $query = "DELETE FROM " . $tableName . " WHERE " . $whereValue; + $result = mysqli_query($connection, $query); + + if ( mysqliResult($connection, $result) ) { + return $result; + } else { + echo ""; + } +} + +function siteListProducts($connection, $page) { + echo "
+
+

Lista produktów:

+
+
"; + $tableName = "product"; + $columnScheme = "*"; + $whereValue = "1=1"; + $result = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( mysqli_num_rows($result) > 0 ) { + echo "
    "; + while ( $row = mysqli_fetch_row($result) ) { + echo "
  • "; + echo $row[1] . " (". $row[2] .", " . $row[3] . ")
  • "; + } + echo "
"; + } else { + echo "
Nie znaleziono żadnych produktów
"; + } + echo "
"; +} + +function newFormatTo80Cols($long_string, $linePrefix, $eolSign) { + $content = array(); + if ( strlen($long_string) > 80 ) { + $toExplode = wordwrap($long_string, 80, "|", false); + $exploded = explode("|", $toExplode); + $i=0; + foreach ( $exploded as $line ) { + $content[$i] = $linePrefix . $line . $eolSign; + $i += 1; + } + } else { + $content[0] = $linePrefix . $long_string . $eolSign; + } + return $content; +} + +function presentListBugs($connection, $cond) { + $tableName = 'bug'; + $columnScheme = "*"; + $whereValue = $cond; + $result = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( mysqli_num_rows($result) > 0 ) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + $n = 1; + while ( $row = mysqli_fetch_row($result) ) { + echo ""; + echo ""; + ++$n; + } + echo ""; + echo "
#Lp.#idProduktKomponentRodzaj zgłosz.Temat zgłosz.Opis zgłosz.Status zgłosz.
" . $n . "#" . $row[0] . ""; + $tableName = 'product'; + $columnScheme = 'name'; + $whereValue = 'id = ' . intval($row[1]); + $result2 = dbQuery($connection, $tableName, $columnScheme, $whereValue); + echo getFieldValue($result2); + echo ""; + $tableName = 'component'; + $columnScheme = 'name'; + $whereValue = 'id = ' . intval($row[2]); + $result3 = dbQuery($connection, $tableName, $columnScheme, $whereValue); + echo getFieldValue($result3); + echo "" . $row[3] . "" . $row[4] . "" . nl2br($row[5]) . ""; + $stateTbl = array("Przyjęty", "Potwierdzony", "W trakcie", "Zakończony", "Odrzucony"); + $index = $row[6]; + echo $stateTbl[$index]; + echo "
"; + } else { + echo "
Nie znaleziono żadnych zgłoszeń w trakcie realizacji
"; + } +} +?> diff --git a/listofbugs.php b/listofbugs.php new file mode 100644 index 0000000..443fa4d --- /dev/null +++ b/listofbugs.php @@ -0,0 +1,48 @@ +
+
+

Lista zgłoszeń:

+
+
+ 0 ) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + $n = 1; + while ( $row = mysqli_fetch_row($result) ) { + echo ""; + echo ""; + ++$n; + } + echo ""; + echo "
#Lp.#idProduktKomponentRodzaj zgłosz.Temat zgłosz.Opis zgłosz.Status zgłosz.
" . $n . "#" . $row[0] . ""; + $tableName = 'product'; + $columnScheme = 'name'; + $whereValue = 'id = ' . intval($row[1]); + $result2 = dbQuery($connection, $tableName, $columnScheme, $whereValue); + #echo getFieldValue($result2); + $row2 = mysqli_fetch_row($result2); + echo $row2[0]; + echo ""; + $tableName = 'component'; + $columnScheme = 'name'; + $whereValue = 'id = ' . intval($row[2]); + $result3 = dbQuery($connection, $tableName, $columnScheme, $whereValue); + #echo getFieldValue($result3); + $row3 = mysqli_fetch_row($result3); + echo $row3[0]; + echo "" . $row[3] . "" . $row[4] . "" . nl2br($row[5]) . ""; + include('forms/chbugstate.php'); + echo "
"; + } else { + echo "
Nie znaleziono żadnych zgłoszonych błędów
"; + } +?> +
+
diff --git a/login.php b/login.php new file mode 100644 index 0000000..efeb35d --- /dev/null +++ b/login.php @@ -0,0 +1,48 @@ + + + + + + +

Zaloguj się:

+ + diff --git a/logout.php b/logout.php new file mode 100644 index 0000000..ce95b5c --- /dev/null +++ b/logout.php @@ -0,0 +1,7 @@ + diff --git a/modules/chbugstate.php b/modules/chbugstate.php new file mode 100644 index 0000000..e0f1ba7 --- /dev/null +++ b/modules/chbugstate.php @@ -0,0 +1,48 @@ +Komentarz powiązane ze zgłoszeniem usunięte
"; + } else { + echo "
Komentarze powiązane ze zgłoszeniem nie zostały usunięte
"; + } + $tableName = 'bug'; + $whereValue = "id = " . intval($_POST["bugId"]); + $result = dbDel($connection, $tableName, $whereValue); + if ( $result == true ) { + echo "
Zgłoszenie zostało usunięte
"; + } else { + echo "
Zgłoszenie nie zostało usunięte
"; + } + } else { + $bugResult = dbQuery($connection, $tableName, $columnScheme, $whereValue); + $bugRow = mysqli_fetch_row($bugResult); + $oldStateId = $bugRow[0]; + + + $setValue = "state = " . $newStateId; + $whereValue = 'id = ' . intval($_POST["bugId"]); + $result = dbUpdate($connection, $tableName, $setValue, $whereValue); + if ( $result == true ) { + echo "
Status zgłoszenia został zmieniony
"; + } else { + echo "
Status zgłoszenia nie został zmieniony
"; + } + + $stateTbl = array("Przyjęty", "Potwierdzony", "W trakcie", "Zakończony", "Odrzucony"); + + $newState = $stateTbl[$newStateId]; + $oldState = $stateTbl[$oldStateId]; + + $tableName = "comment"; + $columnScheme = "bugId,user,date,content"; + $setValue = intval($_POST["bugId"]) . ",'" . $_SESSION["username"] . "','" . date("Y-m-d H:i:s") . "','Status zgłoszenia został zmieniony z " . $oldState . " na " . $newState . "'"; + $result = dbAdd($connection, $tableName, $columnScheme, $setValue); + } +?> diff --git a/modules/chpasswd.php b/modules/chpasswd.php new file mode 100644 index 0000000..f2a272b --- /dev/null +++ b/modules/chpasswd.php @@ -0,0 +1,17 @@ +Hasło zostało zmienione.
"; + } else { + echo "
Zmiana hasła nie powiodła się.
"; + } + } + } +?> diff --git a/modules/delcomponent.php b/modules/delcomponent.php new file mode 100644 index 0000000..e95c042 --- /dev/null +++ b/modules/delcomponent.php @@ -0,0 +1,12 @@ +Komponent został usunięty"; + } else { + echo "
Komponent nie został usunięty
"; + } +?> + diff --git a/modules/delproduct.php b/modules/delproduct.php new file mode 100644 index 0000000..893067d --- /dev/null +++ b/modules/delproduct.php @@ -0,0 +1,21 @@ +Usunięto wszystkie komponenty produktu"; + } else { + echo "
Komponenty produktu nie zostały usunięte
"; + } + + $tableName = 'product'; + $whereValue = "id = " . $id; + $result = dbDel($connection, $tableName, $whereValue); + if ( $result == true ) { + echo "
Produkt został usunięty
"; + } else { + echo "
Produkt nie został usunięty
"; + } +?> + diff --git a/modules/deluser.php b/modules/deluser.php new file mode 100644 index 0000000..9b93b72 --- /dev/null +++ b/modules/deluser.php @@ -0,0 +1,10 @@ +Użytkownik został usunięty."; + } else { + echo "
Użytkownik nie został usunięty.
"; + } +?> diff --git a/modules/editclform.php b/modules/editclform.php new file mode 100755 index 0000000..42f5819 --- /dev/null +++ b/modules/editclform.php @@ -0,0 +1,25 @@ +Kod formularza został usunięty"; + } else { + echo "
Kod formularza nie został usunięty
"; + } + } else { + $tableName = "clform"; + $setValues = "code='" . $_POST["editCLFormCode"] . "'"; + $whereValue = "id = " . $_POST["CLFid"]; + $result = dbUpdate($connection, $tableName, $setValues, $whereValue); + if ( $result == true ) { + echo "
Zapisano zmiany w kodzie formularza.
"; + } else { + echo "
Nie udała się zapisać zmian w kodzie formularza.
"; + } + } + } +?> diff --git a/modules/editcomponent.php b/modules/editcomponent.php new file mode 100644 index 0000000..55c5969 --- /dev/null +++ b/modules/editcomponent.php @@ -0,0 +1,75 @@ +Zapisano zmiany w komponencie."; + } else { + echo "
Nie udała się zapisać zmian w komponencie.
"; + } + } else { + $id = intval($_POST["editCid"]); + $tableName = "component"; + $columnScheme = "productId,name,author,description"; + $whereValue = "id = " . $id; + $result = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( mysqli_num_rows($result) > 0 ) { + $row1 = mysqli_fetch_row($result); + } else { + echo "
Nie udało się odnleźć wybranego komponentu.
"; + } + } +?> + +
+
+
Nowy komponent:
+ 0 ) { + $thereAreProducts = true; + } else { + $thereAreProducts = false; + } + ?> +
+
+ + +
+
+ "> + + +
+
+ + +
+
+ + +
+ +
+
+
+ diff --git a/modules/editdictionary.php b/modules/editdictionary.php new file mode 100755 index 0000000..7d7624f --- /dev/null +++ b/modules/editdictionary.php @@ -0,0 +1,26 @@ +Słownik został usunięty"; + } else { + echo "
Słownik nie został usunięty
"; + } + } else { + $tableName = "dictionary"; + $setValues = "dictionary='" . $_POST["editDictionary"] . "'"; + $whereValue = "id = " . $_POST["dictId"]; + $result = dbUpdate($connection, $tableName, $setValues, $whereValue); + if ( $result == true ) { + echo "
Zapisano zmiany w słowniku.
"; + } else { + echo "
Nie udała się zapisać zmian w słowniku.
"; + } + } + } +?> diff --git a/modules/editproduct.php b/modules/editproduct.php new file mode 100644 index 0000000..be4d2af --- /dev/null +++ b/modules/editproduct.php @@ -0,0 +1,49 @@ +Zapisano zmiany w produkcie."; + } else { + echo "
Nie udało się zapisać zmian w produkcie.
"; + } + } else { + $id = intval($_POST["editPid"]); + $tableName = 'product'; + $columnScheme = "*"; + $whereValue = "id = " . $id . ";"; + $result = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( $result == true ) { + $row = mysqli_fetch_row($result); + } else { + echo "
Nie można odnaleźć wybranego produktu
"; + } + } +?> + +
+
+
Nowy produkt:
+
+
+ + + +
+
+ + +
+
+ + +
+ +
+
+
+ + diff --git a/modules/listclforms.php b/modules/listclforms.php new file mode 100755 index 0000000..27e4fe2 --- /dev/null +++ b/modules/listclforms.php @@ -0,0 +1,95 @@ +
+
+
Formularz list zmian:
+
+
+
Wybierz produkt:
+ + 0): ?> +
+
+ +
+ +
+ + + +
+
+ + + 0 ): ?> + +
+
Podgląd formularza:
+
+ +
+
+
+
Kod formularza:
+
+
+ +
+ +
+ +
+
+
+ + 0 ): ?> + +
+
Słownik:
+
+
+ +
+ +
+ +
+
+
+ + + + + + + + + + +
+
diff --git a/modules/listcomponents.php b/modules/listcomponents.php new file mode 100644 index 0000000..eb69065 --- /dev/null +++ b/modules/listcomponents.php @@ -0,0 +1,79 @@ +
+
+
Lista komponentów:
+
+
+
Wybierz produkt:
+ + 0): ?> +
+
+ +
+ +
+ + + +
+
+ + + 0 ): ?> + + + + + + + + + + + + + 0 ) { + $lp=1; + while ( $row = mysqli_fetch_row($result) ) { + echo ""; + $lp = ++$lp; + } + } + ?> + +
#LpNazwa komponentuAutorOpis komponentu
" . $lp . "" . $row[1] . "" . $row[2] . "" . $row[3] . ""; + include("forms/editcomponent.php"); + echo ""; + include("forms/delcomponent.php"); + echo "
+ + + + + + +
+
diff --git a/modules/listproducts.php b/modules/listproducts.php new file mode 100644 index 0000000..4c4467d --- /dev/null +++ b/modules/listproducts.php @@ -0,0 +1,27 @@ +
+
Lista produktów:
"; + + $tableName = 'product'; + $columnScheme = '*'; + $whereValue = "1=1"; + $result = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( mysqli_num_rows($result) > 0 ) { + echo " + + +"; + while ( $row = mysqli_fetch_row($result) ) { + echo ""; + } + echo "
#idNazwa produktuAutorOpis produktu
" . $row[0] . "" . $row[1] . "" . $row[2] . "" . $row[3] . ""; + include("forms/editproduct.php"); + echo ""; + include("forms/delproduct.php"); + echo "
"; + } else { + echo "
Nie znaleziono żadnych produktów.
"; + } + echo "
"; +?> diff --git a/modules/listusers.php b/modules/listusers.php new file mode 100644 index 0000000..0836bde --- /dev/null +++ b/modules/listusers.php @@ -0,0 +1,27 @@ +
+
Lista użytkowników
"; + + $tableName = 'user'; + $columnScheme = '*'; + $whereValue = "1=1"; + $result = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( mysqli_num_rows($result) > 0 ) { + echo " + + +"; + while ( $row = mysqli_fetch_row($result) ) { + echo ""; + } + echo "
#idNazwa użytkownikaRolaPrzypisz hasłoUsuń użytkownika
" . $row[0] . "" . $row[1] . "" . $row[3] . ""; + include("forms/setpasswd.php"); + echo ""; + include("forms/deluser.php"); + echo "
"; + } else { + echo "
Nie znaleziono użytkowników!
"; + } + echo "
"; +?> diff --git a/modules/newclform.php b/modules/newclform.php new file mode 100755 index 0000000..caec98e --- /dev/null +++ b/modules/newclform.php @@ -0,0 +1,12 @@ +Dodano nowy kod formularza listy zmian dla produktu"; + } else { + echo "
Nie udało się dodać nowego kodu formularza
"; + } + unset($_POST); +?> diff --git a/modules/newcomponent.php b/modules/newcomponent.php new file mode 100644 index 0000000..4c48262 --- /dev/null +++ b/modules/newcomponent.php @@ -0,0 +1,12 @@ +Dodano nowy komponent dla produktu"; + } else { + echo "
Nie udało się dodać nowego komponentu dla produktu
"; + } + unset($_POST); +?> diff --git a/modules/newdictionary.php b/modules/newdictionary.php new file mode 100755 index 0000000..79cad8e --- /dev/null +++ b/modules/newdictionary.php @@ -0,0 +1,12 @@ +Dodano słownik dla produktu"; + } else { + echo "
Nie udało się dodać nowego słownika
"; + } + unset($_POST); +?> diff --git a/modules/newproduct.php b/modules/newproduct.php new file mode 100644 index 0000000..a328215 --- /dev/null +++ b/modules/newproduct.php @@ -0,0 +1,11 @@ +Dodano nowy produkt."; + } else { + echo "
Nie udało się dodać produktu.
"; + } +?> diff --git a/modules/newuser.php b/modules/newuser.php new file mode 100644 index 0000000..4f41fcc --- /dev/null +++ b/modules/newuser.php @@ -0,0 +1,12 @@ +Użytkownik " . $_POST["nuName"] . " został pomyśnie utworzony."; + } else { + echo "
Utworzenie użytkownika niepowiodło się.
"; + } +?> diff --git a/modules/saveslogan.php b/modules/saveslogan.php new file mode 100644 index 0000000..84d9732 --- /dev/null +++ b/modules/saveslogan.php @@ -0,0 +1,11 @@ +Slogan strony głównej został zmieniony"; + } else { + echo "
Slogan nie został zmieniony
"; + } +?> diff --git a/modules/setpasswd.php b/modules/setpasswd.php new file mode 100644 index 0000000..429ca1d --- /dev/null +++ b/modules/setpasswd.php @@ -0,0 +1,12 @@ +Hasło zostało pomyślnie nadane."; + } else { + echo "
Nie udało się ustawić hasła.
"; + } +?> diff --git a/navbar.php b/navbar.php new file mode 100755 index 0000000..aaaa95a --- /dev/null +++ b/navbar.php @@ -0,0 +1,28 @@ + diff --git a/passwd.php b/passwd.php new file mode 100644 index 0000000..855e8a5 --- /dev/null +++ b/passwd.php @@ -0,0 +1,10 @@ + +
+ Password: + +
+" . password_hash($_POST["pass"], PASSWORD_DEFAULT) . ""; + } +?> diff --git a/settings.php b/settings.php new file mode 100644 index 0000000..4053fde --- /dev/null +++ b/settings.php @@ -0,0 +1,57 @@ +

Użytkownicy:

"; + include('forms/newuser.php'); + include('modules/listusers.php'); + echo "
"; + echo "

Produkty:

"; + if ( isset($_POST) && isset($_POST["editPid"]) ) { include('modules/editproduct.php'); } + else { include('forms/newproduct.php'); } + include('modules/listproducts.php'); + echo "
"; + echo "

Komponenty:

"; + if ( isset($_POST) && isset($_POST["editCid"]) ) { include('modules/editcomponent.php'); } + else { include('forms/newcomponent.php'); } + include('modules/listcomponents.php'); + echo "
"; + echo "

Formularz listy zmian:

"; + include('modules/listclforms.php'); + echo "
"; + echo "

Strona główna:

"; + include('forms/slogan.php'); + echo "
"; + + } + } else { + include('403.php'); + } +?> diff --git a/siteListProducts.php b/siteListProducts.php new file mode 100644 index 0000000..90f98e7 --- /dev/null +++ b/siteListProducts.php @@ -0,0 +1,27 @@ + + 0 ) { + echo "
    "; + while ( $row = mysqli_fetch_row($result) ) { + echo "
  • "; + echo $row[1] . " (". $row[2] .", " . $row[3] . ")
  • "; + } + echo "
"; + } else { + echo "
Nie znaleziono żadnych produktów
"; + } + */ + ?> + diff --git a/statistics.php b/statistics.php new file mode 100644 index 0000000..2326232 --- /dev/null +++ b/statistics.php @@ -0,0 +1,54 @@ +
+
+

Statystyka:

+
+
+
W tej instacji BugTrack znajduje się:
+
    +
  • + " . getFieldValue($productResult) . ""; + ?> +
  • +
  • + " . getFieldValue($componentResult) . ""; + ?> +
  • +
  • + " . getFieldValue($allBugsResult) . ""; + ?> +
  • +
  • + 0 AND state < 3"; + $openBugsResult = dbQuery($connection, $tableName, $columnScheme, $whereValue); + echo "Zgłoszeń otwartych: " . getFieldValue($openBugsResult) . ""; + ?> +
  • +
  • + = 3"; + $closedBugsResult = dbQuery($connection, $tableName, $columnScheme, $whereValue); + echo "Zgłoszeń zamkniętych: " . getFieldValue($closedBugsResult) . ""; + ?> +
  • +
+
diff --git a/submit.php b/submit.php new file mode 100644 index 0000000..4bbcd39 --- /dev/null +++ b/submit.php @@ -0,0 +1,108 @@ +Zgłoszenie zostało przyjęte. Niebawem pojawi się na stronie zgłoszonych problemów"; + } else { + echo "
Zgłosznie nie zostało przyjęte.
"; + } + $tableName = 'bug'; + $columnScheme = "id"; + $whereValue = "1=1 ORDER BY id DESC"; + $result = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( mysqli_num_rows($result) > 0 ) { + $row = mysqli_fetch_row($result); + $bugId = $row[0]; + } + + $tableName = 'product'; + $columnScheme = 'name,description'; + $whereValue = "id = " . intval($_POST["submitProductId"]); + $productResult = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( mysqli_num_rows($productResult) > 0 ) { + $productRow = mysqli_fetch_row($productResult); + } + + $tableName = 'component'; + $columnScheme = 'name,description'; + $whereValue = "id = " . intval($_POST["submitCompId"]); + $componentResult = dbQuery($connection, $tableName, $columnScheme, $whereValue); + if ( mysqli_num_rows($componentResult) > 0 ) { + $componentRow = mysqli_fetch_row($componentResult); + } + + $tableName = "comment"; + $columnScheme = 'bugId,user,date,content'; + if ( session_status() != 2 ) { session_start(); } + if ( isset($_SESSION["username"]) ) { $userName = $_SESSION["username"]; } + else { $userName = $_SERVER["REMOTE_ADDR"]; } + $setValue = intval($bugId) . ",'" . $userName . "','" . date("Y-m-d H:i:s") . "','Utworzono zgłoszenie.

Produkt: " . $productRow[0] . " (" . $productRow[1] . ")
Komponent: " . $componentRow[0] . " (" . $componentRow[1] . ")
Rodzaj zgłoszenia: " . mysqli_real_escape_string($connection, htmlspecialchars($_POST["submitTypeOf"])) . "
Temat: " . mysqli_real_escape_string($connection, htmlspecialchars($_POST["submitSubject"])) . "
Opis zgłoszenia:
" . mysqli_real_escape_string($connection, htmlspecialchars($_POST["submitDesc"])) . "'"; + $result = dbAdd($connection, $tableName, $columnScheme, $setValue); + if ( $result == true ) { + echo "
Zgłoszenie zostało również zapisane jako pierwszy komentarz
"; + } else { + echo "
Zgłoszenie nie zostało zapisane.
"; + } + } +?> +
+
+

Zgłoś błąd:

+
+
+
" method="post"> +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
diff --git a/viewchlog.php b/viewchlog.php new file mode 100755 index 0000000..c6b0819 --- /dev/null +++ b/viewchlog.php @@ -0,0 +1,15 @@ + +
+
+

Lista zmian dla wersji produktu :

+
+
+ +
+