1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 12:20:44 +02:00

Convert serialized core prefs to e107 arrayStorage during upgrade. Modified pref_class. expecting some things to break.. work in progress. default_install.xml should now install default emoticon pack correctly.

This commit is contained in:
CaMer0n
2009-09-01 20:09:36 +00:00
parent bbbde843f6
commit 9cb70e72b9
6 changed files with 95 additions and 214 deletions

View File

@@ -9,9 +9,9 @@
* Administration Area - Emotions Settings & Packs
*
* $Source: /cvs_backup/e107_0.8/e107_admin/emoticon.php,v $
* $Revision: 1.16 $
* $Date: 2009-08-28 16:11:00 $
* $Author: marj_nl_fr $
* $Revision: 1.17 $
* $Date: 2009-09-01 20:09:35 $
* $Author: e107coders $
*
*/
@@ -30,10 +30,11 @@ require_once("auth.php");
require_once(e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
if(!$sql->db_Count("core", "(*)", "WHERE e107_name = 'emote_default'"))
if(!$sql->db_Count("core", "(*)", "WHERE e107_name = 'emote_default' AND e107_value !='' "))
{ // Set up the default emotes
$tmp = 'a:28:{s:9:"alien!png";s:6:"!alien";s:10:"amazed!png";s:7:"!amazed";s:9:"angry!png";s:11:"!grr !angry";s:12:"biglaugh!png";s:4:"!lol";s:11:"cheesey!png";s:10:":D :oD :-D";s:12:"confused!png";s:10:":? :o? :-?";s:7:"cry!png";s:19:"&| &-| &o| :(( !cry";s:8:"dead!png";s:21:"x) xo) x-) x( xo( x-(";s:9:"dodge!png";s:6:"!dodge";s:9:"frown!png";s:10:":( :o( :-(";s:7:"gah!png";s:10:":@ :o@ :o@";s:8:"grin!png";s:10:":D :oD :-D";s:9:"heart!png";s:6:"!heart";s:8:"idea!png";s:10:":! :o! :-!";s:7:"ill!png";s:4:"!ill";s:7:"mad!png";s:13:"~:( ~:o( ~:-(";s:12:"mistrust!png";s:9:"!mistrust";s:11:"neutral!png";s:10:":| :o| :-|";s:12:"question!png";s:2:"?!";s:12:"rolleyes!png";s:10:"B) Bo) B-)";s:7:"sad!png";s:4:"!sad";s:10:"shades!png";s:10:"8) 8o) 8-)";s:7:"shy!png";s:4:"!shy";s:9:"smile!png";s:10:":) :o) :-)";s:11:"special!png";s:3:"%-6";s:12:"suprised!png";s:10:":O :oO :-O";s:10:"tongue!png";s:21:":p :op :-p :P :oP :-P";s:8:"wink!png";s:10:";) ;o) ;-)";}';
$sql->db_Insert("core", "'emote_default', '{$tmp}' ");
$insert = array("e107_name"=>"emote_default", "e107_value"=>$tmp);
$sql->db_Replace("core", $insert);
}
@@ -261,7 +262,6 @@ class emotec
$corea = "emote_".$packID;
$emotecode = $sysprefs -> getArray($corea);
$reject = '~^emoteconf|\.html$|\.php$|\.txt$|\.pak$|\.xml|\.phpBB'; // Files to exclude
$emoteArray = $fl -> get_files(e_IMAGE."emotes/".$packID, $reject);
@@ -394,7 +394,8 @@ class emotec
$packID = $_POST['packID'];
unset($_POST['sub_conf'], $_POST['packID']);
$encoded_emotes = $tp->toDB($_POST);
$tmp = addslashes(serialize($encoded_emotes));
// $tmp = addslashes(serialize($encoded_emotes));
$tmp = e107::getArrayStorage()->WriteArray($encoded_emotes);
if ($sql->db_Select("core", "*", "e107_name='emote_".$packID."'"))
{
@@ -487,7 +488,8 @@ class emotec
$confIC = str_replace(".", "!", $tmp[0]);
$confArray[$confIC] = trim($tmp[2]);
}
$tmp = addslashes(serialize($confArray));
// $tmp = addslashes(serialize($confArray));
$tmp = e107::getArrayStorage()->WriteArray($confArray);
$File_type = EMOLAN_22;
}
/* end */
@@ -596,7 +598,8 @@ class emotec
// Save pack info in the database
$tmp = addslashes(serialize($confArray));
// $tmp = addslashes(serialize($confArray));
$tmp = e107::getArrayStorage()->WriteArray($confArray);
$File_type = EMOLAN_23;
}

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
| $Revision: 1.45 $
| $Date: 2009-09-01 02:00:55 $
| $Revision: 1.46 $
| $Date: 2009-09-01 20:09:35 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@@ -253,6 +253,9 @@ function update_706_to_800($type='')
// List of DB tables newly required (defined in core_sql.php) (The existing dblog table gets renamed)
$new_tables = array('admin_log','audit_log', 'dblog');
// List of core prefs that need to be converted from serialized to e107ArrayStorage.
$serialized_prefs = array("'emote'", "'menu_pref'", "'search_prefs'", "'emote_default'");
// List of changed DB tables (defined in core_sql.php)
// (primarily those which have changed significantly; for the odd field write some explicit code - it'll run faster)
@@ -339,6 +342,21 @@ function update_706_to_800($type='')
$do_save = TRUE;
}
// convert all serialized core prefs to e107 ArrayStorage;
$serialz_qry = "SUBSTRING( e107_value,1,5)!='array' AND e107_value !='' ";
// $serialz_qry .= "AND e107_name IN (".implode(",",$serialized_prefs).") ";
if(e107::getDb()->db_Select("core", "*", $serialz_qry))
{
if ($just_check) return update_needed();
while ($row = e107::getDb()->db_Fetch(MYSQL_ASSOC))
{
e107::getDb('sql2')->db_Update('core',"e107_value=\"".convert_serialized($row['e107_value'])."\" WHERE e107_name='".$row['e107_name']."'");
$updateMessages[] = "Converted Serialized prefs [".$row['e107_name']."]"; // LAN_UPDATE_23;
}
}
//TODO de-serialize the user_prefs also.
//change menu_path for usertheme_menu
if($sql->db_Select("menus", "menu_path", "menu_path='usertheme_menu' || menu_path='usertheme_menu/'"))
{
@@ -963,5 +981,11 @@ function get_default_prefs()
return $pref;
}
function convert_serialized($serializedData)
{
$arrayData = unserialize($serializedData);
return e107::getArrayStorage()->WriteArray($arrayData,FALSE);
}
?>

