Jump to content

Ocs-server/Gfx4/get post headers: Difference between revisions

From KDE Community Wiki
Snizzo (talk | contribs)
Created page with "GFX provides a class that automatically handles and parse GET and POST data. So instead of directly accessing those arrays you should use EHeaderDataParser. ---------- If you ..."
 
Snizzo (talk | contribs)
No edit summary
Line 45: Line 45:
<br>
<br>
'''EHeaderDataParser::add_from_string(string $str);'''
'''EHeaderDataParser::add_from_string(string $str);'''
----------------
You can get the script page with all exta data(''&data=example?...'') erased by using:
<br>
'''EHeaderDataParser::erase_get_data(string $url);'''
-----------------
-----------------
EHeaderDataParser can be configure in the generic config file of gfx, which can be located
EHeaderDataParser can be configure in the generic config file of gfx, which can be located

Revision as of 15:54, 28 July 2015

GFX provides a class that automatically handles and parse GET and POST data. So instead of directly accessing those arrays you should use EHeaderDataParser.


If you have to output your data you can use:

EHeaderDataParser::out_get(string $name);
EHeaderDataParser::out_post(string $name);


If you have to insert your data into database and you need them to be safe you can use:

EHeaderDataParser::secure_get(string $name);
EHeaderDataParser::secure_post(string $name);


If you need all your data to be safe you can easily do:

EHeaderDataParser::safeAll();


You can also set GET and POST manually using:

EHeaderDataParser::add_get(string $key, string $value);
EHeaderDataParser::add_post(string $key, string $value);


You can check existance of GET and POST manually using:

EHeaderDataParser::exists_get(string $key);
EHeaderDataParser::exists_post(string $key);


You can use this class to get/set cookie data via:

EHeaderDataParser::get_cookie(string $key);
EHeaderDataParser::set_cookie(string $key, $value);
EHeaderDataParser::del_cookie(string $key);

This can result particularly useful when you need to use EModel's insert and update but not all the data comes from user request.


If you want to take those variables fast and you can't decide you can choose the unsafe way using:

EHeaderDataParser::get(string $key);
EHeaderDataParser::post(string $key);


If you have a string formed as a standard get key/value list (e.g. example=val&example2=val2) you can use this handy method to have that added to the module's stack.
EHeaderDataParser::add_from_string(string $str);


You can get the script page with all exta data(&data=example?...) erased by using:
EHeaderDataParser::erase_get_data(string $url);


EHeaderDataParser can be configure in the generic config file of gfx, which can be located here: gfx3/config/generic.conf.php.

Example:

<?php die("You cannot see config in here."); ?>
protectheaders|yes
protectheaders|no