3.5.2.14. Sites

File: classes/Sites.php
The Sites class provides general support for sites.

3.5.2.14.1. Add
Format: result = Add(name,url,path='',alias=0)
where "name" is the new site name, "url" is the site URL, "path" is the path for site files, and "alias" is 1 to indicate this is an alias.
Example: $result = $sites->Add($sname,$url,'',0);

This method adds a new site with the given parameters.

3.5.2.14.2. Add_Login_Failure
Format: result = Add_Login_Failure(site,uid)
where "site" is the site on which the failure happened, amd "uid" is the user ID.
Example: $result = $sites->Add_Login_Failure($site,$uid);

This method records a login failure for the given site/user.

3.5.2.14.3. Allow_Cookies
Format: result = Allow_Cookies(siteid)
where "siteid" is the site of interest.
Example: $allowed = $sites->Allow_Cookies($siteid);

This method returns true if the specified site allows cookies for persistent logins.

3.5.2.14.4. Allow_Password_Recovery
Format: result = Allow_Password_Recovery(site)
where "site" is the site of interest.
Example: $allowed = $sites->Allow_Password_Recovery($site);

This method returns true if the specified site allows automated password recovery.

3.5.2.14.5. Allow_Unsolicited_Users
Format: result = Allow_Unsolicited_Users(site)
where "site" is the site of interest.
Example: $allowed = $sites->Allow_Unsolicited_Users($site);

This method returns true if the specified site allows users to register for new accounts.

3.5.2.14.6. Allow_Users
Format: result = Allow_Users(site)
where "site" is the site of interest.
Example: $allowed = $sites->Allow_Users($site);

This method returns true if the specified site allows user accounts.

3.5.2.14.7. Blacklisted_IP
Format: result = Blacklisted_IP(siteid)
where "siteid" is the site of interest.
Example: $allowed = !$sites->Blacklisted_IP($siteid);

This method returns true if the current IP is blacklisted for the specified site.

3.5.2.14.8. Blacklisted_Registration_IP
Format: result = Blacklisted_Registration_IP(siteid)
where "siteid" is the site of interest.
Example: $allowed = !$sites->Blacklisted_Registration_IP($siteid);

This method returns true if the current IP is blacklisted for the specified site for the purposing of creating a new user account.

3.5.2.14.9. Check_Profanity($site)
Format: result = Check_Profanity(site)
where "site" is the site of interest.
Example: $check = $sites->Check_Profanity($site);

This method returns true if specified site prohibits user names that are profanity.

3.5.2.14.10. Delete
Format: result = Delete(site)
where "site" is the site of interest.
Example: $result = $sites->Delete($site);

This method deletes the specified site, including all users and data for that site.

3.5.2.14.11. Force_SSL
Format: result = Force_SSL(siteid)
where "siteid" is the site of interest.
Example: $ssl = $sites->Force_SSL(siteid);

This method returns true if the specified site requires HTTPS access. If set and a user visits with HTTP access, he is redirected to HTTPS (in prepare.php).

3.5.2.14.12. get_address_list
Format: result = get_address_list(siteid)
where "siteid" is the site of interest.
Example: $list = $sites->get_address_list($siteid);

This method returns an array of items that indicate which mailing address fields are accepted or required from the user. Each element of the array is an array of information for that line of the address. See set_address_list for a detailed description.

3.5.2.14.13. Get_All_Sites
Format: result = Get_All_Sites()
Example: $result = $sites->Get_All_Sites();

This method returns an array of all defined sites. Each element of the array is an array of information for one site.

3.5.2.14.14. Get_Preference
Format: result = Get_Preference(site,item,index=0,default='')
where "site" is the site in question, "item" is the preference name, "index" is the item index, and "default" is the value to return if the preference is not found.
Example: $result = $sites->Get_Preference($site,$item,1);

This method returns a preference specific to the indicated site.

3.5.2.14.15. Get_Site
Format: result = Get_Site(site)
where "site" is the site in question.
Example: $result = $sites->Get_Site($site);

