}
    if ($valid) {
        // Create a new settings object, and save the settings!
        $result = OA_Preferences::processPreferencesFromForm($aElements, $aCheckboxes);
        if ($result) {
            // Queue confirmation message
            $title = $group . ' ' . $GLOBALS['strPluginPreferences'];
            $translation = new OX_Translation();
            $translated_message = $translation->translate($GLOBALS['strXPreferencesHaveBeenUpdated'], array(htmlspecialchars($title)));
            OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
            OX_Admin_Redirect::redirect('account-preferences-plugin.php?group=' . $group);
        }
        // Could not write the settings configuration file, store this
        // error message and continue
        $aErrormessage[0][] = $strUnableToWritePrefs;
    }
}
// Display the preference page's header and sections
phpAds_PageHeader("account-preferences-index");
// Set the correct section of the preference pages and display the drop-down menu
$oOptions->selection($group);
// Prepare an array of HTML elements to display for the form, and
// output using the $oOption object
foreach ($aGroup['preferences'] as $k => $v) {
    $aPreferences[0]['text'] = $group . ($disabled ? ' - the Administrator has disabled this plugin, you may only change preferences when it is enabled.' : '');
    $aPreferences[0]['items'][] = array('type' => $v['type'], 'name' => $group . '_' . $v['name'], 'text' => $v['label'], 'req' => $v['required'], 'size' => $v['size'], 'value' => $v['value'], 'visible' => $v['visible'], 'disabled' => $disabled);
}
$aPreferences[0]['items'][] = array('type' => 'hiddenfield', 'name' => 'group', 'value' => $group);
$oOptions->show($aPreferences, $aErrormessage);
// Display the page footer
phpAds_PageFooter();
// Display the settings page's header and sections
phpAds_PageHeader("5.1");
if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
    // Show all "Preferences" sections
    phpAds_ShowSections(array("5.1", "5.2", "5.3", "5.5", "5.6", "5.4"));
} else {
    if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
        // Show the "Account Preferences", "User Log" and "Channel Management" sections of the "Preferences" sections
        phpAds_ShowSections(array("5.1", "5.2", "5.4", "5.7"));
    } else {
        if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER) || OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
            // Show the "User Preferences" section of the "Preferences" sections
            $sections = array("5.1", "5.2");
            if (OA_Permission::hasPermission(OA_PERM_USER_LOG_ACCESS)) {
                $sections[] = "5.4";
            }
            phpAds_ShowSections($sections);
        }
    }
}
// Set the correct section of the preference pages and display the drop-down menu
$oOptions->selection("name-language");
// Get the current logged in user details
$oUser = OA_Permission::getCurrentUser();
$aUser = $oUser->aUser;
// Prepare an array of HTML elements to display for the form, and
// output using the $oOption object
$aSettings = array(array('text' => $strUserDetails, 'items' => array(array('type' => 'plaintext', 'name' => 'username', 'value' => $aUser['username'], 'text' => $strUsername, 'size' => 35), array('type' => 'break'), array('type' => 'plaintext', 'name' => 'email_address', 'value' => $aUser['email_address'], 'text' => $strEmailAddress, 'size' => 35), array('type' => 'break'), array('type' => 'text', 'name' => 'contact_name', 'value' => $aUser['contact_name'], 'text' => $strFullName, 'size' => 35))), array('text' => $strLanguage, 'items' => array(array('type' => 'select', 'name' => 'language', 'text' => $strLanguage, 'items' => RV_Admin_Languages::getAvailableLanguages(), 'value' => $GLOBALS['_MAX']['PREF']['language']))));
$oOptions->show($aSettings, $aErrormessage);
// Display the page footer
phpAds_PageFooter();
    $aElements[] = 'tracker_default_type';
    $aElements[] = 'tracker_link_campaigns';
    $aCheckboxes['tracker_link_campaigns'] = true;
    // Save the preferences
    $result = OA_Preferences::processPreferencesFromForm($aElements, $aCheckboxes);
    if ($result) {
        OX_Admin_Redirect::redirect('account-preferences-tracker.php');
    }
    // Could not write the preferences to the database, store this
    // error message and continue
    $aErrormessage[0][] = $strUnableToWritePrefs;
}
// Display the settings page's header and sections
phpAds_PageHeader("account-preferences-index");
// Set the correct section of the preference pages and display the drop-down menu
$oOptions->selection("tracker");
// Get the details of possible tracker statuses
$aStatuses = array();
foreach ($GLOBALS['_MAX']['STATUSES'] as $statusId => $statusName) {
    $aStatuses[$statusId] = $GLOBALS[$statusName];
}
// Get the details of possible tracker types
$aTrackerTypes = array();
foreach ($GLOBALS['_MAX']['CONN_TYPES'] as $typeId => $typeName) {
    $aTrackerTypes[$typeId] = $GLOBALS[$typeName];
}
// Prepare an array of HTML elements to display for the form, and
// output using the $oOption object
$aSettings = array(array('text' => $strTracker, 'items' => array(array('type' => 'select', 'name' => 'tracker_default_status', 'text' => $strDefaultTrackerStatus, 'items' => $aStatuses), array('type' => 'break'), array('type' => 'select', 'name' => 'tracker_default_type', 'text' => $strDefaultTrackerType, 'items' => $aTrackerTypes), array('type' => 'break'), array('type' => 'checkbox', 'name' => 'tracker_link_campaigns', 'text' => $strLinkCampaignsByDefault))));
$oOptions->show($aSettings, $aErrormessage);
// Display the page footer