<?xml version="1.0"?><phpdoc><class name="Bs_Cug" extends="Bs_Object" undoc="false" access="public" package="auth/cug"><file>C:/usr/local/lib/php/blueshoes-4.2/core/auth/cug/Bs_Cug.class.php</file><doc><author>andrej arn &amp;lt;andrej at blueshoes dot org&amp;gt;</author><inherited src="Array"/><description>this class is used to manage closed user groups. cug&amp;apos;s are secured partsof a website that only some ppl can access, usually based on login (user/pass) information.this class needs a session. it uses the global one if it exists, otherwiseit creates the global one.it also needs the bs form stuff to show and handle the login form.dependencies: Bs_Password, Bs_Form (which starts a chain of includes),HtmlTable, Bs_SessionFile</description><shortdescription>Closed User Group (Cug) Class</shortdescription><version>4.0.$id$</version><copyright>blueshoes.org</copyright></doc><function name="Bs_Cug" undoc="false" access="public"><doc><parameter name="$cugName" type="string"/><parameter name="$postData" default="NULL" type="string">(default is NULL which means use $_post. only pass something if really needed.)&#x0a;@2do session handling is to change (use Bs_SimpleSession) --sam</parameter><return type="void"/><description/><shortdescription>Constructor.</shortdescription></doc></function><function name="letMeIn" undoc="false" access="public"><doc><return name="" type="bool"/><description>if this returns false we need to display the login form to the user.</description><shortdescription>tells if the session is registered, the user is logged in.</shortdescription></doc></function><function name="logout" undoc="false" access="public"><doc><return type="void"/><description>cause it might be needed for other things.</description><shortdescription>logs out the user from this cug, does *not* kill the session</shortdescription></doc></function><function name="getLoginForm" undoc="false" access="public"><doc><return name="" type="string"/><description/><shortdescription>returns the login form as html code.</shortdescription></doc></function><function name="treatLoginForm" undoc="false" access="public"><doc><return name="" type="mixed"> (see above)</return><description>if there was a successful login, you get bool TRUE back.otherwise (or on the first display) you get an html string back (thehtml login form).in the past this function redirected automatically after a successfullogin. that changed now, cause you may need to do other stuff, egregister some session vars. feel free to use $this-&amp;gt;redirect() yourself.2002/04/18 --andrej</description><shortdescription>treats the login form.</shortdescription></doc></function><function name="redirect" undoc="false" access="public"><doc><return type="void"/><description/><shortdescription>redirects to the specified page.</shortdescription></doc></function><function name="_validateLogin" undoc="false" access="private"><doc><return type="void"/><description/><shortdescription>overwrite this method.</shortdescription></doc></function><function name="_validateLoginData" undoc="false" access="private"><doc><parameter name="$validateData" type="array">(hash, see above)</parameter><return name="" type="mixed"> (string on failure, bool TRUE on success. on failure $this-&amp;gt;errorMsg gets set too.)</return><description>param $validateData:has at least the keys:&amp;apos;sentUser&amp;apos;&amp;apos;sentPass&amp;apos;&amp;apos;user&amp;apos;&amp;apos;pass&amp;apos;and may have all these 3 keys (or none of them) for the lifecycle:&amp;apos;isActive&amp;apos;        (bool (TRUE/FALE) or int(1/0) (numericthat evaluates to bool))&amp;apos;startDatetime&amp;apos;   (eg 2002-12-31, empty = already)&amp;apos;endDatetime&amp;apos;     (eg 2002-12-31, empty = never)if the lifecycle is there, it is used.big note: these keys have nothing to do with the $userFieldNames object var; theyare internal here.</description><shortdescription>helper function, gets called from _validateLogin().</shortdescription></doc></function><function name="looksLikeHack" undoc="false" access="public"><doc><parameter name="$password" type="string"/><parameter name="$username" default="null" type="string"/><return name="" type="bool"> (also returns FALSE if we don&amp;apos;t know.)</return><description>uses Bs_Password which might need some mysql db tables.</description><shortdescription>let&amp;apos;s see if this failed attempt looks like a hack.</shortdescription></doc></function><function name="_logAttempt" undoc="false" access="private"><doc><return type="void"/><description/><shortdescription>overwrite this method.</shortdescription></doc></function><function name="_prepareLogData" undoc="false" access="private"><doc><parameter name="$isOk" type="bool">(if the login was ok or not.)</parameter><parameter name="$failedReason" default="&amp;apos;&amp;apos;" type="string">(set if login failed. default is &amp;apos;&amp;apos;.)</parameter><parameter name="$looksLikeHack" default="FALSE," type="string">(TRUE if yes. FALSE if no, unknown or unchecked. default is FALSE.)</parameter><parameter name="$realData" default="NULL" type="string">(hash, see above. default is NULL.)</parameter><return name="" type="array"/><description>if set then it is a hash and can have 0-n of the keys &amp;apos;realUserID&amp;apos;, &amp;apos;realUsername&amp;apos;and &amp;apos;realPassword&amp;apos;.if the user-given userID matches a real one, then we can log the real user/passto see how much they were different. but you don&amp;apos;t need that, maybe you don&amp;apos;t wantto log the real user/pass combinations or only the user without real pass.</description><shortdescription>param $realData:</shortdescription></doc></function><function name="_hackAlert" undoc="false" access="private"><doc><return type="void"/><description/><shortdescription>alerts the webmaster by email about the hack attempt.</shortdescription></doc></function><function name="_timeoutOnLoginFailure" undoc="false" access="private"><doc><parameter name="$secs" type="int"/><return type="void"/><description/><shortdescription>makes the user wait on failed logins.</shortdescription></doc></function><function name="_loadLoginForm" undoc="true" access="private"><doc><return type="void"/></doc></function><variable name="$_APP" access="private" type="array"><doc><description/><shortdescription>reference to the global settings hash.</shortdescription></doc></variable><variable name="$form" access="public" type="object [unknown]"><doc><description/><shortdescription>an instance of bs_form.</shortdescription></doc></variable><variable name="$bsSession" access="private" type="object [unknown]"><doc><description/><shortdescription>refenrece to global session object.</shortdescription></doc></variable><variable name="$_postVars" access="private" type="array"><doc><description>gets set in the constructor.we could just use $_POST, but this way we have the optionto use something different. may be needed.</description><shortdescription>reference to the HTTP_POST_VARS array.</shortdescription></doc></variable><variable name="$_cugName" access="private" type="string"><doc><description>a session var with that name will be set to int 1.so this name really should be unique if you run different cug&amp;apos;s.this var gets set in the constructor.</description><shortdescription>the cug needs a name. once the user logged in successfully,</shortdescription></doc></variable><variable name="$redirectPage" access="public" type="string">&amp;apos;frameset.php&amp;apos;<doc><description>once the login was successful.</description><shortdescription>the page (maybe with directory) to which the user will be redirected</shortdescription></doc></variable><variable name="$formTarget" access="public" type="string">&amp;apos;_top&amp;apos;<doc><description>default is &amp;apos;_top&amp;apos;. i think that&amp;apos;s a good thing for most forms.if you want no target, unset() this var. empty is not enough.</description><shortdescription>the target the login form submits to.</shortdescription></doc></variable><variable name="$language" access="public" type="string">&amp;apos;en&amp;apos;<doc><description/><shortdescription>the language used</shortdescription></doc></variable><variable name="$maxNumAttempts" access="public" type="integer"><doc><description>0 means &amp;apos;no limit&amp;apos;.</description><shortdescription>how many login attempts does the user have?</shortdescription></doc></variable><variable name="$checkForHack" access="public" type="string">TRUE<doc><see type="var">$actionOnHack</see><description>logins like root/root, guest/guest, letmein etc are considered hacks.the 3rd such login attempt will result in some action.</description><shortdescription>if we should check for hack attempts or not.</shortdescription></doc></variable><variable name="$actionOnHack" access="public" type="unknown"><doc><see type="var">$checkForHack</see><description>blockCnetblockUsernamealertWebmaster...</description><shortdescription>blockIP</shortdescription></doc></variable><variable name="$logAttempts" access="public" type="integer">1<doc><description>!!! important !!!:due to the current setup, to be able to determine the number offailed logins in a row or hack attempts, we need to log *all* login attempts,also the good ones. otherwise that &amp;quot;in a row&amp;quot; thing won&amp;apos;t work.it could be done differently by saving a counter in the user table, but it&amp;apos;snot. recode it if you feel like doing it, i don&amp;apos;t.0 = no1 = yes, all (=default)2 = failed only3 = successful only</description><shortdescription>should we log login attempts?</shortdescription></doc></variable><variable name="$checkCaseSensitive" access="public" type="integer"><doc><description>0 = yes (all case sensitive)1 = only username2 = only password3 = no (all case insensitive)</description><shortdescription>how should username and password be compared? case sensitive or not?</shortdescription></doc></variable><variable name="$userFieldNames" access="public" type="array">array(&#x0a;    &amp;apos;user&amp;apos;          =&amp;gt; &amp;apos;user&amp;apos;, &#x0a;    &amp;apos;pass&amp;apos;          =&amp;gt; &amp;apos;pass&amp;apos;, &#x0a;    &amp;apos;isActive&amp;apos;      =&amp;gt; &amp;apos;isActive&amp;apos;, &#x0a;    &amp;apos;startDatetime&amp;apos; =&amp;gt; &amp;apos;startDatetime&amp;apos;, &#x0a;    &amp;apos;endDatetime&amp;apos;   =&amp;gt; &amp;apos;endDatetime&amp;apos;, &#x0a;    &amp;apos;email&amp;apos;         =&amp;gt; &amp;apos;email&amp;apos;&#x0a;  )<doc><description>these are the defaults and recommended, you may need to changethem based on your data structure (array or db or file implementation or whatever).var $userFieldNames = array(&amp;apos;user&amp;apos;          =&amp;gt; &amp;apos;user&amp;apos;,&amp;apos;pass&amp;apos;          =&amp;gt; &amp;apos;pass&amp;apos;,&amp;apos;isActive&amp;apos;      =&amp;gt; &amp;apos;isActive&amp;apos;,&amp;apos;startDatetime&amp;apos; =&amp;gt; &amp;apos;startDatetime&amp;apos;,&amp;apos;endDatetime&amp;apos;   =&amp;gt; &amp;apos;endDatetime&amp;apos;,&amp;apos;email&amp;apos;         =&amp;gt; &amp;apos;email&amp;apos;);user and pass are for authentication, isActive startDatetime and endDatetimefor the lifecycle, email is to automatically send the password to the user.if something is not there, that feature cannot be used (lifecycle/email).note: take care that you don&amp;apos;t choose reserved names, eg &amp;apos;password&amp;apos; for mysql.</description><shortdescription>the captions of the keys.</shortdescription></doc></variable><variable name="$errorMsg" access="private" type="unknown"><doc><description/><shortdescription/></doc></variable><constant name="BS_CUG_VERSION" undoc="true" access="private" case="default: case sensitive">4.0.$x$<doc></doc></constant><inherited src="Bs_Object" type="functions"><element>isex</element><element>isexception</element><element>tostring</element><element>tohtml</element><element>persist</element><element>unpersist</element><element>bs_object</element><element>bbsetoutput</element><element>bbawake</element><element>bbisawake</element><element>bbxmsg</element><element>bbxfunctionstart</element><element>bbxfunctionend</element><element>bbxecho</element><element>bbxvar</element><element>bbxvardump</element><element>bbforcetrace</element><element>bbbufferstart</element><element>bbbufferget</element><element>bbbufferendflush</element><element>bbbufferendclean</element></inherited><inherited src="Bs_Object" type="consts"><element>bs_object_version</element></inherited><path><parent>Bs_Object</parent></path><baseclass>Bs_Object</baseclass><subclasses><subclass>Bs_CugArray</subclass><subclass>Bs_CugDb</subclass></subclasses></class></phpdoc>