aliroAuthenticator Class Reference

Inheritance diagram for aliroAuthenticator:

aliroAdminAuthenticator aliroUserAuthenticator

List of all members.

Public Member Functions

 logout ()
 makePassword ($syllables=3)
 makeSalt ()

Private Member Functions

 makeSuffix ($vowels, $consonants)
 makeSyllable ($vowels, $consonants, $double=false)
 makeRandomString ($length=8)


Detailed Description

Definition at line 93 of file aliroAuthenticator.php.


Member Function Documentation

aliroAuthenticator::logout (  ) 

Reimplemented in aliroUserAuthenticator, and aliroAdminAuthenticator.

Definition at line 96 of file aliroAuthenticator.php.

References aliroDatabase::getInstance(), and aliroSessionFactory::getSession().

00096                               {
00097         if (!empty($_SESSION["aliro_{$this->prefix}id"])) {
00098             $currentDate = date('Y-m-d/TH:i:s');
00099             $query = "UPDATE #__users SET lastvisitDate='$currentDate' WHERE id='" . $_SESSION["aliro_{$this->prefix}id"] . "'";
00100             aliroDatabase::getInstance()->doSQL($query);
00101         }
00102         aliroSessionFactory::getSession()->logout();
00103     }

aliroAuthenticator::makePassword ( syllables = 3  ) 

Definition at line 105 of file aliroAuthenticator.php.

References makeSyllable().

00105                                                   {
00106         // Developed from code by http://www.anyexample.com
00107         // 8 vowel sounds 
00108         $vowels = array ('a', 'o', 'e', 'i', 'y', 'u', 'ou', 'oo'); 
00109         // 20 random consonants 
00110         $consonants = array ('w', 'r', 't', 'p', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm', 'qu');
00111         // Generate three syllables
00112         for ($i=0, $password=''; $i<$syllables; $i++) $password .= $this->makeSyllable($vowels, $consonants, $i);
00113         // Return with suffix added
00114         return $password.$this->makeSuffix($vowels, $consonants);
00115     }

aliroAuthenticator::makeSuffix ( vowels,
consonants 
) [private]

Definition at line 117 of file aliroAuthenticator.php.

00117                                                        {
00118         // 10 random suffixes
00119         $suffix = array ('dom', 'ity', 'ment', 'sion', 'ness', 'ence', 'er', 'ist', 'tion', 'or');
00120         $new = $suffix[array_rand($suffix)];
00121         // return suffix, but put a consonant in front if it starts with a vowel
00122         return (in_array($new[0], $vowels)) ? $consonants[array_rand($consonants)].$new : $new;
00123     }

aliroAuthenticator::makeSyllable ( vowels,
consonants,
double = false 
) [private]

Definition at line 125 of file aliroAuthenticator.php.

Referenced by makePassword().

00125                                                                         {
00126         $doubles = array('n', 'm', 't', 's');
00127         $c = $consonants[array_rand($consonants)];
00128         // One in three chance of doubling the consonant - except for first syllable
00129         if ($double AND in_array($c, $doubles) AND 1 == mt_rand(0,2)) $c .= $c;
00130         return $c.$vowels[array_rand($vowels)];
00131     }

aliroAuthenticator::makeSalt (  ) 

Definition at line 133 of file aliroAuthenticator.php.

References makeRandomString().

00133                                 {
00134         return $this->makeRandomString(24);
00135     }

aliroAuthenticator::makeRandomString ( length = 8  )  [private]

Definition at line 137 of file aliroAuthenticator.php.

Referenced by makeSalt().

00137                                                   {
00138         $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!%,-:;@_{}~";
00139         for ($i = 0, $makepass = '', $len = strlen($chars); $i < $length; $i++) $makepass .= $chars[mt_rand(0, $len-1)];
00140         return $makepass;
00141     }


The documentation for this class was generated from the following file:

Generated on Thu Apr 17 13:03:29 2008 for ALIRO by  doxygen 1.5.5