Sophie

Sophie

distrib > Fedora > 16 > x86_64 > media > updates-src > by-pkgid > ee2927ff48c715dc775218a2cc113594 > files > 21

WebCalendar-1.2.4-3.fc16.src.rpm

diff -Naur WebCalendar-1.2.4.orig/includes/classes/WebCalendar.class WebCalendar-1.2.4.new/includes/classes/WebCalendar.class
--- WebCalendar-1.2.4.orig/includes/classes/WebCalendar.class	2011-09-30 17:09:31.835185072 +0200
+++ WebCalendar-1.2.4.new/includes/classes/WebCalendar.class	2011-09-30 17:11:16.210456941 +0200
@@ -152,7 +152,7 @@
     load_global_settings ();
 
     $this->setLanguage ();
-    $user = getValue ( 'user', '[A-Za-z0-9_\.=@,\-]*', true );
+    $user = user_case(getValue ( 'user', '[A-Za-z0-9_\.=@,\-]*', true ));
 
     if ( empty ( $ovrd ) )
       load_user_preferences ();
@@ -572,6 +572,9 @@
         }
       }
     }
+
+    //     If login is not case-sensitive, map it to lowercase now.
+    $login = user_case($login);
   }
 
   /* Initializations from includes/connect.php.
diff -Naur WebCalendar-1.2.4.orig/includes/config.php WebCalendar-1.2.4.new/includes/config.php
--- WebCalendar-1.2.4.orig/includes/config.php	2011-08-09 05:27:56.000000000 +0200
+++ WebCalendar-1.2.4.new/includes/config.php	2011-09-30 17:11:16.210456941 +0200
@@ -104,9 +104,10 @@
 
 function do_config ( $fileLoc ) {
   global $db_database, $db_host, $db_login, $db_password, $db_persistent,
-  $db_type, $NONUSER_PREFIX, $phpdbiVerbose, $PROGRAM_DATE, $PROGRAM_NAME,
-  $PROGRAM_URL, $PROGRAM_VERSION, $readonly, $run_mode, $settings, $single_user,
-  $single_user_login, $TROUBLE_URL, $use_http_auth, $user_inc;
+  $db_type, $ignore_user_case, $NONUSER_PREFIX, $phpdbiVerbose, $PROGRAM_DATE,
+  $PROGRAM_NAME, $PROGRAM_URL, $PROGRAM_VERSION, $readonly, $run_mode,
+  $settings, $single_user, $single_user_login, $TROUBLE_URL, $use_http_auth,
+  $user_inc;
 
   $PROGRAM_VERSION = 'v1.2.4';
   $PROGRAM_DATE = '08 Aug 2011';
@@ -232,6 +233,11 @@
   $use_http_auth = ( preg_match ( '/(1|yes|true|on)/i',
       $settings['use_http_auth'] ) ? true : false );
 
+  // Whether user name is case-insensitive.
+  $ignore_user_case = isset($settings['ignore_user_case'])?
+    preg_match("/(1|yes|true|on)/i", $settings['ignore_user_case'])?
+    true: false: false;
+
   // Type of user authentication.
   $user_inc = $settings['user_inc'];
 
diff -Naur WebCalendar-1.2.4.orig/includes/functions.php WebCalendar-1.2.4.new/includes/functions.php
--- WebCalendar-1.2.4.orig/includes/functions.php	2011-09-30 17:09:31.836184998 +0200
+++ WebCalendar-1.2.4.new/includes/functions.php	2011-09-30 17:11:16.212456828 +0200
@@ -6136,4 +6136,19 @@
   return $ret;
 }
 
+/* Translate user name to lower case if required. */
+function user_case($user)
+{
+  global $ignore_user_case, $NONUSER_PREFIX;
+
+  if (!$ignore_user_case)
+    return $user;
+
+  if (!empty($NONUSER_PREFIX) &&
+   substr($user, 0, strlen($NONUSER_PREFIX)) == $NONUSER_PREFIX)
+    return $user;
+
+  return strtolower($user);
+}
+
 ?>
diff -Naur WebCalendar-1.2.4.orig/includes/settings.php.orig WebCalendar-1.2.4.new/includes/settings.php.orig
--- WebCalendar-1.2.4.orig/includes/settings.php.orig	2007-09-28 15:19:45.000000000 +0200
+++ WebCalendar-1.2.4.new/includes/settings.php.orig	2011-09-30 17:11:16.212456828 +0200
@@ -71,5 +71,10 @@
 # need to modify user-ldap.php to configure some settings.
 user_inc: user.php
 
+# Set the following to true if the user name authentication is not
+# case-sensitive. This results in translating all authenticated user names
+# to lowercase.
+ignore_user_case: false
+
 # end */
 ?>