This method returns an array of information about the specified site.

3.5.2.14.16. get_site_css
Format: result = get_site_css(siteid)
where "siteid" is the site in question.
Example: $result = $sites->get_site_css($siteid);

This method returns the path and filename for a site-specific .css file. It returns a null string if no site-specific css is defined.

3.5.2.14.17. Log_Event
Format: result = Log_Event(site, type, text)
where "site" is the site in question, "type" is the event type, and "text" is the text to log as an event.
Example: $result = $sites->Log_Event($site, $type, $text);

This method adds an event to the event log.

3.5.2.14.18. Login_Success
Format: result = Login_Success(site,uid)
where "site" is the site in question, and "uid" is the user.
Example: $result = $sites->Login_Success($site,$uid);

This method logs a successful login for the specified user.

3.5.2.14.19. Minimum_Password_Size
Format: result = Minimum_Password_Size(siteid)
where "siteid" is the site in question.
Example: $min = $sites->Minimum_Password_Size($siteid);

This method returns the minimum password size, in characters, for the specified site.

3.5.2.14.20. Name
Format: result = Name(site)
where "site" is the site in question.
Example: $name = $sites->Name($site);

This method returns the name of the specified site.

3.5.2.14.21. Preference_Count
Format: result = Preference_Count(site,item)
where "site" is the site in question and "item" is the preference name.
Example: $count = $sites->Preference_Count($site,$item);

This method returns the number of items in the specified preference.

3.5.2.14.22. Preference_List
Format: result = Preference_List(site,item)
where "site" is the site in question and "item" is the preference name.
Example: $prefs = $sites->Preference_List($site,$item);

This method returns an array containing all of the items in the named preference.

3.5.2.14.23. Refresh_Site
Format: result = Refresh_Site(siteid,path='')
where "siteid" is the site in question and "path" is the path for the site. If path is not specified, the default site path is used.
Example: $result = $sites->Refresh_Site($siteid,$path='');

This method returns an array containing all of the items in the named preference.

3.5.2.14.24. Require_Logins
Format: result = Require_Logins(site)
where "site" is the site in question.
Example: $req = $sites->Require_Logins($site);

This method returns true if the specified site requires users to be logged in to access pages.

3.5.2.14.25. resolve_site
Format: result = resolve_site(site)
where "site" is a site name, url, or ID.
Example: $req = $sites->resolve_site($site);

This method returns the site ID of the passed site. -1 is returned if the site is not found.

3.5.2.14.26. set_address_list
Format: result = set_address_list(siteid,info)
where "siteid" is the site in question and "info" is an array of address information
Example: $req = $sites->set_address_list($siteid,$info);

This method sets the default address list. The array contains one element per address line. Each line is an array with the following information:
KeyDescription
requiredTrue if the line is required
typeThe type of address item:
ValueDescription
cCountry
sState/province/subdivision
tText - unvalidated text
zPostal code
tableNot currently used
itemText shown for this item

3.5.2.14.27. Set_Allow_Cookies
Format: result = Set_Allow_Cookies(siteid,value)
where "siteid" is the site in question and "value" is true to allow cookies or false otherwise.
Example: $req = $sites->Set_Allow_Cookies($siteid,$value);

This method sets the allow-cookies flag for the specified site.

3.5.2.14.28. Set_Allow_Password_Recovery
Format: result = Set_Allow_Password_Recovery(siteid,value)
where "siteid" is the site in question and "value" is true to allow password recovery or false otherwise.
Example: $req = $sites->Set_Allow_Password_Recovery($siteid,$value);

This method sets the allow-password-recovery flag for the specified site.

3.5.2.14.29. Set_Allow_Unsolicited_Users
Format: result = Set_Allow_Unsolicited_Users(siteid,value)
where "siteid" is the site in question and "value" is true to allow unsolicited user registration recovery or false otherwise.
Example: $req = $sites->Set_Allow_Unsolicited_Users($siteid,$value);

