コード例 #1
0
// Create a new option object for displaying the setting's page's HTML form
$oOptions = new OA_Admin_Option('preferences');
// Prepare an array for storing error messages
$aErrormessage = array();
$pattern = '/[^a-zA-Z0-9\\._-]/';
$plugin = preg_replace($pattern, '', $_REQUEST['parent']);
$group = preg_replace($pattern, '', $_REQUEST['group']);
$parent = preg_replace($pattern, '', $_REQUEST['parent']);
if ($plugin) {
    $backURL = "plugin-index.php?action=info&package={$plugin}";
} else {
    $backURL = "plugin-index.php?selection=plugins";
}
// get the settings for this plugin
$oManager = new OX_Plugin_ComponentGroupManager();
$aConfig = $oManager->_getComponentGroupConfiguration($group);
// If the settings page is a submission, deal with the form data
if (isset($_POST['submitok']) && $_POST['submitok'] == 'true') {
    // Prepare an array of the HTML elements to process, and the
    // location to save the values in the settings configuration
    // file
    $aElements = array();
    foreach ($aConfig['preferences'] as $k => $v) {
        $aElements[] = $group . '_' . $v['key'];
        // Register the HTML element value
        MAX_commonRegisterGlobalsArray(array($group . '_' . $v['key']));
    }
    $aCheckboxes = array();
    $valid = true;
    $validationFile = MAX_PATH . $GLOBALS['_MAX']['CONF']['pluginPaths']['packages'] . $group . '/processPreferences.php';
    if (file_exists($validationFile)) {
コード例 #2
0
require_once MAX_PATH . '/lib/OA/Admin/Option.php';
require_once MAX_PATH . '/lib/OA/Preferences.php';
require_once MAX_PATH . '/lib/max/Plugin/Translation.php';
require_once MAX_PATH . '/www/admin/config.php';
require_once LIB_PATH . '/Plugin/ComponentGroupManager.php';
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER, OA_ACCOUNT_TRAFFICKER);
phpAds_registerGlobal('group');
// Load the account's preferences, with additional information, into a specially named array
$GLOBALS['_MAX']['PREF_EXTRA'] = OA_Preferences::loadPreferences(true, true);
// Create a new option object for displaying the setting's page's HTML form
$oOptions = new OA_Admin_Option('preferences');
// Prepare an array for storing error messages
$aErrormessage = array();
$oComponentGroupManager = new OX_Plugin_ComponentGroupManager();
$aGroup = $oComponentGroupManager->_getComponentGroupConfiguration($group);
$enabled = $GLOBALS['_MAX']['CONF']['pluginGroupComponents'][$group];
$disabled = !$enabled && OA_Permission::getAccountType() != OA_ACCOUNT_ADMIN;
// If the settings page is a submission, deal with the form data
if (isset($_POST['submitok']) && $_POST['submitok'] == 'true') {
    // Prepare an array of the HTML elements to process, and which
    // of the preferences are checkboxes
    $aElements = array();
    foreach ($aGroup['preferences'] as $k => $v) {
        $aElements[] = $group . '_' . $v['name'];
        // Register the HTML element value
        MAX_commonRegisterGlobalsArray(array($group . '_' . $v['name']));
    }
    $aCheckboxes = array();
    // Validation
    $valid = true;
コード例 #3
0
 /**
  * caches hooks for enabled plugins only
  * indexed by group name
  *
  * @return boolean
  */
 function cachePreferenceOptions()
 {
     $oComponentGroupManager = new OX_Plugin_ComponentGroupManager();
     $aComponentGroups = $GLOBALS['_MAX']['CONF']['pluginGroupComponents'] ? $GLOBALS['_MAX']['CONF']['pluginGroupComponents'] : array();
     $aOptions = array();
     foreach ($aComponentGroups as $name => $enabled) {
         if ($enabled || OA_Permission::getAccountType() == OA_ACCOUNT_ADMIN) {
             $aConfig[$name] = $oComponentGroupManager->_getComponentGroupConfiguration($name);
             if (count($aConfig[$name]['preferences'])) {
                 $aOptions[$name] = array('name' => $name, 'text' => $aConfig[$name]['option'] ? $aConfig[$name]['option'] : $name, 'value' => 'account-preferences-plugin.php?group=' . $name, 'perm' => array(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER, OA_ACCOUNT_TRAFFICKER));
             }
         }
     }
     $oCache = $oComponentGroupManager->_getOA_Cache('Plugins', 'PrefOptions');
     $oCache->setFileNameProtection(false);
     return $oCache->save($aOptions);
 }