home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / groupoffice-com-2.01 / modules / wiki / action / prefs.php < prev    next >
PHP Script  |  2004-03-08  |  1KB  |  49 lines

  1. <?php
  2. // $Id: prefs.php,v 1.1 2004/01/12 22:14:04 comsubvie Exp $
  3.  
  4. require(TemplateDir . '/prefs.php');
  5.  
  6. // View or set a user's preferences.
  7. function action_prefs()
  8. {
  9.   global $Save, $referrer, $user, $rows, $cols, $days, $min, $auth, $hist;
  10.   global $CookieName, $tzoff;
  11.  
  12.   if(!empty($Save))
  13.   {
  14.     if(!empty($user))
  15.     {
  16.       if(!validate_page($user))
  17.         { die(ACTION_ErrorNameMatch); }
  18.     }
  19.  
  20.     ereg("([[:digit:]]*)", $rows, $result);
  21.     if(($rows = $result[1]) <= 0)
  22.       { $rows = 20; }
  23.     ereg("([[:digit:]]*)", $cols, $result);
  24.     if(($cols = $result[1]) <= 0)
  25.       { $cols = 65; }
  26.     if(strcmp($auth, "") != 0)
  27.       { $auth = 1; }
  28.     else
  29.       { $auth = 0; }
  30.     $value = "rows=$rows&cols=$cols&auth=$auth";
  31.     if(strcmp($user, "") != 0)
  32.       { $value = $value . "&user=" . urlencode($user); }
  33.     if(strcmp($days, "") != 0)
  34.       { $value = $value . "&days=$days"; }
  35.     if(strcmp($min, "") != 0)
  36.       { $value = $value . "&min=$min"; }
  37.     if(strcmp($hist, "") != 0)
  38.       { $value = $value . "&hist=$hist"; }
  39.     if(strcmp($tzoff, "") != 0)
  40.       { $value = $value . "&tzoff=$tzoff"; }
  41.     setcookie($CookieName, $value, time() + 157680000, "/", "");
  42.     header("Location: $referrer");
  43.   }
  44.   else
  45.     { template_prefs(); }
  46. }
  47.  
  48. ?>
  49.