This method sets the allow-unsoliticited-user registration flag for the specified site.

3.5.2.14.30. Set_Allow_Users
Format: result = Set_Allow_Users(siteid,value)
where "siteid" is the site in question and "value" is true to allow user logins or false otherwise.
Example: $req = $sites->Set_Allow_Users($siteid,$value);

This method sets the allow-users flag for the specified site.

3.5.2.14.31. Set_Force_SSL
Format: result = Set_Force_SSL(siteid,value)
where "siteid" is the site in question and "value" is true to force HTTPS access, or false otherwise.
Example: $req = $sites->Set_Force_SSL($siteid,$value);

This method sets the allow-users flag for the specified site.

3.5.2.14.32. Set_Minimum_Password_Size
Format: result = Set_Minimum_Password_Size(siteid,value)
where "siteid" is the site in question and "value" is the minimum password length, in characters.
Example: $req = $sites->Set_Minimum_Password_Size($siteid,$value);

This method sets the minimum password length, in characters, for the specified site.

3.5.2.14.33. Set_Name
Format: result = Set_Name(site, name)
where "siteid" is the site in question and "name" is the EWE installation name.
Example: $req = $sites->Set_Name($site, $sname);

This method sets the EWE installation name.

3.5.2.14.34. Set_Preference
Format: result = Set_Preference(site,item,index,value)
where "site" is the site in question, "item" is the preference name, "index" is the index, and "value" is the preference value.
Example: $req = $sites->Set_Preference($site,$item,$index,$value);

This method sets the specified preference on the specified site.

3.5.2.14.35. Set_Require_Logins
Format: result = Set_Require_Logins(siteid,value)
where "site" is the site in question, and "value" is True if logins are required, and false otherwise.
Example: $req = $sites->Set_Require_Logins($siteid,$value);

This method sets the require-logins flag for the specified site.

3.5.2.14.36. set_site_css
Format: result = set_site_css(siteid,css)
where "siteid" is the site in question, and "css" is full path and filename of the .css file for the site.
Example: $req = $sites->set_site_css($siteid,$css);

This method sets the .css file for the specified site.

3.5.2.14.37. Set_Two_Stage_Registration
Format: result = Set_Two_Stage_Registration(siteid,value)
where "siteid" is the site in question, and "value" is true to set the two-stage-registration flag, or false otherwise.
Example: $req = $sites->Set_Two_Stage_Registration($siteid,$value);

This method sets the two-stage-registration flag for the specified site.

3.5.2.14.38. Set_URL
Format: result = Set_URL(site, url)
where "site" is the site in question, and "url" is the URL for the site.
Example: $req = $sites->Set_URL($site, $url);

This method sets the URL for the specified site. Note that this doesn't change the server document root folder.

3.5.2.14.39. Two_Stage_Registration
Format: result = Two_Stage_Registration(siteid)
where "site" is the site in question, and "url" is the URL for the site.
Example: $req = $sites->Two_Stage_Registration($siteid);

This method returns True if the site uses two-stage registration.

3.5.2.14.40. Valid_uname
Format: result = Valid_uname(site,name)
where "site" is the site in question, and "name" is the name to validate.
Example: $req = $sites->Valid_uname($site,$name);

This method returns True if the passed name is valid given the specified site's requirements. Most code should use the Validate_uname() function instead.

3.5.2.14.41. Validate_Password
Format: result = Validate_Password(pass,siteid)
where "site" is the site in question, and "name" is the name to validate.
Example: $req = $sites->Validate_Password($pass,$siteid);

This method returns True if the passed name is valid given the specified site's password requirements, or false otherwise.

3.5.2.14.42. Validate_uname
Format: result = Validate_uname(name,siteid)
where "siteid" is the site in question, and "name" is the name to validate.
Example: $req = $sites->Validate_uname($name,$siteid);

This method returns True if the passed user name is valid given the specified site's requirements, or false otherwise.