mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 03:40:37 +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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -260,8 +261,7 @@ class emotec
|
||||
global $e107, $fl, $sysprefs, $tp;
|
||||
$corea = "emote_".$packID;
|
||||
|
||||
$emotecode = $sysprefs -> getArray($corea);
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
|
@@ -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 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -252,6 +252,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)
|
||||
@@ -338,6 +341,21 @@ function update_706_to_800($type='')
|
||||
$updateMessages[] = LAN_UPDATE_22;
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user