| 831 | 
           florian | 
           1 | 
           <?php
  | 
        
        
            | 
            | 
           2 | 
              | 
        
        
            | 
            | 
           3 | 
           ////////////////////////////////////////////////////////////////////////////////
  | 
        
        
            | 
            | 
           4 | 
           //                                                                            //
  | 
        
        
            | 
            | 
           5 | 
           //   Copyright (C) 2006  Phorum Development Team                              //
  | 
        
        
            | 
            | 
           6 | 
           //   http://www.phorum.org                                                    //
  | 
        
        
            | 
            | 
           7 | 
           //                                                                            //
  | 
        
        
            | 
            | 
           8 | 
           //   This program is free software. You can redistribute it and/or modify     //
  | 
        
        
            | 
            | 
           9 | 
           //   it under the terms of either the current Phorum License (viewable at     //
  | 
        
        
            | 
            | 
           10 | 
           //   phorum.org) or the Phorum License that was distributed with this file    //
  | 
        
        
            | 
            | 
           11 | 
           //                                                                            //
  | 
        
        
            | 
            | 
           12 | 
           //   This program is distributed in the hope that it will be useful,          //
  | 
        
        
            | 
            | 
           13 | 
           //   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
  | 
        
        
            | 
            | 
           14 | 
           //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
  | 
        
        
            | 
            | 
           15 | 
           //                                                                            //
  | 
        
        
            | 
            | 
           16 | 
           //   You should have received a copy of the Phorum License                    //
  | 
        
        
            | 
            | 
           17 | 
           //   along with this program.                                                 //
  | 
        
        
            | 
            | 
           18 | 
           ////////////////////////////////////////////////////////////////////////////////
  | 
        
        
            | 
            | 
           19 | 
              | 
        
        
            | 
            | 
           20 | 
               if(!defined("PHORUM_ADMIN")) return;
  | 
        
        
            | 
            | 
           21 | 
              | 
        
        
            | 
            | 
           22 | 
               if(!phorum_db_check_connection()){
  | 
        
        
            | 
            | 
           23 | 
                   echo "A database connection could not be established.  Please edit include/db/config.php.";
  | 
        
        
            | 
            | 
           24 | 
                   return;
  | 
        
        
            | 
            | 
           25 | 
               }
  | 
        
        
            | 
            | 
           26 | 
              | 
        
        
            | 
            | 
           27 | 
               include_once "./include/admin/PhorumInputForm.php";
  | 
        
        
            | 
            | 
           28 | 
              | 
        
        
            | 
            | 
           29 | 
               if(empty($_POST["step"])){
  | 
        
        
            | 
            | 
           30 | 
                   $step = 0;
  | 
        
        
            | 
            | 
           31 | 
               } else {
  | 
        
        
            | 
            | 
           32 | 
                   $step = $_POST["step"];
  | 
        
        
            | 
            | 
           33 | 
               }
  | 
        
        
            | 
            | 
           34 | 
              | 
        
        
            | 
            | 
           35 | 
               if(isset($PHORUM['internal_version']) && $PHORUM['internal_version'] == PHORUMINTERNAL){
  | 
        
        
            | 
            | 
           36 | 
                   $step = 2;
  | 
        
        
            | 
            | 
           37 | 
               }
  | 
        
        
            | 
            | 
           38 | 
              | 
        
        
            | 
            | 
           39 | 
               switch ($step){
  | 
        
        
            | 
            | 
           40 | 
              | 
        
        
            | 
            | 
           41 | 
                   case 0:
  | 
        
        
            | 
            | 
           42 | 
              | 
        
        
            | 
            | 
           43 | 
                       $frm =& new PhorumInputForm ("", "post", "Continue ->");
  | 
        
        
            | 
            | 
           44 | 
                       $frm->addbreak("Phorum Upgrade");
  | 
        
        
            | 
            | 
           45 | 
                       $frm->addmessage("This wizard will upgrade Phorum on your server.  Phorum has already confirmed that it can connect to your database.  Press continue when you are ready.");
  | 
        
        
            | 
            | 
           46 | 
                       $frm->hidden("module", "upgrade");
  | 
        
        
            | 
            | 
           47 | 
                       $frm->hidden("step", "1");
  | 
        
        
            | 
            | 
           48 | 
                       $frm->show();
  | 
        
        
            | 
            | 
           49 | 
              | 
        
        
            | 
            | 
           50 | 
                       break;
  | 
        
        
            | 
            | 
           51 | 
              | 
        
        
            | 
            | 
           52 | 
                   case 1:
  | 
        
        
            | 
            | 
           53 | 
                       if (! ini_get('safe_mode')) {
  | 
        
        
            | 
            | 
           54 | 
                           set_time_limit(0);
  | 
        
        
            | 
            | 
           55 | 
                           ini_set("memory_limit","64M");
  | 
        
        
            | 
            | 
           56 | 
                       }
  | 
        
        
            | 
            | 
           57 | 
              | 
        
        
            | 
            | 
           58 | 
                       // ok upgrading tables
  | 
        
        
            | 
            | 
           59 | 
                       $message = phorum_upgrade_tables($PHORUM['internal_version'],PHORUMINTERNAL);
  | 
        
        
            | 
            | 
           60 | 
              | 
        
        
            | 
            | 
           61 | 
                       $frm =& new PhorumInputForm ("", "post", "Continue ->");
  | 
        
        
            | 
            | 
           62 | 
              | 
        
        
            | 
            | 
           63 | 
                       // done or not done? ;)
  | 
        
        
            | 
            | 
           64 | 
                       $stepsleft = PHORUMINTERNAL - $PHORUM['internal_version'];
  | 
        
        
            | 
            | 
           65 | 
                       $frm->addbreak("Upgrading tables (multiple steps possible) ....");
  | 
        
        
            | 
            | 
           66 | 
                       $frm->addmessage($message);
  | 
        
        
            | 
            | 
           67 | 
                       if($stepsleft > 0) {
  | 
        
        
            | 
            | 
           68 | 
                           $newstep = 1;
  | 
        
        
            | 
            | 
           69 | 
                       } else {
  | 
        
        
            | 
            | 
           70 | 
                           $newstep = 2;
  | 
        
        
            | 
            | 
           71 | 
                       }
  | 
        
        
            | 
            | 
           72 | 
                       $frm->hidden("step", $newstep);
  | 
        
        
            | 
            | 
           73 | 
                       $frm->hidden("module", "upgrade");
  | 
        
        
            | 
            | 
           74 | 
                       $frm->show();
  | 
        
        
            | 
            | 
           75 | 
              | 
        
        
            | 
            | 
           76 | 
                       break;
  | 
        
        
            | 
            | 
           77 | 
              | 
        
        
            | 
            | 
           78 | 
                   case 2:
  | 
        
        
            | 
            | 
           79 | 
                       echo "The upgrade is complete.  You may want to look through the <a href=\"$_SERVER[PHP_SELF]\">the admin</a> for any new features in this version.";
  | 
        
        
            | 
            | 
           80 | 
              | 
        
        
            | 
            | 
           81 | 
                       break;
  | 
        
        
            | 
            | 
           82 | 
              | 
        
        
            | 
            | 
           83 | 
               }
  | 
        
        
            | 
            | 
           84 | 
              | 
        
        
            | 
            | 
           85 | 
           ?>
  |