3.5.2.13. Server
File: classes/Server.php
The Server class provides general support for EWE.
3.5.2.13.1. Alerts
The following methods handle email alerts.
3.5.2.13.1.1. Add_Alert
Format: result = Add_Alert(email,event)
where "email" is the email address and "event" is the type of event.
Example: $result = $server->Add_Alert($email,$event);
This method adds an email alert. See base/_logs.php for a list of event types.
3.5.2.13.1.2. Delete_Alert
Format: result = Delete_Alert(id)
where "id" is the alert ID.
Example: $result = $server->Delete_Alert($id);
This method deletes the specified alert.
3.5.2.13.1.3. Get_Alerts
Format: result = Get_Alerts(email='',event='')
where "id" is the alert ID.
Example: $result = $server->Get_Alerts($email,$event);
This method returns an array of alerts that match the email, event, or both.
3.5.2.13.2. Countries
The following methods handle countries.
3.5.2.13.2.1. Add_Country
Format: result = Add_Country(cid,name,filename,language,language1=0)
where "cid" is the country ID, "name" is the country name, "filename" is the file name of
a flag for the country, "language" is the primary language for the country, and
"language1" is the secondary language for the country.
Example: $result = $server->Add_Country($cid,$name,$filename,$language);
This method adds a new country with the specified values.
3.5.2.13.2.2. add_state
Format: result = add_state(cid,name,abbreviation)
where "cid" is the country ID, "name" is the state/province name, and "abbreviation" is the
abbreviation code.
Example: $result = $server->add_state($cid,$name,$abbreviation);
This method adds a new state/province/division to the specified country.
3.5.2.13.2.3. countries_with_states
Format: result = countries_with_states()
Example: $result = $server->countries_with_states();
This method returns an array of countries that have states/provinces/subdivisions.
3.5.2.13.2.4. Country_Selection_HTML
Format: result = Country_Selection_HTML(heading,none)
where "heading" is the text for a heading in the selection and "none" is the text for a
"none" item.
Example: $result = $server->Country_Selection_HTML($heading,$none);
This method returns the HTML for a country selection box.
3.5.2.13.2.5. Delete_Country
Format: result = Delete_Country(id)
where "id" is the country ID for the country to remove.
Example: $result = $server->Delete_Country($id);
This method deletes the specified country.
3.5.2.13.2.6. delete_state
Format: result = delete_state(cid,id)
where "cid" is the country ID, and "id" is the ID for the state/province to remove.
Example: $result = $server->delete_state($cid,$id);
This method deletes the specified state/province/subdivision.
3.5.2.13.2.7. Get_Country
Format: result = Get_Country(id)
where "id" is the ID for the country to return.
Example: $result = $server->Get_Country($id);
This method returns an array of information about the specified country.
3.5.2.13.2.8. get_states
Format: result = get_states(id)
where "id" is the ID for the state/province to return.
Example: $result = $server->get_states($id);
This method returns an array of information about the specified state/province.
3.5.2.13.2.9. Rebuild_Country_List
Format: result = Rebuild_Country_List()
Example: $result = $server->Rebuild_Country_List();
This method rebuilds the country list file which is used in HTML pages that need
a country list.
3.5.2.13.2.10. Set_Country
Format: result = Set_Country(cid,name,filename,language,language1=0,subdiv='')
where "cid" is the country id of the country to change, "name" is the new country name,
"Filename" is the new flag image filename, "language" is the new primary language IS,
"language1" is the new secondary language ID, and "subdiv" is the what the counrty
subdivisions are named.
Example: $result = $server->Set_Country($cid,$name,$filename,$language,0,'');
This method alters country information.
3.5.2.13.3. Dictionaries and Exposed Passwords
The following methods handle dictionaries and exposed passwords.
3.5.2.13.3.1. Add_Dictionary_Word
Format: result = Add_Dictionary_Word(word)
where "word" is the word to add.
Example: $result = $server->Add_Dictionary_Word($word);
This method adds a new word to the dictionary.
3.5.2.13.3.2. Add_Exposed
Format: result = Add_Exposed(password)
where "password" is the word to add.
Example: $result = $server->Add_Exposed($password);
This method returns True if the specified word is in the exposed password list.
3.5.2.13.3.3. Dictionary_Word
Format: result = Dictionary_Word(word)
where "word" is the word to check.
Example: $result = $server->Dictionary_Word($s);
This method returns True if the specified word is in the dictionary.
3.5.2.13.3.4. Exposed_Password
Format: result = Exposed_Password(word)
where "word" is the word to check.
Example: $result = $server->Exposed_Password($s);
This method returns True if the specified word is in the exposed password list.
3.5.2.13.4. Downloads
The following methods handle downloads.
3.5.2.13.4.1. add_download
Format: result = add_download(name)
where "name" is the filename to add.
Example: $result = $server->add_download($name);
This method adds a new word to the dictionary.
3.5.2.13.4.2. download_fid
Format: result = download_fid(name)
where "name" is the filename to look up.
Example: $result = $server->download_fid($name);
This method returns the download ID for the specified file name.
3.5.2.13.4.3. get_download_by_fid
Format: result = get_download_by_fid(fid)
where "fid" is the download ID to look up.
Example: $result = $server->get_download_by_fid($fid);
This method returns an array of information for specified download ID.
3.5.2.13.4.4. Get_Download_Detail
Format: result = Get_Download_Detail()
Example: $result = $server->Get_Download_Detail();
This method returns True if download detail is store, otherwise False.
3.5.2.13.4.5. get_downloads
Format: result = get_downloads(name)
where "name" is the download file name
Example: $result = $server->get_downloads($name);
This method returns an array of information on downloads matching the specified name.
if name is "*", all downloads are returned.
3.5.2.13.4.6. get_downloads
Format: result = get_downloads(name)
where "name" is the download file name
Example: $result = $server->get_downloads($name);
This method returns an array of information on downloads matching the specified name.
if name is "*", all downloads are returned.
3.5.2.13.4.7. log_download
Format: result = log_download(filename)
where "filename" is the download file name
Example: $result = $server->log_download($filename);
This method is used to log a view/download of the specified file.
3.5.2.13.4.8. remove_download
Format: result = remove_download(fid)
where "fid" is the download ID
Example: $result = $server->remove_download($fid);
This method removes the download specified.
3.5.2.13.4.9. set_download_count
Format: result = set_download_count(fid,value)
where "fid" is the download ID and "value" is the new view/download count.
Example: $result = $server->set_download_count($fid,$value);
This method sets the view/download count for the specified download ID.
3.5.2.13.4.10. Set_Download_Detail
Format: result = Set_Download_Detail(flag)
where "flag" is true to allow download detail or false to disable.
Example: $result = $server->Set_Download_Detail($flag);
This method sets download detail flag.
3.5.2.13.5. Language
The following methods handle language. Language IDs (LIDs) are used to uniquely
identify each language.
3.5.2.13.5.1. Add_Language
Format: result = Add_Language(name,filename,enabled)
where "name" is the language name, "filename" is the filename of the image for the language, and
"enabled" is true to enable the language, or false otherwise.
Example: $result = $server->Add_Language($name,$filename,$enabled);
This method adds a language.
3.5.2.13.5.2. Delete_Language
Format: result = Delete_Language(lid)
where "lid" is the language ID of the language to delete.
Example: $result = $server->Delete_Language($lid);
This method deletes the specified language.
3.5.2.13.5.3. Delete_Language
Format: result = Delete_Language(lid)
where "lid" is the language ID of the language to delete.
Example: $result = $server->Delete_Language($lid);
This method deletes the specified language.
3.5.2.13.5.4. Get_Default_Language
Format: result = Get_Default_Language()
Example: $result = $server->Get_Default_Language();
This method returns the server's default language (name).
3.5.2.13.5.5. Get_Default_Language_ID
Format: result = Get_Default_Language_ID()
Example: $result = $server->Get_Default_Language_ID();
This method returns the server's default language ID.
3.5.2.13.5.6. Get_Default_Language_Info
Format: result = Get_Default_Language_Info()
Example: $result = $server->Get_Default_Language_Info();
This method returns an array of information on the server's default language.
3.5.2.13.5.7. Get_Language
Format: result = Get_Language(name)
where "name" is the language name
Example: $result = $server->Get_Language($name);
This method returns an array of information on the specified language.
3.5.2.13.5.8. Get_Language_For_Code
Format: result = Get_Language_For_Code(code)
where "code" is the language code
Example: $result = $server->Get_Language_For_Code($s);
This method returns an array of information on the language matching the specified code.
3.5.2.13.5.9. Get_Languages
Format: result = Get_Languages()
where "code" is the language code
Example: $result = $server->Get_Languages();
This method returns an array of defined languages.
3.5.2.13.5.10. Get_Requested_Language
Format: result = Get_Requested_Language()
Example: $result = $server->Get_Requested_Language();
This method returns the language requested by the client accessing the page.
3.5.2.13.5.11. Language_Selection_HTML
Format: result = Language_Selection_HTML(heading,none)
Example: $result = $server->Language_Selection_HTML($heading,$none);
This method returns HTML/Javascript for a language selection box.
3.5.2.13.5.12. Language_Selection_HTML
Format: result = Language_Selection_HTML(heading,none)
Example: $result = $server->Language_Selection_HTML($heading,$none);
This method returns HTML for a language selection box.
3.5.2.13.5.13. Set_Language
Format: result = Set_Language(lid,name,filename,enabled,IETF='')
where "lid" is the language ID, "name" is the new language name, "filename" is the
new image filename, "enabled" is true or false to enable/disable the language, and
"IEFT" is the IETF code for the language.
Example: $result = $server->Set_Language($lid,$name,$filename,$enabled);
This method alters a language to match the specified parameters.
3.5.2.13.6. Sites
The following methods manage sites. See the Sites class for more site management.
3.5.2.13.6.1. Get_Admin_Site
Format: result = Get_Admin_Site()
Example: $result = $server->Get_Admin_Site();
This method returns the url of the admin site, if defined.
3.5.2.13.6.2. Get_Default_Site
Format: result = Get_Default_Site()
Example: $result = $server->Get_Default_Site();
This method returns the server default site.
3.5.2.13.6.3. Get_Site
Format: result = Get_Site(site)
where "site" is the site to get information about
Example: $result = $server->Get_Site($site);
This method returns an array of information about the specified site.
3.5.2.13.6.4. Get_Site_Name
Format: result = Get_Site_Name(site)
where "site" is the site to get information about
Example: $result = $server->Get_Site_Name($site);
This method returns name of the specified site.
3.5.2.13.6.5. Get_Sites
Format: result = Get_Sites()
where "site" is the site to get information about
Example: $result = $server->Get_Sites();
This method returns an array of sites. Each element is an array of information on a site.
3.5.2.13.6.6. Normalize_Site
Format: result = Normalize_Site(site)
where "site" is a site name or URL
Example: $result = $server->Normalize_Site($site);
This method returns a site ID for the given site.
3.5.2.13.6.7. Resolve_Site
Format: result = Resolve_Site(site)
where "site" is a site name or ID
Example: $result = $server->Resolve_Site($site);
This method returns a site ID for the given site.
3.5.2.13.6.8. Set_Admin_Site
Format: result = Set_Admin_Site(value)
where "value" is the site to set as the admin site
Example: $result = $server->Set_Admin_Site($value);
This method sets the EWE admin site.
3.5.2.13.6.9. Set_Default_Site
Format: result = Set_Default_Site(site)
where "value" is the site to set as the default site
Example: $result = $server->Set_Default_Site($site);
This method sets the default site.
3.5.2.13.6.10. Valid_Site
Format: result = Valid_Site(siteid)
where "siteid" is the site to check
Example: $result = $server->Valid_Site($siteid);
This method returns true if the passed site id is valid.
3.5.2.13.7. File Views
These methods support the file view feature.
3.5.2.13.7.1. Add_File_View
Format: result = Add_File_View($name)
where $name is the file name.
Example: $result = $server->Add_File_View($name);
This method adds the specified file to the list of File View files.
3.5.2.13.7.2. Clear_File_View
Format: result = Clear_File_View($name)
where $name is the file name or file ID (fid).
Example: $result = $server->Clear_File_View($name);
This method clears the view detail for the specified file.
3.5.2.13.7.3. Delete_File_View
Format: result = Delete_File_View($name)
where $name is the file name or file ID (fid).
Example: $result = $server->Delete_File_View($name);
This method deletes the specified file and clears its view detail.
3.5.2.13.7.4. Get_File_View
Format: result = Get_File_View($fid)
where $fid is the file ID.
Example: $result = $server->Get_File_View($fid);
This method returns information for the specified file. Currently, this
is the id and name of the file.
3.5.2.13.7.5. Get_File_View_Detail
Format: result = Get_File_View_Detail($name)
where $name is the file name or ID (fid).
Example: $result = $server->Get_File_View_Detail($name);
This method returns an array of view detail for the specified file. For
now, this is simply the timestamp for each view.
3.5.2.13.7.6. Get_File_Views
Format: result = Get_File_Views($name)
where $name is the file name or ID (fid).
Example: $result = $server->Get_File_Views($name);
This method returns the total number of views for the specified file.
3.5.2.13.7.7. Mark_File_View
Format: result = Mark_File_View($name,$add=false)
where $name is the file name or ID (fid) and the optional $add is true to add
the file to the file view list if it isn't already in the list.
Example: $result = $server->Mark_File_View($filename);
This method returns the total number of views for the specified file.
Search_File_Views($name)
3.5.2.13.7.8. Search_File_Views
Format: result = Search_File_Views($name)
where $name is the file name.
Example: $result = $server->Search_File_Views($filename);
This method returns an array of all file view files matching the name. For
instance, if the passed name is "a", any file name containing "a", including the path, is returned.
If the name is null, all files are returned.
3.5.2.13.8. Other methods
General methods not covered above:
3.5.2.13.8.1. clear_automation_manager
Format: result = clear_automation_manager()
Example: $result = $server->clear_automation_manager();
This method deletes the current automation manager information. This is
called when the automation manager ends.
3.5.2.13.8.2. Document_Root
Format: result = Document_Root()
Example: $result = $server->Document_Root();
This method returns the current document root, with trailing path separator.
3.5.2.13.8.3. get_automation_manager
Format: result = get_automation_manager()
Example: $result = $server->get_automation_manager();
This method returns the automation manager process ID.
3.5.2.13.8.4. Get_Default_Address_List
Format: result = Get_Default_Address_List()
Example: $result = $server->Get_Default_Address_List();
This method returns the default address list.
3.5.2.13.8.5. get_event_names
Format: result = get_event_names()
Example: $result = $server->get_event_names();
This method returns an array of event names.
3.5.2.13.8.6. Get_Host
Format: result = Get_Host()
Example: $result = $server->Get_Host();
This method returns the current host name as per the accessing browser.
3.5.2.13.8.7. Get_ini_override
Format: result = Get_ini_override($name)
where "name" is the ini setting name.
Example: $result = $server->Get_ini_override($name);
This method returns the current host name as per the accessing browser.
3.5.2.13.8.8. get_ini_overrides
Format: result = get_ini_overrides()
Example: $result = $server->get_ini_overrides();
This method returns an arrat of all ini overrides.
3.5.2.13.8.9. Get_Version
Format: result = Get_Version()
Example: $result = $server->Get_Version();
This method returns the current EWE version.
3.5.2.13.8.10. Is_Setup
Format: result = Is_Setup()
Example: $result = $server->Is_Setup();
This method returns true if EWE setup is complete.
3.5.2.13.8.11. Is_SSL
Format: result = Is_SSL()
Example: $result = $server->Is_SSL();
This method returns true if the server is being accessed through SSL.
3.5.2.13.8.12. Log_Event
Format: result = Log_Event(site,mess)
where "site" is the site for logging and "mess" is the message.
Example: $result = $server->Log_Event($site,$mess);
This method writes an event to the log file.
3.5.2.13.8.13. register_automation_manager
Format: result = register_automation_manager(pid)
Example: $result = $server->register_automation_manager($pid);
This method registers the automation manager's process ID.
3.5.2.13.8.14. Remove_ini_override
Format: result = Remove_ini_override(name)
where "name" is the ini setting name
Example: $result = $server->Remove_ini_override($name);
This method removes the specified PHP setting override.
3.5.2.13.8.15. Set_ini_override
Format: result = Set_ini_override(name,value)
where "name" is the ini setting name and "value" is the new value for it
Example: $result = $server->Set_ini_override($name,$value);
This method sets the specified PHP setting override.
3.5.2.13.8.16. Set_Name
Format: result = Set_Name(name)
where "name" is the new EWE server name
Example: $result = $server->Set_Name($name);
This method sets the EWE server name to the specified name.
3.5.2.13.8.17. set_step
Format: result = set_step(step)
where "name" is the new EWE server name
Example: $result = $server->set_step($step);
This method is used internally during EWE setup and should not be called
otherwise.
3.5.2.13.8.18. Setup
Format: result = Setup()
where "name" is the new EWE server name
Example: $result = $server->Setup();
This method causes EWE setup to start/continue, if needed.
3.5.2.13.8.19. Setup_Table
Format: result = Setup_Table(step,admin_name,table_sql,text=-1,report=FALSE)
Example: $result = $server->Setup_Table($step,$adminname,$table_sql);
This method is used internally during EWE setup and should not be called
otherwise.
3.5.2.13.8.20. Update_Singleton
Format: result = Update_Singleton(name,index,value)
Example: $result = $server->Update_Singleton($name,$index,$value);
This method does a safe admin preference save such that different processes don't overwrite
the same preference at the same time and cause multiple instances of the preference.