bug 894: A few cleanups and bug fixes.
authorMichael Tänzer <neo@nhng.de>
Sun, 23 Oct 2011 00:16:00 +0000 (02:16 +0200)
committerMichael Tänzer <neo@nhng.de>
Sun, 23 Oct 2011 00:16:00 +0000 (02:16 +0200)
- "A reminder notice has been sent." should be only shown once at the same
page
- "You are not an Assurer" was misleading, only somehow the other user was
not recorded in the session (e.g. URL manipulation/hotlinking)
- Reuse the data fetched moments ago instead of doing another SQL query
- Compare instead of assignment
- Make "Go Back" translatable

Signed-off-by: Michael Tänzer <neo@nhng.de>
pages/wot/5.php
www/wot.php

index 6c53d00..f717870 100644 (file)
 <? 
   if(array_key_exists('error',$_SESSION['_config']) && $_SESSION['_config']['error'] != "") 
   {
-    if(array_key_exists('reminderset',$_SESSION['_config']) && $_SESSION['_config']['remindersent'] == 1) 
-    {
-      ?><font color="orange" size="+1"><?
-    }
-    else 
-    { 
-      ?><font color="orange" size="+1"><?=_("ERROR")?>: <?
-    }
-    echo $_SESSION['_config']['error']."</font>";
-    unset($_SESSION['_config']['error']);
+    ?><font color="orange" size="+1">
+      <? echo _("ERROR").": ".$_SESSION['_config']['error'] ?>
+    </font>
+    <?unset($_SESSION['_config']['error']);
   } 
 ?>
 <? if(array_key_exists('noemailfound',$_SESSION['_config']) && $_SESSION['_config']['noemailfound'] == 1) { ?>
index b975e14..eef8b38 100644 (file)
@@ -112,7 +112,6 @@ function send_reminder()
        }
 
        $_SESSION['_config']['remindersent'] = 1;
-       $_SESSION['_config']['error'] = _("A reminder notice has been sent.");
 }
 
 
@@ -142,13 +141,13 @@ function send_reminder()
 
        if($oldid == 6 && intval($_SESSION['_config']['notarise']['id']) <= 0)
        {
-               show_page ("EnterEmail","","You are not an Assurer");
+               show_page ("EnterEmail","",_("Something went wrong. Please enter the email address again"));
                exit;
        }
        if($oldid == 5 && array_key_exists('reminder',$_POST) && $_POST['reminder'] != "")
        {
                send_reminder();
-               show_page ("EnterEmail","Reminder sent","");
+               show_page ("EnterEmail",_("A reminder notice has been sent."),"");
                exit;
        }
 
@@ -163,19 +162,14 @@ function send_reminder()
                        exit;
                } else 
                {
-                       $_SESSION['_config']['notarise'] = mysql_fetch_assoc($res);
                        $_SESSION['_config']['noemailfound'] = 0;
+                       $_SESSION['_config']['notarise'] = mysql_fetch_assoc($res);
+                       if ($_SESSION['_config']['notarise']['verified'] == 0)
+                       {
+                               show_page("EnterEmail","",_("User is not yet verified. Please try again in 24 hours!"));
+                               exit;
+                       }
                }
-
-               $query = "select `verified` from `users` where `id`='".$_SESSION['_config']['notarise']['id']."'";
-               $res = mysql_query($query);
-               $drow = mysql_fetch_assoc($res);
-               if ($drow['verified'] = 0)
-               {
-                       show_page("EnterEmail","",_("User is not yet verified. Please try again in 24 hours!"));
-                       exit;
-               }
-       
        }
 
        if($oldid == 5 || $oldid == 6)
@@ -252,7 +246,7 @@ $iecho= "c";
                if($newpoints < 0)
                        $newpoints = $awarded = 0;
                
-$query = "select sum(`points`) as `total` from `notary` where `to`='".$_SESSION['_config']['notarise']['id']."' group by `to`";
+               $query = "select sum(`points`) as `total` from `notary` where `to`='".$_SESSION['_config']['notarise']['id']."' group by `to`";
                $res = mysql_query($query);
                $drow = mysql_fetch_assoc($res);
 
@@ -454,7 +448,7 @@ $query = "select sum(`points`) as `total` from `notary` where `to`='".$_SESSION[
                        {
                                sendmail($user['email'], "[CAcert.org] ".$_REQUEST['subject'], $_REQUEST['message'],
                                        $_SESSION['profile']['email'], "", "", $_SESSION['profile']['fname']." ".$_SESSION['profile']['lname']);
-                               show_page("ContactAssurer",_("Your email has been sent to")." ".$user['fname'].".<br />[ <a href='javascript:history.go(-2)'>Go Back</a> ]","");
+                               show_page("ContactAssurer",_("Your email has been sent to")." ".$user['fname'].".<br />[ <a href='javascript:history.go(-2)'>"._("Go Back")."</a> ]","");
                                exit;
                        } else {
                                show_page(0,"",_("Sorry, I was unable to locate that user."));