예제 #1
0
/**
 * A method to create a simple html page that shows a custom text and a navigation button.
 * This should be used to show notices or errors during installation or update.
 * @param string $message    A (html) message that should be displayed.
 * @param string $url        The url to which the user should be navigated if he clicks the button.
 * @param string $buttonText The text of the button.
 * @param string $buttonIcon The icon of the button.
 * @param bool   $update
 */
function showNotice($message, $url, $buttonText, $buttonIcon, $update = false)
{
    global $gL10n;
    $onClickText = '';
    // show dialog with success notification
    $form = new HtmlFormInstallation('installation-form', $url);
    if ($update) {
        $form->setUpdateModus();
    }
    if ($buttonText === $gL10n->get('INS_UPDATE_DATABASE')) {
        $onClickText = $gL10n->get('INS_DATABASE_IS_UPDATED');
    }
    $form->setFormDescription($message);
    $form->addSubmitButton('next_page', $buttonText, array('icon' => $buttonIcon, 'onClickText' => $onClickText));
    $form->show();
    exit;
}
예제 #2
0
if ($installedDbVersion === '') {
    $message = '
        <div class="alert alert-danger alert-small" role="alert">
            <span class="glyphicon glyphicon-exclamation-sign"></span>
            <strong>' . $gL10n->get('INS_UPDATE_NOT_POSSIBLE') . '</strong>
        </div>
        <p>' . $gL10n->get('INS_NO_INSTALLED_VERSION_FOUND', ADMIDIO_VERSION_TEXT) . '</p>';
    showNotice($message, $g_root_path . '/adm_program/index.php', $gL10n->get('SYS_OVERVIEW'), 'layout/application_view_list.png', true);
}
if ($getMode === 1) {
    // if database version is smaller then source version -> update
    // if database version is equal to source but beta has a difference -> update
    if (version_compare($installedDbVersion, ADMIDIO_VERSION_TEXT) === -1 || version_compare($installedDbVersion, ADMIDIO_VERSION_TEXT) === 0 && $maxUpdateStep > $currentUpdateStep) {
        // create a page with the notice that the installation must be configured on the next pages
        $form = new HtmlFormInstallation('update_login_form', 'update.php?mode=2');
        $form->setUpdateModus();
        $form->setFormDescription('<h3>' . $gL10n->get('INS_DATABASE_NEEDS_UPDATED_VERSION', $installedDbVersion, ADMIDIO_VERSION_TEXT) . '</h3>');
        if (!isset($gLoginForUpdate) || $gLoginForUpdate == 1) {
            $form->addDescription($gL10n->get('INS_WEBMASTER_LOGIN_DESC'));
            $form->addInput('login_name', $gL10n->get('SYS_USERNAME'), null, array('maxLength' => 35, 'property' => FIELD_REQUIRED, 'class' => 'form-control-small'));
            $form->addInput('password', $gL10n->get('SYS_PASSWORD'), null, array('type' => 'password', 'property' => FIELD_REQUIRED, 'class' => 'form-control-small'));
        }
        // if this is a beta version then show a warning message
        if (ADMIDIO_VERSION_BETA > 0) {
            $form->addDescription('
                <div class="alert alert-warning alert-small" role="alert">
                    <span class="glyphicon glyphicon-warning-sign"></span>
                    ' . $gL10n->get('INS_WARNING_BETA_VERSION') . '
                </div>');
        }
        $form->addSubmitButton('next_page', $gL10n->get('INS_UPDATE_DATABASE'), array('icon' => 'layout/database_in.png', 'onClickText' => $gL10n->get('INS_DATABASE_IS_UPDATED')));