Absolut Engine PHP Cross Reference Web Portal Systems

Source: /admin/upgrade1_70.php - 181 lines - 7994 bytes - Summary - Text - Print

   1  <?
   2  @include ("coreclass.php");
   3  $ae=new CArticles();
   4  $ae->RequestVariables();
   5  $ae->EngineInitialize();
   6  if (!isset($ae->percent)) $ae->percent=0;
   7  else $ae->percent=$ae->percent+25;
   8  if ($ae->percent==25)
   9     {
  10     @$sql=join('',file('upgrade.sql'));
  11     $sql=explode("#*",$sql);
  12     $sql=explode(";",$sql[0]);
  13     if ($ae->tableprefix<>"ae_") $sql=str_replace("ae_",$ae->tableprefix,$sql);
  14     foreach ($sql as $value)
  15             {
  16             $value=trim($value);
  17             if ($value) $ae->DBQuery($value);
  18             }
  19     }
  20  if ($ae->percent==50)
  21     {
  22     $ae->DBQuery("SELECT * FROM ".$ae->table[0]." ORDER BY section");
  23     $priority=$ae->rowsnumber;
  24     while ($ae->DBGetRow())
  25           {
  26           $temp=$ae->outcome;
  27           $sectionID=$ae->access["ID"];
  28           $ae->DBQuery("UPDATE ".$ae->table[0]." SET priority='".$priority."',parentsectionID='0' WHERE ID='".$sectionID."'");
  29           $priority--;
  30           $ae->outcome=$temp;
  31           }
  32     $ae->DBQuery("SELECT * FROM ".$ae->table[3]);
  33     while ($ae->DBGetRow())
  34           {
  35           $temp=$ae->outcome;
  36           $articleID=$ae->access["ID"];
  37           $sectionID=$ae->access["sectionID"];
  38           $ae->DBQuery("INSERT INTO ".$ae->table[9]." VALUES ('".$articleID."','".$sectionID."')");
  39           $ae->outcome=$temp;
  40           }
  41     }
  42  if ($ae->percent==75)
  43     {
  44     @$sql=join('',file('upgrade.sql'));
  45     $sql=explode("#*",$sql);
  46     $sql=explode(";",$sql[1]);
  47     if ($ae->tableprefix<>"ae_") $sql=str_replace("ae_",$ae->tableprefix,$sql);
  48     foreach ($sql as $value)
  49             {
  50             $value=trim($value);
  51             if ($value) $ae->DBQuery($value);
  52             }
  53     $ae->DBQuery("SELECT * FROM ".$ae->table[1]);
  54     while ($ae->DBGetRow())
  55           {
  56           $temp=$ae->outcome;
  57           $imagesetID=$ae->access["ID"];
  58           $description=$ae->access["description"]; $authorID=$ae->access["authorID"];
  59           $file[1]=$ae->access["file1"]; $file[2]=$ae->access["file2"];
  60           $file[3]=$ae->access["file3"]; $file[4]=$ae->access["file4"];
  61           $file[5]=$ae->access["file5"]; $file[6]=$ae->access["file6"];
  62           $file[7]=$ae->access["file7"]; $file[8]=$ae->access["file8"];
  63           $file[9]=$ae->access["file9"]; $file[10]=$ae->access["file10"];
  64           $filedesc[1]=$ae->access["filedescription1"];
  65           $filedesc[2]=$ae->access["filedescription2"];
  66           $filedesc[3]=$ae->access["filedescription3"];
  67           $filedesc[4]=$ae->access["filedescription4"];
  68           $filedesc[5]=$ae->access["filedescription5"];
  69           $filedesc[6]=$ae->access["filedescription6"];
  70           $filedesc[7]=$ae->access["filedescription7"];
  71           $filedesc[8]=$ae->access["filedescription8"];
  72           $filedesc[9]=$ae->access["filedescription9"];
  73           $filedesc[10]=$ae->access["filedescription10"];
  74           $ae->DBQuery("INSERT INTO ".$ae->table[13]." VALUES ('".$imagesetID."','".$description."','".$authorID."')");
  75           $imagesetID=$ae->insertID;
  76           for ($i=1;$i<=10;$i++)
  77               {
  78               $file[$i]=trim($file[$i]);
  79               if ($file[$i]) $ae->DBQuery("INSERT INTO ".$ae->table[1]."NEW VALUES (NULL,'".$imagesetID."','".$file[$i]."','".$filedesc[$i]."')");
  80               }
  81           $ae->outcome=$temp;
  82           }
  83     $ae->DBQuery("SELECT * FROM ".$ae->table[2]);
  84     while ($ae->DBGetRow())
  85           {
  86           $temp=$ae->outcome;
  87           $filesetID=$ae->access["ID"];
  88           $description=$ae->access["description"]; $authorID=$ae->access["authorID"];
  89           $file[1]=$ae->access["file1"]; $file[2]=$ae->access["file2"];
  90           $file[3]=$ae->access["file3"]; $file[4]=$ae->access["file4"];
  91           $file[5]=$ae->access["file5"];
  92           $ae->DBQuery("INSERT INTO ".$ae->table[12]." VALUES ('".$filesetID."','".$description."','".$authorID."')");
  93           $filesetID=$ae->insertID;
  94           for ($i=1;$i<=5;$i++)
  95               {
  96               $file[$i]=trim($file[$i]);
  97               if ($file[$i]) $ae->DBQuery("INSERT INTO ".$ae->table[2]."NEW VALUES (NULL,'".$filesetID."','".$file[$i]."')");
  98               }
  99           $ae->outcome=$temp;
 100           }
 101     }
 102  if ($ae->percent==100)
 103     {
 104     /*

 105     @$sql=join('',file('upgrade.sql'));

 106     $sql=explode("#*",$sql);

 107     $sql=explode(";",$sql[2]);

 108     if ($ae->tableprefix<>"ae_") $sql=str_replace("ae_",$ae->tableprefix,$sql);

 109     foreach ($sql as $value)

 110             {

 111             $value=trim($value);

 112             if ($value) $ae->DBQuery($value);

 113             }

 114     $ae->DBQuery("SELECT * FROM ".$ae->table[8]." WHERE directory='discussions'");

 115     if ($ae->DBGetRow())

 116        {

 117        $ae->DBQuery("ALTER TABLE ".$ae->tablediscussions[0]." ADD KEY `articleID` (`articleID`)");

 118        }

 119     $ae->DBQuery("SELECT * FROM ".$ae->table[8]." WHERE directory='seo'");

 120     if ($ae->DBGetRow())

 121        {

 122        $ae->DBQuery("ALTER TABLE ".$ae->tableseo[0]." DROP `ID`");

 123        $ae->DBQuery("ALTER TABLE ".$ae->tableseo[0]." ADD KEY `articleID` (`articleID`)");

 124        }

 125     */
 126     if ($ae->cleanurls==2 AND file_exists("../.htaccess"))
 127        {
 128        @$htaccess=file("../.htaccess");
 129        foreach ($htaccess as $key=>$value)
 130                {
 131                $htaccess[$key]=str_replace("RewriteRule ","RewriteRule ^",$value);
 132                }
 133        $htaccess=join("",$htaccess);
 134        @$file=fopen("../.htaccess","wb");
 135        @fwrite($file,$htaccess);
 136        @fclose($file);
 137        }
 138     }
 139  @include ("header.php");
 140  ?>
 141  <div id="installation">
 142  <?
 143  echo '<div id="process" style="width:',$ae->percent,'%;"></div>';
 144  ?>
 145  <br class="clear" />
 146  </div>
 147  <? if ($ae->percent<100): ?>
 148  <form method="post" action="upgrade.php">
 149  <? endif; ?>
 150  <? if ($ae->percent==100): ?>
 151  <form method="post" action="index.php">
 152  <? endif; ?>
 153  <fieldset><legend>Upgrade - progress: <? echo $ae->percent,'%'; ?></legend>
 154  <? if ($ae->percent==0): ?>
 155  <p class="warning"><span>!</span>Please backup your database first! Absolut Engine update script will now proceed with complete smooth upgrade of your database. This assumes you have edited [absolut]/admin/settings.php file to suit your DB & server settings. If you have not, please edit the file and change the settings now.<br class="clear" /></p>
 156  <p class="warning"><span>!</span>Upgrade script will now create new database tables and update some older ones.<br class="clear" /></p>
 157  <? endif; ?>
 158  <? if ($ae->percent==25): ?>
 159  <p class="warning"><span>!</span>Database tables have been created and updated. Upgrade script will now transfer article and section data into new tables.<br class="clear" /></p>
 160  <? endif; ?>
 161  <? if ($ae->percent==50): ?>
 162  <p class="warning"><span>!</span>Article and section data have been transferred. Upgrade script will now transfer image and file data into new tables.<br class="clear" /></p>
 163  <? endif; ?>
 164  <? if ($ae->percent==75): ?>
 165  <p class="warning"><span>!</span>Image and file data have been transferred. Upgrade script will now transfer image and file data into new tables and upgrade installed modules if necessary.<br class="clear" /></p>
 166  <? endif; ?>
 167  <? if ($ae->percent==100): ?>
 168  <p class="warning"><span>!</span>Please, DELETE both upgrade.php and install.php files from your server. They reside in [absolut]/admin/ directory.<br class="clear" /></p>
 169  <p class="warning"><span>!</span>You have finished all steps necessary to make Absolut Engine work. If everything worked, you should see login screen with username/password fields after clicking on "Finish and login" button. Use your username/pass to login.<br class="clear" /></p>
 170  <? endif; ?>
 171  <label for="submit"></label>
 172  <? if ($ae->percent<100): ?>
 173  <input type="submit" name="submit" id="submit" value="Next step" class="button" />
 174  <? endif; ?>
 175  <? if ($ae->percent==100): ?>
 176  <input type="submit" name="submit" id="submit" value="Finish and login" class="button" />
 177  <? endif; ?>
 178  <input type="hidden" name="percent" value="<? echo $ae->percent; ?>">
 179  </fieldset>
 180  </form>
 181  <? @include ("footer.php"); ?>

title

Description

title

Description

title

Description

title

title

Body