diff -Naur WebCalendar-1.2.4.orig/install/index.php WebCalendar-1.2.4.new/install/index.php
--- WebCalendar-1.2.4.orig/install/index.php	2011-09-30 17:09:31.789188478 +0200
+++ WebCalendar-1.2.4.new/install/index.php	2011-09-30 17:11:16.213456768 +0200
@@ -660,6 +660,7 @@
     $settings['install_password'] = '';
     $settings['single_user_login'] = '';
     $settings['use_http_auth'] = 'false';
+    $settings['ignore_user_case'] = 'false';
     $settings['single_user'] = 'false';
     $settings['mode'] = 'prod';
   }
@@ -688,6 +689,7 @@
 $y = getPostValue ( 'app_settings' );
 if ( ! empty ( $y ) ) {
   $settings['single_user_login'] = getPostValue ( 'form_single_user_login' );
+  $settings['ignore_user_case'] = getPostValue ( 'form_ignore_user_case' );
   $settings['readonly'] = getPostValue ( 'form_readonly' );
   if ( getPostValue ( 'form_user_inc' ) == 'http' ) {
     $settings['use_http_auth'] = 'true';
@@ -838,8 +840,10 @@
   }
   if ( form.form_user_inc.options[listid].selected ) {
     makeVisible ( "singleuser" );
+    makeInvisible ( "usercase" );
   } else {
     makeInvisible ( "singleuser" );
+    makeVisible ( "usercase" );
   }
 }
 
@@ -1498,6 +1502,16 @@
     <td>
      <input name="form_single_user_login" size="20" value="<?php echo ( empty ( $settings['single_user_login'] ) ? '' : $settings['single_user_login'] );?>" /></td>
    </tr>
+   <tr id="usercase">
+    <td class="prompt"><?php etranslate ( 'Case-insensitive user name' ) ?>:</td>
+    <td>
+     <input name="form_ignore_user_case" value="true" type="radio"
+ <?php echo ( $settings['ignore_user_case'] == 'true' )? $checked : '';?> /><?php etranslate ( 'Yes' ) ?>
+ &nbsp;&nbsp;&nbsp;&nbsp;
+ <input name="form_ignore_user_case" value="false" type="radio"
+ <?php echo ( $settings['ignore_user_case'] != 'true' )? $checked : '';?> /><?php etranslate ( 'No' ) ?>
+     </td>
+    </tr>
    <tr>
     <td class="prompt"><?php etranslate ( 'Read-Only' ) ?>:</td>
     <td>
diff -Naur WebCalendar-1.2.4.orig/tools/send_reminders.php WebCalendar-1.2.4.new/tools/send_reminders.php
--- WebCalendar-1.2.4.orig/tools/send_reminders.php	2011-08-07 19:56:16.000000000 +0200
+++ WebCalendar-1.2.4.new/tools/send_reminders.php	2011-09-30 17:11:16.213456768 +0200
@@ -101,7 +101,7 @@
 $allusers = user_get_users ();
 $allusercnt = count ( $allusers );
 for ( $i = 0; $i < $allusercnt; $i++ ) {
-  $names[$allusers[$i]['cal_login']] = $allusers[$i]['cal_fullname'];
+  $names[$allusers[$i]['cal_login']] = user_case($allusers[$i]['cal_fullname']);
   $emails[$allusers[$i]['cal_login']] = $allusers[$i]['cal_email'];
 }
 
@@ -271,7 +271,7 @@
 
   if ( $res ) {
     while ( $row = dbi_fetch_row ( $res ) ) {
-      $participants[$num_participants++] = $row[0];
+      $participants[$num_participants++] = user_case($row[0]);
       $percentage[$row[0]] = $row[1];
     }
   }
diff -Naur WebCalendar-1.2.4.orig/translations/English-US.txt WebCalendar-1.2.4.new/translations/English-US.txt
--- WebCalendar-1.2.4.orig/translations/English-US.txt	2011-09-30 17:09:31.771189810 +0200
+++ WebCalendar-1.2.4.new/translations/English-US.txt	2011-09-30 17:11:16.214456702 +0200
@@ -1844,6 +1844,7 @@
 Web Server (detected): Web Server (detected)
 Web Server (not detected): Web Server (not detected)
 None (Single-User): None (Single-User)
+Case-insensitive user name: Case-insensitive user name
 Read-Only: Read-Only
 Environment: Environment
 Production: Production
diff -Naur WebCalendar-1.2.4.orig/translations/French.txt WebCalendar-1.2.4.new/translations/French.txt
--- WebCalendar-1.2.4.orig/translations/French.txt	2011-09-30 17:09:31.781189070 +0200
+++ WebCalendar-1.2.4.new/translations/French.txt	2011-09-30 17:11:16.214456702 +0200
@@ -1794,6 +1794,7 @@
 Web Server (detected): =
 Web Server (not detected): =
 None (Single-User): =
+Case-insensitive user name: =
 Read-Only: =
 Environment: =
 Production: =