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

db pref editor fix and icon-pool uninstall option added.

This commit is contained in:
CaMer0n
2009-09-28 07:17:52 +00:00
parent bd4d1f693e
commit 3c75746aba
5 changed files with 91 additions and 62 deletions

View File

@@ -9,8 +9,8 @@
* Administration - Database Utilities * Administration - Database Utilities
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/db.php,v $ * $Source: /cvs_backup/e107_0.8/e107_admin/db.php,v $
* $Revision: 1.35 $ * $Revision: 1.36 $
* $Date: 2009-09-26 18:08:14 $ * $Date: 2009-09-28 07:17:51 $
* $Author: e107coders $ * $Author: e107coders $
* *
*/ */
@@ -201,7 +201,7 @@ class system_tools
$deleted_list = ""; $deleted_list = "";
$config = ($mode == 'core') ? e107::getConfig('core') : e107::getPlugConfig($mode); $config = ($mode == 'core' || $mode='') ? e107::getConfig('core') : e107::getPlugConfig($mode);
// Single Pref Deletion using button // Single Pref Deletion using button
if(varset($_POST['delpref'])) if(varset($_POST['delpref']))
@@ -506,7 +506,7 @@ class system_tools
* Preferences Editor * Preferences Editor
* @return * @return
*/ */
private function pref_editor($type='') private function pref_editor($type='core')
{ {
//TODO Add drop-down filter for editing plugin prefs also. //TODO Add drop-down filter for editing plugin prefs also.
@@ -579,7 +579,7 @@ class system_tools
<div class='buttons-bar center'> <div class='buttons-bar center'>
".$frm->admin_button('delpref_checked', DBLAN_21, 'delete')." ".$frm->admin_button('delpref_checked', DBLAN_21, 'delete')."
".$frm->admin_button('back', DBLAN_13, 'back')." ".$frm->admin_button('back', DBLAN_13, 'back')."
<input type='hidden' name='pref_type' value='".$_GET['type']."' /> <input type='hidden' name='pref_type' value='".$type."' />
</div> </div>
</fieldset> </fieldset>
</form>\n\n"; </form>\n\n";

View File

@@ -9,9 +9,9 @@
* Image Administration Area * Image Administration Area
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/image.php,v $ * $Source: /cvs_backup/e107_0.8/e107_admin/image.php,v $
* $Revision: 1.22 $ * $Revision: 1.23 $
* $Date: 2009-08-28 16:11:01 $ * $Date: 2009-09-28 07:17:52 $
* $Author: marj_nl_fr $ * $Author: e107coders $
* *
*/ */
require_once("../class2.php"); require_once("../class2.php");
@@ -661,6 +661,10 @@ if(!e_AJAX_REQUEST) require_once("footer.php");
function icon_editor() function icon_editor()
{ {
global $iconpool, $e107, $emessage, $frm, $tp; global $iconpool, $e107, $emessage, $frm, $tp;
$ns = e107::getRender();
$tp = e107::getParser();
ksort($iconpool); ksort($iconpool);
$text = " $text = "
@@ -734,7 +738,7 @@ function icon_editor()
"; ";
//$text .= "<div style='text-align:center'><a href='".e_SELF."'>".DBLAN_13."</a></div>\n"; //$text .= "<div style='text-align:center'><a href='".e_SELF."'>".DBLAN_13."</a></div>\n";
$e107->ns->tablerender(LAN_IMAGEMANAGER." :: ".IMALAN_71, $emessage->render().$text); $ns->tablerender(LAN_IMAGEMANAGER." :: ".IMALAN_71, $emessage->render().$text);
return $text; return $text;
} }

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/plugin.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/plugin.php,v $
| $Revision: 1.47 $ | $Revision: 1.48 $
| $Date: 2009-09-25 02:02:38 $ | $Date: 2009-09-28 07:17:52 $
| $Author: e107coders $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -217,7 +217,8 @@ class pluginManager{
$options = array( $options = array(
'del_tables' => varset($_POST['delete_tables'],FALSE), 'del_tables' => varset($_POST['delete_tables'],FALSE),
'del_userclasses' => varset($_POST['delete_userclasses'],FALSE), 'del_userclasses' => varset($_POST['delete_userclasses'],FALSE),
'del_extended' => varset($_POST['delete_xfields'],FALSE) 'del_extended' => varset($_POST['delete_xfields'],FALSE),
'del_ipool' => varset($_POST['delete_ipool'],FALSE)
); );
$text .= $plugin->manage_plugin_xml($this->id, 'uninstall', $options); $text .= $plugin->manage_plugin_xml($this->id, 'uninstall', $options);
} }
@@ -621,6 +622,8 @@ class pluginManager{
{ {
global $plugin,$frm; global $plugin,$frm;
//TODO 'install' checkbox in plugin upload form. (as it is for theme upload)
/* plugin upload form */ /* plugin upload form */
if(!is_writable(e_PLUGIN)) if(!is_writable(e_PLUGIN))
@@ -733,10 +736,12 @@ class pluginManager{
function pluginRenderPlugin($pluginList) function pluginRenderPlugin($pluginList)
{ {
global $tp, $plugin, $frm; global $plugin, $frm;
if (empty($pluginList)) return ''; if (empty($pluginList)) return '';
$tp = e107::getParser();
$text = ""; $text = "";
@@ -880,7 +885,9 @@ class pluginManager{
function pluginConfirmUninstall() function pluginConfirmUninstall()
{ {
global $plugin, $tp; global $plugin, $frm;
$tp = e107::getParser();
$plug = $plugin->getinfo($this->id); $plug = $plugin->getinfo($this->id);
if ($plug['plugin_installflag'] == true ) if ($plug['plugin_installflag'] == true )
@@ -931,12 +938,7 @@ class pluginManager{
if(is_writable(e_PLUGIN.$plug['plugin_path'])) if(is_writable(e_PLUGIN.$plug['plugin_path']))
{ {
$del_text = " $del_text = $frm->selectbox('delete_files','yesno',0);
<select class='tbox' name='delete_files'>
<option value='0'>".LAN_NO."</option>
<option value='1'>".LAN_YES."</option>
</select>
";
} }
else else
{ {
@@ -960,28 +962,18 @@ class pluginManager{
<td>".LAN_YES."</td> <td>".LAN_YES."</td>
</tr> </tr>
<tr> <tr>
<td> <td>".EPL_ADLAN_57."</td>
".EPL_ADLAN_57."<div class='smalltext'>".EPL_ADLAN_58."</div> <td>".$frm->selectbox('delete_tables','yesno',1)."
</td> <div class='field-help'>".EPL_ADLAN_58."</div>
<td>
<select class='tbox' name='delete_tables'>
<option value='1'>".LAN_YES."</option>
<option value='0'>".LAN_NO."</option>
</select>
</td> </td>
</tr>"; </tr>";
if ($userclasses) if ($userclasses)
{ {
$text .= " <tr> $text .= " <tr>
<td> <td>".EPL_ADLAN_78."<div class='indent'>".$userclasses."</div></td>
".EPL_ADLAN_78."<div class='indent'>".$userclasses."</div><div class='smalltext'>".EPL_ADLAN_79."</div> <td>".$frm->selectbox('delete_userclasses','yesno',1)."
</td> <div class='field-help'>".EPL_ADLAN_79."</div>
<td>
<select class='tbox' name='delete_userclasses'>
<option value='1'>".LAN_YES."</option>
<option value='0'>".LAN_NO."</option>
</select>
</td> </td>
</tr>"; </tr>";
} }
@@ -990,20 +982,30 @@ class pluginManager{
{ {
$text .= " <tr> $text .= " <tr>
<td> <td>
".EPL_ADLAN_80."<div class='indent'>".$eufields."</div><div class='smalltext'>".EPL_ADLAN_79."</div> ".EPL_ADLAN_80."<div class='indent'>".$eufields."</div>
</td>
<td>
<select class='tbox' name='delete_xfields'>
<option value='1'>".LAN_YES."</option>
<option value='0'>".LAN_NO."</option>
</select>
</td> </td>
<td>".$frm->selectbox('delete_xfields','yesno',0)."
<div class='field-help'>".EPL_ADLAN_79."</div></td>
</tr>"; </tr>";
} }
if(e107::getConfig('ipool')->getPref('plugin-'.$plug['plugin_path']))
{
$text .= "<tr>
<td>Remove icons from icon-pool<div class='indent'>".$eufields."</div>
</td>
<td>".$frm->selectbox('delete_ipool','yesno',1)."
<div class='field-help'>".EPL_ADLAN_79."</div></td>
</tr>";
}
$text .="<tr> $text .="<tr>
<td>".EPL_ADLAN_59."<div class='smalltext'>".EPL_ADLAN_60."</div></td> <td>".EPL_ADLAN_59."</td>
<td>{$del_text}</td> <td>{$del_text}
<div class='field-help'>".EPL_ADLAN_60."</div>
</td>
</tr> </tr>
</table> </table>
<div class='buttons-bar center'>"; <div class='buttons-bar center'>";

View File

@@ -9,8 +9,8 @@
* Form Handler * Form Handler
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
* $Revision: 1.45 $ * $Revision: 1.46 $
* $Date: 2009-09-25 02:02:38 $ * $Date: 2009-09-28 07:17:52 $
* $Author: e107coders $ * $Author: e107coders $
* *
*/ */
@@ -308,6 +308,10 @@ class e_form
function selectbox($name, $option_array, $selected = false, $options = array()) function selectbox($name, $option_array, $selected = false, $options = array())
{ {
if($option_array == 'yesno')
{
$option_array = array(1=>LAN_YES,0=>LAN_NO);
}
return $this->select_open($name, $options)."\n".$this->option_multi($option_array, $selected)."\n".$this->select_close(); return $this->select_open($name, $options)."\n".$this->option_multi($option_array, $selected)."\n".$this->select_close();
} }

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
| $Revision: 1.98 $ | $Revision: 1.99 $
| $Date: 2009-09-26 16:54:09 $ | $Date: 2009-09-28 07:17:52 $
| $Author: e107coders $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -294,14 +294,29 @@ class e107plugin
} }
} }
function manage_icons($plugin='') function manage_icons($plugin='',$function='')
{ {
global $iconpool,$pref; global $iconpool,$pref;
$emessage = eMessage::getInstance();
$sql = e107::getDb(); $sql = e107::getDb();
$tp = e107::getParser(); $tp = e107::getParser();
$fl = e107::getFile(); $fl = e107::getFile();
if($plugin && ($function == 'uninstall') )
{
if(vartrue($this->unInstallOpts['del_ipool'], FALSE))
{
$ipool_entry = 'plugin-'.$plugin;
e107::getConfig('ipool')->remove($ipool_entry); // FIXME - ipool removal issue.
$status = (e107::getConfig('ipool')->save(FALSE)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$emessage->add('Removing Icon-Pool entry: '.$ipool_entry, $status);
}
return;
}
$query = "SELECT * FROM #plugin WHERE plugin_installflag =0 ORDER BY plugin_path ASC"; $query = "SELECT * FROM #plugin WHERE plugin_installflag =0 ORDER BY plugin_path ASC";
$sql->db_Select_gen($query); $sql->db_Select_gen($query);
$list = $sql->db_getList(); $list = $sql->db_getList();
@@ -950,7 +965,7 @@ class e107plugin
$tableList = $dbHandler->get_table_def('',$path.$sqlFile); $tableList = $dbHandler->get_table_def('',$path.$sqlFile);
if (!is_array($tableList)) if (!is_array($tableList))
{ {
$error[] = 'Can\'t read SQL definition: '.$path.$sqlFile; $emessage->add("Can\'t read SQL definition: ".$path.$sqlFile,E_MESSAGE_ERROR);
break; break;
} }
// Got the required definition here // Got the required definition here
@@ -960,9 +975,9 @@ class e107plugin
{ {
case 'install' : case 'install' :
$sqlTable = str_replace("CREATE TABLE ".MPREFIX.'`', "CREATE TABLE `".MPREFIX, preg_replace("/create table\s+/si", "CREATE TABLE ".MPREFIX, $ct[0])); $sqlTable = str_replace("CREATE TABLE ".MPREFIX.'`', "CREATE TABLE `".MPREFIX, preg_replace("/create table\s+/si", "CREATE TABLE ".MPREFIX, $ct[0]));
$txt .= "Adding table: {$ct[1]} ... "; $txt = "Adding table: {$ct[1]} ... ";
$result = $this->manage_tables('add', array($sqlTable)); // Pass the statement to create the table $status = $this->manage_tables('add', array($sqlTable)) ? E_MESSAGE_SUCCESS: E_MESSAGE_ERROR; // Pass the statement to create the table
$txt .= ($result ? "Success" : "Failed!").'<br />'; $emessage->add($txt,$status);
break; break;
case 'upgrade' : case 'upgrade' :
$tmp = $dbHandler->update_table_structure($ct,FALSE,TRUE, $pref['multilanguage']); $tmp = $dbHandler->update_table_structure($ct,FALSE,TRUE, $pref['multilanguage']);
@@ -980,12 +995,13 @@ class e107plugin
case 'uninstall' : case 'uninstall' :
if (varsettrue($options['del_tables'], FALSE)) if (varsettrue($options['del_tables'], FALSE))
{ {
$txt .= "Removing table {$ct[1]} <br />"; $txt = "Removing table {$ct[1]} <br />";
$this->manage_tables('remove', array($ct[1])); // Delete the table $status = $this->manage_tables('remove', array($ct[1])) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; // Delete the table
$emessage->add($txt,$status);
} }
else else
{ {
$txt .= "Table {$ct[1]} left in place<br />"; $emessage->add("Table {$ct[1]} left in place.",E_MESSAGE_SUCCESS);
} }
break; break;
} }
@@ -1023,6 +1039,9 @@ class e107plugin
$this->XmlLogLanguageFile($function,$plug_vars['logLanguageFile']); $this->XmlLogLanguageFile($function,$plug_vars['logLanguageFile']);
} }
$this->manage_icons($this->plugFolder,$function);
//FIXME //FIXME
//If any commentIDs are configured, we need to remove all comments on uninstall //If any commentIDs are configured, we need to remove all comments on uninstall
if($function == 'uninstall' && isset($plug_vars['commentID'])) if($function == 'uninstall' && isset($plug_vars['commentID']))