예제 #1
0
                }
                $col = add_collection(plog_tr('Plogger Test Collection'), plog_tr('Feel free to delete it'));
                // Only attempt to create an album if the collection was created - sloppy fix for multiple installs
                if (!empty($col['id'])) {
                    $alb = add_album(plog_tr('Plogger Test Album'), plog_tr('Feel free to delete it'), $col['id']);
                }
            } else {
                echo plog_tr('There was an error with the MySQL connection') . '!';
            }
            // If no errors, tell the user their login and password and link them to the login
            if (empty($errors)) {
                echo "\n\t" . '<h1>' . plog_tr('Plogger Install Complete') . '</h1>';
                echo "\n\n\t" . '<p class="info width-700">' . plog_tr('You have successfully installed Plogger!') . '<br /><br />';
                echo "\n\t" . sprintf(plog_tr('Your username is %s and your password is %s'), '<strong>' . $_SESSION['install_values']['admin_username'] . '</strong>', '<strong>' . $_SESSION['install_values']['admin_password'] . '</strong>');
                echo '</p>';
                if (is_open_perms(PLOGGER_DIR . 'plog-content/')) {
                    echo "\n\n\t" . '<p class="actions width-700">' . sprintf(plog_tr('You can now CHMOD the %s directory back to 0755'), '<strong>plog-content/</strong>') . '.</p>';
                }
                echo "\n\n\t" . '<form action="index.php?r=plog-options.php" method="post">';
                echo "\n\t\t" . '<p><input class="submit" type="submit" name="login" value="' . plog_tr('Log In') . '" /></p>';
                echo "\n\t" . '</form>' . "\n";
                unset($_SESSION['plogger_config']);
                unset($_SESSION['install_values']);
            } else {
                // Else display the errors
            }
        }
    }
} else {
    // Otherwise it's installed
    echo '<p>' . plog_tr('Plogger is already installed') . '.</p>';
예제 #2
0
    } else {
        $output .= "\n\n\t\t" . '<div class="actions width-700">' . plog_tr('No images found in the <strong>plog-content/uploads/</strong> directory. To mass import pictures into your gallery, simply:') . '
			<ul>
				<li><strong>' . plog_tr('Open an FTP connection</strong> to your website') . '</li>
				<li>' . plog_tr('Transfer images you wish to publish to the <strong>plog-content/uploads/</strong> directory') . '</li>
				<li>' . plog_tr('Optionally, you can create folders within that directory to import in groups') . '</li>
			</ul>
		</div>' . "\n";
    }
} else {
    $output .= "\n\t" . '<h1>' . plog_tr('Import Images') . '</h1>';
    $upload_directory = $config['basedir'] . 'plog-content/uploads';
    if (!is_safe_mode() && !is_writable($upload_directory)) {
        $output .= "\n\n\t" . '<p class="errors">' . plog_tr('Your <strong>plog-content/uploads/</strong> directory is NOT WRITABLE! Use your FTP client to CHMOD the directory with the proper permissions or your import may fail!') . '</p>' . "\n";
    } else {
        if (is_open_perms($upload_directory)) {
            $output .= "\n\n\t" . '<p class="actions">' . plog_tr('Your <strong>plog-content/uploads/</strong> directory has open permissions (0777). If you are not importing images or uploading .zip archives, we recommend that you CHMOD the directory to 0755 to increase security on your Plogger install.') . '</p>' . "\n";
        }
    }
    // Grab a list of image files and folders in the uploads so we can clean empty folders
    $content = get_files($config['basedir'] . 'plog-content/uploads', false, true);
    $files = $content['files'];
    $folders = $content['folders'];
    // Build a list of unique directories from the filenames
    $directories = array();
    foreach ($files as $file) {
        $dirname = dirname($file);
        if (!in_array($dirname, $directories)) {
            $directories[md5($dirname)] = $dirname;
        }
    }
function check_requirements()
{
    $errors = array();
    // Check that the session variable can be read
    if (!isset($_SESSION['plogger_session'])) {
        $save_path = ini_get('session.save_path');
        // Check that session.save_path is set (not set by default on PHP5)
        if (empty($save_path)) {
            if (!defined('SESSION_SAVE_PATH')) {
                $sample_text = ' (' . sprintf(plog_tr('see %s if your %s does not contain this variable'), 'plog-config-sample.php', 'plog-config.php') . ')';
            } else {
                $sample_text = '';
            }
            $errors[] = sprintf(plog_tr('The PHP %s variable is not set in your php.ini file.'), '<strong>session.save_path</strong>') . ' ' . sprintf(plog_tr('You can attempt to set this by adding a writable directory path to the %s variable in %s or contact your webhost on how to set this system variable.'), '<strong>SESSION_SAVE_PATH</strong>', 'plog-config.php' . $sample_text);
        } else {
            $errors[] = sprintf(plog_tr('PHP session cookies are not being set. Please check that session cookies are enabled on your browser or verify that your %s variable is set up correctly.'), '<strong>session.save_path</strong>') . ' ' . sprintf(plog_tr('You can attempt to set this by adding a writable directory path to the %s variable in %s or contact your webhost on how to set this system variable.'), '<strong>SESSION_SAVE_PATH</strong>', 'plog-config.php' . $sample_text);
        }
    }
    // Check that the GD library is available
    if (gd_missing()) {
        $errors[] = plog_tr('PHP GD module was not detected.');
    }
    // Check that MySQL functions are available
    if (!function_exists('mysql_connect')) {
        $errors[] = plog_tr('PHP MySQL module was not detected.');
    }
    // Make sure we have permission to read these folders/files
    $files_to_read = array('./plog-admin', './plog-admin/css', './plog-admin/images', './plog-content/images', './plog-content/thumbs', './plog-content/uploads', './plog-includes', './plog-includes/lib');
    foreach ($files_to_read as $file) {
        if (!is_readable(PLOGGER_DIR . $file)) {
            $errors[] = sprintf(plog_tr('The path %s is not readable by the web server.'), '<strong>' . realpath(PLOGGER_DIR . $file) . '</strong>');
        }
    }
    // Workaround for upgrading from beta1 since there are conflicting function in plog-functions.php and beta1 plog-connect.php
    if (function_exists('is_safe_mode')) {
        // If safe mode enabled, we will use the FTP workarounds to deal with folder permissions
        if (!is_safe_mode()) {
            // Make sure we have permission to write to these folders
            $files_to_write = array('./plog-content/images', './plog-content/thumbs');
            $i = 0;
            foreach ($files_to_write as $file) {
                if (!is_writable(PLOGGER_DIR . $file)) {
                    $errors[] = sprintf(plog_tr('The path %s is not writable by the web server.'), '<strong>' . realpath(PLOGGER_DIR . $file) . '</strong>');
                } else {
                    if (is_open_perms(realpath(PLOGGER_DIR . $file))) {
                        $_SESSION['plogger_close_perms'][basename($file)] = realpath(PLOGGER_DIR . $file);
                    }
                }
            }
            if (isset($_SESSION['plogger_close_perms'])) {
                if (!is_writable(PLOGGER_DIR . 'plog-content/')) {
                    $errors[] = sprintf(plog_tr('Please temporarily CHMOD the %s directory to 0777 to allow Plogger to create initial directories for increased security. You will be prompted to CHMOD the directory back to 0755 after installation is complete.'), '<strong>plog-content/</strong>');
                }
            }
        }
    }
    return $errors;
}