Revision 2058
Added by darkviper almost 12 years ago
| branches/2.8.x/CHANGELOG | ||
|---|---|---|
| 11 | 11 |
! = Update/Change |
| 12 | 12 |
=============================================================================== |
| 13 | 13 |
|
| 14 |
01 Jan-2014 Build 2058 Manuela v.d.Decken(DarkViper) |
|
| 15 |
! change wysiwyg module from filterMediaRel to filterReplaceSysvar |
|
| 16 |
! change wb::ReplaceAbsoluteMediaUrl from filterMediaRel to filterReplaceSysvar |
|
| 14 | 17 |
01 Jan-2014 Build 2057 Manuela v.d.Decken(DarkViper) |
| 15 | 18 |
! replace filterMediaRel by filterReplaceSysvar in module/output_filter |
| 16 | 19 |
+ add OutputFilterApi in module/outputfilter |
| branches/2.8.x/wb/admin/interface/version.php | ||
|---|---|---|
| 51 | 51 |
|
| 52 | 52 |
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled) |
| 53 | 53 |
if(!defined('VERSION')) define('VERSION', '2.8.4');
|
| 54 |
if(!defined('REVISION')) define('REVISION', '2057');
|
|
| 54 |
if(!defined('REVISION')) define('REVISION', '2058');
|
|
| 55 | 55 |
if(!defined('SP')) define('SP', '');
|
| branches/2.8.x/wb/framework/class.wb.php | ||
|---|---|---|
| 647 | 647 |
// $message = preg_replace('/[\r\n]/', '<br \>', $message);
|
| 648 | 648 |
|
| 649 | 649 |
// create PHPMailer object and define default settings |
| 650 |
$myMail = new wbmailer();
|
|
| 650 |
$myMail = new WbMailer();
|
|
| 651 | 651 |
// set user defined from address |
| 652 | 652 |
if ($fromaddress!='') {
|
| 653 | 653 |
if($fromname!='') $myMail->FromName = $fromname; // FROM-NAME |
| ... | ... | |
| 750 | 750 |
* independend placeholder |
| 751 | 751 |
*/ |
| 752 | 752 |
public function ReplaceAbsoluteMediaUrl($sContent){
|
| 753 |
$oReg = WbAdaptor::getInstance(); |
|
| 753 | 754 |
if(ini_get('magic_quotes_gpc')==true){
|
| 754 | 755 |
$sContent = $this->strip_slashes($sContent); |
| 755 | 756 |
} |
| 756 | 757 |
if(is_string($sContent)) {
|
| 757 |
$sMediaUrl = WB_URL.MEDIA_DIRECTORY; |
|
| 758 |
$aSearchfor = array('@(<[^>]*=\s*")('.preg_quote($sMediaUrl).')([^">]*".*>)@siU',
|
|
| 759 |
'@(<[^>]*=\s*")('.preg_quote(WB_URL).')([^">]*".*>)@siU');
|
|
| 760 |
$aReplacements = array('$1{SYSVAR:MEDIA_REL}$3',
|
|
| 761 |
'$1{SYSVAR:WB_REL}$3');
|
|
| 758 |
$aSearchfor = array('@(<[^>]*=\s*")('.preg_quote($oReg->AppUrl.$oReg->MediaDir).')([^">]*".*>)@siU',
|
|
| 759 |
'@(<[^>]*=\s*")('.preg_quote($oReg->AppUrl).')([^">]*".*>)@siU');
|
|
| 760 |
$aReplacements = array('$1{SYSVAR:AppUrl.MediaDir}$3',
|
|
| 761 |
'$1{SYSVAR:AppUrl}$3');
|
|
| 762 | 762 |
$sContent = preg_replace($aSearchfor, $aReplacements, $sContent ); |
| 763 | 763 |
} |
| 764 | 764 |
return $sContent; |
| branches/2.8.x/wb/modules/wysiwyg/view.php | ||
|---|---|---|
| 21 | 21 |
throw new IllegalFileException(); |
| 22 | 22 |
} |
| 23 | 23 |
/* -------------------------------------------------------- */ |
| 24 |
$sMediaUrl = WB_URL.MEDIA_DIRECTORY; |
|
| 24 |
//$sMediaUrl = WB_URL.MEDIA_DIRECTORY;
|
|
| 25 | 25 |
// Get content |
| 26 |
$content = '';
|
|
| 27 |
$sql = 'SELECT `content` FROM `'.TABLE_PREFIX.'mod_wysiwyg` WHERE `section_id`='.(int)$section_id;
|
|
| 26 |
$sql = 'SELECT `content` FROM `'.TABLE_PREFIX.'mod_wysiwyg` '
|
|
| 27 |
. 'WHERE `section_id`='.(int)$section_id;
|
|
| 28 | 28 |
if(($content = $database->get_one($sql))) {
|
| 29 |
$content = str_replace('{SYSVAR:MEDIA_REL}', $sMediaUrl, $content );
|
|
| 30 |
$content = str_replace('{SYSVAR:WB_REL}', WB_URL, $content );
|
|
| 29 |
echo $content; |
|
| 30 |
} else {
|
|
| 31 |
echo ''; |
|
| 31 | 32 |
} |
| 32 |
echo $content; |
|
| branches/2.8.x/wb/modules/wysiwyg/modify.php | ||
|---|---|---|
| 27 | 27 |
// Get page content |
| 28 | 28 |
$sql = 'SELECT `content` FROM `'.TABLE_PREFIX.'mod_wysiwyg` WHERE `section_id`='.(int)$section_id; |
| 29 | 29 |
if (($content = $database->get_one($sql)) !== null) {
|
| 30 |
$content = str_replace('{SYSVAR:MEDIA_REL}', $sMediaUrl, $content);
|
|
| 31 |
$content = htmlspecialchars(str_replace('{SYSVAR:WB_REL}', WB_URL, $content));
|
|
| 30 |
$sFilterApi = WB_PATH.'/modules/output_filter/OutputFilterApi.php'; |
|
| 31 |
if (is_readable($sFilterApi)) {
|
|
| 32 |
require_once($sFilterApi); |
|
| 33 |
$content = OutputFilterApi('ReplaceSysvar', $content);
|
|
| 34 |
} |
|
| 35 |
$content = htmlspecialchars($content); |
|
| 32 | 36 |
} else {
|
| 33 | 37 |
$content = 'There is an relation error in the database.'; |
| 34 | 38 |
$sql = 'INSERT INTO `'.TABLE_PREFIX.'mod_wysiwyg` SET ' |
| branches/2.8.x/wb/modules/wysiwyg/upgrade.php | ||
|---|---|---|
| 24 | 24 |
|
| 25 | 25 |
function mod_wysiwyg_upgrade ($bDebug=false) {
|
| 26 | 26 |
global $OK ,$FAIL; |
| 27 |
$database=WbDatabase::getInstance(); |
|
| 27 |
$oDb = WbDatabase::getInstance(); |
|
| 28 |
$oReg = WbAdaptor::getInstance(); |
|
| 28 | 29 |
$msg = array(); |
| 29 | 30 |
$callingScript = $_SERVER["SCRIPT_NAME"]; |
| 30 | 31 |
// check if upgrade startet by upgrade-script to echo a message |
| ... | ... | |
| 42 | 43 |
return ( ($globalStarted==true ) ? $globalStarted : $msg); |
| 43 | 44 |
} else {
|
| 44 | 45 |
for($x=0; $x<sizeof($aTable);$x++) {
|
| 45 |
if(($sOldType = $database->getTableEngine($database->TablePrefix.$aTable[$x]))) {
|
|
| 46 |
if(($sOldType = $oDb->getTableEngine($oDb->TablePrefix.$aTable[$x]))) {
|
|
| 46 | 47 |
if(('myisam' != strtolower($sOldType))) {
|
| 47 |
if(!$database->query('ALTER TABLE `'.$database->TablePrefix.$aTable[$x].'` Engine = \'MyISAM\' ')) {
|
|
| 48 |
$msg[] = $database->get_error();
|
|
| 48 |
if(!$oDb->query('ALTER TABLE `'.$oDb->TablePrefix.$aTable[$x].'` Engine = \'MyISAM\' ')) {
|
|
| 49 |
$msg[] = $oDb->get_error();
|
|
| 49 | 50 |
} else{
|
| 50 |
$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` changed to Engine = \'MyISAM\''." $OK";
|
|
| 51 |
$msg[] = 'TABLE `'.$oDb->TablePrefix.$aTable[$x].'` changed to Engine = \'MyISAM\''." $OK";
|
|
| 51 | 52 |
} |
| 52 | 53 |
} else {
|
| 53 |
$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` has Engine = \'MyISAM\''." $OK";
|
|
| 54 |
$msg[] = 'TABLE `'.$oDb->TablePrefix.$aTable[$x].'` has Engine = \'MyISAM\''." $OK";
|
|
| 54 | 55 |
} |
| 55 | 56 |
} else {
|
| 56 |
$msg[] = $database->get_error();
|
|
| 57 |
$msg[] = $oDb->get_error();
|
|
| 57 | 58 |
} |
| 58 | 59 |
} |
| 59 | 60 |
// add change or missing index |
| 60 |
$sTable = $database->TablePrefix.'mod_wysiwyg';
|
|
| 61 |
if($database->index_exists($sTable, 'PRIMARY')) {
|
|
| 62 |
$sql = 'ALTER TABLE `'.$database->DbName.'`.`'.$sTable.'` DROP PRIMARY KEY';
|
|
| 63 |
if(!$database->query($sql)) {
|
|
| 64 |
$msg[] = ''.$database->get_error();
|
|
| 61 |
$sTable = $oDb->TablePrefix.'mod_wysiwyg';
|
|
| 62 |
if($oDb->index_exists($sTable, 'PRIMARY')) {
|
|
| 63 |
$sql = 'ALTER TABLE `'.$oDb->DbName.'`.`'.$sTable.'` DROP PRIMARY KEY';
|
|
| 64 |
if(!$oDb->query($sql)) {
|
|
| 65 |
$msg[] = ''.$oDb->get_error();
|
|
| 65 | 66 |
} |
| 66 | 67 |
} |
| 67 |
if(!$database->index_add($sTable, '', 'section_id', 'PRIMARY')) {
|
|
| 68 |
$msg[] = ''.$database->get_error();
|
|
| 68 |
if(!$oDb->index_add($sTable, '', 'section_id', 'PRIMARY')) {
|
|
| 69 |
$msg[] = ''.$oDb->get_error();
|
|
| 69 | 70 |
} else {
|
| 70 | 71 |
$msg[] = 'Create PRIMARY KEY ( `section_id` )'." $OK"; |
| 71 | 72 |
} |
| 72 | 73 |
// change table structure |
| 73 |
$sTable = $database->TablePrefix.'mod_wysiwyg';
|
|
| 74 |
$sTable = $oDb->TablePrefix.'mod_wysiwyg';
|
|
| 74 | 75 |
$sDescription = 'LONGTEXT NOT NULL'; |
| 75 | 76 |
$sFieldName = 'text'; |
| 76 |
if(!$database->field_modify($sTable,$sFieldName,$sDescription)) {
|
|
| 77 |
$msg[] = ''.$database->get_error();
|
|
| 77 |
if(!$oDb->field_modify($sTable,$sFieldName,$sDescription)) {
|
|
| 78 |
$msg[] = ''.$oDb->get_error();
|
|
| 78 | 79 |
} else {
|
| 79 | 80 |
$msg[] = 'Field ( `text` ) description has been changed successfully'." $OK"; |
| 80 | 81 |
} |
| 81 | 82 |
$sFieldName = 'content'; |
| 82 |
if(!$database->field_modify($sTable,$sFieldName,$sDescription)) {
|
|
| 83 |
$msg[] = ''.$database->get_error();
|
|
| 83 |
if(!$oDb->field_modify($sTable,$sFieldName,$sDescription)) {
|
|
| 84 |
$msg[] = ''.$oDb->get_error();
|
|
| 84 | 85 |
} else {
|
| 85 | 86 |
$msg[] = 'Field ( `content` ) description has been changed successfully'." $OK"; |
| 86 | 87 |
} |
| 87 |
// change internal absolute Media links into relative links |
|
| 88 |
$sTable = $database->TablePrefix.'mod_wysiwyg'; |
|
| 89 |
$sql = 'UPDATE `'.$sTable.'` '; |
|
| 90 |
$sql .= 'SET `content` = REPLACE(`content`, \'"'.WB_URL.MEDIA_DIRECTORY.'\', \'"{SYSVAR:MEDIA_REL}\')';
|
|
| 91 |
if (!$database->query($sql)) {
|
|
| 92 |
$msg[] = ''.$database->get_error(); |
|
| 93 |
} else {
|
|
| 94 |
$msg[] = 'Change internal absolute Media links into relative links'." $OK"; |
|
| 95 |
} |
|
| 96 |
// change all other internal absolute links into relative links |
|
| 97 |
$sTable = $database->TablePrefix.'mod_wysiwyg'; |
|
| 98 |
$sql = 'UPDATE `'.$sTable.'` '; |
|
| 99 |
$sql .= 'SET `content` = REPLACE(`content`, \'"'.WB_URL.'\', \'"{SYSVAR:WB_REL}\')';
|
|
| 100 |
if (!$database->query($sql)) {
|
|
| 101 |
$msg[] = ''.$database->get_error(); |
|
| 102 |
} else {
|
|
| 103 |
$msg[] = 'Change internal absolute links into relative links'." $OK"; |
|
| 104 |
} |
|
| 88 |
// change internal absolute links into Sysvar placeholders and repair already existing entries |
|
| 89 |
$sTable = $oDb->TablePrefix.'mod_wysiwyg'; |
|
| 90 |
$sql = 'SELECT `section_id`, `content` FROM `'.$oDb->TablePrefix.'mod_wysiwyg` '; |
|
| 91 |
if (($oEntrySet = $oDb->doQuery($sql))) {
|
|
| 92 |
$iRecords = 0; |
|
| 93 |
$iReplaced = 0; |
|
| 94 |
$aSearch = array( '/\{SYSVAR\:MEDIA_REL\}[\/\\\\]?/sU',
|
|
| 95 |
'/\{SYSVAR\:WB_URL\}[\/\\\\]?/sU',
|
|
| 96 |
'/(\{SYSVAR\:AppUrl\.MediaDir\})[\/\\\\]?/sU',
|
|
| 97 |
'/(\{SYSVAR\:AppUrl\})[\/\\\\]?/sU'
|
|
| 98 |
); |
|
| 99 |
$aReplace = array( '{SYSVAR:AppUrl.MediaDir}', '{SYSVAR:AppUrl}', '\1', '\1' );
|
|
| 100 |
while (($aEntry = $oEntrySet->fetchRow(MYSQL_ASSOC))) {
|
|
| 101 |
$iCount = 0; |
|
| 102 |
$aEntry['content'] = preg_replace($aSearch, $aReplace, $aEntry['content'], -1, $iCount); |
|
| 103 |
if ($iCount > 0) {
|
|
| 104 |
$iReplaced += $iCount; |
|
| 105 |
$sql = 'UPDATE `'.$oDb->TablePrefix.'mod_wysiwyg` ' |
|
| 106 |
. 'SET `content`=\''.$oDb->escapeString($aEntry['content']).'\' ' |
|
| 107 |
. 'WHERE `section_id`='.$aEntry['section_id']; |
|
| 108 |
$oDb->doQuery($sql); |
|
| 109 |
$iRecords++; |
|
| 110 |
} |
|
| 111 |
} |
|
| 112 |
$msg[] = '['.$iRecords.'] records with ['.$iReplaced.'] SYSVAR placeholder(s) repaired'." $OK"; |
|
| 113 |
} |
|
| 114 |
try {
|
|
| 115 |
$sql = 'UPDATE `'.$sTable.'` '; |
|
| 116 |
$sql .= 'SET `content` = REPLACE(`content`, \'"'.$oReg->AppPath.$oReg->MediaDir.'\', \'"{SYSVAR:AppPath.MediaDir}\')';
|
|
| 117 |
$oDb->doQuery($sql); |
|
| 118 |
$msg[] = 'Change internal absolute Media links into SYSVAR placeholders'." $OK"; |
|
| 119 |
} catch(WbDatabaseException $e) {
|
|
| 120 |
$msg[] = ''.$oDb->get_error(); |
|
| 121 |
} |
|
| 122 |
try {
|
|
| 123 |
$sql = 'UPDATE `'.$sTable.'` '; |
|
| 124 |
$sql .= 'SET `content` = REPLACE(`content`, \'"'.$oReg->AppPath.'\', \'"{SYSVAR:AppPath}\')';
|
|
| 125 |
$oDb->doQuery($sql); |
|
| 126 |
$msg[] = 'Change internal absolute links into SYSVAR placeholders'." $OK"; |
|
| 127 |
} catch(WbDatabaseException $e) {
|
|
| 128 |
$msg[] = ''.$oDb->get_error(); |
|
| 129 |
} |
|
| 105 | 130 |
// only for $callingScript upgrade-script.php |
| 106 | 131 |
if($globalStarted) {
|
| 107 | 132 |
if($bDebug) {
|
Also available in: Unified diff
! change wysiwyg module from filterMediaRel to filterReplaceSysvar
! change wb::ReplaceAbsoluteMediaUrl from filterMediaRel to filterReplaceSysvar