]> gitweb.morketsmerke.org Git - bugtrack.git/commitdiff
Synchronizacja public -> priv
authorxf0r3m <jakubstasinski@protonmail.com>
Tue, 12 Mar 2024 09:06:17 +0000 (10:06 +0100)
committerxf0r3m <jakubstasinski@protonmail.com>
Tue, 12 Mar 2024 09:06:17 +0000 (10:06 +0100)
btcli

diff --git a/btcli b/btcli
index b19fc5704772aa3f3bac1734898bd23e5395ddd9..d2ba5a873338151467eda37697ec55ec865b4e4d 100755 (executable)
--- a/btcli
+++ b/btcli
@@ -13,6 +13,8 @@
         $whereValue = "1=1";
       } else if ( $type_of == "user" ) {
         $whereValue = "state < 3";
+      } else if ( $type_of == "saved" ) {
+        $whereValue = "state = 5";
       }
     } 
     $result = dbQuery($connection, $tableName, $columnScheme, $whereValue);
@@ -36,7 +38,7 @@
         echo $compName . "\t";
 
         echo $row[3] . "\t" . $row[4] . "\t" . $row[5] . "\t";
-        $stateTbl = array("Przyjęty", "Potwierdzony", "W trakcie", "Zakończony", "Odrzucony");
+        $stateTbl = array("Przyjęty", "Potwierdzony", "W trakcie", "Zakończony", "Odrzucony", "Zachowany");
         $index = $row[6];
         $state=$stateTbl[$index];
 
 
   function show_states($state="all") {
     if ( isset($state) ) {
-      $stateTbl = array('Przyjęty', 'Potwierdzony', 'W trakcie', 'Zakończony', 'Odrzucony', 'Do usunięcia');
+      $stateTbl = array('Przyjęty', 'Potwierdzony', 'W trakcie', 'Zakończony', 'Odrzucony', 'Zachowany', 'Do usunięcia');
       if ( $state == "all" ) {
         for ( $i=0; $i < count($stateTbl); $i++ ) {
           echo $i . "\t" . $stateTbl[$i] . "\n\n";
 
 
   function change_state($connection, $bugId, $newState) {
-    if ( ( $newState < 0 ) || ( $newState > 5 ) ) {
+    if ( ( $newState < 0 ) || ( $newState > 6 ) ) {
       return false;
-    } else if ( $newState == 5 ) {
+    } else if ( $newState == 6 ) {
       $tableName = 'comment';
       $whereValue = 'bugId = ' . intval($bugId);
       $resultk = dbDel($connection, $tableName, $whereValue);
     $whereValue = "bugId = " . intval($bugId);
     $result = dbQuery($connection,$tableName,$columnScheme,$whereValue);
     if ( mysqli_num_rows($result) > 0 ) {
+      $count=1;
+      echo "==============================================================" . "\n\n";
       while( $row = mysqli_fetch_row($result) ) {
         echo $row[0] . ", " . $row[1] . " pisze...\n";
-        echo $row[2] . "\n\n";
+        $msg = $row[2];
+        $msg = str_replace("<br />", "\n", $msg);
+        $msg = str_replace("<strong>","\e[1;37m", $msg);
+        $msg = str_replace("</strong>","\e[0m", $msg);
+        echo $msg . "\n\n";
+        if ( $count == 1 ) {
+          echo "==============================================================" . "\n\n";
+        } else {
+          echo "--------------------------------------------------------------" . "\n\n";
+        }
+        $count++;
       }
     }
   }
   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] == 'lb-saved' ) { list_of_bugs($connection, 'saved'); }
     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]); }
       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 "\tlb-user - prints submitted requests except done or rejected tasks\n\n";
+      echo "\tlb-saved - prints only saved requests\n\n";
       echo "\tlp - prints all products defined on the platform\n\n";
       echo "\tlc <product_name> - prints all components related with given product\n\n";
       echo "\tsb <product_name> <component_name> <type_of> <subject> <description> - submiting bug or \n\tenchancement request\n\n";
       echo "\tdp <product_name> - removes give product with all related components\n\n";
       echo "\tcp <username> <new_password> - 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";
+      echo "To remove some request just set them state 6, which means 'To delete'\n";
+      echo "Setting state 6, causing request deletion\n";
     } else {
       include($ROOT . '/403.php');
     }