Index: splash.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/splash/splash.module,v
retrieving revision 1.8
diff -u -r1.8 splash.module
--- splash.module	18 Mar 2008 12:47:14 -0000	1.8
+++ splash.module	7 Jul 2008 21:39:35 -0000
@@ -1,68 +1,94 @@
 <?php
 //$Id: splash.module,v 1.8 2008/03/18 12:47:14 fokke Exp $
 
-function splash_menu() {
+function splash_menu($may_cache) {
   $items = array();
-  
-  // Splash (for texts)
-  $items['splash'] = array(
-		'title'								=> t('Splash'),
-		'description'					=> t('Splash page before the actual frontpage.'),
-		'page callback'				=> 'splash_page',
-		'access arguments'		=> array('access content'),
-		'type'								=> MENU_CALLBACK,
-	);
-  
-  // Admin
-  $items['admin/settings/splash'] = array(
-		'title'								=> t('Splash'),
-		'description'					=> t('Show a splash page before/over the actual frontpage.'),
-		'page callback'				=> 'drupal_get_form',
-		'page arguments'			=> array('splash_admin_when'),
-		'access arguments'		=> array('administer site configuration'),
-		'file'								=> 'splash.admin.inc',
-	);
-  $items['admin/settings/splash/when'] = array(
-		'title'								=> t('When'),
-		'description'					=> t('Set WHEN the splash page is displayed.'),
-		'type'								=> MENU_DEFAULT_LOCAL_TASK,
-		'weight'							=> -10,
-	);
-  $items['admin/settings/splash/what'] = array(
-		'title'								=> t('What'),
-		'description'					=> t('Set WHAT is displayed as the splash page.'),
-		'page arguments'			=> array('splash_admin_what'),
-		'type'								=> MENU_LOCAL_TASK,
-	);
-  $items['admin/settings/splash/how'] = array(
-		'title'								=> t('How'),
-		'description'					=> t('Set HOW the splash page is displayed.'),
-		'page arguments'			=> array('splash_admin_how'),
-		'type'								=> MENU_LOCAL_TASK,
-	);
+
+  if ($may_cache) {
+    // Splash (for texts)
+    $items['splash'] = array(
+      'path'                => 'splash',
+  		'title'								=> t('Splash'),
+  		'description'					=> t('Splash page before the actual frontpage.'),
+  		'callback'				    => 'splash_page',
+  		'access'		          => user_access('access content'),
+  		'type'								=> MENU_CALLBACK,
+  	);
+
+    // Admin
+    $items[] = array(
+      'path'                => 'admin/settings/splash',
+  		'title'								=> t('Splash'),
+  		'description'					=> t('Show a splash page before/over the actual frontpage.'),
+  		'callback'				    => 'splash_menu_invoke_form',
+  		'callback arguments'	=> array('splash_admin_when'),
+  		'access'		          => user_access('administer site configuration'),
+  	);
+    $items[] = array(
+      'path'                => 'admin/settings/splash/when',
+  		'title'								=> t('When'),
+  		'description'					=> t('Set WHEN the splash page is displayed.'),
+  		'type'								=> MENU_DEFAULT_LOCAL_TASK,
+  		'weight'							=> -10,
+      'access'              => user_access('administer site configuration'),
+      'callback'            => 'splash_menu_invoke_form',
+      'callback arguments'  => array('splash_admin_when'),
+  	);
+    $items[] = array(
+      'path'                => 'admin/settings/splash/what',
+  		'title'								=> t('What'),
+  		'description'					=> t('Set WHAT is displayed as the splash page.'),
+  		'type'								=> MENU_LOCAL_TASK,
+      'access'              => user_access('administer site configuration'),
+      'callback'            => 'splash_menu_invoke_form',
+      'callback arguments'  => array('splash_admin_what'),
+  	);
+    $items[] = array(
+      'path'                => 'admin/settings/splash/how',
+  		'title'								=> t('How'),
+  		'description'					=> t('Set HOW the splash page is displayed.'),
+  		'type'								=> MENU_LOCAL_TASK,
+      'access'              => user_access('administer site configuration'),
+      'callback'            => 'splash_menu_invoke_form',
+      'callback arguments'  => array('splash_admin_how'),
+  	);
+  }
+  else {
+    // Drupal 5's menu system requires hook_init in hook_menu.
+    splash_menu_init();
+  }
 
   return $items;
 }
 
-function splash_init() {
+function splash_menu_invoke_form($form) {
+  require_once('splash.admin.inc');
+  return drupal_get_form($form);
+}
+
+/**
+ * Invoked during hook_menu's non-caching stage.
+ */
+function splash_menu_init() {
   global $base_url;
-  
+
   $splash			= TRUE;
-  $splash_when = variable_get('splash_when', array()); 
-  $splash_what = variable_get('splash_what', array());
+  $splash_what_content = variable_get('splash_what_content', '');
+  $splash_what_redirect = variable_get('splash_what_redirect', '');
+  $splash_when_frequency = variable_get('splash_when_frequency', '');
+  $splash_what_mode = variable_get('splash_what_mode', '');
   $cookie_name = $splash_when['cookie'] ? $splash_when['cookie'] : 'splash_cookie';
   $cookie_data = $_COOKIE[$cookie_name] ? (is_numeric($_COOKIE[$cookie_name]) ? array('time' => $_COOKIE[$cookie_name]) : (array) unserialize($_COOKIE[$cookie_name])) : array();
-  
+
   /*** THE WHEN ***/
-  
   // No WHAT
-  if (!$splash_what['content']) {
+  if (empty($splash_what_content)) {
 	  $splash = FALSE;
-	  
+
 	// Someone knew this special way to get around the splash :)
 	} elseif ($_GET['splash'] == 'off') {
 		$splash = FALSE;
-		
+
 	// Someone knew this special way to force splash display
 	} elseif ($_GET['splash'] == 'on') {
 		$splash = TRUE;
@@ -70,45 +96,40 @@
   // We are not on the front page (cannot use drupal_is_front_page here)
 	} elseif ($_GET['q'] != drupal_get_normal_path(variable_get('site_frontpage', 'node'))) {
   	$splash = FALSE;
-  	
+
   // We come from an internal page
   } elseif (($parsed_url = parse_url($base_url)) && stristr(referer_uri(), $parsed_url['host'])) {
   	$splash = FALSE;
-  
+
   // Front page is splash page?!
-  } elseif ($splash_what['redirect'] && $_GET['q'] == drupal_get_normal_path($splash_what['redirect'])) {
+  } elseif ($splash_what_redirect && $_GET['q'] == drupal_get_normal_path($splash_what_redirect)) {
   	$splash = FALSE;
-		
+
 	} else {
-		
-		// Conditions
-		if (module_exists('condition') && is_array($splash_when['conditions'])) {
-			$splash = condition_selection_validate($splash_when['conditions']);
-		}
-			
+
 		// Frequency
 		if ($splash) {
-			
+
 			// No cookie
 			if (!$cookie_data['time']) {
 				$splash = TRUE;
-				
+
 			} else {
-	  
+
 			  // Once
-			  if ($splash_when['frequency'] == 'once') {
+			  if ($splash_when_frequency == 'once') {
 			  	$splash = FALSE;
-			
+
 			  // Every day
-			  } else if ($cookie_data['time'] && $splash_when['frequency'] == 'daily' && (time() - $cookie_data['time'] < 86400)) {
+			  } else if ($cookie_data['time'] && $splash_when_frequency == 'daily' && (time() - $cookie_data['time'] < 86400)) {
 			  	$splash = FALSE;
-			  	
+
 			  // Every week
-			  } else if ($cookie_data['time'] && $splash_when['frequency'] == 'weekly' && (time() - $cookie_data['time'] < 604800)) {
+			  } else if ($cookie_data['time'] && $splash_when_frequency == 'weekly' && (time() - $cookie_data['time'] < 604800)) {
 			  	$splash = FALSE;
-			  	
+
 			  // Never
-			  } else if ($splash_when['frequency'] != 'always') {
+			  } else if ($splash_when_frequency != 'always') {
 				  $splash = FALSE;
 			  }
 		  }
@@ -119,77 +140,78 @@
   if ($splash) {
 
 	  /*** THE WHAT ***/
-	  
+
 	  // Text
-  	if ($splash_what['mode'] == 'template' || $splash_what['mode'] == 'fullscreen') {
+  	if ($splash_what_mode == 'template' || $splash_what_mode == 'fullscreen') {
 	  	$url = check_url('splash');
-	  	
+
 	  // Path or URL
   	} else {
-	  	$paths = preg_split('/[\n\r]+/', $splash_what['content']);
+	  	$paths = preg_split('/[\n\r]+/', $splash_what_content);
 
 	  	// Sequence
-	  	if ($splash_what['mode'] == 'sequence') {
+	  	if ($splash_what_mode == 'sequence') {
 		  	$last_path = $cookie_data['sequence'];
 		  	$last_index = array_search($last_path, $paths);
-		  	
+
 		  	if ($last_index !== FALSE && count($paths) > $last_index + 1) {
 			  	$next_index = $last_index + 1;
-			  	
+
 		  	} else {
 			  	$next_index = 0;
 		  	}
-		  	
+
 		  	$cookie_data['sequence'] = $paths[$next_index];
-		  	
+
 		  // Random
 	  	} else {
 		  	$next_index = array_rand($paths);
-	  	}	  	
-	  	
+	  	}
+
 	  	$url = check_url($paths[$next_index]);
   	}
-  	
+
   	$cookie_data['time'] = time();
   	setcookie($cookie_name, serialize($cookie_data), time() + 604800, '/');
-  	
+
   	/*** THE HOW ***/
-  	$splash_how = variable_get('splash_how', array());
-  	$size = $splash_how['size'] ? explode('x', $splash_how['size']) : FALSE;
-  	
+  	$splash_how_mode = variable_get('splash_how_mode', 'redirect');
+    $splash_how_size = variable_get('splash_how_size', '');
+  	$size = !empty($splash_how_size) ? explode('x', $splash_how_size) : FALSE;
+
 	  // Thickbox
-	  if ($splash_how['mode'] == 'thickbox') {
+	  if ($splash_how_mode == 'thickbox') {
 		  drupal_set_html_head(
 		  	"<link rel=\"stylesheet\" href=\"".base_path().drupal_get_path('module', 'splash')."/thickbox/thickbox.css\" type=\"text/css\" media=\"screen\" />\n".
 		  	"<style type=\"text/css\">.TB_overlayMacFFBGHack {background: url('".base_path().drupal_get_path('module', 'splash')."/thickbox/macFFBgHack.png') repeat;}</style>\n".
 		  	"<script type=\"text/javascript\">var tb_pathToImage = '".base_path().drupal_get_path('module', 'splash')."/thickbox/loadingAnimation.gif';</script>"
 		  );
 		  drupal_add_js(drupal_get_path('module', 'splash').'/thickbox/thickbox.js');
-		  
+
 		  $query = array();
 		  $url_parts = parse_url($url);
-		  
+
 		  // Open external URLs and templated texts in iFrame
-		  if ($url_parts['scheme'] || $splash_what['mode'] == 'template') {
+		  if ($url_parts['scheme'] || $splash_how_mode == 'template') {
 			  $query[] = 'TB_iframe=true';
 		  }
-		  
+
 		  // Set size
 		  if ($size) {
 			  $query[] = 'width='.$size[0].'&height='.$size[1];
 		  }
-		  
+
 			if (count($query)) {
-				$url = url($url, array('query' => implode('&', $query)));
+				$url = url($url, implode('&', $query));
 			}
-		  
-		  drupal_add_js('$(document).ready(function(){ tb_show("", "'.$url.'") });', 'inline');		  
-		  
+
+		  drupal_add_js('$(document).ready(function(){ tb_show("", "'.$url.'") });', 'inline');
+
 		// New window
-	  } else if ($splash_how['mode'] == 'window') {
+	  } else if ($splash_how_mode == 'window') {
 		  $size_str = $size ? ', "width='.$size[0].',height='.$size[1].'"' : '';
-		  drupal_add_js('window.onload = function() { window.open("'.$url.'", "splash"'.$size_str.'); }', 'inline'); 
-	  
+		  drupal_add_js('window.onload = function() { window.open("'.$url.'", "splash"'.$size_str.'); }', 'inline');
+
 	  // Redirect
   	} else {
 	  	drupal_goto($url);
@@ -197,8 +219,8 @@
   }
 }
 
-function splash_help($path, $arg) {
-  switch ($path) {
+function splash_help($section) {
+  switch ($section) {
     case 'admin/settings/splash':
       return '<p>'. t('Install the !condition module to add additional conditions for displaying the splash page. Please note that the splash page is never displayed in the following conditions: <ul><li>The requested page is not the front page.</li><li>The visitor returns to the frontpage from another page on the same site.</li><li>The splash page is the same as the front page.</li><li>The visitors added <code>?nosplash</code> to the URL.</li></ul>', array('!condition' => l(t('Condition'), 'http://drupal.org/project/condition'))).'</p>';
     case 'admin/settings/splash/what':
@@ -209,17 +231,17 @@
 }
 
 function splash_page() {
-	$splash_what = variable_get('splash_what', array());
-	
-	$output = check_markup($splash_what['content'], $splash_what['format']);
-	
-  if ($splash_what['mode'] == 'fullscreen') {
+  $splash_what_mode = variable_get('splash_what_mode', '');
+	$splash_what_content = variable_get('splash_what_content', '');
+	$splash_what_filter = variable_get('splash_what_filter', '');
+
+	$output = check_markup($splash_what_content, $splash_what_filter, FALSE);
+
+  if ($splash_what_mode == 'fullscreen') {
 	  echo $output;
 	  exit;
-	  
+
   } else {
 	  return $output;
   }
 }
-
-?>
\ No newline at end of file
Index: splash.install
===================================================================
RCS file: splash.install
diff -N splash.install
--- splash.install	17 Mar 2008 13:56:37 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,29 +0,0 @@
-<?php
-
-function splash_update_6200() {
-	$ret = array();
-	
-	// Old variables
-  $redirect		= variable_get('splash_redirect', NULL);
-  $cookie			= variable_get('splash_cookie', NULL);
-  $frequency	= variable_get('splash_frequency', NULL);
-  $code				= variable_get('splash_code', NULL);
-  
-  // New variables
-  variable_set('splash_when', array(
-  	'frequency' => (!is_string($frequency) || strlen($frequency) == 0) ? 'always' : $frequency,
-  	'cookie' => (!is_string($cookie) || strlen($frequency) == 0) ? 'splash_cookie' : $cookie,
-  ));
-  variable_set('splash_what', array(
-  	'content' => (!is_string($redirect) || strlen($redirect) == 0) ? '' : $redirect,
-  ));
-
-  // Code has been moved to Conditions module
-  if (is_string($code) && strlen($code) > 0) {
-	  drupal_set_message(t('Splash - Install the conditions module to trigger the display by the PHP code you had set: %code', array('%code' => $code)));
-  }
-	
-	return $ret;
-}
-
-?>
\ No newline at end of file
Index: splash.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/splash/splash.admin.inc,v
retrieving revision 1.2
diff -u -r1.2 splash.admin.inc
--- splash.admin.inc	18 Mar 2008 08:41:44 -0000	1.2
+++ splash.admin.inc	7 Jul 2008 21:39:35 -0000
@@ -1,83 +1,39 @@
 <?php
 
 function splash_admin_when() {
-	$splash_when = variable_get('splash_when', array());
-
-	$form['general'] = array(
+	$form['when'] = array(
 		'#type' => 'fieldset',
 		'#title' => t('Settings'),
-	);	
-  $form['general']['frequency'] = array(
-	  '#type' => 'select', 
-	  '#title' => t('Display with frequency'), 
-	  '#default_value' => $splash_when['frequency'],
+	);
+  $form['when']['splash_when_frequency'] = array(
+	  '#type' => 'select',
+	  '#title' => t('Display with frequency'),
+	  '#default_value' => variable_get('splash_when_frequency', ''),
 	  '#options' => array(
 	  	''				=> t('Never (off)'),
 		  'always'	=> t('Always'),
 		  'once'		=> t('Once'),
 		  'daily'		=> t('Daily'),
 		  'weekly'	=> t('Weekly'),
-		), 
+		),
 	  '#description' => t('How often should visitors see the splash page?'),
 	);
-	$form['general']['cookie'] = array(
+	$form['when']['splash_when_cookie'] = array(
 		'#type' => 'radios',
-		'#title' => t('Display on next visit'), 
-		'#description' => t('Reset the name of the cookie to force the display of the splash on next visit.'), 
+		'#title' => t('Display on next visit'),
+		'#description' => t('Reset the name of the cookie to force the display of the splash on next visit.'),
 		'#options' => array(
 			0 => t('No'),
 			1 => t('Yes'),
 		),
-		'#default_value' => 0,
+		'#default_value' => variable_get('splash_when_cookie', 0),
 	);
-	
-	if (module_exists('condition')) {
-		$form = array_merge($form, module_invoke('condition', 'selection_form', $splash_when['conditions']));
-	}
-	
-	$form = system_settings_form($form);
-	
-	unset($form['#submit']);
-	
-	return $form;
-}
 
-function splash_admin_when_submit($form, &$form_state) {
-	
-  if ($op == t('Reset to defaults')) {
-	  variable_del('splash_when');
-	  
-    drupal_set_message(t('The configuration options have been reset to their default values.'));
-  }
-  
-  else {
-	  $splash_when = variable_get('splash_when', array());
-		$splash_when['frequency'] = $form_state['values']['frequency'];
-		
-		if ($form_state['values']['cookie']) {
-			$splash_when['cookie'] = 'splash_cookie_'.time();
-		}
-		
-		if (module_exists('condition')) {
-			$splash_when['conditions'] = $form_state['values']['conditions'];
-		}
-		
-		variable_set('splash_when', $splash_when);
-		  
-    drupal_set_message(t('The configuration options have been saved.'));
-  }
-  
-  cache_clear_all();
-  drupal_rebuild_theme_registry();
+	return system_settings_form($form);
 }
 
 function splash_admin_what() {
-	$splash_what = variable_get('splash_what', array());
-
-	$form['splash_what'] = array(
-		'#tree' => TRUE,
-	);
-  $form['splash_what']['mode'] = array(
+  $form['splash_what']['splash_what_mode'] = array(
     '#type' => 'select',
     '#title' => t('Content mode'),
     '#options' => array(
@@ -86,67 +42,42 @@
     	'template' => t('Display entered text in the site template'),
     	'fullscreen' => t('Display entered text/HTML full screen'),
     ),
-    '#default_value' => $splash_what['mode'],
+    '#default_value' => variable_get('splash_what_mode', ''),
     '#description' => t('Determines how the content field below will be used.'),
   );
-  
-  $form['splash_what']['content'] = array(
+
+  $form['splash_what']['splash_what_content'] = array(
     '#type' => 'textarea',
     '#title' => t('Content'),
-    '#default_value' => $splash_what['content'],
+    '#default_value' => variable_get('splash_what_content', ''),
     '#description' => t('Text to show or paths/URLs (one on each line) to use.'),
   );
 
-  $form['splash_what']['filter'] = filter_form($splash_what['format']);
-  $form['splash_what']['format'] = array(
-  	'#type' => 'value',
-  	'#value' => $splash_what['format'],
-  );  
-	
-  $form['#submit'][] = 'splash_admin_what_submit';
-  
-  return system_settings_form($form);
-}
+  $form['splash_what']['splash_what_filter'] = filter_form(variable_get('splash_what_filter', ''), NULL, array('splash_what_filter'));
 
-function splash_admin_what_submit($form, &$form_state) {
-	$form_state['values']['splash_what']['format'] = $form_state['values']['format'];
+  return system_settings_form($form);
 }
 
 function splash_admin_how() {
-	$splash_how = variable_get('splash_how', array());
-	
 	$options = array(
-		'' => t('Redirect'),
+		'redirect' => t('Redirect'),
 		'window' => t('Open in new window'),
 		'thickbox' => t('Open in ThickBox'),
 	);
-	
-	$form['splash_how'] = array(
-		'#tree' => TRUE,
-	);
-  $form['splash_how']['mode'] = array(
+  $form['splash_how']['splash_how_mode'] = array(
     '#type' => 'radios',
     '#required' => TRUE,
     '#title' => t('Display mode'),
     '#options' => $options,
-    '#default_value' => $splash_how['mode'],
+    '#default_value' => variable_get('splash_how_mode', 'redirect'),
     '#description' => t('Redirect to the splash page, open it in a new window or in a fancy !thickbox.', array('!thickbox' => l(t('ThickBox'), 'http://jquery.com/demo/thickbox/'))),
   );
-  $form['splash_how']['size'] = array(
+  $form['splash_how']['splash_how_size'] = array(
     '#type' => 'textfield',
     '#title' => t('Window/Box size'),
-    '#default_value' => $splash_how['size'],
+    '#default_value' => variable_get('splash_how_size', '400x300'),
     '#description' => t('Size (<code>WIDTHxHEIGHT</code>, e.g. 400x300) of the window or ThickBox.'),
   );
-	
-	return system_settings_form($form);
-}
 
-function splash_admin_how_validate($form, &$form_state) {
-	
-	if (!empty($form_state['values']['splash_how']['size']) && !preg_match('/^[1-9][0-9]*x[1-9][0-9]*$/i', $form_state['values']['splash_how']['size'])) {
-		form_set_error('size', t('Invalid Window/Box size. Use <code>WIDTHxHEIGHT</code>, e.g. 400x300.'));
-	} 
+	return system_settings_form($form);
 }
-
-?>
\ No newline at end of file
Index: splash.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/splash/splash.info,v
retrieving revision 1.2
diff -u -r1.2 splash.info
--- splash.info	9 Feb 2008 17:11:43 -0000	1.2
+++ splash.info	7 Jul 2008 21:39:35 -0000
@@ -1,4 +1,3 @@
 ;$Id: splash.info,v 1.2 2008/02/09 17:11:43 fokke Exp $
 name = Splash
 description = Allows to show a splash page on first, daily or weekly visit.
-core = 6.x
\ No newline at end of file
Index: .project
===================================================================
RCS file: .project
diff -N .project
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ .project	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>Splash 5</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+	</buildSpec>
+	<natures>
+	</natures>
+</projectDescription>
