commit fbcb777f826e1ad6013c6746aad5c6eb5b1f6b38
Author: Petr Lukašík <lukasik@rtsoft.cz>
Date:   Mon Jun 10 17:13:32 2019 +0200

    Re #7580 administrace - články

diff --git a/old/html/multidic/app/webroot/administration/add_article.php b/old/html/multidic/app/webroot/administration/add_article.php
index b9fd72a..10a9d4d 100644
--- a/old/html/multidic/app/webroot/administration/add_article.php
+++ b/old/html/multidic/app/webroot/administration/add_article.php
@@ -13,11 +13,10 @@ require_once("./administration/article.php");
       echo $string;
   }
 
-
-if (Empty($language) || $language == "") {
+if (Empty(@$_REQUEST['language']) || @$_REQUEST['language'] == "") {
   $krok = 0;
 }
-else if (Empty($source) || $source == "") {
+else if (Empty(@$_REQUEST['source']) || @$_REQUEST['source'] == "") {
   $krok = 1;
 }
 else {
@@ -58,11 +57,11 @@ switch ($krok) {
     <form action="" method="POST" name="new_article_form1">
       <table>
       <tr class="akt">
-        <td><?php echo(get_source_chooser($language))?></td>
+        <td><?php echo(get_source_chooser(@$_REQUEST['language']))?></td>
       </tr>
       <tr class="nadpis_sekce">
         <td>
-          <input type="hidden" name="language" value="<?php echo $language?>">
+          <input type="hidden" name="language" value="<?php echo @$_REQUEST['language']?>">
           <input type="hidden" name="action" value="select_source">
           <input type="submit" value="Dál">
         </td>
@@ -79,17 +78,19 @@ switch ($krok) {
   
   $zobrazit_znovu = true;  
 
-    if (!Empty($action) && $action == "insert_new_article") {
+    if (!Empty(@$_REQUEST['action']) && @$_REQUEST['action'] == "insert_new_article") {
 
-    $user = $ses_IDuser;
+    $user = $_SESSION['ses_IDuser'];
   
   
-    if (Empty($lection)) {
+    if (Empty(@$_REQUEST['lection'])) {
       print_hlasku("Lekci musíte vyplnit");
     }
     else {
-      if (insert_article($language,$source,$lection,$title,$body,$note,$user)) {
+      if (insert_article(@$_REQUEST['language'],@$_REQUEST['source'],@$_REQUEST['lection'],@$_REQUEST['title'],@$_REQUEST['body'],@$_REQUEST['note'],$user)) {
         print_hlasku ("Článek přidán...");
+      }else{
+          print_hlasku("Nastala chyba při vytváření článku");
       }
 
       $zobrazit_znovu = false;
@@ -125,38 +126,38 @@ switch ($krok) {
       <table>
       <tr class="akt">
         <td>název</td>
-        <td<?php if ($language == 1 || $language == 2) echo " dir=\"rtl\"" ?>>
-        <input type="text" <?php if ($language == 1 || $language == 2) echo "class=\"arabic\"\n" ?>
+        <td<?php if (@$_REQUEST['language'] == 1 || @$_REQUEST['language'] == 2) echo " dir=\"rtl\"" ?>>
+        <input type="text" <?php if (@$_REQUEST['language'] == 1 || @$_REQUEST['language'] == 2) echo "class=\"arabic\"\n" ?>
                name="title"  
-               size="29"<?php znova($title)?> 
+               size="29"<?php znova(@$_REQUEST['title'])?>
                onfocus="aktivujKlavesnici('new_article_form.title')" /></td>
       </tr>
       <tr class="akt">
         <td>text</td>
-        <td<?php if ($language == 1 || $language == 2) echo " dir=\"rtl\"" ?>>
-        <textarea <?php if ($language == 1 || $language == 2) echo "class=\"arabic\"\n" ?>
+        <td<?php if (@$_REQUEST['language'] == 1 || @$_REQUEST['language'] == 2) echo " dir=\"rtl\"" ?>>
+        <textarea <?php if (@$_REQUEST['language'] == 1 || @$_REQUEST['language'] == 2) echo "class=\"arabic\"\n" ?>
             name="body" 
             rows="7" 
             wrap="PHYSICAL" 
             cols="25"
             onfocus="aktivujKlavesnici('new_article_form.body')"
-        ><?php znova_hodnota($body) ?></textarea>       
+        ><?php znova_hodnota(@$_REQUEST['body']) ?></textarea>       
                
                
                </td>
       </tr>
       <tr class="akt">
         <td>poznámka</td>
-        <td><input type="text" name="note"  size="50"<?php znova($note)?> /></td>
+        <td><input type="text" name="note"  size="50"<?php znova(@$_REQUEST['note'])?> /></td>
       </tr>
       <tr class="akt">
         <td>lekce*</td>
-        <td><input type="text" name="lection"  size="50"<?php znova($lection)?> /></td>
+        <td><input type="text" name="lection"  size="50"<?php znova(@$_REQUEST['lection'])?> /></td>
       </tr>
       <tr class="nadpis_sekce">
         <td>
-          <input type="hidden" name="language" value="<?php echo $language?>">
-          <input type="hidden" name="source" value="<?php echo $source?>">
+          <input type="hidden" name="language" value="<?php echo @$_REQUEST['language']?>">
+          <input type="hidden" name="source" value="<?php echo @$_REQUEST['source']?>">
           <input type="hidden" name="action" value="insert_new_article">
         </td>
         <td><input type="submit" value="Vlož"></td>
diff --git a/old/html/multidic/app/webroot/administration/add_article_voice.php b/old/html/multidic/app/webroot/administration/add_article_voice.php
index c7b9b67..47e9e31 100644
--- a/old/html/multidic/app/webroot/administration/add_article_voice.php
+++ b/old/html/multidic/app/webroot/administration/add_article_voice.php
@@ -3,14 +3,14 @@
   require_once("./administration/voice.php");
   $znovu = true;
 
-if (!Empty($action) && $action == "add_article_voice") {
+if (!Empty(@$_REQUEST['action']) && @$_REQUEST['action'] == "add_article_voice") {
   
-  if (Empty($soubor)) {
+  if (Empty(@$_REQUEST['soubor'])) {
     print_hlasku("Musíte vybrat soubor");
   }
   else {
     $znovu = false;
-    save_article_voice($soubor,$article_id);
+    save_article_voice(@$_REQUEST['soubor'],@$_REQUEST['article_id']);
     echo_zpet_do_clanku();
   }
 }
@@ -47,7 +47,7 @@ if ($znovu) {
       <tr class="nadpis_sekce">
         <td>
           <input type="hidden" name="action" value="add_article_voice">
-          <input type="hidden" name="article_id" value="<?php echo $article_id?>">
+          <input type="hidden" name="article_id" value="<?php echo @$_REQUEST['article_id']?>">
         </td>
         <td><input type="submit" value="Vlož"></td>
       </tr>
diff --git a/old/html/multidic/app/webroot/administration/article.php b/old/html/multidic/app/webroot/administration/article.php
index a990fa4..e94dd00 100644
--- a/old/html/multidic/app/webroot/administration/article.php
+++ b/old/html/multidic/app/webroot/administration/article.php
@@ -5,7 +5,7 @@ function authorize_article($ID) {
   require_once("./classes/db.php");
   $spojeni = new DB_Sql();
   $dotaz = "UPDATE article SET autorized = true
-                        WHERE \"IDarticle\" = '$ID'";
+                        WHERE IDarticle = '$ID'";
   $spojeni->query($dotaz);
   if ($spojeni->connection->errno != 0) {
     return false;
@@ -26,17 +26,14 @@ function get_header_of_table() {
 }
 
 function get_row_of_table($Record) {
-  global $language;
-  global $order;
-  global $od;
-  global $limit;
-  global $contrains_source;
-  global $contrains_lection;
+  $language = $Record['language'];
+  $contrains_source = $_REQUEST['contrains_source'];
+  $contrains_lection = $_REQUEST['contrains_lection'];
 
   $nav_str = "language=$language&contrains_source=$contrains_source&contrains_lection=$contrains_lection";
 
   //pr($Record);
-  
+  $navrat = "";
   $navrat .= "  <tr>\n";
   $navrat .= '    <td>
                 <a href="?nav_id=list_article&action=delete_article&article_id='.$Record[0].'&'.$nav_str.'">smaž</a>
@@ -98,7 +95,6 @@ function get_razeni($l_order = "IDarticle",
                     $contrains_lection = "all",
                     $nonauthorized = false) {
 
-  global $language;
 
   global $order;
   global $od;
@@ -108,6 +104,9 @@ function get_razeni($l_order = "IDarticle",
   $od    = $l_od;
   $limit = $l_limit;
 
+  $language = $_REQUEST['language'];
+  $contrains_source = $_REQUEST['contrains_source'];
+  $contrains_lection = $_REQUEST['contrains_lection'];
 
   $nav = ($nonauthorized)? "list_nonauthorized_article" : "list_article";
   $nav_str = "language=$language&contrains_source=$contrains_source&contrains_lection=$contrains_lection";
@@ -159,11 +158,11 @@ function get_razeni($l_order = "IDarticle",
 }
 
 function get_pocet_clanku($contrains_source, $contrains_lection, $nonauthorized) {
-  global $language;
-  require_once("./classes/db.php");
+  $language = $_REQUEST['language'];
+
   $spojeni = new DB_Sql();
   //$spojeni->debug = true;
-  $dotaz = "SELECT \"IDarticle\" FROM article";
+  $dotaz = "SELECT IDarticle FROM article";
    if ($nonauthorized == true) {
     $dotaz .= " WHERE autorized = false";
 	}
@@ -257,21 +256,21 @@ 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 * FROM article WHERE \"IDarticle\" = '$id'";
+  $dotaz = "SELECT * FROM article WHERE IDarticle = '$id'";
   $radky = $spojeni->query($dotaz);
   $spojeni->next_record();
 
   if ($spojeni->connection->errno != 0) {
-    print_hlasku("Clanek se nepodařilo načíst.");
+    print_hlasku("Članek se nepodařilo načíst.");
   }
 
-  return $spojeni->Record;
+  return $spojeni->row;
 }
 
 function delete_article($ID) {
   require_once("./classes/db.php");
   $spojeni = new DB_Sql();
-  $dotaz = "DELETE FROM article WHERE \"IDarticle\" = '$ID'";
+  $dotaz = "DELETE FROM article WHERE IDarticle = '$ID'";
   $spojeni->query($dotaz);
   if ($spojeni->connection->errno != 0) {
     return false;
@@ -287,7 +286,7 @@ function update_article($id, $title, $body, $note, $lection) {
                             body = '".AddSlashes($body)."',
                             note = '".AddSlashes($note)."',
                             lection = '".AddSlashes($lection)."'
-                            WHERE \"IDarticle\" = '".AddSlashes($id)."'";
+                            WHERE IDarticle = '".AddSlashes($id)."'";
   $spojeni->query($dotaz);
   if ($spojeni->connection->errno != 0) {
     print_hlasku("Slovo se nepodařilo upravit.");
@@ -303,14 +302,14 @@ function insert_article($language,$source,$lection,$title,$body,$note,$user){
   $spojeni = new DB_Sql();
   //$NOW = Date("YmdHis");
 
-  $dotaz = "INSERT INTO article (\"language\",
-                              \"source\",
-                              \"lection\",
-                              \"inserted_by\",
-                              \"title\",
-                              \"body\",
-                              \"note\",
-                              \"article_voice\")
+  $dotaz = "INSERT INTO article (language,
+                              source,
+                              lection,
+                              inserted_by,
+                              title,
+                              body,
+                              note,
+                              article_voice)
                     VALUES ('$language',
                             '$source',
                             '$lection',
@@ -320,7 +319,8 @@ function insert_article($language,$source,$lection,$title,$body,$note,$user){
                             '$note',
                             '0')";
   $spojeni->query($dotaz);
-  if ($spojeni->connection->errno != 0) {
+
+    if ($spojeni->connection->errno != 0) {
     return false;
   }
   return true;
diff --git a/old/html/multidic/app/webroot/administration/edit_article.php b/old/html/multidic/app/webroot/administration/edit_article.php
index 0d5e655..8d4afa1 100644
--- a/old/html/multidic/app/webroot/administration/edit_article.php
+++ b/old/html/multidic/app/webroot/administration/edit_article.php
@@ -1,14 +1,14 @@
 <?php 
 require_once("./administration/article.php");
 $vypis_edit = true;
-if (!Empty($action) && $action == "edit_article") {
+if (!Empty(@$_REQUEST['action']) && @$_REQUEST['action'] == "edit_article") {
   
 
-  if (Empty($lection)) {
+  if (Empty(@$_REQUEST['lection'])) {
     print_hlasku("Lekci musíte vyplnit");
   }
   else {
-    update_article($article_id, $title, $body, $note, $lection);
+    update_article(@$_REQUEST['article_id'], @$_REQUEST['title'], @$_REQUEST['body'], @$_REQUEST['note'], @$_REQUEST['lection']);
     
     echo_zpet_do_clanku();
     $vypis_edit = false;
@@ -18,11 +18,11 @@ if (!Empty($action) && $action == "edit_article") {
 }
 if($vypis_edit){
   
-  $Record = get_article($article_id);
-  $title         = $Record["title"];
-  $body          = $Record["body"];
-  $note          = $Record["note"];
-  $lection       = $Record["lection"]; 
+  $Record = get_article(@$_REQUEST['article_id']);
+  @$_REQUEST['title']         = $Record["title"];
+  @$_REQUEST['body']          = $Record["body"];
+  @$_REQUEST['note']          = $Record["note"];
+  @$_REQUEST['lection']       = $Record["lection"]; 
 
 ?>
 
@@ -53,42 +53,42 @@ if($vypis_edit){
       <table>
       <tr class="akt">
         <td>název</td>
-        <td<?php  if ($language == 1 || $language == 2) echo " dir=\"rtl\"" ?>>
-        <input type="text" <?php  if ($language == 1 || $language == 2) echo "class=\"arabic\"\n" ?>
+        <td<?php  if (@$_REQUEST['language'] == 1 || @$_REQUEST['language'] == 2) echo " dir=\"rtl\"" ?>>
+        <input type="text" <?php  if (@$_REQUEST['language'] == 1 || @$_REQUEST['language'] == 2) echo "class=\"arabic\"\n" ?>
                class= "arabic"
                name="title"  
                size="29"
-               value="<?php echo $title?>" 
+               value="<?php echo @$_REQUEST['title']?>" 
                onfocus="aktivujKlavesnici('edit_article_form.title')" /></td>
       </tr>
       <tr class="akt">
         <td>text</td>
-        <td<?php  if ($language == 1 || $language == 2) echo " dir=\"rtl\"" ?>>
-        <textarea <?php  if ($language == 1 || $language == 2) echo "class=\"arabic\"\n" ?>
+        <td<?php  if (@$_REQUEST['language'] == 1 || @$_REQUEST['language'] == 2) echo " dir=\"rtl\"" ?>>
+        <textarea <?php  if (@$_REQUEST['language'] == 1 || @$_REQUEST['language'] == 2) echo "class=\"arabic\"\n" ?>
         class= "arabic"
             name="body" 
             rows="7" 
             wrap="PHYSICAL" 
             cols="25"
             onfocus="aktivujKlavesnici('edit_article_form.body')"
-        ><?php  echo $body ?></textarea>       
+        ><?php  echo @$_REQUEST['body'] ?></textarea>       
                
                
                </td>
       </tr>
       <tr class="akt">
         <td>poznámka</td>
-        <td><input type="text" name="note"  size="50" value="<?php  echo $note ?>" /></td>
+        <td><input type="text" name="note"  size="50" value="<?php  echo @$_REQUEST['note'] ?>" /></td>
       </tr>
       <tr class="akt">
         <td>lekce*</td>
-        <td><input type="text" name="lection"  size="50" value="<?php  echo $lection ?>" /></td>
+        <td><input type="text" name="lection"  size="50" value="<?php  echo @$_REQUEST['lection'] ?>" /></td>
       </tr>
       <tr class="nadpis_sekce">
         <td>
-          <input type="hidden" name="article_id" value="<?php echo $article_id?>">
-          <input type="hidden" name="language" value="<?php echo $language?>">
-          <input type="hidden" name="source" value="<?php echo $source?>">
+          <input type="hidden" name="article_id" value="<?php echo @$_REQUEST['article_id']?>">
+          <input type="hidden" name="language" value="<?php echo @$_REQUEST['language']?>">
+          <input type="hidden" name="source" value="<?php echo @$_REQUEST['source']?>">
           <input type="hidden" name="action" value="edit_article">
         </td>
         <td><input type="submit" value="Uprav"></td>
diff --git a/old/html/multidic/app/webroot/administration/voice.php b/old/html/multidic/app/webroot/administration/voice.php
index c273176..0081d91 100644
--- a/old/html/multidic/app/webroot/administration/voice.php
+++ b/old/html/multidic/app/webroot/administration/voice.php
@@ -23,7 +23,7 @@ function save_article_voice($file,$id) {
   }
   require_once("./classes/db.php");
   $spojeni = new DB_Sql();
-  $dotaz = "UPDATE article SET article_voice = 1 WHERE \"IDarticle\" = $id ";
+  $dotaz = "UPDATE article SET article_voice = 1 WHERE IDarticle = $id ";
   $spojeni->query($dotaz);
   
   if ($spojeni->connection->errno != 0) return false;
diff --git a/old/html/multidic/app/webroot/functions/dictionary.php b/old/html/multidic/app/webroot/functions/dictionary.php
index 8c6ce25..b00e5e4 100644
--- a/old/html/multidic/app/webroot/functions/dictionary.php
+++ b/old/html/multidic/app/webroot/functions/dictionary.php
@@ -1009,15 +1009,13 @@ function povolPromennou($nazev)
 
 function echo_zpet_do_slovniku()
 {
-    global $language;
-    global $nonauthorized;
-    global $contrains_source;
-    global $contrains_lection;
-    global $contrains_user_id;
-
+    $language = $_REQUEST['language'];
+    $contrains_source = $_REQUEST['contrains_source'];
+    $contrains_lection = $_REQUEST['contrains_lection'];
+    $contrains_user_id = $_SESSION['ses_IDuser'];
     //echo $nonauthorized;
 
-    if ($nonauthorized) $pomocna = "list_nonauthorized_word";
+    if ($_REQUEST['nonauthorized']) $pomocna = "list_nonauthorized_word";
     else $pomocna = "list_word";
 
     echo "<br />
@@ -1028,10 +1026,9 @@ function echo_zpet_do_slovniku()
 
 function echo_zpet_do_clanku()
 {
-    global $language;
-    global $contrains_source;
-    global $contrains_lection;
-
+    $language = $_REQUEST['language'];
+    $contrains_source = $_REQUEST['contrains_source'];
+    $contrains_lection = $_REQUEST['contrains_lection'];
     echo "<br />
         <a href=\"?nav_id=list_article&language=$language&contrains_source=$contrains_source&contrains_lection=$contrains_lection\">
            Zpět na seznam článků
