head	1.2;
access;
symbols;
locks; strict;
comment	@# @;


1.2
date	99.08.04.04.15.59;	author chuck;	state dead;
branches;
next	1.1;

1.1
date	99.07.20.07.36.26;	author jon;	state Exp;
branches;
next	;


desc
@@


1.2
log
@cjh: pruning out all the code that either isn't used or is only used for
maintaining/creating users - all of which is moving to Horde proper. Also a
few more fixes for the new session/user stuff, though I haven't quite gotten
rid of the "users" table yet - that's coming, though.

babel.php3 is a nice bit shorter, now... ;)

Anyway, a bit more work, and a better Horde user framework, and babel should
be more or less ready for primetime. oh, there's that whole customization
thing, too.

Speaking of which, what do people prefer: imp-style defaults.php3, or
babel-style babel.conf. I figure we should standardize on one; they're both
easy to auto-generate; babel's is maybe a little bit more overhead to parse,
but it's a bit more user friendly as well. Thoughts?
@
text
@function generate_password (&$request_ref, &$password_ref) {
  if (!($dict = $request_ref->conf['dictionary']))
    return error("dictionary not set in conf");
  
  srand(uniqid(rand()));
  
  if (!($words = file($dict)))
    return error("could not open dict '$dict'");
  
  array_walk($words, 'trim');
  
  $word1 = '';
  $word2 = '';
  
  while (!ereg("^[[:alnum:]]", $word1) && strlen($word1) < 3 || strlen($word1) > 6) {
    $word1 = $words[rand(0, count($words)-1)];
  }
  
  while (!ereg("^[[:alnum:]]", $word2) && strlen($word2) < 3 || strlen($word2) > 6) {
    $word2 = $words[rand(0, count($words)-1)];
  }
  
  $word1 = trim($word1);
  $word2 = trim($word2);
  
  $password_ref = "$word1-$word2";
  
  return success();
}
@


1.1
log
@
jon: alrighty, babel.php3.in is now broken down into seperate
     function files.  they're jusy dying to be combined into
     objects and seperate source files.
@
text
@@

