Browse code

Warnings und Success-Meldungen in der Session speichern

git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1802 87cf0b9e-d624-0410-a070-f6ee81989793

bernd authored on06/09/2010 04:31:16
Showing1 changed files
... ...
@@ -25,27 +25,24 @@ function input_error($reason)
25 25
 
26 26
 function warning($msg)
27 27
 {
28
-  global $warning;
29
-  if (!isset($warning))
30
-    $warning = array();
31
-  array_push($warning, $msg);
28
+  if (!isset($_SESSION['warning']))
29
+    $_SESSION['warning'] = array();
30
+  array_push($_SESSION['warning'], $msg);
32 31
 }
33 32
 
34 33
 function success_msg($msg)
35 34
 {
36
-  global $success_msg;
37
-  if (!isset($success_msg))
38
-    $success_msg = array();
39
-  array_push($success_msg, $msg);
35
+  if (!isset($_SESSION['success_msg']))
36
+    $_SESSION['success_msg'] = array();
37
+  array_push($_SESSION['success_msg'], $msg);
40 38
 }
41 39
 
42 40
 
43 41
 function we_have_an_error()
44 42
 {
45 43
   global $input_error;
46
-  global $warning;
47 44
 
48
-  return ((count($input_error) + count($warning)) > 0);
45
+  return ((count($input_error) + count($_SESSION['warning'])) > 0);
49 46
 
50 47
 }
51 48
 
... ...
@@ -53,8 +50,6 @@ function we_have_an_error()
53 50
 function show_messages()
54 51
 {
55 52
   global $input_error;
56
-  global $success_msg;
57
-  global $warning;
58 53
   if (isset($input_error))
59 54
   {
60 55
     echo '<div class="error">
... ...
@@ -69,29 +64,31 @@ function show_messages()
69 64
     echo '</ul>
70 65
     </div>';
71 66
   }
72
-  if (isset($warning))
67
+  if (isset($_SESSION['warning']))
73 68
   {
74 69
     echo '<div class="error">
75 70
     <ul>
76 71
     ';
77
-    foreach ($warning as $msg)
72
+    foreach ($_SESSION['warning'] as $msg)
78 73
     {
79 74
       echo '<li>'.nl2br(filter_input_general($msg))."</li>\n";
80 75
     }
81 76
     echo '</ul>
82 77
     </div>';
78
+    unset($_SESSION['warning']);
83 79
   }
84
-  if (isset($success_msg))
80
+  if (isset($_SESSION['success_msg']))
85 81
   {
86 82
     echo '<div class="success">
87 83
     <ul>
88 84
     ';
89
-    foreach ($success_msg as $msg)
85
+    foreach ($_SESSION['success_msg'] as $msg)
90 86
     {
91 87
       echo '<li>'.nl2br(filter_input_general($msg))."</li>\n";
92 88
     }
93 89
     echo '</ul>
94 90
     </div>';
91
+    unset($_SESSION['success_msg']);
95 92
   }
96 93
 }
97 94