commit 5eb74cd6b1230ae5605e99e3e187b6eefd8c9123
Author: Petr Lukašík <lukasik@rtsoft.cz>
Date:   Mon Jun 10 15:35:16 2019 +0200

    Re #7580 osobní sféra - články

diff --git a/old/html/multidic/app/webroot/administration/article.php b/old/html/multidic/app/webroot/administration/article.php
index 2a5dff2..a990fa4 100644
--- a/old/html/multidic/app/webroot/administration/article.php
+++ b/old/html/multidic/app/webroot/administration/article.php
@@ -242,12 +242,12 @@ function print_table_of_article($language = "all", $contrains_source = "all", $c
     $dotaz .= "AND lection = '$contrains_lection'";
 
 
-  $dotaz .= " ORDER BY \"$order\" OFFSET $od LIMIT $limit";
+  $dotaz .= " ORDER BY $order LIMIT $limit OFFSET $od";
 
   $radky = $spojeni->query($dotaz);
 
   while ($spojeni->next_record()) {
-    $navrat .= get_row_of_table($spojeni->Record);
+    $navrat .= get_row_of_table($spojeni->row);
   }
   $navrat .= get_foot_of_table();
   $navrat .= "</table>";
diff --git a/old/html/multidic/app/webroot/administration/list_article.php b/old/html/multidic/app/webroot/administration/list_article.php
index d85efc2..96a8a29 100644
--- a/old/html/multidic/app/webroot/administration/list_article.php
+++ b/old/html/multidic/app/webroot/administration/list_article.php
@@ -5,51 +5,51 @@ if ($cesta == "./examination/")
 else
   require_once("./administration/article.php");
 
-if (Empty($language)) :
 
+if (Empty(@$_REQUEST['language'])) :
 
 ?>
   <p>Vyberte jazyk:</p>
   <p>
-    <a href="?nav_id=<?php echo @$_REQUEST['nav_id']?>&language=1<?php echo $pomocna?>">arabský</a><br />
-    <a href="?nav_id=<?php echo @$_REQUEST['nav_id']?>&language=2<?php echo $pomocna?>">hebrejský</a><br />
-    <a href="?nav_id=<?php echo @$_REQUEST['nav_id']?>&language=3<?php echo $pomocna?>">akkadský</a><br /><br />
+    <a href="?nav_id=<?php echo @$_REQUEST['nav_id']?>&language=1">arabský</a><br />
+    <a href="?nav_id=<?php echo @$_REQUEST['nav_id']?>&language=2">hebrejský</a><br />
+    <a href="?nav_id=<?php echo @$_REQUEST['nav_id']?>&language=3">akkadský</a><br /><br />
 
     <a href="?nav_id=<?php echo @$_REQUEST['nav_id']?>&language=all&contrains_source=all&contrains_lection=all">všechny</a>
   </p>
 <?php
 
-elseif ($language != "all" && Empty($contrains_source)):
+elseif (@$_REQUEST['language'] != "all" && Empty(@$_REQUEST['contrains_source'])):
 ?>
   <p>Vyberte zdroj:</p>
   <p><form method="post">
 
      <?php
-echo get_source_chooser($language, "contrains_source");
+echo get_source_chooser(@$_REQUEST['language'], "contrains_source");
 ?>
      <input type="submit" value="Dál" />
      </form>
-   <br /> <a href="?nav_id=<?php echo @$_REQUEST['nav_id']?>&language=<?php echo $language?>&contrains_source=all&contrains_lection=all">všechny</a>
+   <br /> <a href="?nav_id=<?php echo @$_REQUEST['nav_id']?>&language=<?php echo @$_REQUEST['language']?>&contrains_source=all&contrains_lection=all">všechny</a>
   </p>
 <?php
-elseif ($language != "all" && $contrains_source != "all" && Empty($contrains_lection)):
+elseif (@$_REQUEST['language'] != "all" && @$_REQUEST['contrains_source'] != "all" && Empty(@$_REQUEST['contrains_lection'])):
 ?>
   <p>Vyberte lekci:</p>
   <p><form method="post">
 
      <?php
-echo get_lection_chooser_article($contrains_source, 1, "contrains_lection");
+echo get_lection_chooser_article(@$_REQUEST['contrains_source'], 1, "contrains_lection");
 ?>
      <input type="submit" value="Dál" />
-     <input type="hidden" name="contrains_source" value="<?php echo $contrains_source?>" title="Dál" />
+     <input type="hidden" name="contrains_source" value="<?php echo @$_REQUEST['contrains_source']?>" title="Dál" />
      </form>
-   <br /> <a href="?nav_id=<?php echo @$_REQUEST['nav_id']?>&language=<?php echo $language?>&contrains_source=<?php echo $contrains_source?>&contrains_lection=all">všechny</a>
+   <br /> <a href="?nav_id=<?php echo @$_REQUEST['nav_id']?>&language=<?php echo @$_REQUEST['language']?>&contrains_source=<?php echo @$_REQUEST['contrains_source']?>&contrains_lection=all">všechny</a>
   </p>
 <?php
 else :
 //obsluha mazani slovicek
-if (!Empty($action) && $action == "delete_article") {
-  if (delete_article($article_id))
+if (!Empty(@$_REQUEST['action']) && @$_REQUEST['action'] == "delete_article") {
+  if (delete_article(@$_REQUEST['article_id']))
     print_hlasku("Článek smazán.");
   else
     print_hlasku("Článek se nepodařilo smazat");
@@ -69,26 +69,27 @@ if (!Empty($action) && $action == "delete_article") {
   else
     print_hlasku("Bohužel,$coun_false článků se nepodařilo smazat ($coun_true se podařilo smazat)");*/
 }
-
 //obsluha autorizace slovicka
-if (!Empty($nav_id) && $nav_id == "autorize_article") {
 
-  if (authorize_article($article_id))
+if (!Empty(@$_REQUEST['nav_id']) && @$_REQUEST['nav_id'] == "autorize_article") {
+
+  if (authorize_article(@$_REQUEST['article_id']))
     print_hlasku("Článek autorizován.");
   else
     print_hlasku("Bohužel, článek se nepodařilo autorizovat.");
 }
 
-if ($nav_id == "list_article") $pomocna = false;
-else if ($nav_id == "list_nonauthorized_article") $pomocna = true;
-else  $pomocna = ($nonauthorized == true);
+if (@$_REQUEST['nav_id'] == "list_article") $pomocna = false;
+else if (@$_REQUEST['nav_id'] == "list_nonauthorized_article") $pomocna = true;
+else  $pomocna = (@$_REQUEST['nonauthorized'] == true);
 //pr($nav_id);
 //vypis
-if (!Empty($serad)) {
-    print_table_of_article($language, $contrains_source, $contrains_lection,$pomocna, $order, $od, $limit);
+
+if (!Empty(@$_REQUEST['serad'])) {
+    print_table_of_article(@$_REQUEST['language'], @$_REQUEST['contrains_source'], @$_REQUEST['contrains_lection'], $pomocna, @$_REQUEST['order'], @$_REQUEST['od'], @$_REQUEST['limit']);
 }
 else {
-  print_table_of_article($language, $contrains_source, $contrains_lection, $pomocna);
+  print_table_of_article(@$_REQUEST['language'], @$_REQUEST['contrains_source'], @$_REQUEST['contrains_lection'], $pomocna);
 }
 
 endif;
diff --git a/old/html/multidic/app/webroot/examination/article.php b/old/html/multidic/app/webroot/examination/article.php
index 0acd0a9..bcd818a 100644
--- a/old/html/multidic/app/webroot/examination/article.php
+++ b/old/html/multidic/app/webroot/examination/article.php
@@ -23,6 +23,7 @@ function get_row_of_table($Record) {
 
   $nav_str = "language=$language&contrains_source=$contrains_source&contrains_lection=$contrains_lection";
 
+  $navrat = "";
   $navrat .= "  <tr class=\"akt\">";
   $navrat .= "\n    <td>  ".$Record['language']." </td>";
   $navrat .= "\n    <td>  ".$Record['source']."</td>";
@@ -140,14 +141,14 @@ function build_query_article($language, $contrains_source, $contrains_lection,$o
             FROM article ar, language lan, source so";
 
   if ($language != "all")
-    $dotaz .= " WHERE ar.language LIKE '$language' ";
+    $dotaz .= " WHERE ar.language LIKE '$language'";
   else
     $dotaz .= " WHERE TRUE ";
 
   if ($contrains_source != "all")
-    $dotaz .= "AND ar.source = $contrains_source";
+    $dotaz .= " AND ar.source = '$contrains_source'";
   if ($contrains_lection != "all")
-    $dotaz .= "AND ar.lection = $contrains_lection";
+    $dotaz .= " AND ar.lection = '$contrains_lection'";
 
   $dotaz .= " AND ar.language = lan.IDlanguage
               AND ar.source   = so.IDsource ";
@@ -185,6 +186,7 @@ function get_short_table_of_article($language = "all", $contrains_source = "all"
  *
  */
 function print_table_of_article($language = "all", $contrains_source = "all", $contrains_lection = "all",
+                          $nonauthorized = false,
                           $order = "IDarticle", $od = 0, $limit = 30) {
 
   require_once("./classes/db.php");
@@ -205,11 +207,12 @@ function print_table_of_article($language = "all", $contrains_source = "all", $c
   $navrat .= get_header_of_table();
 
   $dotaz = build_query_article($language, $contrains_source, $contrains_lection,$order, $od, $limit);
-    //echo "dotaz: ".$dotaz;
+
+  //echo "dotaz: ".$dotaz;
   $radky = $spojeni->query($dotaz);
 
   while ($spojeni->next_record()) {
-    $navrat .= get_row_of_table($spojeni->Record);
+    $navrat .= get_row_of_table($spojeni->row);
   }
   $navrat .= get_foot_of_table();
   $navrat .= "</table>";
@@ -217,10 +220,11 @@ function print_table_of_article($language = "all", $contrains_source = "all", $c
 }
 
 function get_article($id) {
+
   require_once("./classes/db.php");
   $spojeni = new DB_Sql();
-  $dotaz = "SELECT DISTINCT ON (ar.\"IDarticle\")
-                         ar.\"IDarticle\"  as \"IDarticle\",
+  $dotaz = "SELECT DISTINCT
+                         ar.IDarticle  as IDarticle,
                          ar.title          as title,
                          ar.body           as body,
                          ar.note           as note,
@@ -228,11 +232,11 @@ function get_article($id) {
                          lan.language      as language,
                          so.title          as source,
                          ar.lection        as lection,
-                         ar.source         as \"IDsource\"
+                         ar.source         as IDsource
              FROM article ar, language lan, source so
-             WHERE \"IDarticle\" = '$id'
-              AND ar.language = lan.\"IDlanguage\"
-              AND ar.source   = so.\"IDsource\" ";
+             WHERE IDarticle = '$id'
+              AND ar.language = lan.IDlanguage
+              AND ar.source   = so.IDsource ";
   $radky = $spojeni->query($dotaz);
   $spojeni->next_record();
 
@@ -240,7 +244,7 @@ function get_article($id) {
     print_hlasku("Slovo se nepodařilo načíst.");
   }
 
-  return $spojeni->Record;
+  return $spojeni->row;
 }
 
 
diff --git a/old/html/multidic/app/webroot/examination/detail_article.php b/old/html/multidic/app/webroot/examination/detail_article.php
index 2ce4815..05b9eec 100644
--- a/old/html/multidic/app/webroot/examination/detail_article.php
+++ b/old/html/multidic/app/webroot/examination/detail_article.php
@@ -1,7 +1,7 @@
 <?php
 require_once("./examination/article.php");
 
-$article = get_article($article_id);
+$article = get_article(@$_REQUEST['article_id']);
 
 ?>
 <h4>Detail článku</h4>
diff --git a/old/html/multidic/app/webroot/functions/dictionary.php b/old/html/multidic/app/webroot/functions/dictionary.php
index c5d50c5..20d9545 100644
--- a/old/html/multidic/app/webroot/functions/dictionary.php
+++ b/old/html/multidic/app/webroot/functions/dictionary.php
@@ -425,6 +425,8 @@ function get_lection_chooser($source, $size = 1, $nazev = "lection")
 
 function get_lection_chooser_article($source, $size = 1, $nazev = "lection")
 {
+    $cisla = array();
+    $hodnoty = array();
     require_once("./classes/db.php");
     $spojeni = new DB_Sql();
     $dotaz = "SELECT lection FROM article WHERE source = '$source' GROUP BY lection ORDER BY lection ";
@@ -432,8 +434,8 @@ function get_lection_chooser_article($source, $size = 1, $nazev = "lection")
     $navrat = "<select name=\"$nazev\" size=\"$size\">";
     $i = 0;
     while ($spojeni->next_record()) {
-        $cisla[$i] = 0 + ($spojeni->Record["lection"]);
-        $hodnoty[$i] = $spojeni->Record["lection"];
+        $cisla[$i] = 0 + ($spojeni->row["lection"]);
+        $hodnoty[$i] = $spojeni->row["lection"];
         $i++;
     }
     if (count($cisla) <= 0) {
