functions

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
functions [2019/03/21 11:19]
aducomadmin
functions [2020/07/15 14:19] (current)
aducomadmin
Line 4: Line 4:
  
 |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]]|
 +|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.|
-|inPostState|Tests if the form has received form data or is in it's initials state|inPostState();|true or false|if(inPostState() ){…}| +|getProtocol|Returns the used protocol as HTTP:// or HTTPS:// |function getProtocol()|HTTP:// or HTTPS:// | | 
-|isAjax|Tests if the current module takes part in an Ajax handler|isAjax()|true or false|if(isAjax()) { … }| +|inPostState|Tests if the form has received form data or is in it's initials state|function inPostState();|true or false|if(inPostState() ){…}
-|isLoggedOn|Testst if the current users is logged on|isLoggedOn()|true or false|if(isLoggedOn()) { … }| +|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');
-|phspCrypt|Encrypts and Decrypts data.|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');+|isAjax|Tests if the current module takes part in an Ajax handler|function isAjax()|true or false|if(isAjax()) { … }| 
-|PHP redirect|Redirects current form to another page.|PHP redirect($url);|nothing|Sample: PHP redirect('main.php');| +|isHTTPS|Tests if the URL runs under https|function isHTTPS()|true or false|if(isHTTPS()) { …}| 
-|rtrSubmitBtn|Retrieves the id of the button clicked|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'; +|isLoggedOn|Testst if the current users is logged on|function isLoggedOn()|true or false|if(isLoggedOn()) { … }
-|session_stop|Releases session variables and closes current session|session_stop()|nothing|This function will prevent data to be saved in a reusable session cookie after termination of the application.|+|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');
 +|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'; 
 +|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);| 
 +|sessionVarExists|Checks if the session variable exists.|function sessionVarExists($theVar) {|true or false| | 
 +|unsetSessionVar|Clears the variable and **removes** it from the sessionstack.|function unsetSessionVar($theVar)|nothing| |
  
 =====   ===== =====   =====
Line 18: Line 36:
  
 |function|description|prototype|returns|Notes| |function|description|prototype|returns|Notes|
-|showMessage|Displays a modal message|showMessage($msg)|nothing|   \\ In general this function can be used to submit and in ajax stage to display a popup message, but only on events that passes the $app object. \\   \\ Example: $app→showMessage('process complete'); \\  \\ See also macro notation (@@showMessage('…');  |+|showMessage|Displays a modal message|showMessage($msg)|nothing|   \\ In general this function can be used to submit and in ajax stage to display a popup message, but only on events that passes the $app object. \\  \\ Example: $app→showMessage('process complete'); \\  \\ See also macro notation (@@showMessage('…');  
 +|setSessionVar|Sets a session variable|function setSessionVar($theVar, $value)|nothing|This function sets a session variable that is maintained over the same session.|
 | | | | | | | | | | | |
  
  • functions.1553163568.txt.gz
  • Last modified: 2020/02/04 18:28
  • (external edit)