function save_settings_rm_plugin() { global $xoopsSecurity; $name = rmc_server_var($_POST, 'plugin', ''); if ($name == '') { redirectMsg('plugins.php', __('You must specify a existing plugin', 'rmcommon'), 1); die; } $plugin = new RMPlugin($name); if ($plugin->isNew()) { redirectMsg('plugins.php', __('Specified plugin is not installed yet!', 'rmcommon'), 1); die; } if (!$plugin->getVar('status')) { redirectMsg('plugins.php', __('Specified plugin is not active!', 'rmcommon'), 1); die; } if (!$xoopsSecurity->check()) { redirectMsg('plugins.php?action=configure&plugin=' . $name, __('Session token expired!', 'rmcommon'), 1); die; } $options = $plugin->options(); $db = Database::getInstance(); $confs = array(); foreach ($options as $k => $option) { if (!isset($_POST['conf_' . $k])) { continue; } $value = $_POST['conf_' . $k]; $option['value'] = is_array($value) ? serialize($value) : $value; $db->queryF("UPDATE " . $db->prefix("rmc_settings") . " SET value='{$option['value']}' WHERE element='{$name}' AND type='plugin' AND name='{$k}'"); } redirectMsg('plugins.php', __('Settings updated!', 'rmcommon'), 0); }
function save_settings_rm_plugin() { global $xoopsSecurity; $name = rmc_server_var($_POST, 'plugin', ''); if ($name == '') { redirectMsg('plugins.php', __('You must specify a existing plugin', 'rmcommon'), 1); die; } $plugin = new RMPlugin($name); if ($plugin->isNew()) { redirectMsg('plugins.php', __('Specified plugin is not installed yet!', 'rmcommon'), 1); die; } if (!$plugin->getVar('status')) { redirectMsg('plugins.php', __('Specified plugin is not active!', 'rmcommon'), 1); die; } if (!$xoopsSecurity->check()) { redirectMsg('plugins.php?action=configure&plugin=' . $name, __('Session token expired!', 'rmcommon'), 1); die; } $options = $plugin->options(); $db = XoopsDatabaseFactory::getDatabaseConnection(); $confs = array(); foreach ($options as $k => $option) { if (!isset($_POST['conf_' . $k])) { continue; } $value = $_POST['conf_' . $k]; $option['value'] = is_array($value) ? serialize($value) : $value; $db->queryF("UPDATE " . $db->prefix("rmc_settings") . " SET value='{$option['value']}' WHERE element='{$name}' AND type='plugin' AND name='{$k}'"); } $events = RMEvents::get(); /** * Evnet params * 1: Options as array * 2: PLugin dir name * 3: Plugin object */ $events->run_event('rmcommon.save.plugin.settings', $options, $plugin->getVar('dir'), $plugin); redirectMsg('plugins.php', __('Settings updated!', 'rmcommon'), 0); }