function auto_update_showpage()
{
    global $db, $main_smarty, $the_template, $template_dir;
    include_once 'config.php';
    include_once mnminclude . 'html1.php';
    include_once mnminclude . 'link.php';
    include_once mnminclude . 'tags.php';
    include_once mnminclude . 'smartyvariables.php';
    include_once "archive.php";
    // Create mysql backup
    if ($_GET['download'] == 'mysql') {
        set_time_limit(0);
        require "auto_update_backup.php";
        $b = new MysqlBackup($_GET['type'] == 'zip' ? '' : $_GET['type']);
        $tmpfname = $b->backup();
        header('Content-Description: File Transfer');
        header('Pragma: no-cache');
        header('Content-Type: application/force-download');
        header('Cache-Control: no-cache, must-revalidate');
        header("Content-Disposition: attachment; filename=pligg_db_backup_" . date("Y_m_d") . ".sql" . ($_GET['type'] == 'gzip' ? '.gz' : ($_GET['type'] == 'zip' ? '.zip' : '')));
        if ($_GET['type'] == 'zip') {
            $test = new zip_file(tempnam('/tmp', ''));
            $test->set_options(array('inmemory' => 1, 'storepaths' => 0));
            $test->add_files(array($tmpfname));
            $test->create_archive();
            print $test->archive;
        } else {
            readfile($tmpfname);
            unlink($tmpfname);
        }
        exit;
    } elseif ($_GET['download'] == 'files') {
        set_time_limit(0);
        $tmpfname = tempnam('/tmp', '');
        if ($_GET['type'] == 'gzip') {
            $test = new gzip_file($tmpfname);
            $test->set_options(array('inmemory' => 1, 'basedir' => "./", 'overwrite' => 1, 'level' => 1));
        } else {
            $test = new zip_file($tmpfname);
            $test->set_options(array('inmemory' => 1, 'recurse' => 1, 'storepaths' => 1));
        }
        $test->add_files("*");
        $test->exclude_files("./cache/*");
        $test->create_archive();
        // Check for errors (you can check for errors at any point)
        if (count($test->errors) > 0) {
            print "Errors occurred.";
        }
        // Process errors here
        header('Content-Description: File Transfer');
        header('Pragma: no-cache');
        header('Content-Type: application/force-download');
        header('Cache-Control: no-cache, must-revalidate');
        header("Content-Disposition: attachment; filename=pligg_backup_" . date("Y_m_d") . ($_GET['type'] == 'gzip' ? '.tar.gz' : '.zip'));
        // Send archive to user for download
        print $test->archive;
        exit;
    }
    $main_smarty = do_sidebar($main_smarty);
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('god');
    if ($canIhaveAccess == 1) {
        // breadcrumbs
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        // breadcrumbs
        define('modulename', 'status');
        $main_smarty->assign('modulename', modulename);
        define('pagename', 'admin_modifystatus');
        $main_smarty->assign('pagename', pagename);
        if ($_GET['step'] == 2) {
            $main_smarty->assign('gzip', function_exists('gzopen'));
            $main_smarty->assign('zip', class_exists('ZipArchive', FALSE));
            $main_smarty->assign('tpl_center', auto_update_tpl_path . 'auto_update_step2');
        } elseif ($_GET['step'] == 3) {
            $_SESSION['upload_files'] = array();
            $main_smarty->assign('exists', !file_exists(mnmpath . "latest.zip") ? 'disabled' : '');
            $main_smarty->assign('tpl_center', auto_update_tpl_path . 'auto_update_step3');
        } elseif ($_GET['step'] == 4) {
            $main_smarty->assign('tpl_center', auto_update_tpl_path . 'auto_update_step4');
        } elseif ($_GET['step'] == 5) {
            $main_smarty->assign('upgrade_exists', file_exists('install/upgrade.php'));
            $main_smarty->assign('tpl_center', auto_update_tpl_path . 'auto_update_step5');
        } elseif ($_GET['step'] == 6) {
            $main_smarty->assign('tpl_center', auto_update_tpl_path . 'auto_update_step6');
        } else {
            $main_smarty->assign('tpl_center', auto_update_tpl_path . 'auto_update_main');
        }
        list($yourversion, $latestversion) = auto_update_detect_version();
        $main_smarty->assign('yourversion', $yourversion);
        $main_smarty->assign('latestversion', $latestversion);
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
        die;
    }
}
 endtable();
 if (!$display_continue_button) {
     //no
     if ($CONFIG['photo_shop_download_zip'] == '1') {
         if (!file_exists($dest_dir . "download.zip")) {
             //zip file doesn't exist... create it
             // Create new zip file in the directory below the current one
             $test = new zip_file($dest_dir . "download.zip");
             // Do not recurse through subdirectories
             // Do not store file paths in archive
             // Overwrite existing files
             // Do not create in mem but on hd
             $test->set_options(array('overwrite' => 1, 'inmemory' => 0, 'recurse' => 0, 'storepaths' => 0));
             // Add all jpegs and gifs in the images directory to archive
             $test->add_files(array("{$dest_dir}/*.*"));
             $test->exclude_files("{$dest_dir}/*.html");
             $test->exclude_files("{$dest_dir}/*.htaccess");
             $test->exclude_files("{$dest_dir}/*.htpasswd");
             // Create archive in path
             $test->create_archive();
         }
         //display zipo download button
         msg_box($lang_photoshop_ipn['ipn_download_zip'], '', $lang_photoshop_ipn['ipn_download_zip'], $dest_dir . "download.zip", '100%');
     }
 }
 //display continue button
 if ($display_continue_button || $return_lnk != '') {
     if ($return_lnk == 'index' && $display_continue_button) {
         // we're coming here from the admin, but we need to continue further from the creation to the download... carry the admin with
         msg_box($lang_photoshop_ipn['ipn_image_create_finished'], '', $lang_photoshop_ipn['ipn_continue'], str_replace('&', '&', "index.php?file=photo_shop/photo_shop_download_order&order={$order}&return_lnk=index"), '100%');
     } elseif ($return_lnk == 'index' && !$display_continue_button) {