';
echo html_print_image("images/firts_task/icono_grande_import.png", true, array("title" => __("Plugin Registration") ));
echo '
';
echo '';
echo '
' . __("Plugin registration") . '
';
echo '
' .
__("This extension makes registration of server plugins more easy.
Here you can upload a server plugin in Pandora FMS 3.x zipped format (.pspz).
Please refer to documentation on how to obtain and use Pandora FMS Server Plugins.
You can get more plugins in our Public Resource Library ") . '
';
// Upload form
echo "
';
echo '';
$zip = null;
$upload = false;
if (isset($_FILES['plugin_upload'])) {
$config["plugin_store"] = $config["attachment_store"] . "/plugin";
$name_file = $_FILES['plugin_upload']['name'];
$zip = zip_open($_FILES['plugin_upload']['tmp_name']);
$upload = true;
}
if ($zip) {
while ($zip_entry = zip_read($zip)) {
if (zip_entry_open($zip, $zip_entry, "r")) {
if (zip_entry_name($zip_entry) == "plugin_definition.ini") {
$basepath = $config["attachment_store"];
}
else {
$basepath = $config["plugin_store"];
}
$filename = $basepath . "/". zip_entry_name($zip_entry);
$fp = fopen($filename, 'w');
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
fwrite($fp, $buf);
fclose($fp);
chmod ($filename, 0755);
zip_entry_close($zip_entry);
}
}
zip_close($zip);
}
if ($upload) {
// Parse with sections
if (! $ini_array = parse_ini_file($config["attachment_store"] . "/plugin_definition.ini", true)) {
echo "