[ Index ] |
PHP Cross Reference of phpwcms V1.5.0 _r431 (28.01.12) |
[Summary view] [Print] [Text view]
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 //used to convert old style file uploads 24 25 $phpwcms = array(); 26 27 require_once ('../config/phpwcms/conf.inc.php'); 28 require_once ('../include/inc_lib/default.inc.php'); 29 require_once (PHPWCMS_ROOT.'/include/inc_lib/dbcon.inc.php'); 30 require_once (PHPWCMS_ROOT.'/include/inc_lib/general.inc.php'); 31 require_once (PHPWCMS_ROOT.'/include/inc_lib/backend.functions.inc.php'); 32 33 ?> 34 <html> 35 <body> 36 <h3>Upgrade article summary image for article</h3> 37 <?php 38 39 // get all articles 40 if($all = _dbQuery("SELECT article_id, article_image, article_title, article_tstamp FROM ".DB_PREPEND."phpwcms_article")) { 41 42 foreach($all as $key => $value) { 43 44 $all[$key]['article_image'] = unserialize($all[$key]['article_image']); 45 if(isset($all[$key]['article_image']['prev']) && !empty($all[$key]['article_image']['id'])) { 46 47 //dumpVar($all[$key]); 48 49 unset($all[$key]['article_image']['prev']); 50 unset($all[$key]['article_image']['prev_info']); 51 unset($all[$key]['article_image']['prev_make']); 52 unset($all[$key]['article_image']['add']); 53 unset($all[$key]['article_image']['cname']); 54 55 $all[$key]['article_image']['id'] = intval($all[$key]['article_image']['id']); 56 57 // retrieve image information 58 $file = _dbQuery("SELECT f_id, f_hash, f_ext FROM ".DB_PREPEND."phpwcms_file WHERE f_id=".$all[$key]['article_image']['id']." LIMIT 1"); 59 60 if(!empty($file[0]['f_id']) && $file[0]['f_id'] == $all[$key]['article_image']['id']) { 61 $all[$key]['article_image']['hash'] = $file[0]['f_hash']; 62 $all[$key]['article_image']['ext'] = $file[0]['f_ext']; 63 $all[$key]['article_image']['list_usesummary'] = 1; 64 65 $sql = "UPDATE ".DB_PREPEND."phpwcms_article SET "; 66 $sql .= "article_image = '".aporeplace(serialize($all[$key]['article_image']))."',"; 67 $sql .= "article_tstamp = '".$all[$key]['article_tstamp']."' WHERE article_id = ".$all[$key]['article_id']." LIMIT 1"; 68 69 $result = _dbQuery($sql, 'UPDATE'); 70 71 echo '<pre'; 72 if($result === false) { 73 echo ' style="color:#CC3300"'; 74 } 75 echo '>[ID:'.sprintf('%04s', $all[$key]['article_id']).'] '.html_specialchars($all[$key]['article_title']); 76 echo '</pre>'.LF; 77 78 } 79 80 } else { 81 82 unset($all[$key]); 83 84 } 85 86 } 87 88 } 89 ?> 90 91 <p><strong>Done!</strong> All articles not listed here are not touched.</p> 92 </body> 93 </html>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Jan 29 16:31:14 2012 | Cross-referenced by PHPXref 0.7.1 |