View File

@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8' ?>
<e107Export version='0.8.0 (cvs)' timestamp='1251685685' >
<e107Export version='0.8.0 (cvs)' timestamp='1251834958' >
<prefs>
<core name='admin_alerts_ok'>1</core>
<core name='admin_alerts_uniquemenu'>0</core>
@@ -187,7 +187,7 @@ City, State, Country
)]]></core>
<core name='sitetheme_pref'></core>
<core name='siteurl'>/</core>
<core name='smiley_activate'></core>
<core name='smiley_activate'>1</core>
<core name='ssl_enabled'>0</core>
<core name='subnews_attach'></core>
<core name='subnews_class'>0</core>
@@ -211,186 +211,34 @@ City, State, Country
<core name='wmessage_sc'>0</core>
<core name='wysiwyg'>0</core>
<core name='xup_enabled'>1</core>
<emote name='0'><![CDATA[array (
'&|' => 'cry.png',
)]]></emote>
<emote name='1'><![CDATA[array (
'&-|' => 'cry.png',
)]]></emote>
<emote name='2'><![CDATA[array (
'&o|' => 'cry.png',
)]]></emote>
<emote name='3'><![CDATA[array (
':((' => 'cry.png',
)]]></emote>
<emote name='4'><![CDATA[array (
'~:(' => 'mad.png',
)]]></emote>
<emote name='5'><![CDATA[array (
'~:o(' => 'mad.png',
)]]></emote>
<emote name='6'><![CDATA[array (
'~:-(' => 'mad.png',
)]]></emote>
<emote name='7'><![CDATA[array (
':)' => 'smile.png',
)]]></emote>
<emote name='8'><![CDATA[array (
':o)' => 'smile.png',
)]]></emote>
<emote name='9'><![CDATA[array (
':-)' => 'smile.png',
)]]></emote>
<emote name='10'><![CDATA[array (
':(' => 'frown.png',
)]]></emote>
<emote name='11'><![CDATA[array (
':o(' => 'frown.png',
)]]></emote>
<emote name='12'><![CDATA[array (
':-(' => 'frown.png',
)]]></emote>
<emote name='13'><![CDATA[array (
':D' => 'grin.png',
)]]></emote>
<emote name='14'><![CDATA[array (
':oD' => 'grin.png',
)]]></emote>
<emote name='15'><![CDATA[array (
':-D' => 'grin.png',
)]]></emote>
<emote name='16'><![CDATA[array (
':?' => 'confused.png',
)]]></emote>
<emote name='17'><![CDATA[array (
':o?' => 'confused.png',
)]]></emote>
<emote name='18'><![CDATA[array (
':-?' => 'confused.png',
)]]></emote>
<emote name='19'><![CDATA[array (
'%-6' => 'special.png',
)]]></emote>
<emote name='20'><![CDATA[array (
'x)' => 'dead.png',
)]]></emote>
<emote name='21'><![CDATA[array (
'xo)' => 'dead.png',
)]]></emote>
<emote name='22'><![CDATA[array (
'x-)' => 'dead.png',
)]]></emote>
<emote name='23'><![CDATA[array (
'x(' => 'dead.png',
)]]></emote>
<emote name='24'><![CDATA[array (
'xo(' => 'dead.png',
)]]></emote>
<emote name='25'><![CDATA[array (
'x-(' => 'dead.png',
)]]></emote>
<emote name='26'><![CDATA[array (
':@' => 'gah.png',
)]]></emote>
<emote name='27'><![CDATA[array (
':o@' => 'gah.png',
)]]></emote>
<emote name='28'><![CDATA[array (
':-@' => 'gah.png',
)]]></emote>
<emote name='29'><![CDATA[array (
':!' => 'idea.png',
)]]></emote>
<emote name='30'><![CDATA[array (
':o!' => 'idea.png',
)]]></emote>
<emote name='31'><![CDATA[array (
':-!' => 'idea.png',
)]]></emote>
<emote name='32'><![CDATA[array (
':|' => 'neutral.png',
)]]></emote>
<emote name='33'><![CDATA[array (
':o|' => 'neutral.png',
)]]></emote>
<emote name='34'><![CDATA[array (
':-|' => 'neutral.png',
)]]></emote>
<emote name='35'><![CDATA[array (
'?!' => 'question.png',
)]]></emote>
<emote name='36'><![CDATA[array (
'B)' => 'rolleyes.png',
)]]></emote>
<emote name='37'><![CDATA[array (
'Bo)' => 'rolleyes.png',
)]]></emote>
<emote name='38'><![CDATA[array (
'B-)' => 'rolleyes.png',
)]]></emote>
<emote name='39'><![CDATA[array (
'8)' => 'shades.png',
)]]></emote>
<emote name='40'><![CDATA[array (
'8o)' => 'shades.png',
)]]></emote>
<emote name='41'><![CDATA[array (
'8-)' => 'shades.png',
)]]></emote>
<emote name='42'><![CDATA[array (
':O' => 'suprised.png',
)]]></emote>
<emote name='43'><![CDATA[array (
':oO' => 'suprised.png',
)]]></emote>
<emote name='44'><![CDATA[array (
':-O' => 'suprised.png',
)]]></emote>
<emote name='45'><![CDATA[array (
':p' => 'tongue.png',
)]]></emote>
<emote name='46'><![CDATA[array (
':op' => 'tongue.png',
)]]></emote>
<emote name='47'><![CDATA[array (
':-p' => 'tongue.png',
)]]></emote>
<emote name='48'><![CDATA[array (
':P' => 'tongue.png',
)]]></emote>
<emote name='49'><![CDATA[array (
':oP' => 'tongue.png',
)]]></emote>
<emote name='50'><![CDATA[array (
':-P' => 'tongue.png',
)]]></emote>
<emote name='51'><![CDATA[array (
';)' => 'wink.png',
)]]></emote>
<emote name='52'><![CDATA[array (
';o)' => 'wink.png',
)]]></emote>
<emote name='53'><![CDATA[array (
';-)' => 'wink.png',
)]]></emote>
<emote name='54'><![CDATA[array (
'!ill' => 'ill.png',
)]]></emote>
<emote name='55'><![CDATA[array (
'!amazed' => 'amazed.png',
)]]></emote>
<emote name='56'><![CDATA[array (
'!cry' => 'cry.png',
)]]></emote>
<emote name='57'><![CDATA[array (
'!dodge' => 'dodge.png',
)]]></emote>
<emote name='58'><![CDATA[array (
'!alien' => 'alien.png',
)]]></emote>
<emote name='59'><![CDATA[array (
'!heart' => 'heart.png',
)]]></emote>
<emote name='alien!png'>!alien</emote>
<emote name='amazed!png'>!amazed</emote>
<emote name='angry!png'>!grr !angry</emote>
<emote name='biglaugh!png'>!lol</emote>
<emote name='cheesey!png'>:D :oD :-D</emote>
<emote name='confused!png'>:? :o? :-?</emote>
<emote name='cry!png'><![CDATA[&| &-| &o| :(( !cry]]></emote>
<emote name='dead!png'>x) xo) x-) x( xo( x-(</emote>
<emote name='dodge!png'>!dodge</emote>
<emote name='frown!png'>:( :o( :-(</emote>
<emote name='gah!png'>:@ :o@ :o@</emote>
<emote name='grin!png'>:D :oD :-D</emote>
<emote name='heart!png'>!heart</emote>
<emote name='idea!png'>:! :o! :-!</emote>
<emote name='ill!png'>!ill</emote>
<emote name='mad!png'>~:( ~:o( ~:-(</emote>
<emote name='mistrust!png'>!mistrust</emote>
<emote name='neutral!png'>:| :o| :-|</emote>
<emote name='question!png'>?!</emote>
<emote name='rolleyes!png'>B) Bo) B-)</emote>
<emote name='sad!png'>!sad</emote>
<emote name='shades!png'>8) 8o) 8-)</emote>
<emote name='shy!png'>!shy</emote>
<emote name='smile!png'>:) :o) :-)</emote>
<emote name='special!png'>%-6</emote>
<emote name='suprised!png'>:O :oO :-O</emote>
<emote name='tongue!png'>:p :op :-p :P :oP :-P</emote>
<emote name='wink!png'>;) ;o) ;-)</emote>
<menu name='clock_caption'>Date / Time</menu>
<menu name='comment_caption'>Latest Comments</menu>
<menu name='comment_characters'>50</menu>
@@ -791,10 +639,10 @@ City, State, Country
<item>
<field name='news_id'>1</field>
<field name='news_title'>Welcome to e107</field>
<field name='news_body'></field>
<field name='news_body'>Welcome :-) :-( :-)))</field>
<field name='news_extended'></field>
<field name='news_datestamp'>1251665200</field>
<field name='news_author'>0</field>
<field name='news_author'>1</field>
<field name='news_category'>1</field>
<field name='news_allow_comments'>1</field>
<field name='news_start'>0</field>

