Example #1
0
$install_index = 0;
$ui_request = false;
$show_finish = true;
// used to figure out if we should show the finish button in case of an error or not.
if (!$error) {
    // read the manifest
    if (substr($file, -4) == '.zip') {
        $p = new etano_package();
        if (!isset($_GET['finish']) && !isset($_GET['skip_input']) && !isset($_GET['ui_error'])) {
            // first time here
            $dirname = $fileop->extract_zip(_BASEPATH_ . '/tmp/packages/' . $file);
        } else {
            $dirname = substr($file, 0, -4);
        }
        if (is_file(_BASEPATH_ . '/tmp/packages/' . $dirname . '/manifest.xml')) {
            $p->set_file(_BASEPATH_ . '/tmp/packages/' . $dirname . '/manifest.xml');
        } elseif (!empty($dirname)) {
            if (is_dir(_BASEPATH_ . '/tmp/packages/' . $dirname)) {
                $fileop->delete(_BASEPATH_ . '/tmp/packages/' . $dirname);
            }
            $error = true;
            $topass['message']['type'] = MESSAGE_ERROR;
            $topass['message']['text'] = 'Invalid package';
        }
        if (!$p->error) {
            $install_index_start = 0;
            $skip_input = -1;
            if (isset($_GET['finish'])) {
                // no previous error for this package.
                $install_index_start = (int) $_GET['finish'];
                $p->post_install($install_index_start);