mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-27 03:39:57 +03:00
plugins go now in the #plugins table
git-svn-id: http://piwigo.org/svn/trunk@1584 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
9c3e182268
commit
a81bac0f15
10 changed files with 306 additions and 85 deletions
|
@ -24,7 +24,9 @@
|
|||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
function get_plugins()
|
||||
/* Returns an array of plugins defined in the plugin directory
|
||||
*/
|
||||
function get_fs_plugins()
|
||||
{
|
||||
$plugins = array();
|
||||
|
||||
|
@ -39,7 +41,7 @@ function get_plugins()
|
|||
and file_exists($path.'/index.php')
|
||||
)
|
||||
{
|
||||
$plugin = array('name'=>'?', 'version'=>'?', 'uri'=>'', 'description'=>'');
|
||||
$plugin = array('name'=>'?', 'version'=>'0', 'uri'=>'', 'description'=>'');
|
||||
$plg_data = implode( '', file($path.'/index.php') );
|
||||
|
||||
if ( preg_match("|Plugin Name: (.*)|i", $plg_data, $val) )
|
||||
|
@ -66,39 +68,6 @@ function get_plugins()
|
|||
return $plugins;
|
||||
}
|
||||
|
||||
function activate_plugin($plugin_name)
|
||||
{
|
||||
global $conf;
|
||||
$arr = get_active_plugins(false);
|
||||
array_push($arr, $plugin_name);
|
||||
if ($arr != array_unique($arr) )
|
||||
return false; // just added the same one
|
||||
$conf['active_plugins'] = implode(',', $arr);
|
||||
pwg_query('
|
||||
UPDATE '.CONFIG_TABLE.'
|
||||
SET value="'.$conf['active_plugins'].'"
|
||||
WHERE param="active_plugins"');
|
||||
return true;
|
||||
}
|
||||
|
||||
function deactivate_plugin($plugin_name)
|
||||
{
|
||||
global $conf;
|
||||
$arr = get_active_plugins(false);
|
||||
$idx = array_search($plugin_name, $arr);
|
||||
if ($idx!==false)
|
||||
{
|
||||
unset( $arr[$idx] );
|
||||
$conf['active_plugins'] = implode(',', $arr);
|
||||
pwg_query('
|
||||
UPDATE '.CONFIG_TABLE.'
|
||||
SET value="'.$conf['active_plugins'].'"
|
||||
WHERE param="active_plugins"');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*allows plugins to add their content to the administration page*/
|
||||
function add_plugin_admin_menu($title, $func)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue