bug 1112: Fix things popped up in review:
authorMichael Tänzer <neo@nhng.de>
Wed, 20 Feb 2013 14:52:30 +0000 (15:52 +0100)
committerMichael Tänzer <neo@nhng.de>
Wed, 20 Feb 2013 14:52:30 +0000 (15:52 +0100)
- whitespace/indentation
- require vs. include and possible issue with relative path
- wording
- intval($id)
- unnecessary change of language while the text is not sent through gettext
anyway
- do not use mysql_escape_string on email body
- make strings easier to translate

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

index 33c9259..c5377ac 100644 (file)
@@ -44,9 +44,9 @@
        function get_number_of_ttpassurances ($userid)
        {
                $res = query_init ("SELECT count(*) AS `list` FROM `notary`
        function get_number_of_ttpassurances ($userid)
        {
                $res = query_init ("SELECT count(*) AS `list` FROM `notary`
-                       WHERE (`method`='Trusted Third Parties' or `method`='TTP-Assisted') AND `from`='".intval($userid)."' ");
+                       WHERE (`method`='Trusted Third Parties' or `method`='TTP-Assisted') AND `from`='".intval($userid)."' ");
                $row = query_getnextrow($res);
                $row = query_getnextrow($res);
-                                                   
+
                return intval($row['list']);
        }
 
                return intval($row['list']);
        }
 
index 5167d96..befdfe4 100644 (file)
@@ -14,8 +14,8 @@
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-*/ 
-include_once("../includes/wot.inc.php");
+*/
+require_once(dirname(__FILE__).'/../../includes/wot.inc.php');
 ?>
 
 <h3><?=_("Trusted Third Parties")?></h3>
 ?>
 
 <h3><?=_("Trusted Third Parties")?></h3>
@@ -39,11 +39,11 @@ include_once("../includes/wot.inc.php");
 if ($_SESSION['profile']['points']<100){
        // test for TTP assurances
        if (get_number_of_ttpassurances(intval($_SESSION['profile']['id']))<2){?>
 if ($_SESSION['profile']['points']<100){
        // test for TTP assurances
        if (get_number_of_ttpassurances(intval($_SESSION['profile']['id']))<2){?>
-               <p><?=_("If you want to ask for TTP assurances fill out the missing data and send the request to support@cacert.org to start the process. CAcert will inform you then about the next steps.")?></p>
+               <p><?=_("If you want to ask for TTP assurances fill out the missing data and send the request to support@cacert.org to start the process. CAcert will then inform you about the next steps.")?></p>
                <form method="post" action="wot.php">
                <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
                        <tr>
                <form method="post" action="wot.php">
                <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
                        <tr>
-                               <td class="DataTD"><?=_("Country you want to visit the TTP")?></td>
+                               <td class="DataTD"><?=_("Country where you want to visit the TTP")?></td>
                                <td class="DataTD"><select size="1" name="country">
                                                <option>Australia</option>
                                                <option>Puerto Rico</option>
                                <td class="DataTD"><select size="1" name="country">
                                                <option>Australia</option>
                                                <option>Puerto Rico</option>
@@ -51,12 +51,12 @@ if ($_SESSION['profile']['points']<100){
                                        </select></td>
                        </tr>
                        <tr>
                                        </select></td>
                        </tr>
                        <tr>
-                               <td class="DataTD"><?=_("I want to take part in the TTP Topup Programme")?></td>
+                               <td class="DataTD"><?=_("I want to take part in the TTP Topup programme")?></td>
                                <td class="DataTD"><input type="checkbox" name="ttptopup" value="1"></td>
                        </tr>
                        <tr>
                                <td colspan="2" >
                                <td class="DataTD"><input type="checkbox" name="ttptopup" value="1"></td>
                        </tr>
                        <tr>
                                <td colspan="2" >
-                                       <input type="hidden" name="oldid" value="4">
+                                       <input type="hidden" name="oldid" value="<?=intval($id)?>">
                                        <input type="submit" name="ttp" value="<?=_("I need a TTP assurance")?>">
                                </td>
                        </tr>
                                        <input type="submit" name="ttp" value="<?=_("I need a TTP assurance")?>">
                                </td>
                        </tr>
@@ -65,14 +65,14 @@ if ($_SESSION['profile']['points']<100){
 <? //"
        } else {
        /* As soon as the TPP TOPUP Programme is established this routine should be used
 <? //"
        } else {
        /* As soon as the TPP TOPUP Programme is established this routine should be used
-       <p><?=_("As you got already 2 TTP assurances you only can take part in the TTP TOPUP programme.\n\n If you want to ask for the TTP TOPUP programme use the submit button to send the request to support@cacert.org to start the process. CAcert will inform you then about the next steps.")?></p>
+       <p><?=_("As you have already got 2 TTP assurances you can only take part in the TTP TOPUP programme. If you want to ask for the TTP TOPUP programme use the submit button to send the request to support@cacert.org to start the process. CAcert will then inform you about the next steps.")?></p>
                <form method="post" action="wot.php">
                <form method="post" action="wot.php">
-                       <input type="hidden" name="oldid" value="<?=$id?>">
+                       <input type="hidden" name="oldid" value="<?=intval($id)?>">
                        <input type="submit" name="ttptopup" value="<?=_("I need a TTP TOPUP")?>">
                        <input type="submit" name="ttptopup" value="<?=_("I need a TTP TOPUP")?>">
-        </form>
+               </form>
 */
 ?>
 */
 ?>
-       <p><?=_("We are working to develop the TTP TOPUP process to be able to fill the gap of the missing 30 assurance points to 100 assurance points. In the meanwhile you have to close this gap with face to face assurances with CAcert Assurers. Think not only travelling to populated countries, but as well to assurers visiting your country or area.")?></p>  
+       <p><?=_("We are working to develop the TTP TOPUP process to be able to fill the gap of the missing 30 assurance points to 100 assurance points. Meanwhile you have to close this gap with face to face assurances from CAcert Assurers. Think not only travelling to populated countries, but as well to assurers visiting your country or area.")?></p>  
 <?
        }
 } else {
 <?
        }
 } else {
index 2ffaf7b..36d25b9 100644 (file)
@@ -130,39 +130,35 @@ function send_reminder()
                
        if($oldid == 4)
        {
                
        if($oldid == 4)
        {
-          $my_translation = L10n::get_translation();
-                L10n::set_translation($_SESSION['_config']['notarise']['language']);    
-         if ($_POST['ttp']!='') {
-                //This mail does not need to be translated
-                $body = "Hi TTP adminstrators,\n\n";
-     $body .= "User ".$_SESSION['profile']['fname']." ". 
-        $_SESSION['profile']['lname']." with email address '".
-        $_SESSION['profile']['email']."' is requesting a TTP assurances for ".
-     mysql_escape_string(stripslashes($_POST['country'])).".\n\n";
-                if ($_POST['ttptopup']=='1') {
-                 $body .= "The user is requesting also the TTP TOPUP.\n\n";
-        }else{
-      $body .= "The user is NOT requesting the TTP TOPUP.\n\n";
-     }
-     $body .= "The user received ".(int)$_SESSION['profile']['points']." assurance points up today.\n\n";
-                $body .= "Please start the TTP assurance process.";
-          sendmail("support@cacert.org", "[CAcert.org] "._("TTP request."), $body, "support@cacert.org", "", "", "CAcert Website");
-
-     //This mail needs to be translated
-               L10n::set_translation($my_translation);
-
-               $body  =_("You are receiving this email because you asked for TTP assurance.")."\n\n";
-               if ($_POST['ttptopup']=='1') {
-                 $body .=_("You are requesting the TTP TOPUP.")."\n\n";
-        }else{
-      $body .=_("You are NOT requesting the TTP TOPUP.")."\n\n";
-     }
-               $body .= _("Best regards")."\n";
-               $body .= _("CAcert Support Team");
+               if ($_POST['ttp']!='') {
+                       //This mail does not need to be translated
+                       $body = "Hi TTP adminstrators,\n\n";
+                       $body .= "User ".$_SESSION['profile']['fname']." ".
+                       $_SESSION['profile']['lname']." with email address '".
+                       $_SESSION['profile']['email']."' is requesting a TTP assurances for ".
+                       mysql_escape_string(stripslashes($_POST['country'])).".\n\n";
+                       if ($_POST['ttptopup']=='1') {
+                               $body .= "The user is also requesting TTP TOPUP.\n\n";
+                       }else{
+                               $body .= "The user is NOT requesting TTP TOPUP.\n\n";
+                       }
+                       $body .= "The user received ".intval($_SESSION['profile']['points'])." assurance points up to today.\n\n";
+                       $body .= "Please start the TTP assurance process.";
+                       sendmail("support@cacert.org", "[CAcert.org] TTP request.", $body, "support@cacert.org", "", "", "CAcert Website");
+
+                       //This mail needs to be translated
+                       $body  =_("You are receiving this email because you asked for TTP assurance.")."\n\n";
+                       if ($_POST['ttptopup']=='1') {
+                               $body .=_("You are requesting TTP TOPUP.")."\n\n";
+                       }else{
+                               $body .=_("You are NOT requesting TTP TOPUP.")."\n\n";
+                       }
+                       $body .= _("Best regards")."\n";
+                       $body .= _("CAcert Support Team");
 
 
-               sendmail($_SESSION['profile']['email'], "[CAcert.org] "._("You requested TTP assurances"), $body, "support@cacert.org", "", "", "CAcert Support");
+                       sendmail($_SESSION['profile']['email'], "[CAcert.org] "._("You requested TTP assurances"), $body, "support@cacert.org", "", "", "CAcert Support");
 
 
-    }
+               }
 
        }
 
 
        }
 
@@ -372,12 +368,10 @@ $iecho= "c";
 
                if(($drow['total'] + $newpoints) >= 100 && $newpoints > 0)
                {
 
                if(($drow['total'] + $newpoints) >= 100 && $newpoints > 0)
                {
-//                     $body .= _("You now have over 100 points and can start assuring others.")."\n\n";
-                       $body .= _("You have at least 100 Assurance Points, if you want to become an assurer try the")." ";
-                       $body .= _("Assurer Challenge")." ( https://cats.cacert.org )\n\n";
-                       $body .= _("To make it easier for others in your area to find you, it's helpful to list yourself as an assurer (this is voluntary), as well as a physical location where you live or work the most. You can flag your account to be listed, and add a comment to the display by going to:")."\n\n";
+                       $body .= _("You have at least 100 Assurance Points, if you want to become an assurer try the Assurer Challenge")." ( https://cats.cacert.org )\n\n";
+                       $body .= _("To make it easier for others in your area to find you, it's helpful to list yourself as an assurer (this is voluntary), as well as a physical location where you live or work the most. You can flag your account to be listed, and add a comment to the display by going to:")."\n";
                        $body .= "https://www.cacert.org/wot.php?id=8\n\n";
                        $body .= "https://www.cacert.org/wot.php?id=8\n\n";
-                       $body .= _("You can list your location by going to:")."\n\n";
+                       $body .= _("You can list your location by going to:")."\n";
                        $body .= "https://www.cacert.org/wot.php?id=13\n\n";
                }
 
                        $body .= "https://www.cacert.org/wot.php?id=13\n\n";
                }