2021-08-23 23:55:52 +00:00
< ? php
2021-09-02 18:35:25 +00:00
/**
* @ brief enhancePostContent , a plugin for Dotclear 2
*
* @ package Dotclear
* @ subpackage Plugin
*
* @ author Jean - Christian Denis and Contributors
*
* @ copyright Jean - Christian Denis
* @ copyright GPL - 2.0 https :// www . gnu . org / licenses / gpl - 2.0 . html
*/
2021-08-23 23:55:52 +00:00
# This file only update old filters lists from settings to database
2021-08-24 20:05:23 +00:00
$f = $core -> con -> select ( " SELECT * FROM " . $core -> prefix . " setting WHERE setting_ns='enhancePostContent' AND blog_id IS NOT NULL " );
2021-08-23 23:55:52 +00:00
2021-08-24 20:05:23 +00:00
while ( $f -> fetch ()) {
if ( preg_match ( '#enhancePostContent_(.*?)List#' , $f -> setting_id , $m )) {
$curlist = @ unserialize ( $f -> setting_value );
if ( is_array ( $curlist )) {
foreach ( $curlist as $k => $v ) {
$cur = $core -> con -> openCursor ( $core -> prefix . 'epc' );
$core -> con -> writeLock ( $core -> prefix . 'epc' );
2021-08-23 23:55:52 +00:00
2021-08-24 20:05:23 +00:00
$cur -> epc_id = $core -> con -> select ( 'SELECT MAX(epc_id) FROM ' . $core -> prefix . 'epc' . ' ' ) -> f ( 0 ) + 1 ;
$cur -> blog_id = $f -> blog_id ;
$cur -> epc_filter = $m [ 1 ];
$cur -> epc_key = $k ;
$cur -> epc_value = $v ;
2021-08-23 23:55:52 +00:00
2021-08-24 20:05:23 +00:00
$cur -> insert ();
$core -> con -> unlock ();
}
}
$core -> con -> execute ( " DELETE FROM " . $core -> prefix . " setting WHERE setting_id=' " . $f -> setting_id . " ' AND setting_ns='enhancePostContent' AND blog_id=' " . $f -> blog_id . " ' " );
}
}