View File

@@ -3,7 +3,7 @@
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/emote_filter.php,v $
| $Revision: 1.3 $
| $Date: 2009-07-25 07:54:34 $
| $Author: marj_nl_fr $
| $Revision: 1.4 $
| $Date: 2009-09-01 20:09:35 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@@ -32,6 +32,8 @@ class e_emotefilter {
$pref['emotepack'] = "default";
save_prefs();
}
$this->emotes = $sysprefs->getArray("emote_".$pref['emotepack']);
foreach($this->emotes as $key => $value)
@@ -46,6 +48,7 @@ class e_emotefilter {
$key = str_replace("!", "_", $key);
$filename = e_IMAGE."emotes/" . $pref['emotepack'] . "/" . $key;
$fileloc = SITEURLBASE.e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/" . $key;
if(file_exists($filename))

View File

@@ -9,8 +9,8 @@
* mySQL Handler
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/mysql_class.php,v $
* $Revision: 1.41 $
* $Date: 2009-08-31 02:00:51 $
* $Revision: 1.42 $
* $Date: 2009-09-01 20:09:35 $
* $Author: e107coders $
*/
@@ -30,7 +30,7 @@ if(defined('MYSQL_LIGHT'))
$sql = new db;
$sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
}
elseif(defined('E107_INSTALL'))
elseif(defined('E107_INSTALL')) //TODO Remove the need for this if possible
{
class dummyTraffic {
function Bump() { return; }
@@ -61,7 +61,7 @@ $db_ConnectionID = NULL; // Stores ID for the first DB connection used - which s
* MySQL Abstraction class
*
* @package e107
* @version $Revision: 1.41 $
* @version $Revision: 1.42 $
* @author $Author: e107coders $
*/
class db {

View File

@@ -9,8 +9,8 @@
* e107 Preference Handler
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/pref_class.php,v $
* $Revision: 1.15 $
* $Date: 2009-08-31 02:49:01 $
* $Revision: 1.16 $
* $Date: 2009-09-01 20:09:36 $
* $Author: e107coders $
*/
@@ -619,7 +619,7 @@ final class e_core_pref extends e_pref
'core' => 'SitePrefs',
'core_backup' => 'SitePrefs_Backup',
'core_old' => 'pref',
'emote' => 'emote',
'emote' => 'emote_default', //TODO include other emote packs of the user.
'menu' => 'menu_pref',
'search' => 'search_prefs',
'notify' => 'notify_prefs',
@@ -631,7 +631,8 @@ final class e_core_pref extends e_pref
*
* @var array
*/
protected $serial_bc_array = array('core_old', 'emote', 'menu', 'search');
// protected $serial_bc_array = array('core_old', 'emote', 'menu', 'search');
protected $serial_bc_array = array('core_old');
/**
* Constructor
@@ -858,8 +859,10 @@ class prefs
* - @access public
*/
// retrieve prefs as an array of values
function getArray($name) {
return unserialize($this->get($name));
function getArray($name)
{
return e107::getArrayStorage()->ReadArray($this->get($name));
// return unserialize($this->get($name));
}
@@ -945,8 +948,8 @@ class prefs
$$name[$key] = $tp->toDB($prefvalue);
}
}
$tmp = serialize($$name);
$tmp = e107::getArrayStorage()->WriteArray($$name);
// $tmp = serialize($$name);
$this->set($tmp, $name, $table, $uid);
}
}