- Timestamp:
- Apr 7, 2011, 11:47:01 AM (13 years ago)
- Location:
- branches/2.2
- Files:
-
- 7 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/admin/include/plugins.class.php
r8728 r10131 27 27 var $db_plugins_by_id = array(); 28 28 var $server_plugins = array(); 29 var $default_plugins = array('LocalFilesEditor', 'language_switch', 'c13y_upgrade', 'admin_multi_view'); 29 30 30 31 /** … … 284 285 } 285 286 287 // Retrieve PEM versions 288 function get_versions_to_check($version=PHPWG_VERSION) 289 { 290 $versions_to_check = array(); 291 $url = PEM_URL . '/api/get_version_list.php?category=12&format=php'; 292 if (fetchRemote($url, $result) and $pem_versions = @unserialize($result)) 293 { 294 if (!preg_match('/^\d+\.\d+\.\d+/', $version)) 295 { 296 $version = $pem_versions[0]['name']; 297 } 298 $branch = substr($version, 0, strrpos($version, '.')); 299 foreach ($pem_versions as $pem_version) 300 { 301 if (strpos($pem_version['name'], $branch) === 0) 302 { 303 $versions_to_check[] = $pem_version['id']; 304 } 305 } 306 } 307 return $versions_to_check; 308 } 309 286 310 /** 287 311 * Retrieve PEM server datas to $server_plugins … … 291 315 global $user; 292 316 317 $versions_to_check = $this->get_versions_to_check(); 318 if (empty($versions_to_check)) 319 { 320 return false; 321 } 322 323 // Plugins to check 324 $plugins_to_check = array(); 325 foreach($this->fs_plugins as $fs_plugin) 326 { 327 if (isset($fs_plugin['extension'])) 328 { 329 $plugins_to_check[] = $fs_plugin['extension']; 330 } 331 } 332 333 // Retrieve PEM plugins infos 334 $url = PEM_URL . '/api/get_revision_list.php'; 293 335 $get_data = array( 294 336 'category_id' => 12, 295 337 'format' => 'php', 296 );297 298 // Retrieve PEM versions299 $version = PHPWG_VERSION;300 $versions_to_check = array();301 $url = PEM_URL . '/api/get_version_list.php';302 if (fetchRemote($url, $result, $get_data) and $pem_versions = @unserialize($result))303 {304 if (!preg_match('/^\d+\.\d+\.\d+/', $version))305 {306 $version = $pem_versions[0]['name'];307 }308 $branch = substr($version, 0, strrpos($version, '.'));309 foreach ($pem_versions as $pem_version)310 {311 if (strpos($pem_version['name'], $branch) === 0)312 {313 $versions_to_check[] = $pem_version['id'];314 }315 }316 }317 if (empty($versions_to_check))318 {319 return false;320 }321 322 // Plugins to check323 $plugins_to_check = array();324 foreach($this->fs_plugins as $fs_plugin)325 {326 if (isset($fs_plugin['extension']))327 {328 $plugins_to_check[] = $fs_plugin['extension'];329 }330 }331 332 // Retrieve PEM plugins infos333 $url = PEM_URL . '/api/get_revision_list.php';334 $get_data = array_merge($get_data, array(335 338 'last_revision_only' => 'true', 336 339 'version' => implode(',', $versions_to_check), 337 340 'lang' => substr($user['language'], 0, 2), 338 341 'get_nb_downloads' => 'true', 339 )340 342 ); 341 343 … … 363 365 } 364 366 return true; 367 } 368 return false; 369 } 370 371 function get_incompatible_plugins($actualize=false) 372 { 373 if (isset($_SESSION['incompatible_plugins']) and !$actualize 374 and $_SESSION['incompatible_plugins']['~~expire~~'] > time()) 375 { 376 return $_SESSION['incompatible_plugins']; 377 } 378 379 $_SESSION['incompatible_plugins'] = array('~~expire~~' => time() + 300); 380 381 $versions_to_check = $this->get_versions_to_check(); 382 if (empty($versions_to_check)) 383 { 384 return false; 385 } 386 387 // Plugins to check 388 $plugins_to_check = array(); 389 foreach($this->fs_plugins as $fs_plugin) 390 { 391 if (isset($fs_plugin['extension'])) 392 { 393 $plugins_to_check[] = $fs_plugin['extension']; 394 } 395 } 396 397 // Retrieve PEM plugins infos 398 $url = PEM_URL . '/api/get_revision_list.php'; 399 $get_data = array( 400 'category_id' => 12, 401 'format' => 'php', 402 'version' => implode(',', $versions_to_check), 403 'extension_include' => implode(',', $plugins_to_check), 404 ); 405 406 if (fetchRemote($url, $result, $get_data)) 407 { 408 $pem_plugins = @unserialize($result); 409 if (!is_array($pem_plugins)) 410 { 411 return false; 412 } 413 414 $server_plugins = array(); 415 foreach ($pem_plugins as $plugin) 416 { 417 if (!isset($server_plugins[$plugin['extension_id']])) 418 { 419 $server_plugins[$plugin['extension_id']] = array(); 420 } 421 array_push($server_plugins[$plugin['extension_id']], $plugin['revision_name']); 422 } 423 424 foreach ($this->fs_plugins as $plugin_id => $fs_plugin) 425 { 426 if (isset($fs_plugin['extension']) 427 and !in_array($plugin_id, $this->default_plugins) 428 and $fs_plugin['version'] != 'auto' 429 and (!isset($server_plugins[$fs_plugin['extension']]) or !in_array($fs_plugin['version'], $server_plugins[$fs_plugin['extension']]))) 430 { 431 $_SESSION['incompatible_plugins'][$plugin_id] = $fs_plugin['version']; 432 } 433 } 434 return $_SESSION['incompatible_plugins']; 365 435 } 366 436 return false; … … 484 554 return $status; 485 555 } 556 557 function get_merged_extensions($version=PHPWG_VERSION) 558 { 559 if (isset($_SESSION['merged_extensions']) and $_SESSION['merged_extensions']['~~expire~~'] > time()) 560 { 561 return $_SESSION['merged_extensions']; 562 } 563 564 $_SESSION['merged_extensions'] = array('~~expire~~' => time() + 600); 565 566 if (fetchRemote(PHPWG_URL.'/download/merged_extensions.txt', $result)) 567 { 568 $rows = explode("\n", $result); 569 foreach ($rows as $row) 570 { 571 if (preg_match('/^(\d+\.\d+): *(.*)$/', $row, $match)) 572 { 573 if (version_compare($version, $match[1], '>=')) 574 { 575 $extensions = explode(',', trim($match[2])); 576 $_SESSION['merged_extensions'] = array_merge($_SESSION['merged_extensions'], $extensions); 577 } 578 } 579 } 580 } 581 582 return $_SESSION['merged_extensions']; 583 } 486 584 487 585 /** -
branches/2.2/admin/plugins_list.php
r10007 r10131 68 68 69 69 $plugins->sort_fs_plugins('name'); 70 $plugins->get_merged_extensions(); 71 $plugins->get_incompatible_plugins(); 72 $merged_plugins = false; 70 73 71 74 foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) 72 75 { 76 if (isset($_SESSION['incompatible_plugins'][$plugin_id]) 77 and $fs_plugin['version'] != $_SESSION['incompatible_plugins'][$plugin_id]) 78 { 79 // Incompatible plugins must be reinitilized 80 $plugins->get_incompatible_plugins(true); 81 } 82 73 83 $tpl_plugin = array( 74 84 'NAME' => $fs_plugin['name'], … … 78 88 'AUTHOR' => $fs_plugin['author'], 79 89 'AUTHOR_URL' => @$fs_plugin['author uri'], 80 'U_ACTION' => sprintf($action_url, $plugin_id) 90 'U_ACTION' => sprintf($action_url, $plugin_id), 91 'INCOMPATIBLE' => isset($_SESSION['incompatible_plugins'][$plugin_id]), 81 92 ); 82 93 … … 90 101 } 91 102 103 if (isset($fs_plugin['extension']) and in_array($fs_plugin['extension'], $_SESSION['merged_extensions'])) 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 } 110 $tpl_plugin['STATE'] = 'merged'; 111 $tpl_plugin['DESC'] = l10n('THIS PLUGIN IS NOW PART OF PIWIGO CORE! DELETE IT NOW.'); 112 $merged_plugins = true; 113 } 114 92 115 $template->append('plugins', $tpl_plugin); 116 } 117 118 $template->append('plugin_states', 'active'); 119 $template->append('plugin_states', 'inactive'); 120 $template->append('plugin_states', 'uninstalled'); 121 122 if ($merged_plugins) 123 { 124 $template->append('plugin_states', 'merged'); 93 125 } 94 126 … … 98 130 ); 99 131 100 foreach($missing_plugin_ids as $plugin_id)101 {102 $template->append(103 'plugins',104 array(105 'NAME' => $plugin_id,106 'VERSION' => $plugins->db_plugins_by_id[$plugin_id]['version'],107 'DESC' => "ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW !",108 'U_ACTION' => sprintf($action_url, $plugin_id),109 'STATE' => 'missing',110 )111 );112 }113 114 $template->append('plugin_states', 'active');115 $template->append('plugin_states', 'inactive');116 $template->append('plugin_states', 'uninstalled');117 118 132 if (count($missing_plugin_ids) > 0) 119 133 { 134 foreach($missing_plugin_ids as $plugin_id) 135 { 136 $template->append( 137 'plugins', 138 array( 139 'NAME' => $plugin_id, 140 'VERSION' => $plugins->db_plugins_by_id[$plugin_id]['version'], 141 'DESC' => l10n('ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW.'), 142 'U_ACTION' => sprintf($action_url, $plugin_id), 143 'STATE' => 'missing', 144 ) 145 ); 146 } 120 147 $template->append('plugin_states', 'missing'); 121 148 } -
branches/2.2/admin/themes/default/template/plugins_list.tpl
r6363 r10131 1 {footer_script} 2 var incompatible_msg = '{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'javascript'}'; 3 incompatible_msg += '\n'; 4 incompatible_msg += '{'Do you want to activate anyway?'|@translate|@escape:'javascript'}'; 5 6 {literal} 7 jQuery(document).ready(function() { 8 jQuery('.incompatible').click(function() { 9 return confirm(incompatible_msg); 10 }); 11 jQuery('.warning').tipTip({ 12 'delay' : 0, 13 'fadeIn' : 200, 14 'fadeOut' : 200 15 }); 16 }); 17 {/literal}{/footer_script} 18 1 19 <div class="titrePage"> 2 20 <h2>{'Plugins'|@translate}</h2> … … 20 38 {'Missing Plugins'|@translate} 21 39 40 {elseif $plugin_state == 'merged'} 41 {'Obsolete Plugins'|@translate} 42 22 43 {/if} 23 44 </legend> … … 27 48 <table> 28 49 <tr> 29 <td class="pluginBoxNameCell">{$plugin.NAME}</td> 50 <td class="pluginBoxNameCell{if $plugin.INCOMPATIBLE} warning" title="{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'html'}{/if}"> 51 {$plugin.NAME} 52 </td> 30 53 <td>{$plugin.DESC}</td> 31 54 </tr> … … 36 59 37 60 {elseif $plugin_state == 'inactive'} 38 <a href="{$plugin.U_ACTION}&action=activate" >{'Activate'|@translate}</a>61 <a href="{$plugin.U_ACTION}&action=activate" {if $plugin.INCOMPATIBLE}class="incompatible"{/if}>{'Activate'|@translate}</a> 39 62 | <a href="{$plugin.U_ACTION}&action=uninstall" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Uninstall'|@translate}</a> 40 63 … … 46 69 <a href="{$plugin.U_ACTION}&action=uninstall" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Uninstall'|@translate}</a> 47 70 71 {elseif $plugin_state == 'merged'} 72 <a href="{$plugin.U_ACTION}&action=delete">{'Delete'|@translate}</a> 48 73 {/if} 49 74 </td> -
branches/2.2/admin/themes/default/theme.css
r9951 r10131 1044 1044 #batchManagerGlobal #applyFilterBlock {margin-top:20px;} 1045 1045 #batchManagerGlobal .useFilterCheckbox {display:none} 1046 1047 .warning { 1048 background:url(icon/warning.png) no-repeat top left; 1049 width: 130px; 1050 padding-left: 20px; 1051 } -
branches/2.2/include/common.inc.php
r8728 r10131 158 158 } 159 159 160 161 160 // language files 162 161 load_language('common.lang'); -
branches/2.2/language/en_UK/admin.lang.php
r9936 r10131 778 778 $lang['Visit language site'] = 'Visit language site'; 779 779 $lang['New Version'] = 'New Version'; 780 $lang['Obsolete Plugins'] = 'Obsolete Plugins'; 781 $lang['WARNING! This plugin does not seem to be compatible with this version of Piwigo.'] = 'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'; 782 $lang['Do you want to activate anyway?'] = 'Do you want to activate anyway?'; 783 $lang['THIS PLUGIN IS NOW PART OF PIWIGO CORE! DELETE IT NOW.'] = 'THIS PLUGIN IS NOW PART OF PIWIGO CORE! UNINSTALL IT NOW!'; 784 $lang['ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW.'] = 'ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW.'; 780 785 ?> -
branches/2.2/language/fr_FR/admin.lang.php
r10040 r10131 789 789 $lang['Visit language site'] = 'Visitez le site de la langue'; 790 790 $lang['New Version'] = 'Nouvelle version'; 791 $lang['Obsolete Plugins'] = 'Plugins obsolètes'; 792 $lang['WARNING! This plugin does not seem to be compatible with this version of Piwigo.'] = 'ATTENTION! Ce plugin n\'a pas l\'air d\'être compatible avec votre version de Piwigo.'; 793 $lang['Do you want to activate anyway?'] = 'Voulez-vous l\'activer quand même?'; 794 $lang['THIS PLUGIN IS NOW PART OF PIWIGO CORE! DELETE IT NOW.'] = 'CE PLUGIN FAIT DÉSORMAIS PARTIE DU CORE DE PIWIGO! SUPPRIMEZ-LE.'; 795 $lang['ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW.'] = 'ERREUR: CE PLUGIN EST MANQUANT MAIS TOUJOURS INSTALLÉ! DÉSINSTALLEZ-LE.'; 791 796 ?>
Note: See TracChangeset
for help on using the changeset viewer.