/**
 * Update site plugin settings
 * @param string $name the name of the value to update.
 * @param string $value the value to update with
 * @return boolean true for success, false if failed
 */
function updateSitePluginSettings($name, $value)
{
    // This block automatically checks this action against the permissions database before running.
    if (!checkActionPermissionSelf(__FUNCTION__, func_get_args())) {
        addAlert("danger", "Sorry, you do not have permission to access this resource.");
        return false;
    }
    return updatePluginConfig($name, $value);
}
Beispiel #2
0
function handleDataSet($plugin, $DATA)
{
    global $configMappings, $activePlugins, $service, $pluginURL, $pluginPath, $pluginName, $configMapping, $configVal;
    $context = Model_Context::getInstance();
    $xmls = new XMLStruct();
    if (!$xmls->open($DATA)) {
        unset($xmls);
        return array('error' => '3', 'customError' => '');
    }
    unset($xmls);
    if (!in_array($plugin, $activePlugins)) {
        return array('error' => '9', 'customError' => _f('%1 : 플러그인이 활성화되어 있지 않아 설정을 저장하지 못했습니다.', $plugin));
    }
    $reSetting = true;
    if (!empty($configMappings[$plugin]['dataValHandler'])) {
        $context->setProperty('plugin.uri', $context->getProperty('service.path') . "/plugins/{$plugin}");
        $context->setProperty('plugin.path', ROOT . "/plugins/{$plugin}");
        $context->setProperty('plugin.name', $plugin);
        $pluginURL = $context->getProperty('plugin.uri');
        // Legacy plugin support.
        $pluginPath = $context->getProperty('plugin.path');
        $pluginName = $context->getProperty('plugin.name');
        include_once ROOT . "/plugins/{$plugin}/index.php";
        if (function_exists($configMappings[$plugin]['dataValHandler'])) {
            if (!empty($configMappings[$plugin]['config'])) {
                $configVal = getCurrentSetting($plugin);
                $context->setProperty('plugin.config', Setting::fetchConfigVal($configVal));
            } else {
                $configVal = '';
                $context->setProperty('plugin.config', array());
            }
            // Loading locale resource
            $languageDomain = null;
            if (is_dir($pluginPath . '/locale/')) {
                $locale = Locales::getInstance();
                $languageDomain = $locale->domain;
                if (file_exists($pluginPath . '/locale/' . $locale->defaultLanguage . '.php')) {
                    $locale->setDirectory($pluginPath . '/locale');
                    $locale->set($locale->defaultLanguage, $pluginName);
                    $locale->domain = $pluginName;
                }
            }
            $reSetting = call_user_func($configMappings[$plugin]['dataValHandler'], serialize(fetchConfigXML($DATA)));
            $pluginURL = $pluginPath = $pluginName = "";
            $context->unsetProperty('plugin.uri');
            $context->unsetProperty('plugin.path');
            $context->unsetProperty('plugin.name');
            $context->unsetProperty('plugin.config', array());
            if (!is_null($languageDomain)) {
                $locale->domain = $languageDomain;
            }
        }
        if (true !== $reSetting) {
            return array('error' => '9', 'customError' => $reSetting);
        }
    }
    $result = updatePluginConfig($plugin, $DATA);
    return array('error' => $result, 'customError' => '');
}
Beispiel #3
0
 } else {
     if ($_GET['action'] == paths && $_GET['mode'] == autodetect) {
         autodetectPaths();
         displayPaths();
     } else {
         if ($_GET['tab'] == 5 || $_GET['action'] == paths) {
             displayPaths();
         } else {
             if (isset($_POST['saveDashboard'])) {
                 updateDashboard();
             } else {
                 if (isset($_POST['savePlugins'])) {
                     updatePlugins();
                 } else {
                     if (isset($_POST['plugin_update'])) {
                         updatePluginConfig();
                     } else {
                         if (isset($_POST['savePaths'])) {
                             updatePaths();
                         } else {
                             if (isset($_POST['addUser'])) {
                                 addUser();
                             } else {
                                 if (isset($_POST['userToGroup'])) {
                                     addUserToGroup();
                                 } else {
                                     if (isset($_POST['delUserFromGroup'])) {
                                         delUserFromGroup();
                                     } else {
                                         if (isset($_POST['delUser'])) {
                                             removeUser();