[ Index ]

PHP Cross Reference of phpwcms V1.5.0 _r431 (28.01.12)

title

Body

[close]

/setup/ -> upgrade.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2012 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>7) <a href="upgrade_articlealias.php" target="_blank"><strong>UPDATE ARTICLE ALIAS</strong></a></p>
 189  
 190  <h1>Update old default article end date 2010-12-31, 23:59:59:</h1>
 191  <p>8) <a href="upgrade_articledate.php" target="_blank"><strong>SET ARTICLE END 2010-12-31, 23:59:59 plus 20 YEARS</strong></a></p>
 192  
 193  <?php
 194  $do = 0;
 195  if(isset($_POST['sqlfile']) && isset($_GET["do"]) && $_GET["do"] == "upgrade") {
 196  
 197      $file = str_replace('inc/showsql.php?f=', '', slweg($_POST['sqlfile']));
 198      if(file_exists("update_sql/".$file)) {
 199          $do = 1;
 200      }
 201  }
 202  
 203  if($do) {
 204  
 205      $sql_data = read_textfile("update_sql/".$file);
 206      $sql_data = preg_replace("/#.*.\n/", "", $sql_data );
 207      $sql_data = preg_replace("/ `phpwcms/", " `".DB_PREPEND."phpwcms", $sql_data );
 208      $sql = explode(";", $sql_data);
 209  
 210      echo '<div id="license" style="width:550px">';
 211      echo '<p><a href="upgrade.php">Chosse another SQL file...</a></p>';
 212      echo '<pre>';
 213  
 214      foreach($sql as $key => $value) {
 215          $value = trim($value);
 216          if(!$value) {
 217              unset($sql[$key]);
 218          } else {
 219          
 220              if($phpwcms['db_version'] > 40100 && $phpwcms['db_charset']=='utf8') {
 221                  $value = utf8_encode($value);
 222              }
 223          
 224              if(!mysql_query($value)) echo '<span class="error">ERROR: '.html_entities(@mysql_error())." -&gt; </span>";
 225              echo html_specialchars($value).";\n";
 226          }
 227      }
 228      
 229      echo '</pre></div>';
 230  
 231  } else {
 232  
 233  ?>
 234  <form action="upgrade.php?do=upgrade" method="post" name="form1" id="form1">
 235  <p><strong>Please proof!</strong> Upgrade script will use following data:</p>
 236  <table border="0" cellpadding="0" cellspacing="0" class="sqlselect" summary="">
 237  
 238  <?php
 239  
 240  if(empty($phpwcms['db_charset']) || empty($phpwcms['db_collation']) || empty($phpwcms['db_version'])) {
 241  
 242  ?>
 243    <tr bgcolor="#FFFFFF">
 244      <td align="right" valign="top">MySQL basics:</td>
 245      <td style="color:#FFFFFF;background-color:    #CC3300;" valign="top">
 246          <strong>Before you continue proof the following config settings:</strong><br />
 247          $phpwcms['db_charset']<br />
 248          $phpwcms['db_collation']<br />
 249          $phpwcms['db_version']<br />
 250          If you are not sure how to handle this <br />
 251          try to start setup process! <br />
 252          <strong>But STOP SETUP BEFORE SQL IMPORT!!!</strong> </td>
 253    </tr>
 254  <?php
 255  }
 256  ?>
 257  
 258    <tr bgcolor="#FFFFFF">
 259      <td align="right">MySQL host:</td>
 260      <td style="font-weight:bold; "><?php echo $phpwcms["db_host"] ?></td>
 261    </tr>
 262    <tr bgcolor="#FFFFFF">
 263      <td align="right">Database:</td>
 264      <td style="font-weight:bold; "><?php echo $phpwcms["db_table"] ?></td>
 265    </tr>
 266    <tr bgcolor="#FFFFFF">
 267      <td align="right">DB user:</td>
 268      <td style="font-weight:bold; "><?php echo $phpwcms["db_user"] ?></td>
 269    </tr>
 270    <tr bgcolor="#FFFFFF">
 271      <td align="right">DB table prefix:</td>
 272      <td style="font-weight:bold; "><?php echo $phpwcms["db_prepend"] ?>&nbsp;</td>
 273    </tr>
 274    
 275    
 276  
 277    
 278    
 279    <tr bgcolor="#FFFFFF">
 280      <td align="right">&nbsp;select&nbsp;SQL&nbsp;file:</td>
 281      <td><select name="sqlfile" id="sqlfile" onchange="window.open(this.options[this.selectedIndex].value,'sqlqueries')">
 282        <option value="inc/showsql.php" style="font-weight:bold; font-style:italic;">Please select&#8230;</option>
 283        <?php
 284  
 285  $dir = 'update_sql';
 286  if(is_dir($dir)) {
 287      $ph            = opendir($dir);
 288      $dir_sql    = array();
 289      while($pf = readdir($ph)) {
 290             if( $pf != '.' && $pf != '..' && !is_dir($dir.'/'.$pf) && preg_match('/(\.sql)$/', strtolower($pf)) ) 
 291          {
 292              $dir_sql[] = html_specialchars($pf);
 293          }
 294      }
 295      closedir($ph);
 296      
 297      natsort($dir_sql);
 298      
 299      foreach($dir_sql as $pf) {
 300      
 301          echo '<option value="inc/showsql.php?f='.$pf.'">'.$pf."</option>\n";
 302      
 303      }
 304      
 305  }
 306      
 307      
 308      
 309  ?>
 310      </select></td>
 311    </tr>
 312  </table>
 313  <p style="margin-top:5px;"><strong>SQL queries to be processed:</strong></p>
 314  <iframe name="sqlqueries" id="sqlqueries" frameborder="0" scrolling="auto" src="inc/showsql.php"></iframe>
 315  <p><input name="submit" type="submit" value="Upgrade database" /></p>
 316  </form>
 317  <?php 
 318  
 319  }
 320  
 321  ?>
 322  
 323          
 324      </td>
 325      <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>
 326    </tr>
 327    <tr>
 328      <td><img src="../img/backend/backend_a_r1_c1.gif" alt="" width="15" height="15" border="0" /></td>
 329      <td valign="bottom" bgcolor="#FFFFFF" class="navtext"><img src="../img/backend/backend_r6_c2.jpg" alt="" width="740" height="15" border="0" /></td>
 330      <td valign="bottom" class="navtext"><img src="../img/backend/backend_a_r1_c7.gif" alt="" width="15" height="15" border="0" /></td>
 331    </tr>
 332    <tr>
 333      <td width="15"><img src="../img/leer.gif" alt="" width="14" height="20" /></td>
 334      <td colspan="2" valign="bottom" class="navtext"><a href="http://www.phpwcms.de" target="_blank">phpwcms</a> &copy; 2003&#8212;<?php echo date('Y') ?>  <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>.
 335          Extensions are copyright of their respective owners.</td>
 336    </tr>
 337    <tr>
 338      <td colspan="3"><img src="../img/leer.gif" alt="" width="1" height="8" /></td>
 339    </tr>
 340  </table>
 341  </body>
 342  </html>


Generated: Sun Jan 29 16:31:14 2012 Cross-referenced by PHPXref 0.7.1