[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/setup/ -> upgrade.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2009 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
   6   
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11    
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license 
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15    
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY 
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19   
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  $phpwcms = array();
  24  
  25  $_this_path = realpath(dirname(__FILE__).'/../');
  26  if(is_file($_this_path.'/config/phpwcms/conf.inc.php')) {
  27      require_once ($_this_path.'/config/phpwcms/conf.inc.php');
  28  } else {
  29      die('Please proof location of "conf.inc.php".');
  30  }
  31  
  32  if (!defined('PHPWCMS_INCLUDE_CHECK')) {
  33     define('PHPWCMS_INCLUDE_CHECK', true);
  34  }
  35  
  36  require_once  ($_this_path.'/include/inc_lib/default.inc.php');
  37  require_once  (PHPWCMS_ROOT.'/include/inc_lib/dbcon.inc.php');
  38  require_once  (PHPWCMS_ROOT.'/include/inc_lib/general.inc.php');
  39  require_once  (PHPWCMS_ROOT.'/include/inc_lib/backend.functions.inc.php');
  40  require_once  (PHPWCMS_ROOT.'/setup/inc/upgrade.func.inc.php');
  41  
  42  ?>
  43  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  44  <html xmlns="http://www.w3.org/1999/xhtml">
  45  <head >
  46  <title>Upgrade phpwcms</title>
  47  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  48  <link href="../include/inc_css/install.css" rel="stylesheet" type="text/css" />
  49  <style type="text/css">
  50  <!--
  51  body {
  52      padding:    0 15px 15px 15px;
  53      margin: 0;
  54  }
  55  -->
  56  </style>
  57  </head>
  58  
  59  <body>
  60  <table width="770" border="0" align="center" cellpadding="0" cellspacing="0" summary="">
  61    <tr>
  62      <td colspan="3"><img src="../img/leer.gif" alt="[beliebiger Wert]" width="1" height="7" /></td>
  63    </tr>
  64    <tr>
  65      <td colspan="3"><img src="../img/leer.gif" alt="" width="15" height="1" /><a href="http://www.phpwcms.de" target="_blank"><img src="../img/backend/backend_r1_c3.jpg" alt="phpwcms" width="95" height="24" border="0" /></a></td>
  66    </tr>
  67    <tr>
  68      <td colspan="3"><img src="../img/leer.gif" alt="" width="1" height="7" /></td>
  69    </tr>
  70    <tr bgcolor="#FFFFFF">
  71      <td valign="top" style="background-image:url(../img/backend/backend_r3_c4.jpg); background-repeat:repeat-x; "><img src="../img/backend/backend_r3_c1.jpg" alt="" width="15" height="40" /></td>
  72      <td valign="top" style="background-image:url(../img/backend/backend_r3_c4.jpg); background-repeat:repeat-x; "><table width="740" border="0" cellpadding="0" cellspacing="0" summary="">
  73          <tr>
  74            <td colspan="2"><img src="../img/leer.gif" alt="" width="1" height="9" /></td>
  75          </tr>
  76          <tr>
  77            <td valign="top" class="navtext">PHPWCMS UPGRADE VERSION&nbsp;<?php echo $phpwcms['release'].', RELEASE '.$phpwcms['release_date'] ?></td>
  78            <td align="right" valign="top" class="navtext"><a href="../index.php" target="_top">HOME</a> |
  79              <a href="setup.php">SETUP</a> | <a href="index.php" target="_top">LICENCE</a> | <a href="<?php echo PHPWCMS_URL.get_login_file() ?>" target="_top">LOGIN</a></td>
  80          </tr>
  81      </table></td>
  82      <td valign="top" style="background-image:url(../img/backend/backend_r3_c4.jpg); background-repeat:repeat-x; "><img src="../img/backend/backend_r3_c7.jpg" alt="" width="15" height="40" /></td>
  83    </tr>
  84    <tr bgcolor="#FFFFFF">
  85      <td width="15" bgcolor="#FFFFFF" style="background-image:url(../img/backend/preinfo2_r7_c2.gif);background-repeat:repeat-y;"><img src="../img/leer.gif" alt="" width="15" height="1" /></td>
  86      <td valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="0" cellspacing="0" style="border:1px dotted #7599BB;" summary="">
  87          <tr>
  88            <td colspan="4"><img src="../img/leer.gif" alt="" width="1" height="6" /></td>
  89          </tr>
  90          <tr>
  91            <td width="6" rowspan="10"><img src="../img/leer.gif" alt="" width="6" height="1" /></td>
  92            <td align="right" class="chatlist">&nbsp;system:&nbsp;</td>
  93            <td class="chatlist" width="100%"><?php echo php_uname() ?></td>
  94            <td width="6" rowspan="10"><img src="../img/leer.gif" alt="" width="6" height="1" /></td>
  95          </tr>
  96          <tr>
  97            <td align="right" class="chatlist">server:&nbsp;</td>
  98            <td class="chatlist"><?php echo $_SERVER['SERVER_SOFTWARE'] ?></td>
  99          </tr>
 100          <tr>
 101            <td align="right" class="chatlist">php:&nbsp;</td>
 102            <td class="chatlist">v<?php echo PHP_VERSION ?></td>
 103          </tr>
 104          <tr>
 105            <td align="right" class="chatlist">mysql:&nbsp;</td>
 106            <td class="chatlist"><?php echo mysql_get_client_info() ?> (is just client information, server might be different)</td>
 107          </tr>
 108          <tr>
 109            <td align="right" class="chatlist">path:&nbsp;</td>
 110            <td class="chatlist"><?php echo html_specialchars(str_replace("\\", '/', preg_replace('/\/setup$/','', dirname(__FILE__)))); ?></td>
 111          </tr>
 112          <tr>
 113            <td align="right" class="chatlist">php.ini:&nbsp;</td>
 114            <td class="chatlist"><?php
 115            
 116            if(ini_get('register_globals')) {
 117                echo 'register_globals = On -&gt; should always be set Off because of <a href="http://phpsec.org/projects/guide/1.html#1.3" target="_blank" style="text-decoration:underline">security risks</a>';
 118            } else {
 119              echo 'register_globals = Off -&gt; that\'s good :)';
 120            }
 121            
 122            
 123            
 124            ?></td>
 125          </tr>
 126          <tr>
 127            <td align="right" class="chatlist">&nbsp;</td>
 128            <td class="chatlist"><?php
 129            
 130            if(ini_get('safe_mode')) {
 131                echo 'safe_mode = On -&gt; you have limited permissions, you might not be able to use ImageMagick';
 132            } else {
 133              echo 'safe_mode = Off -&gt; good when you want to use ImageMagick, may have some <a href="http://phpsec.org/" target="_blank" style="text-decoration:underline">security risks</a>';
 134            }
 135            
 136            ?></td>
 137          </tr>
 138          <tr>
 139            <td align="right" class="chatlist">&nbsp;</td>
 140            <td class="chatlist">GD = <?php 
 141                      
 142                  $_phpinfo = parsePHPModules();
 143                  if(isset($_phpinfo['gd']['GD Support']) && $_phpinfo['gd']['GD Support'] == 'enabled') {
 144                      echo 'On';
 145                      echo isset($_phpinfo['gd']['GD Version']) ? ' -&gt; '.$_phpinfo['gd']['GD Version'] : '';
 146                  } else {
 147                      echo 'Off';
 148                  }
 149                  
 150                  
 151          
 152          ?></td>
 153          </tr>
 154          <tr>
 155            <td colspan="2" class="chatlist"><img src="../img/leer.gif" alt="" width="1" height="6" /></td>
 156          </tr>
 157          <tr>
 158            <td colspan="2" class="chatlist"><div id="warning">
 159  <p><strong>ATTENTION! </strong>Before you start updating &#8212; <strong>backup</strong> all
 160    phpwcms files AND  all databases. Sometimes it might be better you merge SQL
 161     files manually. Don't forget to make copies of  CSS files, templates,
 162    images, settings and custom scripts.</p>
 163  </div></td>
 164          </tr>
 165          
 166          <tr>
 167            <td colspan="4"><img src="../img/leer.gif" alt="" width="1" height="6" /></td>
 168          </tr>
 169      </table>      
 170  
 171      
 172  
 173    <h1>When upgrading from releases older than 1.1.9:</h1>
 174   <p> There are some deeper changes. After upgrading db frame the following<br />
 175    files needs to be processed.<br />
 176    1) <a href="upgrade_filestorage.php" target="_blank"><strong>UPGRADE FILESTORAGE</strong></a> (all
 177    files will be moved and renamed)<br />
 178    2) <a href="upgrade_articleimages.php" target="_blank"><strong>UPGRADE ARTICLE
 179      CONTENT IMAGE</strong></a><br />
 180    3) <a href="upgrade_articleimagelist.php" target="_blank"><strong>UPGRADE ARTICLE
 181  CONTENT IMAGELIST</strong></a><br />
 182   4) <a href="upgrade_articleimg.php" target="_blank"><strong>UPGRADE ARTICLE
 183   SUMMARY IMAGE</strong></a></p>
 184   <h1>When upgrading from releases older than 1.2.9:</h1>
 185  <p>5) <a href="upgrade_pagelayout.php" target="_blank"><strong>UPGRADE PAGELAYOUT</strong></a></p>
 186  <h1>When upgrading from releases older than 1.3.1:</h1>
 187  <p>6) <a href="upgrade_multimedia.php" target="_blank"><strong>UPGRADE CONTENT PART MULTIMEDIA</strong></a></p>
 188  <p>6) <a href="upgrade_articlealias.php" target="_blank"><strong>UPDATE ARTICLE ALIAS</strong></a></p>
 189  <?php
 190  $do = 0;
 191  if(isset($_POST['sqlfile']) && isset($_GET["do"]) && $_GET["do"] == "upgrade") {
 192  
 193      $file = str_replace('inc/showsql.php?f=', '', slweg($_POST['sqlfile']));
 194      if(file_exists("update_sql/".$file)) {
 195          $do = 1;
 196      }
 197  }
 198  
 199  if($do) {
 200  
 201      $sql_data = read_textfile("update_sql/".$file);
 202      $sql_data = preg_replace("/#.*.\n/", "", $sql_data );
 203      $sql_data = preg_replace("/ `phpwcms/", " `".DB_PREPEND."phpwcms", $sql_data );
 204      $sql = explode(";", $sql_data);
 205  
 206      echo '<div id="license" style="width:550px">';
 207      echo '<p><a href="upgrade.php">Chosse another SQL file...</a></p>';
 208      echo '<pre>';
 209  
 210      foreach($sql as $key => $value) {
 211          $value = trim($value);
 212          if(!$value) {
 213              unset($sql[$key]);
 214          } else {
 215          
 216              if($phpwcms['db_version'] > 40100 && $phpwcms['db_charset']=='utf8') {
 217                  $value = utf8_encode($value);
 218              }
 219          
 220              if(!mysql_query($value)) echo '<span class="error">ERROR: '.html_entities(@mysql_error())." -&gt; </span>";
 221              echo html_specialchars($value).";\n";
 222          }
 223      }
 224      
 225      echo '</pre></div>';
 226  
 227  } else {
 228  
 229  ?>
 230  <form action="upgrade.php?do=upgrade" method="post" name="form1" id="form1">
 231  <p><strong>Please proof!</strong> Upgrade script will use following data:</p>
 232  <table border="0" cellpadding="0" cellspacing="0" class="sqlselect" summary="">
 233  
 234  <?php
 235  
 236  if(empty($phpwcms['db_charset']) || empty($phpwcms['db_collation']) || empty($phpwcms['db_version'])) {
 237  
 238  ?>
 239    <tr bgcolor="#FFFFFF">
 240      <td align="right" valign="top">MySQL basics:</td>
 241      <td style="color:#FFFFFF;background-color:    #CC3300;" valign="top">
 242          <strong>Before you continue proof the following config settings:</strong><br />
 243          $phpwcms['db_charset']<br />
 244          $phpwcms['db_collation']<br />
 245          $phpwcms['db_version']<br />
 246          If you are not sure how to handle this <br />
 247          try to start setup process! <br />
 248          <strong>But STOP SETUP BEFORE SQL IMPORT!!!</strong> </td>
 249    </tr>
 250  <?php
 251  }
 252  ?>
 253  
 254    <tr bgcolor="#FFFFFF">
 255      <td align="right">MySQL host:</td>
 256      <td style="font-weight:bold; "><?php echo $phpwcms["db_host"] ?></td>
 257    </tr>
 258    <tr bgcolor="#FFFFFF">
 259      <td align="right">Database:</td>
 260      <td style="font-weight:bold; "><?php echo $phpwcms["db_table"] ?></td>
 261    </tr>
 262    <tr bgcolor="#FFFFFF">
 263      <td align="right">DB user:</td>
 264      <td style="font-weight:bold; "><?php echo $phpwcms["db_user"] ?></td>
 265    </tr>
 266    <tr bgcolor="#FFFFFF">
 267      <td align="right">DB table prefix:</td>
 268      <td style="font-weight:bold; "><?php echo $phpwcms["db_prepend"] ?>&nbsp;</td>
 269    </tr>
 270    
 271    
 272  
 273    
 274    
 275    <tr bgcolor="#FFFFFF">
 276      <td align="right">&nbsp;select&nbsp;SQL&nbsp;file:</td>
 277      <td><select name="sqlfile" id="sqlfile" onchange="window.open(this.options[this.selectedIndex].value,'sqlqueries')">
 278        <option value="inc/showsql.php" style="font-weight:bold; font-style:italic;">Please select&#8230;</option>
 279        <?php
 280  
 281  $dir = 'update_sql';
 282  if(is_dir($dir)) {
 283      $ph            = opendir($dir);
 284      $dir_sql    = array();
 285      while($pf = readdir($ph)) {
 286             if( $pf != '.' && $pf != '..' && !is_dir($dir.'/'.$pf) && preg_match('/(\.sql)$/', strtolower($pf)) ) 
 287          {
 288              $dir_sql[] = html_specialchars($pf);
 289          }
 290      }
 291      closedir($ph);
 292      
 293      natsort($dir_sql);
 294      
 295      foreach($dir_sql as $pf) {
 296      
 297          echo '<option value="inc/showsql.php?f='.$pf.'">'.$pf."</option>\n";
 298      
 299      }
 300      
 301  }
 302      
 303      
 304      
 305  ?>
 306      </select></td>
 307    </tr>
 308  </table>
 309  <p style="margin-top:5px;"><strong>SQL queries to be processed:</strong></p>
 310  <iframe name="sqlqueries" id="sqlqueries" frameborder="0" scrolling="auto" src="inc/showsql.php"></iframe>
 311  <p><input name="submit" type="submit" value="Upgrade database" /></p>
 312  </form>
 313  <?php 
 314  
 315  }
 316  
 317  ?>
 318  
 319          
 320      </td>
 321      <td width="15" bgcolor="#FFFFFF" style="background-image:url(../img/backend/preinfo2_r7_c7.gif);background-repeat:repeat-y;background-position:right;"><img src="../img/leer.gif" alt="" width="15" height="1" /></td>
 322    </tr>
 323    <tr>
 324      <td><img src="../img/backend/backend_a_r1_c1.gif" alt="" width="15" height="15" border="0" /></td>
 325      <td valign="bottom" bgcolor="#FFFFFF" class="navtext"><img src="../img/backend/backend_r6_c2.jpg" alt="" width="740" height="15" border="0" /></td>
 326      <td valign="bottom" class="navtext"><img src="../img/backend/backend_a_r1_c7.gif" alt="" width="15" height="15" border="0" /></td>
 327    </tr>
 328    <tr>
 329      <td width="15"><img src="../img/leer.gif" alt="" width="14" height="20" /></td>
 330      <td colspan="2" valign="bottom" class="navtext"><a href="http://www.phpwcms.de" target="_blank">phpwcms</a> &copy; 2003&#8212;2007  <a title="oliver at phpwcms dot de" onclick="location.href='mailto:oliver'+'@'+'phpwcms'+'.'+'de';return false;" href="#">Oliver Georgi</a>. Licensed under <a href="http://www.gnu.org/licenses/gpl.html" target="_blank">GPL</a>.
 331          Extensions are copyright of their respective owners.</td>
 332    </tr>
 333    <tr>
 334      <td colspan="3"><img src="../img/leer.gif" alt="" width="1" height="8" /></td>
 335    </tr>
 336  </table>
 337  </body>
 338  </html>


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7