diff --git a/admin/advanced_feature.php b/admin/advanced_feature.php
index f8991ff07..b1614b488 100644
--- a/admin/advanced_feature.php
+++ b/admin/advanced_feature.php
@@ -71,19 +71,19 @@ array_push($advanced_features,
array
(
'CAPTION' => l10n('Elements_not_linked'),
- 'URL' => get_root_url().'admin.php?page=element_set&cat=not_linked'
+ 'URL' => get_root_url().'admin.php?page=element_set&cat=not_linked'
));
array_push($advanced_features,
array
(
'CAPTION' => l10n('Duplicates'),
- 'URL' => get_root_url().'admin.php?page=element_set&cat=duplicates'
+ 'URL' => get_root_url().'admin.php?page=element_set&cat=duplicates'
));
//$advanced_features is array of array composed of CAPTION & URL
$advanced_features =
- trigger_event('array_advanced_features', $advanced_features);
+ trigger_event('get_admin_advanced_features_links', $advanced_features);
// +-----------------------------------------------------------------------+
// | Template init |
diff --git a/admin/site_manager.php b/admin/site_manager.php
index 53330d7f9..375f92349 100644
--- a/admin/site_manager.php
+++ b/admin/site_manager.php
@@ -297,7 +297,7 @@ while ($row = mysql_fetch_array($result))
$plugin_links = array();
//$plugin_links is array of array composed of U_HREF, U_HINT & U_CAPTION
$plugin_links =
- trigger_event('array_site_manager_plugin_links',
+ trigger_event('get_admins_site_links',
$plugin_links, $row['id'], $is_remote);
// plugin_links
diff --git a/plugins/add_index/admin/admin_menu.php b/plugins/add_index/admin/admin_menu.php
new file mode 100644
index 000000000..2ab250119
--- /dev/null
+++ b/plugins/add_index/admin/admin_menu.php
@@ -0,0 +1,76 @@
+set_filenames(array('plugin_admin_content' => dirname(__FILE__).'/admin_menu.tpl'));
+
+/*
+if ( isset($_POST['eventTracer_filters']) )
+{
+ $v = $_POST['eventTracer_filters'];
+ $v = str_replace( "\r\n", "\n", $v );
+ $v = str_replace( "\n\n", "\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;
+ array_push($page['infos'], 'event tracer options saved');
+}
+$template->assign_var('EVENT_TRACER_FILTERS', implode("\n", $this->my_config['filters'] ) );
+$template->assign_var('EVENT_TRACER_SHOW_ARGS', $this->my_config['show_args'] ? 'checked="checked"' : '' );*/
+$template->assign_var('filename', $conf['add_index_filename']);
+$template->assign_var('source_directory_path', $conf['add_index_source_directory_path']);
+$template->assign_var('F_ACTION', $my_url);
+
+// +-----------------------------------------------------------------------+
+// | Sending html code |
+// +-----------------------------------------------------------------------+
+$template->assign_var_from_handle('PLUGIN_ADMIN_CONTENT', 'plugin_admin_content');
+
+?>
\ No newline at end of file
diff --git a/plugins/add_index/admin/admin_menu.tpl b/plugins/add_index/admin/admin_menu.tpl
new file mode 100644
index 000000000..b365e312f
--- /dev/null
+++ b/plugins/add_index/admin/admin_menu.tpl
@@ -0,0 +1,29 @@
+
+
{lang:add_index_Description_1}
+{lang:add_index_Description_2}
+
+
diff --git a/plugins/add_index/admin/main_page.php b/plugins/add_index/admin/main_page.php
index 488e0bb85..a99eefa90 100644
--- a/plugins/add_index/admin/main_page.php
+++ b/plugins/add_index/admin/main_page.php
@@ -3,7 +3,7 @@
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
-// | Copyright (C) 2006 Ruben ARNAUD - team@phpwebgallery.net |
+// | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | last modifier : $Author: rub $
// | revision : $Revision: 1.0.2.0 $
@@ -23,30 +23,14 @@
// | USA. |
// +-----------------------------------------------------------------------+
-// +-----------------------------------------------------------------------+
-// | Here before to modify by user |
-// +-----------------------------------------------------------------------+
-// Name of index file (index.php or index.htm or index.html)
-if (!isset($conf['index']['file_name']))
+if ((!defined('PHPWG_ROOT_PATH')) or (!(defined('IN_ADMIN') and IN_ADMIN)))
{
- $conf['index']['file_name'] = 'index.php';
-}
-// Name of index file (index.php or index.htm or index.html)
-if (!isset($conf['index']['source_directory_name']))
-{
- // Name of the directoty use in order to copy index file
- $conf['index']['source_directory_name'] = 'include/index.php';
+ die('Hacking attempt!');
}
-// +-----------------------------------------------------------------------+
-// | include |
-// +-----------------------------------------------------------------------+
-
-if (!defined('PHPWG_ROOT_PATH'))
-{
- die ("Hacking attempt!");
-}
-
+// +-----------------------------------------------------------------------+
+// | include |
+// +-----------------------------------------------------------------------+
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
@@ -100,13 +84,15 @@ function get_add_index_directories($path, $recursive = true)
// +-----------------------------------------------------------------------+
// | Main |
-// +-----------------------------------------------------------------------+
-$index_file_src=PHPWG_ROOT_PATH.$conf['index']['source_directory_name'];
+// +-----------------------------------------------------------------------+
+// Compute values
+$index_file_src=$conf['add_index_source_directory_path'].$conf['add_index_filename'];
$overwrite_file=isset($_GET['overwrite']);
$site_id = (isset($_GET['site_id']) and is_numeric($_GET['site_id'])
? $_GET['site_id']
: 0);
+// Init values
$add_index_results = array();
$count_copy = 0;
$count_skip = 0;
@@ -140,7 +126,7 @@ order by
//echo $galleries_url.'
';
foreach (get_add_index_directories($galleries_url) as $dir_galleries)
{
- $file_dest = $dir_galleries.'/'.$conf['index']['file_name'];
+ $file_dest = $dir_galleries.'/'.$conf['add_index_filename'];
if ($overwrite_file or !@file_exists($file_dest))
{
if (copy($index_file_src, $file_dest))
@@ -174,7 +160,8 @@ order by
}
}
- if ($count_copy != 0)
+ // Show always an result, defaut (0 copy, $count_copy == $count_skip == 0)
+ if (($count_copy != 0) or ($count_skip == 0))
{
array_push($add_index_results,
l10n_dec('add_index_nb_copied_file', 'add_index_nb_copied_files',
diff --git a/plugins/add_index/language/en_UK.iso-8859-1/help/advanced_feature.html b/plugins/add_index/language/en_UK.iso-8859-1/help/advanced_feature.html
index 46eae4b61..5724d5d1b 100644
--- a/plugins/add_index/language/en_UK.iso-8859-1/help/advanced_feature.html
+++ b/plugins/add_index/language/en_UK.iso-8859-1/help/advanced_feature.html
@@ -2,6 +2,6 @@
-
Add and overwrite "index" files for all local sites:
- Overwrite copy the file ./include/index.php in all sub-directories of gallerie local sites.
+ Overwrite copy the file ./include/index.php to all sub-directories of gallerie local sites.
diff --git a/plugins/add_index/language/en_UK.iso-8859-1/help/site_manager.html b/plugins/add_index/language/en_UK.iso-8859-1/help/site_manager.html
index 7bd92283a..3ea24ac6b 100644
--- a/plugins/add_index/language/en_UK.iso-8859-1/help/site_manager.html
+++ b/plugins/add_index/language/en_UK.iso-8859-1/help/site_manager.html
@@ -2,6 +2,6 @@
-
Add "index" files for local site:
- Copy the file ./include/index.php in all sub-directories of selected local site.
+ Copy the file ./include/index.php to all sub-directories of selected local site.
diff --git a/plugins/add_index/language/en_UK.iso-8859-1/plugin.lang.php b/plugins/add_index/language/en_UK.iso-8859-1/plugin.lang.php
index b7e68ced1..c76bbc24c 100644
--- a/plugins/add_index/language/en_UK.iso-8859-1/plugin.lang.php
+++ b/plugins/add_index/language/en_UK.iso-8859-1/plugin.lang.php
@@ -3,7 +3,7 @@
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
-// | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net |
+// | Copyright (C) 2007 Ruben ARNAUD - team@phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
@@ -29,6 +29,7 @@
$lang['Add_Index'] = 'Add "index" files';
$lang['Advanced_Add_Index'] = 'Add and overwrite "index" files for all local sites';
$lang['Manager_Add_Index'] = 'add "index"';
+$lang['Menu_Add_Index'] = 'Add "index"';
$lang['add_index_file_copied'] = '%s copied';
$lang['add_index_file_not_copied'] = '%s not copied';
@@ -41,4 +42,11 @@ $lang['add_index_nb_not_copied_file'] = '%d file not copied';
$lang['add_index_nb_not_copied_files'] = '%d files not copied';
$lang['add_index_src_file_dont_exists'] = 'Source file %s don\'t esists, cannot duplicate this file';
+$lang['add_index_Description_1'] = 'Add "index" files allows to copy "index" file from source directory to all sub-directories of gallerie local sites.';
+$lang['add_index_Description_2'] = '"index" file prevents to list contents of a directory.';
+$lang['add_index_Parameters'] = 'Parameters';
+$lang['add_index_filename'] = 'File name';
+$lang['add_index_source_directory_path'] = 'Path of source directory';
+
+
?>
diff --git a/plugins/add_index/language/fr_FR.iso-8859-1/plugin.lang.php b/plugins/add_index/language/fr_FR.iso-8859-1/plugin.lang.php
index 1e64654aa..579a56aa3 100644
--- a/plugins/add_index/language/fr_FR.iso-8859-1/plugin.lang.php
+++ b/plugins/add_index/language/fr_FR.iso-8859-1/plugin.lang.php
@@ -3,7 +3,7 @@
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
-// | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net |
+// | Copyright (C) 2007 Ruben ARNAUD - team@phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
@@ -29,6 +29,7 @@
$lang['Add_Index'] = 'Ajout des fichiers "index"';
$lang['Advanced_Add_Index'] = 'Ajout et écrasement des fichiers "index" pour tous les sites locaux';
$lang['Manager_Add_Index'] = 'ajout des "index"';
+$lang['Menu_Add_Index'] = 'Add "index"';
$lang['add_index_file_copied'] = '%s copié';
$lang['add_index_file_not_copied'] = '%s non copié';
@@ -41,4 +42,10 @@ $lang['add_index_nb_not_copied_file'] = '%d fichier non copi
$lang['add_index_nb_not_copied_files'] = '%d fichiers non copiés';
$lang['add_index_src_file_dont_exists'] = 'Le fichier source n\'existe pas, la duplication de ce fichier n\'est pas possible';
+$lang['add_index_Description_1'] = 'L\'ajout des fichiers " permet de copier le fichier "index" du repertoire source vers tous les sous-répertoires des galeries des sites locaux.';
+$lang['add_index_Description_2'] = 'Le fichier "index" empêche de lister le contenu d\'un répertoire.';
+$lang['add_index_Parameters'] = 'Paramètres';
+$lang['add_index_filename'] = 'Nom du fichier';
+$lang['add_index_source_directory_path'] = 'Chemin du répertoire source';
+
?>
diff --git a/plugins/add_index/main.admin.inc.php b/plugins/add_index/main.admin.inc.php
index cf55c6edf..24cfa1dc5 100644
--- a/plugins/add_index/main.admin.inc.php
+++ b/plugins/add_index/main.admin.inc.php
@@ -3,7 +3,7 @@
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
-// | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net |
+// | Copyright (C) 2007 Ruben ARNAUD - team@phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
@@ -33,6 +33,22 @@ if ((!defined('PHPWG_ROOT_PATH')) or (!(defined('IN_ADMIN') and IN_ADMIN)))
class AdminAddIndex extends AddIndex
{
+ function load_params()
+ {
+ global $conf;
+ // Name of index file (index.php or index.htm or index.html)
+ if (!isset($conf['add_index_filename']))
+ {
+ $conf['add_index_filename'] = 'index.php';
+ }
+ // Name of index file (index.php or index.htm or index.html)
+ if (!isset($conf['add_index_source_directory_path']))
+ {
+ // Name of the directoty use in order to copy index file
+ $conf['add_index_source_directory_path'] = PHPWG_ROOT_PATH.'include/';
+ }
+ }
+
function loading_lang()
{
global $lang;
@@ -40,26 +56,26 @@ class AdminAddIndex extends AddIndex
include(get_language_filepath('plugin.lang.php', $this->path));
}
- function array_advanced_features($advanced_features)
+ function get_admin_advanced_features_links($advanced_features)
{
array_push($advanced_features,
array
(
'CAPTION' => l10n('Advanced_Add_Index'),
- 'URL' => get_root_url().'admin.php?page=main_page&page_type=plugin&plugin_id=add_index&overwrite'
+ 'URL' => get_root_url().'admin.php?page=main_page&page_type=plugin&plugin_id=add_index&overwrite'
));
return $advanced_features;
}
- function array_site_manager_plugin_links($site_manager_plugin_links, $site_id, $is_remote)
+ function get_admins_site_links($site_manager_plugin_links, $site_id, $is_remote)
{
if (!$is_remote)
{
array_push($site_manager_plugin_links,
array
(
- 'U_HREF' => get_root_url().'admin.php?page=main_page&page_type=plugin&plugin_id=add_index&site_id='.$site_id,
+ 'U_HREF' => get_root_url().'admin.php?page=main_page&page_type=plugin&plugin_id=add_index&site_id='.$site_id,
'U_CAPTION' => l10n('Manager_Add_Index'),
'U_HINT' => l10n('Add_Index')
));
@@ -67,12 +83,29 @@ class AdminAddIndex extends AddIndex
return $site_manager_plugin_links;
}
+
+ function plugin_admin_menu()
+ {
+ add_plugin_admin_menu(l10n('Menu_Add_Index'), array(&$this, 'do_plugin_admin_menu'));
+ }
+
+ function do_plugin_admin_menu($my_url)
+ {
+ include_once(dirname(__FILE__).'/admin/'.'admin_menu.php');
+ }
+
}
+// Create object
$add_index = new AdminAddIndex();
+// Load Add Index parameters
+$add_index->load_params();
+
+// Add events
add_event_handler('loading_lang', array(&$add_index, 'loading_lang'));
-add_event_handler('array_advanced_features', array(&$add_index, 'array_advanced_features'));
-add_event_handler('array_site_manager_plugin_links', array(&$add_index, 'array_site_manager_plugin_links'), EVENT_HANDLER_PRIORITY_NEUTRAL, 3);
+add_event_handler('get_admin_advanced_features_links', array(&$add_index, 'get_admin_advanced_features_links'));
+add_event_handler('get_admins_site_links', array(&$add_index, 'get_admins_site_links'), EVENT_HANDLER_PRIORITY_NEUTRAL, 3);
+add_event_handler('plugin_admin_menu', array(&$add_index, 'plugin_admin_menu') );
?>
\ No newline at end of file
diff --git a/plugins/add_index/main.base.inc.php b/plugins/add_index/main.base.inc.php
new file mode 100644
index 000000000..50f6e898a
--- /dev/null
+++ b/plugins/add_index/main.base.inc.php
@@ -0,0 +1,44 @@
+path = dirname(__FILE__).'/';
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/plugins/add_index/main.inc.php b/plugins/add_index/main.inc.php
index cf334be63..1f6346486 100644
--- a/plugins/add_index/main.inc.php
+++ b/plugins/add_index/main.inc.php
@@ -9,7 +9,7 @@ Plugin URI: http://www.phpwebgallery.net
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
-// | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net |
+// | Copyright (C) 2007 Ruben ARNAUD - team@phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
@@ -37,38 +37,18 @@ if (!defined('PHPWG_ROOT_PATH'))
die('Hacking attempt!');
}
-class AddIndex
+if (in_array(script_basename(), array('popuphelp', 'admin')))
{
- var $path;
-
- function AddIndex()
+ if (defined('IN_ADMIN') and IN_ADMIN)
{
- $this->path = dirname(__FILE__).'/';
+ include_once(dirname(__FILE__).'/'.'main.base.inc.php');
+ include_once(dirname(__FILE__).'/'.'main.admin.inc.php');
}
-
- function get_popup_help_content($popup_help_content, $page)
+ else
{
- $help_content =
- @file_get_contents(get_language_filepath('help/'.$page.'.html', $this->path));
- if ($help_content == false)
- {
- return $popup_help_content;
- }
- else
- {
- return $popup_help_content.$help_content;
- }
+ include_once(dirname(__FILE__).'/'.'main.base.inc.php');
+ include_once(dirname(__FILE__).'/'.'main.normal.inc.php');
}
}
-if (defined('IN_ADMIN') and IN_ADMIN)
-{
- include_once(dirname(__FILE__).'/'.'main.admin.inc.php');
-}
-else
-{
- $add_index = new AddIndex();
- add_event_handler('get_popup_help_content', array(&$add_index, 'get_popup_help_content'), EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
-}
-
?>
\ No newline at end of file
diff --git a/plugins/add_index/main.normal.inc.php b/plugins/add_index/main.normal.inc.php
new file mode 100644
index 000000000..f412a4b1f
--- /dev/null
+++ b/plugins/add_index/main.normal.inc.php
@@ -0,0 +1,65 @@
+path));
+ }
+ else
+ {
+ $help_content = false;
+ }
+
+ if ($help_content == false)
+ {
+ return $popup_help_content;
+ }
+ else
+ {
+ return $popup_help_content.$help_content;
+ }
+ }
+}
+
+// Create object
+$add_index = new NormalAddIndex();
+
+// Add events
+add_event_handler('get_popup_help_content', array(&$add_index, 'get_popup_help_content'), EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
+
+?>
\ No newline at end of file
diff --git a/plugins/add_index/maintain.inc.php b/plugins/add_index/maintain.inc.php
new file mode 100644
index 000000000..a2b3aa201
--- /dev/null
+++ b/plugins/add_index/maintain.inc.php
@@ -0,0 +1,38 @@
+
\ No newline at end of file