pwg_db_real_escape_string($content_new)), array('id' => $row['id']) ); } } $upgrade_description.= ', Additional Pages'; } // // PWG Stuffs // $is_plugin_installed = false; $plugin_table = $prefixeTable.'stuffs'; $query = 'SHOW TABLES LIKE \''.$plugin_table.'\';'; $result = pwg_query($query); while ($row = pwg_db_fetch_row($result)) { if ($plugin_table == $row[0]) { $is_plugin_installed = true; } } if ($is_plugin_installed) { $query = ' SELECT id, datas FROM '.$plugin_table.' WHERE path LIKE \'%plugins/PWG_Stuffs/modules/Personal%\' ;'; $result = pwg_query($query); while ($row = pwg_db_fetch_assoc($result)) { $content_orig = $row['datas']; $content_new = serialize(replace_hotlinks(unserialize($content_orig))); if ($content_orig != $content_new) { single_update( $plugin_table, array('datas' => pwg_db_real_escape_string($content_new)), array('id' => $row['id']) ); } } $upgrade_description.= ', PWG Stuffs'; } $upgrade_description.= ')'; echo "\n".$upgrade_description."\n"; // +-----------------------------------------------------------------------+ // | Functions | // +-----------------------------------------------------------------------+ function replace_hotlinks($string) { global $conf; // websize 2.3 = medium 2.4 $string = preg_replace( '#(upload/\d{4}/\d{2}/\d{2}/\d{14}-\w{8})(\.(jpg|png))#', 'i.php?/$1-me$2', $string ); // I've tried but I didn't find the way to do it correctly // $string = preg_replace( // '#(galleries/.*?/)(?!:(pwg_high|'.$conf['dir_thumbnail'].')/)([^/]*?)(\.[a-z0-9]{3,4})([\'"])#', // 'i.php?/(1=$1)(2=$2)-me(3=$3)(4=$4)', // 'i.php?/$1$2-me$3', // $string // ); // thumbnail 2.3 = th size 2.4 $string = preg_replace( '#(upload/\d{4}/\d{2}/\d{2}/)'.$conf['dir_thumbnail'].'/'.$conf['prefix_thumbnail'].'(\d{14}-\w{8})(\.(jpg|png))#', 'i.php?/$1$2-th$3', $string ); $string = preg_replace( '#(galleries/.*?/)'.$conf['dir_thumbnail'].'/'.$conf['prefix_thumbnail'].'(.*?)(\.[a-z0-9]{3,4})([\'"])#', 'i.php?/$1$2-th$3$4', $string ); // HD 2.3 = original 2.4 $string = preg_replace( '#(upload/\d{4}/\d{2}/\d{2}/)pwg_high/(\d{14}-\w{8}\.(jpg|png))#', '$1$2', $string ); $string = preg_replace( '#(galleries/.*?)/pwg_high(/.*?\.[a-z0-9]{3,4})#', '$1$2', $string ); return $string; } ?>