Пример #1
0
    unlink($TempDB);
    $ForceConfigReload = True;
    prnMsg(_('The plugin has been successfully removed.'), 'success');
} else {
    echo '<form onSubmit="return VerifyForm(this);" enctype="multipart/form-data" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post" class="noPrint">';
    echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
    echo '<input type="submit" name="reload" value="Reload" hidden="hidden" />';
    echo '<div>';
    if (!isset($_POST['reload'])) {
        echo '<div class="page_help_text noPrint">' . _('Select the plugin that you wish to remove from the list below.') . '</div>';
        echo '<br /><div class="centre">
				<div class="box_header">' . _('Installed plugins') . '</div>
				<select required="required" minlength="1" multiple="multiple" name="Available" onclick="ReloadForm(reload);">';
        $Plugins = scandir('plugins/');
        foreach ($Plugins as $Plugin) {
            if (IsPlugin($Plugin)) {
                $ZipFile = zip_open('plugins/' . $Plugin);
                while ($FileName = zip_read($ZipFile)) {
                    $Entry = zip_entry_name($FileName);
                    if ($Entry == 'summary.xml') {
                        $xml = zip_entry_read($FileName);
                        $Summary = new SimpleXMLElement($xml);
                        $PluginName = $Summary->name;
                        if ($Summary->installed == 1) {
                            echo '<option value="' . $Plugin . '">' . $PluginName . '</option>';
                        }
                    }
                }
            }
        }
        echo '</select>';
Пример #2
0
<?php

include 'includes/session.inc';
$Title = _('Upload a KwaMoja plugin');
include 'includes/header.inc';
echo '<p class="page_title_text noPrint" ><img src="' . $RootPath . '/css/' . $Theme . '/images/upload.png" title="' . _('Upload Plugin') . '" alt="" />' . _('Upload KwaMoja Plugin') . '</p>';
if (isset($_POST['submit'])) {
    switch ($_FILES['pluginfile']['error']) {
        case UPLOAD_ERR_OK:
            if (IsPlugin($_FILES['pluginfile'])) {
                if (!is_dir('/plugins')) {
                    if (is_writable('../')) {
                        mkdir('plugins', 0777);
                    } else {
                        prnMsg(_('The plugins directory cannot be created. Please make your root directory writeable for the web server'), 'error');
                        unset($_POST['submit']);
                        break;
                    }
                }
                move_uploaded_file($_FILES['pluginfile']['tmp_name'], 'plugins/' . $_FILES['pluginfile']['name']);
                prnMsg(_('The plugin has been successfully uploaded to your plugins directory. Now you can install it.'), 'success');
                include 'includes/footer.inc';
                exit;
            }
            break;
        case UPLOAD_ERR_INI_SIZE:
            prnMsg(_('The file you have selected is too big. It exceeds the maximum size allowed by your PHP installation.'), 'error');
            unset($_POST['submit']);
            break;
        case UPLOAD_ERR_FORM_SIZE:
            prnMsg(_('The file you have selected is too big. Please try a different file.'), 'error');