From 7e76d8b8e0457bb97ff5aa3ee8e6c9640f2f966f Mon Sep 17 00:00:00 2001
From: barrett <barrett@52745.no-reply.drupal.org>
Date: Sun, 25 Mar 2012 00:03:46 -0400
Subject: [PATCH] Modifications based on Code Review (coder module): Adding
 some calls to t() and filter_xss() and some minor style
 issues.

---
 protected_node.fork.inc        |    7 +++----
 protected_node.install         |    2 +-
 protected_node.module          |    8 ++++----
 protected_node.redirect.inc    |    4 ++--
 protected_node.settings.inc    |    6 +++---
 protected_node_rules.rules.inc |    3 ++-
 6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/protected_node.fork.inc b/protected_node.fork.inc
index a716c5a..809aa83 100644
--- a/protected_node.fork.inc
+++ b/protected_node.fork.inc
@@ -13,8 +13,7 @@
  *
  * @return The array of nids.
  */
-function protected_node_password_nids()
-{
+function protected_node_password_nids() {
   $nids = array();
   $nids_list = explode(',', $_GET['protected_pages']);
   foreach ($nids_list as $nid) {
@@ -104,7 +103,7 @@ function protected_node_enter_any_password() {
       $title = token_replace($title, 'node', $node);
       $title = token_replace($title, 'user', $user);
     }
-    drupal_set_title($title);
+    drupal_set_title(filter_xss($title));
   }
 
   // information appear between the title and the password form
@@ -177,7 +176,7 @@ function protected_node_enter_any_password() {
   }
   if ($cancel) {
     $form['protected_node_enterpassword']['cancel'] = array(
-      '#value' => l('Cancel', $cancel),
+      '#value' => l(t('Cancel'), $cancel),
     );
   }
 
diff --git a/protected_node.install b/protected_node.install
index af0691d..083c143 100644
--- a/protected_node.install
+++ b/protected_node.install
@@ -344,7 +344,7 @@ function protected_node_update_6003() {
   $ret = array();
 
   variable_del('protected_node_global_password_field');
-  drupal_set_message('Please, change your global Protected node password as it may have been compromised.', 'warning');
+  drupal_set_message(t('Please, change your global Protected node password as it may have been compromised.'), 'warning');
 
   return $ret;
 }
diff --git a/protected_node.module b/protected_node.module
index ddfec7d..acd8626 100644
--- a/protected_node.module
+++ b/protected_node.module
@@ -131,7 +131,7 @@ function protected_node_access_callback() {
         return FALSE;
       }
     }
-    else if(substr($_GET['destination'], -7) == '/delete') {
+    elseif (substr($_GET['destination'], -7) == '/delete') {
       if (!node_access('delete', $node)) {
         return FALSE;
       }
@@ -431,7 +431,7 @@ function protected_node_nodeapi(&$node, $op, $arg = 0, $page = 0) {
             // automatically generate a password for the email (note that means the author won't know the password!)
             $_protected_node_random_passwd = user_password();
             $missing_password = FALSE; // not missing anymore
-            drupal_set_message('A random password was generated in order to send the email about this page. Remember that changing the password will prevent users you just emailed from accessing this page.', 'warning');
+            drupal_set_message(t('A random password was generated in order to send the email about this page. Remember that changing the password will prevent users you just emailed from accessing this page.'), 'warning');
           }
         }
         else {
@@ -650,7 +650,7 @@ function protected_node_save(&$node) {
       // this happens when the global password is to be used
       $node->protected_node_passwd = '';
     }
-    elseif($node->protected_node_passwd) {
+    elseif ($node->protected_node_passwd) {
       $node->protected_node_clear_passwd = $node->protected_node_passwd;
       $node->protected_node_passwd = sha1($node->protected_node_passwd);
     }
@@ -967,7 +967,7 @@ function protected_node_isset_protected($nid) {
  *
  * @param[in] $nid  The node to lock.
  *
- * @return TRUE if the node gets unlocked. 
+ * @return TRUE if the node gets unlocked.
  */
 function protected_node_lock($nid) {
   if (is_numeric($nid) && isset($_SESSION['_protected_node']['passwords'][$nid])) {
diff --git a/protected_node.redirect.inc b/protected_node.redirect.inc
index e29b566..31fda84 100644
--- a/protected_node.redirect.inc
+++ b/protected_node.redirect.inc
@@ -58,7 +58,7 @@ function protected_node_enterpassword() {
       $title = token_replace($title, 'node', $node);
       $title = token_replace($title, 'user', $user);
     }
-    drupal_set_title($title);
+    drupal_set_title(filter_xss($title));
   }
 
   // information appear between the title and the password form
@@ -131,7 +131,7 @@ function protected_node_enterpassword() {
   }
   if ($cancel) {
     $form['protected_node_enterpassword']['cancel'] = array(
-      '#value' => l('Cancel', $cancel),
+      '#value' => l(t('Cancel'), $cancel),
     );
   }
 
diff --git a/protected_node.settings.inc b/protected_node.settings.inc
index dbb5869..c7653ee 100644
--- a/protected_node.settings.inc
+++ b/protected_node.settings.inc
@@ -585,7 +585,7 @@ function _protected_node_admin_settings_submit($form, &$form_state) {
  */
 function protected_node_action_clear_sessions($form, &$form_state) {
   variable_set('protected_node_session_timelimit', time());
-  drupal_set_message('All the Protected Node sessions were cleared.');
+  drupal_set_message(t('All the Protected Node sessions were cleared.'));
 }
 
 /**
@@ -600,7 +600,7 @@ function protected_node_action_reset_passwords($form, &$form_state) {
     $sql = "UPDATE {protected_nodes} SET protected_node_passwd = '%s'";
     db_query($sql, sha1($passwd));
     variable_set('protected_node_session_timelimit', time());
-    drupal_set_message('All protected nodes are now publicly visible unless protected by another module.');
+    drupal_set_message(t('All protected nodes are now publicly visible unless protected by another module.'));
   }
   else {
     form_error($form['protected_node_actions']['protected_node_reset_passwords']['protected_node_reset_passwords_password'],
@@ -659,7 +659,7 @@ function protected_node_action_protect_all_nodes($form, &$form_state) {
 function protected_node_action_protect_nodes_with_password($form, &$form_state) {
   $sql = "UPDATE {protected_nodes} SET protected_node_is_protected = 1 WHERE protected_node_is_protected = 0 AND protected_node_passwd <> ''";
   db_query($sql);
-  drupal_set_message('All nodes with an existing password (excluding the global password) are now protected.');
+  drupal_set_message(t('All nodes with an existing password (excluding the global password) are now protected.'));
 }
 
 /**
diff --git a/protected_node_rules.rules.inc b/protected_node_rules.rules.inc
index 2e117b8..50e47f3 100644
--- a/protected_node_rules.rules.inc
+++ b/protected_node_rules.rules.inc
@@ -1,6 +1,7 @@
 <?php
 /**
- * @file Rules integration for the protected_node module.
+ * @file
+ * Rules integration for the protected_node module.
  */
 
 /**
-- 
1.7.4.4

