functions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
functions [2020/07/15 14:03]
aducomadmin
functions [2020/07/15 14:19] (current)
aducomadmin
Line 5: Line 5:
 |function|description|prototype|returns|Notes| |function|description|prototype|returns|Notes|
 |clean_html|Clean HTML string removing all element attributes and elements which are not in the provided whitelist (but keeping their allowed children).|function clean_html($html, array $whitelist)|sanitized html|based upon [[https://github.com/alixaxel/phunction/blob/master/phunction/HTML.php|https://github.com/alixaxel/phunction/blob/master/phunction/HTML.php]]| |clean_html|Clean HTML string removing all element attributes and elements which are not in the provided whitelist (but keeping their allowed children).|function clean_html($html, array $whitelist)|sanitized html|based upon [[https://github.com/alixaxel/phunction/blob/master/phunction/HTML.php|https://github.com/alixaxel/phunction/blob/master/phunction/HTML.php]]|
 +|closeSession|Closes the session by unsetting it, destroying it, closes the write buffer and clears the session cookie.|function closeSession()|nothing| |
 |getGUID|Retrieves a unique string|function getGUID()|string|Returns a string that can be used for validation situations, i.e. for confirming credentials etc. In PHsPeed this string is used to let users validate their account.| |getGUID|Retrieves a unique string|function getGUID()|string|Returns a string that can be used for validation situations, i.e. for confirming credentials etc. In PHsPeed this string is used to let users validate their account.|
 |getProtocol|Returns the used protocol as HTTP:// or HTTPS:// |function getProtocol()|HTTP:// or HTTPS:// | | |getProtocol|Returns the used protocol as HTTP:// or HTTPS:// |function getProtocol()|HTTP:// or HTTPS:// | |
 |inPostState|Tests if the form has received form data or is in it's initials state|function inPostState();|true or false|if(inPostState() ){…}| |inPostState|Tests if the form has received form data or is in it's initials state|function inPostState();|true or false|if(inPostState() ){…}|
-|getSessionVar|Gets a session variable|function getSessionVar($theVar, $default='')|$variable|This function gets a session variable that is maintained over the same session. If the variable does not exists it returns the default value. I.e. getSessionVar('myVar', 'nothing');|+|getSessionVar|Gets a session variable|function getSessionVar($theVar, $default='')|string|This function gets a session variable that is maintained over the same session. If the variable does not exists it returns the default value. I.e. getSessionVar('myVar', 'nothing');|
 |isAjax|Tests if the current module takes part in an Ajax handler|function isAjax()|true or false|if(isAjax()) { … }| |isAjax|Tests if the current module takes part in an Ajax handler|function isAjax()|true or false|if(isAjax()) { … }|
 |isHTTPS|Tests if the URL runs under https|function isHTTPS()|true or false|if(isHTTPS()) { …}| |isHTTPS|Tests if the URL runs under https|function isHTTPS()|true or false|if(isHTTPS()) { …}|
 |isLoggedOn|Testst if the current users is logged on|function isLoggedOn()|true or false|if(isLoggedOn()) { … }| |isLoggedOn|Testst if the current users is logged on|function isLoggedOn()|true or false|if(isLoggedOn()) { … }|
 |isTrue|Test if a value is true or false. The function returns 'true' if the given parameter has one of the folowing values: 't','T','y','Y','true','TRUE','yes','YES'|function isTrue($string)|true or false|if(isTrue('Y')) {…}| |isTrue|Test if a value is true or false. The function returns 'true' if the given parameter has one of the folowing values: 't','T','y','Y','true','TRUE','yes','YES'|function isTrue($string)|true or false|if(isTrue('Y')) {…}|
 +| | | | | |
 |phspCrypt|Encrypts and Decrypts data.|function phspCrypt($string, $mode)|string|available modes are: 'e' for encryption and 'd' for description. The key and salt used is setup in the project properties. This function is used by PHsPeed to store database credentials, emailing options etc. Once set in the IDE then do not change as this will make the encrypted files unreadable. \\  \\ Sample: $mystr=phspCrypt($enc, 'e');| |phspCrypt|Encrypts and Decrypts data.|function phspCrypt($string, $mode)|string|available modes are: 'e' for encryption and 'd' for description. The key and salt used is setup in the project properties. This function is used by PHsPeed to store database credentials, emailing options etc. Once set in the IDE then do not change as this will make the encrypted files unreadable. \\  \\ Sample: $mystr=phspCrypt($enc, 'e');|
-|PHP redirect|Redirects current form to another page.|function phspRedirect($url, $origin)|nothing|Redirects to another module. Origin is optionas and can be used to pass the current module as a recepient.|+|phspCreateLink|Creates a link that can be used for redirecting to other modules. It automatically appends the phspeed token for security and the result is encrypted. Parameters become available as session variables in the requested application.|function phspCreateLink($url, $parms)|nothing|Sample: hspCreateLink('myapp.php', 'name=abc';
 +|phspHash|returns hash.|function phspHashB64($str, $algo='sha256')|string| | 
 +|phspHashB64|returns base64 encoded hash|function phspHashB64($str, $algo='sha256')|string| | 
 +|phspHMac|return hmac hash|function phspHMac($str, $algo='sha256')|string| | 
 +|phspRedirect|Redirects current form to another page. See phspCreateLink. for details.|function phspRedirect($url, $origin, $parms)|nothing|Redirects to another module. Origin is optionas and can be used to pass the current module as a recepient.
 +|rtrCmd()|Returns application command|function rtrCmd()|string|Used to retrieve commands from the application.| 
 +|rtrSender()|Returns the sending application|function rtrSender()|string| |
 |rtrSubmitBtn|Retrieves the id of the button clicked|function rtrSubmitBtn();|string|This function will return the button clicked. It is only to be used in the submit process and is not usable in ajax events. If you have more buttons on the form and want to take action depending on the submit button clicked then this function is useful. \\ Sample: \\  \\ $key=rtrSubmitBtn(); \\ if($key=='mail_btn_1') { …. } \\  \\ The name of the button is the name that is used in its constructor (#module _ #name). So if the PHP modules name is 'myapp' and the button is called 'mybtn' then the function would return 'myapp_mybtn';  | |rtrSubmitBtn|Retrieves the id of the button clicked|function rtrSubmitBtn();|string|This function will return the button clicked. It is only to be used in the submit process and is not usable in ajax events. If you have more buttons on the form and want to take action depending on the submit button clicked then this function is useful. \\ Sample: \\  \\ $key=rtrSubmitBtn(); \\ if($key=='mail_btn_1') { …. } \\  \\ The name of the button is the name that is used in its constructor (#module _ #name). So if the PHP modules name is 'myapp' and the button is called 'mybtn' then the function would return 'myapp_mybtn';  |
 |session_stop|Releases session variables and closes current session|function session_stop()|nothing|This function will prevent data to be saved in a reusable session cookie after termination of the application.| |session_stop|Releases session variables and closes current session|function session_stop()|nothing|This function will prevent data to be saved in a reusable session cookie after termination of the application.|
 +|setLoggedOff|Logs a user off, clears internal buffers|function setLoggedOff()|nothing| |
 +|setLoggedOn|Set the logon status for a certain user (depending on RBA module)|function setLoggedOn($usernum='generic')|true/false| |
 |setSessionVar|Sets a session variable|function setSessionVar($theVar, $theVal)|nothing|This function sets a session variable that is maintained over the same session. I.e. setSessionVar('myVar', $value);| |setSessionVar|Sets a session variable|function setSessionVar($theVar, $theVal)|nothing|This function sets a session variable that is maintained over the same session. I.e. setSessionVar('myVar', $value);|
 |sessionVarExists|Checks if the session variable exists.|function sessionVarExists($theVar) {|true or false| | |sessionVarExists|Checks if the session variable exists.|function sessionVarExists($theVar) {|true or false| |
  • functions.txt
  • Last modified: 2020/07/15 14:19
  • by aducomadmin