mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-26 19:29:58 +03:00
- plugins admin menu appear now in the admin page menubar
- plugins are loaded immediately after loading the config (allow them to hack more of pwg like user init, template init etc...) - trigger event format_exif_data (for picture display only) git-svn-id: http://piwigo.org/svn/trunk@1655 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
51e56e9c1f
commit
f7960e7e72
10 changed files with 53 additions and 65 deletions
32
admin.php
32
admin.php
|
@ -31,6 +31,7 @@ define('IN_ADMIN', true);
|
||||||
include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
|
include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
|
||||||
|
|
||||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
||||||
|
include_once(PHPWG_ROOT_PATH.'admin/include/functions_plugins.inc.php');
|
||||||
|
|
||||||
// +-----------------------------------------------------------------------+
|
// +-----------------------------------------------------------------------+
|
||||||
// | Check Access and exit when user status is not ok |
|
// | Check Access and exit when user status is not ok |
|
||||||
|
@ -58,6 +59,9 @@ else
|
||||||
$page['page'] = 'intro';
|
$page['page'] = 'intro';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$page['errors'] = array();
|
||||||
|
$page['infos'] = array();
|
||||||
|
|
||||||
$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
|
$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
|
||||||
$conf_link = $link_start.'configuration&section=';
|
$conf_link = $link_start.'configuration&section=';
|
||||||
$opt_link = $link_start.'cat_options&section=';
|
$opt_link = $link_start.'cat_options&section=';
|
||||||
|
@ -114,19 +118,38 @@ if ($conf['allow_random_representative'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------- content display
|
// required before plugin page inclusion
|
||||||
$page['errors'] = array();
|
trigger_action('plugin_admin_menu');
|
||||||
$page['infos'] = array();
|
|
||||||
|
|
||||||
include(PHPWG_ROOT_PATH.'admin/'.$page['page'].'.php');
|
include(PHPWG_ROOT_PATH.'admin/'.$page['page'].'.php');
|
||||||
|
|
||||||
|
//------------------------------------------------------------- content display
|
||||||
|
$template->assign_block_vars('plugin_menu.menu_item',
|
||||||
|
array(
|
||||||
|
'NAME' => l10n('admin'),
|
||||||
|
'URL' => $link_start.'plugins'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if ( isset($page['plugin_admin_menu']) )
|
||||||
|
{
|
||||||
|
$plug_base_url = $link_start.'plugin&section=';
|
||||||
|
foreach ($page['plugin_admin_menu'] as $menu)
|
||||||
|
{
|
||||||
|
$template->assign_block_vars('plugin_menu.menu_item',
|
||||||
|
array(
|
||||||
|
'NAME' => $menu['title'],
|
||||||
|
'URL' => $plug_base_url.$menu['uid']
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// +-----------------------------------------------------------------------+
|
// +-----------------------------------------------------------------------+
|
||||||
// | errors & infos |
|
// | errors & infos |
|
||||||
// +-----------------------------------------------------------------------+
|
// +-----------------------------------------------------------------------+
|
||||||
|
|
||||||
if (count($page['errors']) != 0)
|
if (count($page['errors']) != 0)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('errors',array());
|
|
||||||
foreach ($page['errors'] as $error)
|
foreach ($page['errors'] as $error)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('errors.error',array('ERROR'=>$error));
|
$template->assign_block_vars('errors.error',array('ERROR'=>$error));
|
||||||
|
@ -135,7 +158,6 @@ if (count($page['errors']) != 0)
|
||||||
|
|
||||||
if (count($page['infos']) != 0)
|
if (count($page['infos']) != 0)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('infos',array());
|
|
||||||
foreach ($page['infos'] as $info)
|
foreach ($page['infos'] as $info)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('infos.info',array('INFO'=>$info));
|
$template->assign_block_vars('infos.info',array('INFO'=>$info));
|
||||||
|
|
|
@ -31,40 +31,25 @@ if( !defined("PHPWG_ROOT_PATH") )
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
||||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions_plugins.inc.php');
|
|
||||||
check_status(ACCESS_ADMINISTRATOR);
|
check_status(ACCESS_ADMINISTRATOR);
|
||||||
|
|
||||||
$template->set_filenames(array('plugin' => 'admin/plugin.tpl'));
|
$template->set_filenames(array('plugin' => 'admin/plugin.tpl'));
|
||||||
|
|
||||||
trigger_action('plugin_admin_menu');
|
|
||||||
|
|
||||||
|
|
||||||
if ( isset($page['plugin_admin_menu']) )
|
if ( isset($page['plugin_admin_menu']) )
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('plugin_menu.menu_item',
|
|
||||||
array(
|
|
||||||
'NAME' => l10n('Plugins'),
|
|
||||||
'URL' => PHPWG_ROOT_PATH.'admin.php?page=plugins'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$plug_base_url = PHPWG_ROOT_PATH.'admin.php?page=plugin&section=';
|
|
||||||
foreach ($page['plugin_admin_menu'] as $menu)
|
foreach ($page['plugin_admin_menu'] as $menu)
|
||||||
{
|
{
|
||||||
if (isset($_GET['section']) and $menu['uid']==$_GET['section'])
|
if (isset($_GET['section']) and $menu['uid']==$_GET['section'])
|
||||||
{
|
{
|
||||||
$found_menu=$menu;
|
$found_menu=$menu;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
$template->assign_block_vars('plugin_menu.menu_item',
|
|
||||||
array(
|
|
||||||
'NAME' => $menu['title'],
|
|
||||||
'URL' => $plug_base_url.$menu['uid']
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset($found_menu) )
|
if ( isset($found_menu) )
|
||||||
{
|
{
|
||||||
|
$template->assign_var('PLUGIN_TITLE', $found_menu['title'] );
|
||||||
call_user_func(
|
call_user_func(
|
||||||
$found_menu['function'],
|
$found_menu['function'],
|
||||||
PHPWG_ROOT_PATH.'admin.php?page=plugin&section='.$found_menu['uid'] );
|
PHPWG_ROOT_PATH.'admin.php?page=plugin&section='.$found_menu['uid'] );
|
||||||
|
|
|
@ -31,7 +31,6 @@ if( !defined("PHPWG_ROOT_PATH") )
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
||||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions_plugins.inc.php');
|
|
||||||
check_status(ACCESS_ADMINISTRATOR);
|
check_status(ACCESS_ADMINISTRATOR);
|
||||||
|
|
||||||
$my_base_url = PHPWG_ROOT_PATH.'admin.php?page=plugins';
|
$my_base_url = PHPWG_ROOT_PATH.'admin.php?page=plugins';
|
||||||
|
@ -162,29 +161,6 @@ foreach ($db_plugins as $db_plugin)
|
||||||
|
|
||||||
$template->set_filenames(array('plugins' => 'admin/plugins.tpl'));
|
$template->set_filenames(array('plugins' => 'admin/plugins.tpl'));
|
||||||
|
|
||||||
trigger_action('plugin_admin_menu');
|
|
||||||
|
|
||||||
$template->assign_block_vars('plugin_menu.menu_item',
|
|
||||||
array(
|
|
||||||
'NAME' => l10n('Plugins'),
|
|
||||||
'URL' => PHPWG_ROOT_PATH.'admin.php?page=plugins'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( isset($page['plugin_admin_menu']) )
|
|
||||||
{
|
|
||||||
$plug_base_url = PHPWG_ROOT_PATH.'admin.php?page=plugin&section=';
|
|
||||||
foreach ($page['plugin_admin_menu'] as $menu)
|
|
||||||
{
|
|
||||||
$template->assign_block_vars('plugin_menu.menu_item',
|
|
||||||
array(
|
|
||||||
'NAME' => $menu['title'],
|
|
||||||
'URL' => $plug_base_url.$menu['uid']
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$num=0;
|
$num=0;
|
||||||
foreach( $fs_plugins as $plugin_id => $fs_plugin )
|
foreach( $fs_plugins as $plugin_id => $fs_plugin )
|
||||||
{
|
{
|
||||||
|
|
|
@ -137,6 +137,7 @@ or die ( "Could not connect to database" );
|
||||||
// since basic gallery information is not available
|
// since basic gallery information is not available
|
||||||
//
|
//
|
||||||
load_conf_from_db();
|
load_conf_from_db();
|
||||||
|
load_plugins();
|
||||||
|
|
||||||
include(PHPWG_ROOT_PATH.'include/user.inc.php');
|
include(PHPWG_ROOT_PATH.'include/user.inc.php');
|
||||||
|
|
||||||
|
@ -158,8 +159,6 @@ if ($user['is_the_guest'])
|
||||||
// template instance
|
// template instance
|
||||||
$template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template'], $user['theme'] );
|
$template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template'], $user['theme'] );
|
||||||
|
|
||||||
load_plugins();
|
|
||||||
|
|
||||||
if ($conf['gallery_locked'])
|
if ($conf['gallery_locked'])
|
||||||
{
|
{
|
||||||
$header_msgs[] = $lang['gallery_locked_message'];
|
$header_msgs[] = $lang['gallery_locked_message'];
|
||||||
|
|
|
@ -41,6 +41,7 @@ if ($conf['show_exif'])
|
||||||
|
|
||||||
if ($exif = @read_exif_data($picture['current']['image_path']))
|
if ($exif = @read_exif_data($picture['current']['image_path']))
|
||||||
{
|
{
|
||||||
|
$exif = trigger_event('format_exif_data', $exif, $picture['current'] );
|
||||||
$template->assign_block_vars(
|
$template->assign_block_vars(
|
||||||
'metadata.headline',
|
'metadata.headline',
|
||||||
array('TITLE' => 'EXIF Metadata')
|
array('TITLE' => 'EXIF Metadata')
|
||||||
|
|
|
@ -352,8 +352,8 @@ if (isset($page['comment']) and $page['comment'] != '')
|
||||||
//------------------------------------------------------------ log informations
|
//------------------------------------------------------------ log informations
|
||||||
pwg_log('category', $page['title']);
|
pwg_log('category', $page['title']);
|
||||||
|
|
||||||
trigger_action('loc_end_index');
|
|
||||||
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
||||||
|
trigger_action('loc_end_index');
|
||||||
$template->parse('index');
|
$template->parse('index');
|
||||||
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -9,7 +9,11 @@ if ( isset($_POST['eventTracer_filters']) )
|
||||||
$v = $_POST['eventTracer_filters'];
|
$v = $_POST['eventTracer_filters'];
|
||||||
$v = str_replace( "\r\n", "\n", $v );
|
$v = str_replace( "\r\n", "\n", $v );
|
||||||
$v = str_replace( "\n\n", "\n", $v );
|
$v = str_replace( "\n\n", "\n", $v );
|
||||||
$this->my_config['filters'] = explode("\n", $v);
|
$v = stripslashes($v);
|
||||||
|
if (!empty($v))
|
||||||
|
$this->my_config['filters'] = explode("\n", $v);
|
||||||
|
else
|
||||||
|
$this->my_config['filters'] = array();
|
||||||
$this->my_config['show_args'] = isset($_POST['eventTracer_show_args']);
|
$this->my_config['show_args'] = isset($_POST['eventTracer_show_args']);
|
||||||
$this->save_config();
|
$this->save_config();
|
||||||
global $page;
|
global $page;
|
||||||
|
|
|
@ -71,6 +71,18 @@
|
||||||
</ul>
|
</ul>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
<dl>
|
||||||
|
<dt>{lang:Plugins}</dt>
|
||||||
|
<dd>
|
||||||
|
<ul>
|
||||||
|
<!-- BEGIN plugin_menu -->
|
||||||
|
<!-- BEGIN menu_item -->
|
||||||
|
<li><a href="{plugin_menu.menu_item.URL}">{plugin_menu.menu_item.NAME}</a></li>
|
||||||
|
<!-- END menu_item -->
|
||||||
|
<!-- END plugin_menu -->
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
</div> <!-- menubar -->
|
</div> <!-- menubar -->
|
||||||
|
|
||||||
<div id="content">
|
<div id="content">
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
<div class="titrePage">
|
<div class="titrePage">
|
||||||
<h2>
|
<h2>{PLUGIN_TITLE}</h2>
|
||||||
<!-- BEGIN plugin_menu -->
|
|
||||||
<!-- BEGIN menu_item -->
|
|
||||||
<span style="margin-left:2px;"><a href="{plugin_menu.menu_item.URL}">{plugin_menu.menu_item.NAME}</a></span>
|
|
||||||
<!-- END menu_item -->
|
|
||||||
<!-- END plugin_menu -->
|
|
||||||
</h2>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
<div class="titrePage">
|
<div class="titrePage">
|
||||||
<h2>
|
<h2>{lang:Plugins}
|
||||||
<!-- BEGIN plugin_menu -->
|
|
||||||
<!-- BEGIN menu_item -->
|
|
||||||
<span style="margin-left:2px;"><a href="{plugin_menu.menu_item.URL}">{plugin_menu.menu_item.NAME}</a></span>
|
|
||||||
<!-- END menu_item -->
|
|
||||||
<!-- END plugin_menu -->
|
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -24,7 +19,7 @@
|
||||||
<td>{plugins.plugin.DESCRIPTION}</td>
|
<td>{plugins.plugin.DESCRIPTION}</td>
|
||||||
<td>
|
<td>
|
||||||
<!-- BEGIN action -->
|
<!-- BEGIN action -->
|
||||||
<a href="{plugins.plugin.action.U_ACTION}">{plugins.plugin.action.L_ACTION}</a>
|
<a href="{plugins.plugin.action.U_ACTION}" {TAG_INPUT_ENABLED}>{plugins.plugin.action.L_ACTION}</a>
|
||||||
<!-- END action -->
|
<!-- END action -->
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue