]> gitweb.morketsmerke.org Git - sc.git/commitdiff
Ukrycie komunikatów zwracanych w przypadku pobranie pustego zbioru - BT #185
authorxf0r3m <jakubstasinski@protonmail.com>
Tue, 23 Jul 2024 06:18:29 +0000 (08:18 +0200)
committerxf0r3m <jakubstasinski@protonmail.com>
Tue, 23 Jul 2024 06:18:29 +0000 (08:18 +0200)
library.php
sccli

index 893266a8a283b8663dc017c1553ad03e33dd76d4..f5a67d680e4deb512bd9082b66bf09f1746cbe31 100644 (file)
@@ -7,7 +7,9 @@ function mysqliResult($connection, $result) {
     }
     return true;
   } else {
-    echo "<script>console.log('Zapytanie nie powiodło się: " . mysqli_error($connection) . "');</script>";
+    if ( ! isset($_SERVER["SHELL"]) ) {
+      echo "<script>console.log('Zapytanie nie powiodło się: " . mysqli_error($connection) . "');</script>";
+    }
     return false;
   }
 }
@@ -20,7 +22,9 @@ function dbQuery($connection, $tableName, $columnScheme, $whereValue, $debug=0)
   if ( mysqliResult($connection, $result) ) {
     return $result;
   } else {
-    echo "<script>console.log('Pobranie danych z bazy jest niemożliwe');</script>";
+    if ( ! isset($_SERVER["SHELL"]) ) {
+      echo "<script>console.log('Pobranie danych z bazy jest niemożliwe');</script>";
+    }
   }
 
 }
@@ -37,7 +41,9 @@ function dbUpdate($connection, $tableName, $setValue, $whereValue) {
   if ( mysqliResult($connection, $result) ) {
     return $result;
   } else {
-    echo "<script>console.log('Zmiana danych w bazie jest niemożliwa');</script>";
+    if ( ! isset($_SERVER["SHELL"]) ) {
+      echo "<script>console.log('Zmiana danych w bazie jest niemożliwa');</script>";
+    }
   }
 
 }
@@ -49,7 +55,9 @@ function dbAdd($connection, $tableName, $columnScheme, $setValues) {
   if ( mysqliResult($connection, $result) ) {
     return $result;
   } else {
-    echo "<script>console.log('Dodanie danych do bazy jest niemożliwa');</script>";
+    if ( ! isset($_SERVER["SHELL"]) ) {
+      echo "<script>console.log('Dodanie danych do bazy jest niemożliwa');</script>";
+    }
   }
 }
 
@@ -60,7 +68,9 @@ function dbDel($connection, $tableName, $whereValue) {
   if ( mysqliResult($connection, $result) ) {
     return $result;
   } else {
-    echo "<script>console.log('Usunięcie danych z bazy jest niemożliwa');</script>";
+    if ( ! isset($_SERVER["SHELL"]) ) {
+      echo "<script>console.log('Usunięcie danych z bazy jest niemożliwa');</script>";
+    }
   }
 }
 
diff --git a/sccli b/sccli
index 00a6b51fcc772355c7dd17dd1b6123e873b104a0..e17d20b9419f7f667ef1d179563f5830b27803e6 100755 (executable)
--- a/sccli
+++ b/sccli
@@ -131,6 +131,7 @@ if ( isset($argv[1]) ) {
     echo "\t ms - Przenosi stronę do podanej kategorii:\n\t - sccli ms <id_strony> <id_kategorii>\n";
     echo "\t ds - Usuwa podaną stronę - sccli ds <id_strony>\n";
     echo "\t dc - Usuwa podaną kategorię (jeśli są tam strony, też zostaną usunięte):\n\t - sccli dc <id_kategorii>\n";
+    echo "\nJeśli program nie zwróci nic, oznacza to, że pobrano z bazy danych pusty zbiór.\n";
   } else {
     echo "
       <div class=\"alert alert-danger\" role=\"alert\">