- Timestamp:
- Apr 11, 2011, 12:30:56 PM (13 years ago)
- Location:
- trunk/admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/plugins.class.php
r10129 r10293 79 79 { 80 80 case 'install': 81 if (!empty($crt_db_plugin)) 82 { 83 array_push($errors, 'CANNOT INSTALL - ALREADY INSTALLED'); 84 break; 85 } 86 if (!isset($this->fs_plugins[$plugin_id])) 87 { 88 array_push($errors, 'CANNOT INSTALL - NO SUCH PLUGIN'); 81 if (!empty($crt_db_plugin) or !isset($this->fs_plugins[$plugin_id])) 82 { 89 83 break; 90 84 } … … 110 104 if (!isset($crt_db_plugin)) 111 105 { 112 array_push($errors, 'CANNOT ACTIVATE - NOT INSTALLED'); 106 $errors = $this->perform_action('install', $plugin_id); 107 } 108 elseif ($crt_db_plugin['state'] == 'active') 109 { 113 110 break; 114 111 } 115 if ($crt_db_plugin['state'] != 'inactive') 116 { 117 array_push($errors, 'invalid current state ' . $crt_db_plugin['state']); 118 break; 119 } 120 if (file_exists($file_to_include)) 112 if (empty($errors) and file_exists($file_to_include)) 121 113 { 122 114 include_once($file_to_include); … … 137 129 138 130 case 'deactivate': 139 if (!isset($crt_db_plugin)) 140 { 141 die ('CANNOT DEACTIVATE - NOT INSTALLED'); 142 } 143 if ($crt_db_plugin['state'] != 'active') 144 { 145 die('invalid current state ' . $crt_db_plugin['state']); 131 if (!isset($crt_db_plugin) or $crt_db_plugin['state'] != 'active') 132 { 133 break; 146 134 } 147 135 $query = ' … … 161 149 if (!isset($crt_db_plugin)) 162 150 { 163 die ('CANNOT UNINSTALL - NOT INSTALLED'); 151 break; 152 } 153 if ($crt_db_plugin['state'] == 'active') 154 { 155 $this->perform_action('deactivate', $plugin_id); 164 156 } 165 157 $query = ' … … 176 168 break; 177 169 170 case 'restore': 171 $this->perform_action('uninstall', $plugin_id); 172 unset($this->db_plugins_by_id[$plugin_id]); 173 $errors = $this->perform_action('activate', $plugin_id); 174 break; 175 178 176 case 'delete': 179 177 if (!empty($crt_db_plugin)) 180 178 { 181 array_push($errors, 'CANNOT DELETE - PLUGIN IS INSTALLED'); 182 break; 179 $this->perform_action('uninstall', $plugin_id); 183 180 } 184 181 if (!isset($this->fs_plugins[$plugin_id])) 185 182 { 186 array_push($errors, 'CANNOT DELETE - NO SUCH PLUGIN');187 183 break; 188 184 } -
trunk/admin/plugins_list.php
r10128 r10293 98 98 else 99 99 { 100 $tpl_plugin['STATE'] = ' uninstalled';100 $tpl_plugin['STATE'] = 'inactive'; 101 101 } 102 102 103 103 if (isset($fs_plugin['extension']) and in_array($fs_plugin['extension'], $_SESSION['merged_extensions'])) 104 104 { 105 switch($tpl_plugin['STATE']) 106 { 107 case 'active': $plugins->perform_action('deactivate', $plugin_id); 108 case 'inactive': $plugins->perform_action('uninstall', $plugin_id); 109 } 105 $plugins->perform_action('uninstall', $plugin_id); 110 106 $tpl_plugin['STATE'] = 'merged'; 111 107 $tpl_plugin['DESC'] = l10n('THIS PLUGIN IS NOW PART OF PIWIGO CORE! DELETE IT NOW.'); … … 118 114 $template->append('plugin_states', 'active'); 119 115 $template->append('plugin_states', 'inactive'); 120 $template->append('plugin_states', 'uninstalled');121 116 122 117 if ($merged_plugins) -
trunk/admin/themes/default/template/plugins_list.tpl
r10113 r10293 32 32 {'Inactive Plugins'|@translate} 33 33 34 {elseif $plugin_state == 'uninstalled'}35 {'Uninstalled Plugins'|@translate}36 37 34 {elseif $plugin_state == 'missing'} 38 35 {'Missing Plugins'|@translate} … … 57 54 {if $plugin.STATE == 'active'} 58 55 <a href="{$plugin.U_ACTION}&action=deactivate">{'Deactivate'|@translate}</a> 56 | <a href="{$plugin.U_ACTION}&action=restore" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Restore'|@translate}</a> 59 57 60 58 {elseif $plugin_state == 'inactive'} 61 59 <a href="{$plugin.U_ACTION}&action=activate" {if $plugin.INCOMPATIBLE}class="incompatible"{/if}>{'Activate'|@translate}</a> 62 | <a href="{$plugin.U_ACTION}&action=uninstall" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Uninstall'|@translate}</a> 63 64 {elseif $plugin_state == 'uninstalled'} 65 <a href="{$plugin.U_ACTION}&action=install">{'Install'|@translate}</a> 66 | <a href="{$plugin.U_ACTION}&action=delete" onclick="return confirm('{'Are you sure you want to delete this plugin?'|@translate|@escape:'javascript'}');">{'Delete'|@translate}</a> 60 | <a href="{$plugin.U_ACTION}&action=delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Delete'|@translate}</a> 67 61 68 62 {elseif $plugin_state == 'missing'}
Note: See TracChangeset
for help on using the changeset viewer.