diff options
author | rvelices <rv-github@modusoptimus.com> | 2006-12-14 00:58:57 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2006-12-14 00:58:57 +0000 |
commit | f7960e7e72ca913e1e67844dec6ff0d40de46d1b (patch) | |
tree | 678ca1a56753234b43b6ba65eb0b61fb7535787f | |
parent | 51e56e9c1f4952a7d8cb7533b62c2829c15df01e (diff) |
- 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
Diffstat (limited to '')
-rw-r--r-- | admin.php | 32 | ||||
-rw-r--r-- | admin/plugin.php | 21 | ||||
-rw-r--r-- | admin/plugins.php | 24 | ||||
-rw-r--r-- | include/common.inc.php | 3 | ||||
-rw-r--r-- | include/picture_metadata.inc.php | 1 | ||||
-rw-r--r-- | index.php | 2 | ||||
-rw-r--r-- | plugins/event_tracer/tracer_admin.php | 6 | ||||
-rw-r--r-- | template/yoga/admin.tpl | 12 | ||||
-rw-r--r-- | template/yoga/admin/plugin.tpl | 8 | ||||
-rw-r--r-- | template/yoga/admin/plugins.tpl | 9 |
10 files changed, 53 insertions, 65 deletions
@@ -31,6 +31,7 @@ define('IN_ADMIN', true); 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_plugins.inc.php'); // +-----------------------------------------------------------------------+ // | Check Access and exit when user status is not ok | @@ -58,6 +59,9 @@ else $page['page'] = 'intro'; } +$page['errors'] = array(); +$page['infos'] = array(); + $link_start = PHPWG_ROOT_PATH.'admin.php?page='; $conf_link = $link_start.'configuration&section='; $opt_link = $link_start.'cat_options&section='; @@ -114,19 +118,38 @@ if ($conf['allow_random_representative']) ); } -//------------------------------------------------------------- content display -$page['errors'] = array(); -$page['infos'] = array(); +// required before plugin page inclusion +trigger_action('plugin_admin_menu'); 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 | // +-----------------------------------------------------------------------+ if (count($page['errors']) != 0) { - $template->assign_block_vars('errors',array()); foreach ($page['errors'] as $error) { $template->assign_block_vars('errors.error',array('ERROR'=>$error)); @@ -135,7 +158,6 @@ if (count($page['errors']) != 0) if (count($page['infos']) != 0) { - $template->assign_block_vars('infos',array()); foreach ($page['infos'] as $info) { $template->assign_block_vars('infos.info',array('INFO'=>$info)); diff --git a/admin/plugin.php b/admin/plugin.php index e3d5e4e4e..c880cdca7 100644 --- a/admin/plugin.php +++ b/admin/plugin.php @@ -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_plugins.inc.php'); check_status(ACCESS_ADMINISTRATOR); $template->set_filenames(array('plugin' => 'admin/plugin.tpl')); -trigger_action('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) { if (isset($_GET['section']) and $menu['uid']==$_GET['section']) { $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) ) { + $template->assign_var('PLUGIN_TITLE', $found_menu['title'] ); call_user_func( $found_menu['function'], PHPWG_ROOT_PATH.'admin.php?page=plugin&section='.$found_menu['uid'] ); diff --git a/admin/plugins.php b/admin/plugins.php index 6b5bf4505..e8f2c2a5a 100644 --- a/admin/plugins.php +++ b/admin/plugins.php @@ -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_plugins.inc.php'); check_status(ACCESS_ADMINISTRATOR); $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')); -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; foreach( $fs_plugins as $plugin_id => $fs_plugin ) { diff --git a/include/common.inc.php b/include/common.inc.php index 2b02e0cf8..c1ebc7f74 100644 --- a/include/common.inc.php +++ b/include/common.inc.php @@ -137,6 +137,7 @@ or die ( "Could not connect to database" ); // since basic gallery information is not available // load_conf_from_db(); +load_plugins(); include(PHPWG_ROOT_PATH.'include/user.inc.php'); @@ -158,8 +159,6 @@ if ($user['is_the_guest']) // template instance $template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template'], $user['theme'] ); -load_plugins(); - if ($conf['gallery_locked']) { $header_msgs[] = $lang['gallery_locked_message']; diff --git a/include/picture_metadata.inc.php b/include/picture_metadata.inc.php index 038737eb7..a661a09e9 100644 --- a/include/picture_metadata.inc.php +++ b/include/picture_metadata.inc.php @@ -41,6 +41,7 @@ if ($conf['show_exif']) if ($exif = @read_exif_data($picture['current']['image_path'])) { + $exif = trigger_event('format_exif_data', $exif, $picture['current'] ); $template->assign_block_vars( 'metadata.headline', array('TITLE' => 'EXIF Metadata') @@ -352,8 +352,8 @@ if (isset($page['comment']) and $page['comment'] != '') //------------------------------------------------------------ log informations pwg_log('category', $page['title']); -trigger_action('loc_end_index'); include(PHPWG_ROOT_PATH.'include/page_header.php'); +trigger_action('loc_end_index'); $template->parse('index'); include(PHPWG_ROOT_PATH.'include/page_tail.php'); ?> diff --git a/plugins/event_tracer/tracer_admin.php b/plugins/event_tracer/tracer_admin.php index 9231638b1..7371d2531 100644 --- a/plugins/event_tracer/tracer_admin.php +++ b/plugins/event_tracer/tracer_admin.php @@ -9,7 +9,11 @@ if ( isset($_POST['eventTracer_filters']) ) $v = $_POST['eventTracer_filters']; $v = str_replace( "\r\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->save_config(); global $page; diff --git a/template/yoga/admin.tpl b/template/yoga/admin.tpl index 294b39b15..03c1f993b 100644 --- a/template/yoga/admin.tpl +++ b/template/yoga/admin.tpl @@ -71,6 +71,18 @@ </ul> </dd> </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 id="content"> diff --git a/template/yoga/admin/plugin.tpl b/template/yoga/admin/plugin.tpl index 96b0c3ae8..f4b1b838f 100644 --- a/template/yoga/admin/plugin.tpl +++ b/template/yoga/admin/plugin.tpl @@ -1,11 +1,5 @@ <div class="titrePage"> - <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> + <h2>{PLUGIN_TITLE}</h2> </div> diff --git a/template/yoga/admin/plugins.tpl b/template/yoga/admin/plugins.tpl index db661ac95..00d344cac 100644 --- a/template/yoga/admin/plugins.tpl +++ b/template/yoga/admin/plugins.tpl @@ -1,10 +1,5 @@ <div class="titrePage"> - <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>{lang:Plugins} </h2> </div> @@ -24,7 +19,7 @@ <td>{plugins.plugin.DESCRIPTION}</td> <td> <!-- 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 --> </td> </tr> |