require_once 'endpoints/formInstance.php';
require_once 'endpoints/formTemplates.php';
require_once 'endpoints/groups.php';
require_once 'endpoints/indexFields.php';
require_once 'endpoints/meta.php';
require_once 'endpoints/parse.php';
require_once 'endpoints/pData.php';
require_once 'endpoints/sites.php';
require_once 'endpoints/users.php';
// CLASS INSTANTIATIONS
$docRequest = new Documents();
$emailRequest = new Emails();
$filesRequest = new Files();
$foldersRequest = new Folders();
$formInstanceRequest = new FormInstance();
$formTemplatesRequest = new FormTemplates();
$groupsRequest = new Groups();
$indexFieldsRequest = new IndexFields();
$metaRequest = new Meta();
$parseRequest = new Parse();
$pdataRequest = new PersistedData();
$sitesRequest = new Sites();
$usersRequest = new Users();
// ------------------------- REQUESTS ---------------------------
// DOCUMENTS
echo $docRequest->deleteDoc('7a6a7f74-3b82-e511-bf04-008cfa482110');
echo $docRequest->getDoc('name%20eq%20%27test%20-2%20-%20test%27');
echo $docRequest->getDocId('e10f2106-8c72-e511-befe-98991b71acc0');
echo $docRequest->getDocIdRev('3c7168e7-4b82-e511-bf04-008cfa482110');
echo $docRequest->getDocIdRevId('e10f2106-8c72-e511-befe-98991b71acc0', 'b5d82c06-8c72-e511-befe-98991b71acc0');
echo $docRequest->getDocIndexFields('3c7168e7-4b82-e511-bf04-008cfa482110');
SetDefine('DIR_ABS', $_SERVER['DOCUMENT_ROOT'] . PATH);
SetDefine('FS_SIMPL', DIR_ABS . '../simpl/');
SetDefine('FS_CACHE', DIR_ABS . '../cache/');
SetDefine('DIR_CLASSES', DIR_ABS . '../classes/');
// Include Smarty
SetDefine('DIR_SMARTY', DIR_ABS . '../smarty/');
// Include SIMPL
include_once FS_SIMPL . 'simpl.php';
include_once DIR_ABS . '../inc/functions.php';
include_once DIR_SMARTY . 'Smarty.class.php';
include_once DIR_CLASSES . 'utilities.php';
// Connect to database
$db = new Db();
$db->Connect();
// Create the template object
$smarty = new FormTemplates();
// Assign the mode to the templates
$smarty->assign('mode', $mode);
SetDefine('CONSUMER_KEY', '');
SetDefine('CONSUMER_SECRET', '');
SetDefine('OAUTH_CALLBACK', ADDRESS . 'callback');
$myUser = new User();
$myAccountInfo = new AccountInfo();
// If the user has already logged in the past week
if (isset($_COOKIE['session']) && $_COOKIE['session'] != '') {
    // Look the user up and set their session
    $myUser->SetValue('sessionid', $_COOKIE['session']);
    $myUser->GetInfo(NULL, array('sessionid'));
    if ($myUser->GetPrimary() != '') {
        $myAccountInfo->SetValue('user_id', $myUser->GetPrimary());
        $myAccountInfo->GetInfo(NULL, array('user_id'));