<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2009 The Nucleus Group
+ * Copyright (C) 2002-2012 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @copyright Copyright (C) 2002-2012 The Nucleus Group
* @version $Id: upgrade2.5.php 1889 2012-06-17 08:46:45Z sakamocchi $
*/
$query = 'DELETE FROM ' . sql_table('plugin_option_desc');
upgrade_query('Flushing plugin option descriptions', $query);
$query = 'SELECT * FROM ' . sql_table('plugin_option') .' ORDER BY oid ASC';
- $res = DB::getResult($query);
+ $res = sql_query($query);
$aValues = array();
- foreach ( $res as $row) {
+ while ($o = mysql_fetch_object($res)) {
$query = 'INSERT INTO ' . sql_table('plugin_option_desc')
.' (opid, oname, ocontext, odesc, otype)'
." VALUES ("
- .DB::quoteValue($row['opid']).','
- .DB::quoteValue($row['oname']) .','
+ ."'".addslashes($o->opid)."',"
+ ."'".addslashes($o->oname) ."',"
."'global',"
- .DB::quoteValue($row['odesc']) .','
- .DB::quoteValue($row['otype']) .')';
- upgrade_query('Moving option description for '.i18n::hsc($row['oname']).' to ' . sql_table('plugin_option_desc'), $query);
+ ."'".addslashes($o->odesc) ."',"
+ ."'".addslashes($o->otype) ."')";
+ upgrade_query('Moving option description for '.i18n::hsc($o->oname).' to ' . sql_table('plugin_option_desc'), $query);
// store new id
$aValues[] = array (
- 'id' => DB::getInsertId(),
- 'value' => $row['ovalue']
+ 'id' => mysql_insert_id(),
+ 'value' => $o->ovalue
);
}
}
foreach ($aValues as $aInfo) {
$query = 'INSERT INTO ' . sql_table('plugin_option')
.' (oid, ocontextid, ovalue)'
- ." VALUES (".$aInfo['id'].",'0',".DB::quoteValue($aInfo['value']).')';
+ ." VALUES (".$aInfo['id'].",'0','".addslashes($aInfo['value'])."')";
upgrade_query('Re-filling ' . sql_table('plugin_option') . ' ('.$aInfo['id'].')', $query);
}
}