aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/include/plugins.class.php132
-rw-r--r--admin/plugins_list.php65
-rw-r--r--admin/themes/clear/icon/warning.pngbin0 -> 680 bytes
-rw-r--r--admin/themes/default/icon/warning.pngbin0 -> 680 bytes
-rw-r--r--admin/themes/default/template/plugins_list.tpl29
-rw-r--r--admin/themes/default/theme.css6
-rw-r--r--include/common.inc.php1
-rw-r--r--language/en_UK/admin.lang.php5
-rw-r--r--language/fr_FR/admin.lang.php5
9 files changed, 204 insertions, 39 deletions
diff --git a/admin/include/plugins.class.php b/admin/include/plugins.class.php
index 4aa7223bb..30242f01b 100644
--- a/admin/include/plugins.class.php
+++ b/admin/include/plugins.class.php
@@ -26,6 +26,7 @@ class plugins
var $fs_plugins = array();
var $db_plugins_by_id = array();
var $server_plugins = array();
+ var $default_plugins = array('LocalFilesEditor', 'language_switch', 'c13y_upgrade', 'admin_multi_view');
/**
* Initialize $fs_plugins and $db_plugins_by_id
@@ -283,23 +284,12 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id=\'' . $plugin_id . '\'';
}
}
- /**
- * Retrieve PEM server datas to $server_plugins
- */
- function get_server_plugins($new=false)
+ // Retrieve PEM versions
+ function get_versions_to_check($version=PHPWG_VERSION)
{
- global $user;
-
- $get_data = array(
- 'category_id' => 12,
- 'format' => 'php',
- );
-
- // Retrieve PEM versions
- $version = PHPWG_VERSION;
$versions_to_check = array();
- $url = PEM_URL . '/api/get_version_list.php';
- if (fetchRemote($url, $result, $get_data) and $pem_versions = @unserialize($result))
+ $url = PEM_URL . '/api/get_version_list.php?category=12&format=php';
+ if (fetchRemote($url, $result) and $pem_versions = @unserialize($result))
{
if (!preg_match('/^\d+\.\d+\.\d+/', $version))
{
@@ -314,6 +304,17 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id=\'' . $plugin_id . '\'';
}
}
}
+ return $versions_to_check;
+ }
+
+ /**
+ * Retrieve PEM server datas to $server_plugins
+ */
+ function get_server_plugins($new=false)
+ {
+ global $user;
+
+ $versions_to_check = $this->get_versions_to_check();
if (empty($versions_to_check))
{
return false;
@@ -331,12 +332,13 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id=\'' . $plugin_id . '\'';
// Retrieve PEM plugins infos
$url = PEM_URL . '/api/get_revision_list.php';
- $get_data = array_merge($get_data, array(
+ $get_data = array(
+ 'category_id' => 12,
+ 'format' => 'php',
'last_revision_only' => 'true',
'version' => implode(',', $versions_to_check),
'lang' => substr($user['language'], 0, 2),
'get_nb_downloads' => 'true',
- )
);
if (!empty($plugins_to_check))
@@ -365,6 +367,74 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id=\'' . $plugin_id . '\'';
}
return false;
}
+
+ function get_incompatible_plugins($actualize=false)
+ {
+ if (isset($_SESSION['incompatible_plugins']) and !$actualize
+ and $_SESSION['incompatible_plugins']['~~expire~~'] > time())
+ {
+ return $_SESSION['incompatible_plugins'];
+ }
+
+ $_SESSION['incompatible_plugins'] = array('~~expire~~' => time() + 300);
+
+ $versions_to_check = $this->get_versions_to_check();
+ if (empty($versions_to_check))
+ {
+ return false;
+ }
+
+ // Plugins to check
+ $plugins_to_check = array();
+ foreach($this->fs_plugins as $fs_plugin)
+ {
+ if (isset($fs_plugin['extension']))
+ {
+ $plugins_to_check[] = $fs_plugin['extension'];
+ }
+ }
+
+ // Retrieve PEM plugins infos
+ $url = PEM_URL . '/api/get_revision_list.php';
+ $get_data = array(
+ 'category_id' => 12,
+ 'format' => 'php',
+ 'version' => implode(',', $versions_to_check),
+ 'extension_include' => implode(',', $plugins_to_check),
+ );
+
+ if (fetchRemote($url, $result, $get_data))
+ {
+ $pem_plugins = @unserialize($result);
+ if (!is_array($pem_plugins))
+ {
+ return false;
+ }
+
+ $server_plugins = array();
+ foreach ($pem_plugins as $plugin)
+ {
+ if (!isset($server_plugins[$plugin['extension_id']]))
+ {
+ $server_plugins[$plugin['extension_id']] = array();
+ }
+ array_push($server_plugins[$plugin['extension_id']], $plugin['revision_name']);
+ }
+
+ foreach ($this->fs_plugins as $plugin_id => $fs_plugin)
+ {
+ if (isset($fs_plugin['extension'])
+ and !in_array($plugin_id, $this->default_plugins)
+ and $fs_plugin['version'] != 'auto'
+ and (!isset($server_plugins[$fs_plugin['extension']]) or !in_array($fs_plugin['version'], $server_plugins[$fs_plugin['extension']])))
+ {
+ $_SESSION['incompatible_plugins'][$plugin_id] = $fs_plugin['version'];
+ }
+ }
+ return $_SESSION['incompatible_plugins'];
+ }
+ return false;
+ }
/**
* Sort $server_plugins
@@ -483,6 +553,34 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id=\'' . $plugin_id . '\'';
@unlink($archive);
return $status;
}
+
+ function get_merged_extensions($version=PHPWG_VERSION)
+ {
+ if (isset($_SESSION['merged_extensions']) and $_SESSION['merged_extensions']['~~expire~~'] > time())
+ {
+ return $_SESSION['merged_extensions'];
+ }
+
+ $_SESSION['merged_extensions'] = array('~~expire~~' => time() + 600);
+
+ if (fetchRemote(PHPWG_URL.'/download/merged_extensions.txt', $result))
+ {
+ $rows = explode("\n", $result);
+ foreach ($rows as $row)
+ {
+ if (preg_match('/^(\d+\.\d+): *(.*)$/', $row, $match))
+ {
+ if (version_compare($version, $match[1], '>='))
+ {
+ $extensions = explode(',', trim($match[2]));
+ $_SESSION['merged_extensions'] = array_merge($_SESSION['merged_extensions'], $extensions);
+ }
+ }
+ }
+ }
+
+ return $_SESSION['merged_extensions'];
+ }
/**
* delete $path directory
diff --git a/admin/plugins_list.php b/admin/plugins_list.php
index 21e8ec3f2..1af2e239b 100644
--- a/admin/plugins_list.php
+++ b/admin/plugins_list.php
@@ -67,9 +67,19 @@ $plugins->set_tabsheet($page['page']);
// +-----------------------------------------------------------------------+
$plugins->sort_fs_plugins('name');
+$plugins->get_merged_extensions();
+$plugins->get_incompatible_plugins();
+$merged_plugins = false;
foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
{
+ if (isset($_SESSION['incompatible_plugins'][$plugin_id])
+ and $fs_plugin['version'] != $_SESSION['incompatible_plugins'][$plugin_id])
+ {
+ // Incompatible plugins must be reinitilized
+ $plugins->get_incompatible_plugins(true);
+ }
+
$tpl_plugin = array(
'NAME' => $fs_plugin['name'],
'VISIT_URL' => $fs_plugin['uri'],
@@ -77,7 +87,8 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
'DESC' => $fs_plugin['description'],
'AUTHOR' => $fs_plugin['author'],
'AUTHOR_URL' => @$fs_plugin['author uri'],
- 'U_ACTION' => sprintf($action_url, $plugin_id)
+ 'U_ACTION' => sprintf($action_url, $plugin_id),
+ 'INCOMPATIBLE' => isset($_SESSION['incompatible_plugins'][$plugin_id]),
);
if (isset($plugins->db_plugins_by_id[$plugin_id]))
@@ -89,34 +100,50 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
$tpl_plugin['STATE'] = 'uninstalled';
}
+ if (isset($fs_plugin['extension']) and in_array($fs_plugin['extension'], $_SESSION['merged_extensions']))
+ {
+ switch($tpl_plugin['STATE'])
+ {
+ case 'active': $plugins->perform_action('deactivate', $plugin_id);
+ case 'inactive': $plugins->perform_action('uninstall', $plugin_id);
+ }
+ $tpl_plugin['STATE'] = 'merged';
+ $tpl_plugin['DESC'] = l10n('THIS PLUGIN IS NOW PART OF PIWIGO CORE! DELETE IT NOW.');
+ $merged_plugins = true;
+ }
+
$template->append('plugins', $tpl_plugin);
}
-$missing_plugin_ids = array_diff(
- array_keys($plugins->db_plugins_by_id),
- array_keys($plugins->fs_plugins)
- );
+$template->append('plugin_states', 'active');
+$template->append('plugin_states', 'inactive');
+$template->append('plugin_states', 'uninstalled');
-foreach($missing_plugin_ids as $plugin_id)
+if ($merged_plugins)
{
- $template->append(
- 'plugins',
- array(
- 'NAME' => $plugin_id,
- 'VERSION' => $plugins->db_plugins_by_id[$plugin_id]['version'],
- 'DESC' => "ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW !",
- 'U_ACTION' => sprintf($action_url, $plugin_id),
- 'STATE' => 'missing',
- )
- );
+ $template->append('plugin_states', 'merged');
}
-$template->append('plugin_states', 'active');
-$template->append('plugin_states', 'inactive');
-$template->append('plugin_states', 'uninstalled');
+$missing_plugin_ids = array_diff(
+ array_keys($plugins->db_plugins_by_id),
+ array_keys($plugins->fs_plugins)
+ );
if (count($missing_plugin_ids) > 0)
{
+ foreach($missing_plugin_ids as $plugin_id)
+ {
+ $template->append(
+ 'plugins',
+ array(
+ 'NAME' => $plugin_id,
+ 'VERSION' => $plugins->db_plugins_by_id[$plugin_id]['version'],
+ 'DESC' => l10n('ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW.'),
+ 'U_ACTION' => sprintf($action_url, $plugin_id),
+ 'STATE' => 'missing',
+ )
+ );
+ }
$template->append('plugin_states', 'missing');
}
diff --git a/admin/themes/clear/icon/warning.png b/admin/themes/clear/icon/warning.png
new file mode 100644
index 000000000..060b57707
--- /dev/null
+++ b/admin/themes/clear/icon/warning.png
Binary files differ
diff --git a/admin/themes/default/icon/warning.png b/admin/themes/default/icon/warning.png
new file mode 100644
index 000000000..060b57707
--- /dev/null
+++ b/admin/themes/default/icon/warning.png
Binary files differ
diff --git a/admin/themes/default/template/plugins_list.tpl b/admin/themes/default/template/plugins_list.tpl
index d6a8364ee..618104ca5 100644
--- a/admin/themes/default/template/plugins_list.tpl
+++ b/admin/themes/default/template/plugins_list.tpl
@@ -1,3 +1,21 @@
+{footer_script}
+var incompatible_msg = '{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'javascript'}';
+incompatible_msg += '\n';
+incompatible_msg += '{'Do you want to activate anyway?'|@translate|@escape:'javascript'}';
+
+{literal}
+jQuery(document).ready(function() {
+ jQuery('.incompatible').click(function() {
+ return confirm(incompatible_msg);
+ });
+ jQuery('.warning').tipTip({
+ 'delay' : 0,
+ 'fadeIn' : 200,
+ 'fadeOut' : 200
+ });
+});
+{/literal}{/footer_script}
+
<div class="titrePage">
<h2>{'Plugins'|@translate}</h2>
</div>
@@ -19,6 +37,9 @@
{elseif $plugin_state == 'missing'}
{'Missing Plugins'|@translate}
+ {elseif $plugin_state == 'merged'}
+ {'Obsolete Plugins'|@translate}
+
{/if}
</legend>
{foreach from=$plugins item=plugin name=plugins_loop}
@@ -26,7 +47,9 @@
<div class="pluginBox">
<table>
<tr>
- <td class="pluginBoxNameCell">{$plugin.NAME}</td>
+ <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}">
+ {$plugin.NAME}
+ </td>
<td>{$plugin.DESC}</td>
</tr>
<tr>
@@ -35,7 +58,7 @@
<a href="{$plugin.U_ACTION}&amp;action=deactivate">{'Deactivate'|@translate}</a>
{elseif $plugin_state == 'inactive'}
- <a href="{$plugin.U_ACTION}&amp;action=activate">{'Activate'|@translate}</a>
+ <a href="{$plugin.U_ACTION}&amp;action=activate" {if $plugin.INCOMPATIBLE}class="incompatible"{/if}>{'Activate'|@translate}</a>
| <a href="{$plugin.U_ACTION}&amp;action=uninstall" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Uninstall'|@translate}</a>
{elseif $plugin_state == 'uninstalled'}
@@ -45,6 +68,8 @@
{elseif $plugin_state == 'missing'}
<a href="{$plugin.U_ACTION}&amp;action=uninstall" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Uninstall'|@translate}</a>
+ {elseif $plugin_state == 'merged'}
+ <a href="{$plugin.U_ACTION}&amp;action=delete">{'Delete'|@translate}</a>
{/if}
</td>
<td>
diff --git a/admin/themes/default/theme.css b/admin/themes/default/theme.css
index 13c499411..bb645c256 100644
--- a/admin/themes/default/theme.css
+++ b/admin/themes/default/theme.css
@@ -1043,3 +1043,9 @@ LEGEND {
#batchManagerGlobal .removeFilter span {display:none}
#batchManagerGlobal #applyFilterBlock {margin-top:20px;}
#batchManagerGlobal .useFilterCheckbox {display:none}
+
+.warning {
+ background:url(icon/warning.png) no-repeat top left;
+ width: 130px;
+ padding-left: 20px;
+}
diff --git a/include/common.inc.php b/include/common.inc.php
index f5640f04c..048290e19 100644
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -157,7 +157,6 @@ else
define('PEM_URL', 'http://'.PHPWG_DOMAIN.'/ext');
}
-
// language files
load_language('common.lang');
if ( is_admin() || (defined('IN_ADMIN') and IN_ADMIN) )
diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php
index 1d86a5394..444c896f3 100644
--- a/language/en_UK/admin.lang.php
+++ b/language/en_UK/admin.lang.php
@@ -777,4 +777,9 @@ $lang['All languages are up to date.'] = 'All languages are up to date.';
$lang['Visit theme site'] = 'Visit theme site';
$lang['Visit language site'] = 'Visit language site';
$lang['New Version'] = 'New Version';
+$lang['Obsolete Plugins'] = 'Obsolete Plugins';
+$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.';
+$lang['Do you want to activate anyway?'] = 'Do you want to activate anyway?';
+$lang['THIS PLUGIN IS NOW PART OF PIWIGO CORE! DELETE IT NOW.'] = 'THIS PLUGIN IS NOW PART OF PIWIGO CORE! UNINSTALL IT NOW!';
+$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.';
?> \ No newline at end of file
diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php
index bc7ab447a..e53cf21c9 100644
--- a/language/fr_FR/admin.lang.php
+++ b/language/fr_FR/admin.lang.php
@@ -788,4 +788,9 @@ $lang['All languages are up to date.'] = 'Toutes les langues sont à jour.';
$lang['Visit theme site'] = 'Visitez le site du thème';
$lang['Visit language site'] = 'Visitez le site de la langue';
$lang['New Version'] = 'Nouvelle version';
+$lang['Obsolete Plugins'] = 'Plugins obsolètes';
+$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.';
+$lang['Do you want to activate anyway?'] = 'Voulez-vous l\'activer quand même?';
+$lang['THIS PLUGIN IS NOW PART OF PIWIGO CORE! DELETE IT NOW.'] = 'CE PLUGIN FAIT DÉSORMAIS PARTIE DU CORE DE PIWIGO! SUPPRIMEZ-LE.';
+$lang['ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW.'] = 'ERREUR: CE PLUGIN EST MANQUANT MAIS TOUJOURS INSTALLÉ! DÉSINSTALLEZ-LE.';
?>