/** * This function install a plugin and all their functionallity */ function install_rm_plugin() { $name = rmc_server_var($_GET, '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 installed already!', 'rmcommon'), 1); die; } if (!$plugin->load_from_dir($name)) { redirectMsg('plugins.php', sprintf(__('%s is not a valid plugin!', 'rmcommon'), $name), 1); die; } if (!$plugin->save()) { redirectMsg('plugins.php', __('Plugin could not be installed, please try again.', 'rmcommon'), 1); die; } if (!$plugin->on_install()) { redirectMsg('plugins.php', __('The plugin has been inserted on database, but erros ocurred on this process.', 'rmcommon') . '<br />' . $plugin->errors(), 1); die; } rm_reload_plugins(); redirectMsg('plugins.php', __('Plugin installed succesfully!', 'rmcommon'), 0); }