Index: front_page.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/front/front_page.info,v
retrieving revision 1.13
diff -u -r1.13 front_page.info
--- front_page.info	26 Mar 2008 05:20:48 -0000	1.13
+++ front_page.info	25 Jan 2011 21:08:35 -0000
@@ -2,12 +2,8 @@
 name = Front Page
 description = Allows site admins setup custom front pages for the site.
 package = Administration
-
-; Information added by drupal.org packaging script on 2007-01-20
-project = "front"
-
-core = 6.x
-
-; Information added by drupal.org packaging script on 2008-04-29
-version = "6.x-1.2"
-core = "6.x"
+core = 7.x
+files[] = front_page.module
+
+version = "7.x-1.x-dev"
+core = "7.x"
Index: front_page.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/front/front_page.module,v
retrieving revision 1.75.2.6
diff -u -r1.75.2.6 front_page.module
--- front_page.module	29 Apr 2008 08:34:08 -0000	1.75.2.6
+++ front_page.module	25 Jan 2011 21:08:35 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: front_page.module,v 1.75.2.6 2008/04/29 08:34:08 augustin Exp $
+// $Id$
 /**
  *
  * This module allows the site admin to set advanced front page settings.
@@ -14,30 +14,30 @@
  */
 
 /**
- * Implementation of hook_help().
+ * Implements hook_help().
  */
 function front_page_help($section) {
   switch ($section) {
-    case 'admin/settings/front':
+    case 'admin/config/front':
       $roles = user_roles();
       $special_note = '';
       if (count($roles) >= 3) {
         krsort($roles);
-        $special_note = '<fieldset>'. t('<legend>front page by role usage</legend><p><strong>Note:</strong>When using the front pages by role option, please note that if a user has multiple roles the first role match will determine which front page they see. Here is the order that the roles will be checked (from left to right).</p>') .'<p>';
+        $special_note = '<fieldset>' . t('<legend>front page by role usage</legend><p><strong>Note:</strong>When using the front pages by role option, please note that if a user has multiple roles the first role match will determine which front page they see. Here is the order that the roles will be checked (from left to right).</p>') . '<p>';
         foreach ($roles as $role_id => $role_name) {
           $special_note .= "<strong>$role_id</strong> $role_name |  ";
         }
-        $special_note .= '</p>'. t('<p>The default setting for new roles is SAME AS AUTHENTICATED USERS.</p>') .'</fieldset>';
+        $special_note .= '</p>' . t('<p>The default setting for new roles is SAME AS AUTHENTICATED USERS.</p>') . '</fieldset>';
       }
-      return  t('<p>Setup custom front pages for your site. Click on the option to expand the form and customise your settings.</p><p><em>Anonymous User</em> = visitor not logged in  | <em>Authenticated User</em> = visitor who is logged in</p>') . $special_note;
+      return t('<p>Setup custom front pages for your site. Click on the option to expand the form and customise your settings.</p><p><em>Anonymous User</em> = visitor not logged in  | <em>Authenticated User</em> = visitor who is logged in</p>') . $special_note;
   }
 }
 
 /**
- * Implementation of hook_menu.
+ * Implements hook_menu().
  */
 function front_page_menu() {
-  $items['admin/settings/front'] = array(
+  $items['admin/config/front'] = array(
     'title' => 'Advanced front page settings',
     'description' => 'Specify a unique layout or splash page based on role type - override your HOME and breadcrumb links - display a custom mission style notice for users who haven\'t visited in a while - disable site and display a \'temporarily offline\' message.',
     'page callback' => 'drupal_get_form',
@@ -52,17 +52,22 @@
 }
 
 /**
- * Implementation of hook_perm.
+ * Implements hook_permission().
  */
-function front_page_perm() {
-  return array('access frontpage');
+function front_page_permission() {
+  return array(
+    'access frontpage' => array(
+      'title' => t('access frontpage'),
+      'description' => t('TODO Add a description for \'access frontpage\''),
+    ),
+  );
 }
 
 /**
  * This function sets up the admin/build/front_page settings page.
  *
  */
-function front_page_admin() {
+function front_page_admin($form, &$form_state) {
   // Load any existing settings and build the by redirect by role form
   $form['byrole'] = array(
     '#type' => 'fieldset',
@@ -85,13 +90,13 @@
       '#title' => t('Front Page for !rolename.', array('!rolename' => $rolename)),
     );
 
-    $form[$role]['front_'. $role .'_text'] = array(
+    $form[$role]['front_' . $role . '_text'] = array(
       '#type' => 'textarea',
       '#title' => t('Body'),
-      '#default_value' => variable_get('front_'. $role .'_text', ''),
+      '#default_value' => variable_get('front_' . $role . '_text', ''),
       '#cols' => 60,
       '#rows' => 20,
-      '#description' => t('Paste your HTML or TEXT here.') .'<br /><br />'. t('You can paste in the full HTML code for a complete page and include a different style sheet in the HEAD of the document if you want a completely different layout and style to the rest of your site.'),
+      '#description' => t('Paste your HTML or TEXT here.') . '<br /><br />' . t('You can paste in the full HTML code for a complete page and include a different style sheet in the HEAD of the document if you want a completely different layout and style to the rest of your site.'),
     );
 
     // Set the type options common for all roles.
@@ -102,12 +107,12 @@
     );
 
     // Set the description common for all roles.
-    $description = '<dl><dt>'. t('themed') .'</dt>
-      <dd>'. t('means your default layout, theme and stylesheet will be loaded with your custom front_page.') .'</dd></dl>';
-    $description .= '<dl><dt>'. t('full') .'</dt>
-      <dd>'. t('allows you to have a completely different layout, style sheet etc.') .'</dd></dl>';
-    $description .= '<dl><dt>'. t('redirect') .'</dt>
-      <dd>'. t('will automatically redirect visitors already logged in to a specific page specified in the REDIRECT TO box.') .'</dd></dl>';
+    $description = '<dl><dt>' . t('themed') . '</dt>
+      <dd>' . t('means your default layout, theme and stylesheet will be loaded with your custom front_page.') . '</dd></dl>';
+    $description .= '<dl><dt>' . t('full') . '</dt>
+      <dd>' . t('allows you to have a completely different layout, style sheet etc.') . '</dd></dl>';
+    $description .= '<dl><dt>' . t('redirect') . '</dt>
+      <dd>' . t('will automatically redirect visitors already logged in to a specific page specified in the REDIRECT TO box.') . '</dd></dl>';
 
     // Set the options that varies from role to role.
     switch ($role) {
@@ -117,41 +122,41 @@
       case 2: // Authenticated user
         $default_value =  variable_get('front_2_type', 'same_as_anon');
         $options['same_as_anon'] = t('same as anonymous users');
-        $description .= '<dl><dt>'. t('same as anonymous users') .'</dt>
-          <dd>'. t('will display the same content as for Anonymous users.') .'</dd></dl>';
+        $description .= '<dl><dt>' . t('same as anonymous users') . '</dt>
+          <dd>' . t('will display the same content as for Anonymous users.') . '</dd></dl>';
         break;
       default: // Other roles
-        $default_value =  variable_get('front_'. $role .'_type', 'same_as_anon');
+        $default_value =  variable_get('front_' . $role . '_type', 'same_as_anon');
         $options['same_as_anon'] = t('same as anonymous users');
         $options['sameasauth'] = t('same as authenticated users');
-        $description .= '<dl><dt>'. t('same as anonymous users') .'</dt>
-          <dd>'. t('will display the same content as for Anonymous users.') .'</dd></dl>';
-        $description .= '<dl><dt>'. t('same as authenticated users') .'</dt>
-          <dd>'. t('will display the same content as for Authenticated (logged in) users.') .'</dd></dl>';
+        $description .= '<dl><dt>' . t('same as anonymous users') . '</dt>
+          <dd>' . t('will display the same content as for Anonymous users.') . '</dd></dl>';
+        $description .= '<dl><dt>' . t('same as authenticated users') . '</dt>
+          <dd>' . t('will display the same content as for Authenticated (logged in) users.') . '</dd></dl>';
         break;
     }
 
-    $form[$role]['front_'. $role .'_type'] = array(
+    $form[$role]['front_' . $role . '_type'] = array(
       '#type' => 'select',
       '#title' => t('Select type'),
       '#default_value' => $default_value,
       '#options' => $options,
-      '#description' => '<p>'. $description .'</p>',
+      '#description' => '<p>' . $description . '</p>',
     );
 
-    $form[$role]['front_'. $role .'_redirect'] = array(
+    $form[$role]['front_' . $role . '_redirect'] = array(
       '#type' => 'textfield',
       '#title' => t('Redirect to'),
-      '#default_value' => variable_get('front_'. $role .'_redirect', 'node'),
+      '#default_value' => variable_get('front_' . $role . '_redirect', 'node'),
       '#cols' => 20,
       '#rows' => 1,
       '#description' => t('If you have selected <strong>REDIRECT</strong> you need to specify where the user should be pointed to.  If you are not using clean URLs, specify the part after "?q=".  If unsure, specify "node".'),
     );
 
-    $form[$role]['front_'. $role .'_php'] = array(
+    $form[$role]['front_' . $role . '_php'] = array(
       '#type' => 'checkbox',
       '#title' => t('Allow embedded PHP code in this front page'),
-      '#return_value' => 1, '#default_value' => variable_get('front_'. $role .'_php', 0),
+      '#return_value' => 1, '#default_value' => variable_get('front_' . $role . '_php', 0),
       '#description' => t('If this option is enabled, the body text can have embedded &lt;?php...?&gt; tags with PHP code inside. Click on the special Handbook pages for tips on <a href="http://drupal.org/node/23220">Using PHP snippets in your front_page</a>.'),
     );
   }
@@ -190,8 +195,8 @@
     '#title' => t('Been away for'),
     '#default_value' => variable_get('special_notice_time', ''),
     '#options' => array(
-      'one day'      => t('one day') ,
-      'one week'     => t('one week') ,
+      'one day'      => t('one day'),
+      'one week'     => t('one week'),
       'one month'    => t('one month'),
       'three months' => t('three months'),
       'six months'   => t('six months'),
@@ -265,23 +270,23 @@
 
   // Set the time to check against the last access of the user by the variable set in settings.
   switch (variable_get('front_special_notice_time', '')) {
-    case 'one day' :
-      $check_time = (time() -  (24 * 60 * 60));
+    case 'one day':
+      $check_time = (REQUEST_TIME -  (24 * 60 * 60));
       break;
-    case 'one week' :
-      $check_time = (time() -  (7 * 24 * 60 * 60));
+    case 'one week':
+      $check_time = (REQUEST_TIME -  (7 * 24 * 60 * 60));
       break;
-    case 'one month' :
-      $check_time = (time() -  (30 * 24 * 60 * 60));
+    case 'one month':
+      $check_time = (REQUEST_TIME -  (30 * 24 * 60 * 60));
       break;
-    case 'three months' :
-      $check_time = (time() -  (90 * 24 * 60 * 60));
+    case 'three months':
+      $check_time = (REQUEST_TIME -  (90 * 24 * 60 * 60));
       break;
-    case 'six months' :
-      $check_time = (time() -  (180 * 24 * 60 * 60));
+    case 'six months':
+      $check_time = (REQUEST_TIME -  (180 * 24 * 60 * 60));
       break;
-    case 'one year' :
-      $check_time = (time() -  (360 * 24 * 60 * 60));
+    case 'one year':
+      $check_time = (REQUEST_TIME -  (360 * 24 * 60 * 60));
       break;
   }
 
@@ -291,10 +296,11 @@
     $newhome =  variable_get('front_page_breadcrumb_redirect', 'node');
     $ref = $_SERVER['HTTP_REFERER'];
     global $user, $base_url;
-    $parsed_url=parse_url($base_url);
+    $parsed_url = parse_url($base_url);
     $domain = $parsed_url['host'];
     if (stristr($ref, $domain)) {
-      drupal_goto($path = $newhome, $query = null, $fragment = null);
+      // TODO $query = null needs to be an array of keys and values instead of a string.
+      drupal_goto($path = $newhome, array('query' => $query = null, 'fragment' => $fragment = null));
     }
   }
 
@@ -307,12 +313,16 @@
 
     // If PHP code execution is allowed then use eval.
     if (variable_get('front_1_php', 0)) {
-      $output = drupal_eval($output);
+      if (module_exists('php')) {
+        $output = php_eval($output);
+
+      }
     }
     $fptype = variable_get('front_1_type', 'drupal');
     switch ($fptype) {
       case 'themed':
-        print theme('page', $output);
+        // TODO Please change this theme call as discussed at http://drupal.org/node/224333#theme_page.
+        // print theme('page', $output);
         return;
 
       case 'full':
@@ -321,8 +331,9 @@
 
       case 'redirect':
         $output = variable_get('front_1_redirect', 'drupal');
-        drupal_goto($path = $output, $query = null, $fragment = null);
-      break;
+        // TODO $query = null needs to be an array of keys and values instead of a string.
+        drupal_goto($path = $output, array('query' => $query = null, 'fragment' => $fragment = null));
+        break;
     }
   }
 
@@ -341,19 +352,23 @@
           $output = '<div id="mission">';
           $output .= variable_get('special_notice_text', '');
           $output .= '</div>';
-          $output .= variable_get('front_'. $role_id .'_text', '');
+          $output .= variable_get('front_' . $role_id . '_text', '');
         }
         else {
-          $output = variable_get('front_'. $role_id .'_text', '');
+          $output = variable_get('front_' . $role_id . '_text', '');
         }
         // if PHP code execution is allowed then use eval
-        if (variable_get('front_'. $role_id .'_php', 0)) {
-          $output = drupal_eval($output);
+        if (variable_get('front_' . $role_id . '_php', 0)) {
+          if (module_exists('php')) {
+            $output = php_eval($output);
+
+          }
         }
-        $fptype = variable_get('front_'. $role_id .'_type', 'drupal'); //check whether it is a themed or full front page.
+        $fptype = variable_get('front_' . $role_id . '_type', 'drupal'); //check whether it is a themed or full front page.
         switch ($fptype) {
           case 'themed':
-            print theme('page', $output);
+            // TODO Please change this theme call as discussed at http://drupal.org/node/224333#theme_page.
+            // print theme('page', $output);
             return;
 
           case 'full':
@@ -364,12 +379,16 @@
             $output = variable_get('front_1_text', 'drupal');
             // If PHP code execution is allowed then use eval.
             if (variable_get('front_1_php', 0)) {
-              $output = drupal_eval($output);
+              if (module_exists('php')) {
+                $output = php_eval($output);
+
+              }
             }
             $fptype = variable_get('front_1_type', 'drupal');
             switch ($fptype) {
               case 'themed':
-                print theme('page', $output);
+                // TODO Please change this theme call as discussed at http://drupal.org/node/224333#theme_page.
+                // print theme('page', $output);
                 return;
 
               case 'full':
@@ -378,20 +397,25 @@
 
               case 'redirect':
                 $output = variable_get('front_1_redirect', 'drupal');
-                drupal_goto($path = $output, $query = null, $fragment = null);
-              break;
+                // TODO $query = null needs to be an array of keys and values instead of a string.
+                drupal_goto($path = $output, array('query' => $query = null, 'fragment' => $fragment = null));
+                break;
             }
 
           case 'sameasauth':
             $output = variable_get('front_2_text', 'drupal');
             // If PHP code execution is allowed then use eval.
             if (variable_get('front_2_php', 0)) {
-              $output = drupal_eval($output);
+              if (module_exists('php')) {
+                $output = php_eval($output);
+
+              }
             }
             $fptype = variable_get('front_2_type', 'drupal');
             switch ($fptype) {
               case 'themed':
-                print theme('page', $output);
+                // TODO Please change this theme call as discussed at http://drupal.org/node/224333#theme_page.
+                // print theme('page', $output);
                 return;
 
               case 'full':
@@ -400,13 +424,15 @@
 
               case 'redirect':
                 $output = variable_get('front_2_redirect', 'drupal');
-                drupal_goto($path = $output, $query = null, $fragment = null);
+                // TODO $query = null needs to be an array of keys and values instead of a string.
+                drupal_goto($path = $output, array('query' => $query = null, 'fragment' => $fragment = null));
                 break;
             }
 
           case 'redirect':
-            $output = variable_get('front_'. $role_id .'_redirect', 'drupal');
-            drupal_goto($path = $output, $query = null, $fragment = null);
+            $output = variable_get('front_' . $role_id . '_redirect', 'drupal');
+            // TODO $query = null needs to be an array of keys and values instead of a string.
+            drupal_goto($path = $output, array('query' => $query = null, 'fragment' => $fragment = null));
             break;
 
         }

