[ Index ]

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

title

Body

[close]

/setup/ -> upgrade_multimedia.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  //used to convert old style file uploads
  24  
  25  require_once ('../config/phpwcms/conf.inc.php');
  26  require_once  ('../include/inc_lib/default.inc.php');
  27  require_once  (PHPWCMS_ROOT.'/include/inc_lib/dbcon.inc.php');
  28  require_once  (PHPWCMS_ROOT.'/include/inc_lib/general.inc.php');
  29  
  30  echo '<html><body><pre>';
  31  
  32  echo 'CONVERT CONTENT PART MULTIMEDIA' . LF;
  33  echo '=================================================================' . LF.LF;
  34  
  35  $pagelayout = _dbQuery("SELECT * FROM ".DB_PREPEND."phpwcms_articlecontent WHERE acontent_type=9 and acontent_media != ''");
  36  
  37  $c = 1;
  38  
  39  foreach($pagelayout as $var) {
  40  
  41      $media = array();
  42  
  43      $media["media"]         = explode(":", $var["acontent_media"]);
  44      
  45      $media["media_backup"]    = $var["acontent_media"];
  46                                          
  47      $media["media_type"]    = intval($media["media"][0]);
  48      $media["media_player"]    = intval($media["media"][1]);
  49      $media["media_src"]        = intval($media["media"][5]);
  50      $media["media_pos"]        = intval($media["media"][2]);
  51      $media["media_width"]    = intval($media["media"][3]);
  52      $media["media_height"]    = intval($media["media"][4]);
  53      $media["media_auto"]    = (intval($media["media"][8])) ? 1 : 0;
  54      $media["media_transparent"]    = isset($media["media"][9]) ? intval($media["media"][9]) : 0;
  55      $media["media_control"]    = (intval($media["media"][7])) ? 1 : 0;
  56  
  57      if($media["media_src"]) {
  58          // remote Source
  59          $media["media_extern"]    = base64_decode($media["media"][6]);
  60          $media["media_id"]        = 0;
  61          $media["media_name"]    = '';
  62  
  63      } else {
  64          //internal source
  65          list($media["media_id"], $media["media_name"]) = explode(':', base64_decode($media["media"][6]));
  66          $media["media_id"]        = intval($media["media_id"]);
  67          $media["media_name"]    = trim($media["media_name"]);
  68          $media["media_extern"]    = '';
  69      }
  70      
  71      unset($media["media"]);
  72  
  73      $sql  = "UPDATE ".DB_PREPEND."phpwcms_articlecontent SET ";
  74      $sql .=    "acontent_form='".aporeplace(serialize($media))."', acontent_media='', ";
  75      $sql .= "acontent_created='".$var["acontent_created"]."', acontent_tstamp='".$var["acontent_tstamp"]."' ";
  76      $sql .= "WHERE acontent_id = ".$var["acontent_id"];
  77      $upgrade = _dbQuery($sql, 'UPDATE');
  78  
  79      echo sprintf('%05d: ', $c).' CP-ID: '.$var['acontent_id'].LF;
  80      flush();
  81      $c++;
  82  }
  83  
  84  if($c==1) echo 'No content part multimedia found for upgrading!';
  85  
  86  
  87  echo '</pre></body></html>';
  88  
  89  ?>


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