This page documents useful functions available to be called before executing data modifications (insert/update/delete) using a service controller.
Authenticity (ticket) checking
Check if the user has authenticity to prevent CSRF.
$access->check_authenticity() //function to prevent CSRF by including a ticket in the popup form
<input type="hidden" name="ticket" value="{$ticket}">
Preference checking
Check if a preference (feature) is enabled.
//check preference Services_Exception_Disabled::check('feature_wiki_structure');
If you want to check several preferences, call each separately
//check preferences Services_Exception_Disabled::check('feature_wiki'); Services_Exception_Disabled::check('feature_wiki_structure'); Services_Exception_Disabled::check('feature_wiki_export');
Permission checking
Check for necessary permissions (tiki_p_XXXX)
//check permission $permission = Perms::get(); if (! $permission->tiki_p_edit_menu_options) { throw new Services_Exception_Denied(tr('Permission denied')); }
Checking mandatory input
Check if a mandatory input data is available and fire error it is if not provided
Call a function from a library
You will probably need to use some functions from libraries.
Initialize the library
$structLib = TikiLib::lib('struct');
db/config/tiki.xml
Call the function
$structLib->move_to_structure($page_ref_id, $structure_id);