Feature Issue ID 0000496: Integrate MOD add_index on PWG with plugin.lang.php

Add some plugin triggers:
  o for help
  o for language
  o for site manager
  o for advanced features

Allow to launch directly plugin page (without section key)

Add add_index plugin, available on site manager and advanced features

Configuration page and best help must be coming soon.



git-svn-id: http://piwigo.org/svn/trunk@1699 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rub 2007-01-08 00:16:10 +00:00
commit 4489066c98
34 changed files with 929 additions and 40 deletions

View file

@ -0,0 +1,220 @@
<?php
// +-----------------------------------------------------------------------+
// | 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 |
// +-----------------------------------------------------------------------+
// | last modifier : $Author: rub $
// | revision : $Revision: 1.0.2.0 $
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | 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']))
{
$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';
}
// +-----------------------------------------------------------------------+
// | include |
// +-----------------------------------------------------------------------+
if (!defined('PHPWG_ROOT_PATH'))
{
die ("Hacking attempt!");
}
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
// +-----------------------------------------------------------------------+
// | Check Access and exit when user status is not ok |
// +-----------------------------------------------------------------------+
check_status(ACCESS_ADMINISTRATOR);
// +-----------------------------------------------------------------------+
// | Functions |
// +-----------------------------------------------------------------------+
/**
* returns an array containing sub-directories
* recursive by default
*
* directories nammed ".svn" are omitted
*
* @param string $path
* @param bool $recursive
* @return array
*/
function get_add_index_directories($path, $recursive = true)
{
$dirs = array();
if (is_dir($path))
{
if ($contents = opendir($path))
{
while (($node = readdir($contents)) !== false)
{
if (
is_dir($path.'/'.$node)
and $node != '.'
and $node != '..'
and $node != '.svn'
)
{
array_push($dirs, $path.'/'.$node);
if ($recursive)
{
$dirs = array_merge($dirs, get_add_index_directories($path.'/'.$node));
}
}
}
}
}
return $dirs;
}
// +-----------------------------------------------------------------------+
// | Main |
// +-----------------------------------------------------------------------+
$index_file_src=PHPWG_ROOT_PATH.$conf['index']['source_directory_name'];
$overwrite_file=isset($_GET['overwrite']);
$site_id = (isset($_GET['site_id']) and is_numeric($_GET['site_id'])
? $_GET['site_id']
: 0);
$add_index_results = array();
$count_copy = 0;
$count_skip = 0;
$count_error = 0;
if (@file_exists($index_file_src))
{
$query = '
select
galleries_url
from
'.SITES_TABLE;
if (!empty($site_id))
{
$query .= '
where
id = '.$site_id;
}
$query .= '
order by
id';
$result = pwg_query($query);
if (mysql_num_rows($result) > 0)
{
while (list($galleries_url) = mysql_fetch_row($result))
{
if (!url_is_remote($galleries_url))
{
//echo $galleries_url.'<BR>';
foreach (get_add_index_directories($galleries_url) as $dir_galleries)
{
$file_dest = $dir_galleries.'/'.$conf['index']['file_name'];
if ($overwrite_file or !@file_exists($file_dest))
{
if (copy($index_file_src, $file_dest))
{
array_push($add_index_results,
sprintf(l10n('add_index_file_copied'), $file_dest));
$count_copy++;
}
else
{
array_push($page['errors'],
sprintf(l10n('add_index_file_not_copied'), $file_dest));
$count_error++;
}
}
else
{
$count_skip++;
}
}
}
else
{
if (!empty($site_id))
{
array_push($page['errors'],
sprintf(l10n('add_index_not_local_site'),
$galleries_url, $site_id));
}
}
}
}
if ($count_copy != 0)
{
array_push($add_index_results,
l10n_dec('add_index_nb_copied_file', 'add_index_nb_copied_files',
$count_copy));
}
if ($count_skip != 0)
{
array_push($add_index_results,
l10n_dec('add_index_nb_skipped_file', 'add_index_nb_skipped_files',
$count_skip));
}
if ($count_error != 0)
{
array_push($page['errors'],
l10n_dec('add_index_nb_not_copied_file', 'add_index_nb_not_copied_files',
$count_error));
}
}
else
{
array_push($page['errors'],
sprintf(l10n('add_index_src_file_dont_exists'), $index_file_src));
}
// +-----------------------------------------------------------------------+
// | template initialization |
// +-----------------------------------------------------------------------+
$template->set_filenames(array('main_page' => dirname(__FILE__).'/main_page.tpl'));
if (count($add_index_results) != 0)
{
foreach ($add_index_results as $result)
{
$template->assign_block_vars('add_index_results.result', array('RESULT' => $result));
}
}
// +-----------------------------------------------------------------------+
// | Sending html code |
// +-----------------------------------------------------------------------+
$template->assign_var_from_handle( 'ADMIN_CONTENT', 'main_page');
?>

View file

@ -0,0 +1,14 @@
<!-- $Id: notification_by_mail.tpl Ruben ARNAUD -->
<div class="titrePage">
<h2>{lang:Add_Index}</h2>
</div>
<!-- BEGIN add_index_results -->
<div>
<ul>
<!-- BEGIN result -->
<li>{add_index_results.result.RESULT}</li>
<!-- END result -->
</ul>
</div>
<!-- END add_index_results -->

View file

@ -0,0 +1,35 @@
<?php
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
// | last update : $Date: 2006-07-18 23:38:54 +0200 (mar., 18 juil. 2006) $
// | last modifier : $Author: rub $
// | revision : $Revision: 1481 $
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
// recursive call of index.php
$url = '../index.php';
header( 'Request-URI: '.$url );
header( 'Content-Location: '.$url );
header( 'Location: '.$url );
exit();
?>

View file

@ -0,0 +1,7 @@
<p>Functionality of AddIndex plugin:</p>
<ul>
<li>
<strong>Add and overwrite "index" files for all local sites:</strong>
Overwrite copy the file ./include/index.php in all sub-directories of gallerie local sites.
</li>
<ul>

View file

@ -0,0 +1,35 @@
<?php
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
// | last update : $Date: 2006-03-15 23:44:35 +0100 (mer., 15 mars 2006) $
// | last modifier : $Author: plg $
// | revision : $Revision: 1082 $
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
// recursive call of index.php
$url = '../index.php';
header( 'Request-URI: '.$url );
header( 'Content-Location: '.$url );
header( 'Location: '.$url );
exit();
?>

View file

@ -0,0 +1,7 @@
<p>Functionality of AddIndex plugin:</p>
<ul>
<li>
<strong>Add "index" files for local site:</strong>
Copy the file ./include/index.php in all sub-directories of selected local site.
</li>
<ul>

View file

@ -0,0 +1,35 @@
<?php
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
// | last update : $Date: 2006-03-15 23:44:35 +0100 (mer., 15 mars 2006) $
// | last modifier : $Author: plg $
// | revision : $Revision: 1082 $
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
// recursive call of index.php
$url = '../index.php';
header( 'Request-URI: '.$url );
header( 'Content-Location: '.$url );
header( 'Location: '.$url );
exit();
?>

View file

@ -0,0 +1,44 @@
<?php
// +-----------------------------------------------------------------------+
// | 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 |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
// | last update : $Date: 2006-07-18 23:38:54 +0200 (mar., 18 juil. 2006) $
// | last modifier : $Author: rub $
// | revision : $Revision: 1481 $
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
$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['add_index_file_copied'] = '%s copied';
$lang['add_index_file_not_copied'] = '%s not copied';
$lang['add_index_not_local_site'] = '%s [%d] is a remote site, it\`s compatible with add "index" files';
$lang['add_index_nb_copied_file'] = '%d file copied';
$lang['add_index_nb_copied_files'] = '%d files copied';
$lang['add_index_nb_skipped_file'] = '%d file skipped';
$lang['add_index_nb_skipped_files'] = '%d files skipped';
$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';
?>

View file

@ -0,0 +1,7 @@
<p>Fonctionnalité du plugin AddIndex:</p>
<ul>
<li>
<strong>Ajout et écrasement des fichiers "index" pour tous les sites locaux :</strong>
Copie avec écrasement le fichier ./include/index.php dans tous les sous-répertoires des galeries des sites locaux.
</li>
</ul>

View file

@ -0,0 +1,35 @@
<?php
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
// | last update : $Date: 2006-03-15 23:44:35 +0100 (mer., 15 mars 2006) $
// | last modifier : $Author: plg $
// | revision : $Revision: 1082 $
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
// recursive call of index.php
$url = '../index.php';
header( 'Request-URI: '.$url );
header( 'Content-Location: '.$url );
header( 'Location: '.$url );
exit();
?>

View file

@ -0,0 +1,7 @@
<p>Fonctionnalité du plugin AddIndex:</p>
<ul>
<li>
<strong>Ajout des fichiers "index" pour le site local :</strong>
Copie le fichier ./include/index.php dans tous les sous-répertoires du site sélectionné.
</li>
</ul>

View file

@ -0,0 +1,35 @@
<?php
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
// | last update : $Date: 2006-03-15 23:44:35 +0100 (mer., 15 mars 2006) $
// | last modifier : $Author: plg $
// | revision : $Revision: 1082 $
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
// recursive call of index.php
$url = '../index.php';
header( 'Request-URI: '.$url );
header( 'Content-Location: '.$url );
header( 'Location: '.$url );
exit();
?>

View file

@ -0,0 +1,44 @@
<?php
// +-----------------------------------------------------------------------+
// | 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 |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
// | last update : $Date: 2006-07-18 23:38:54 +0200 (mar., 18 juil. 2006) $
// | last modifier : $Author: rub $
// | revision : $Revision: 1481 $
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
$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['add_index_file_copied'] = '%s copié';
$lang['add_index_file_not_copied'] = '%s non copié';
$lang['add_index_not_local_site'] = '%s [%d] est un site distant, ce n\'est pas compatible avec l\'ajout de fichiers "index"';
$lang['add_index_nb_copied_file'] = '%d fichier copié';
$lang['add_index_nb_copied_files'] = '%d fichiers copiés';
$lang['add_index_nb_skipped_file'] = '%d fichier à ne pas traiter';
$lang['add_index_nb_skipped_files'] = '%d fichiers à ne pas traiter';
$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';
?>

View file

@ -0,0 +1,35 @@
<?php
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
// | last update : $Date: 2006-07-18 23:38:54 +0200 (mar., 18 juil. 2006) $
// | last modifier : $Author: rub $
// | revision : $Revision: 1481 $
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
// recursive call of index.php
$url = '../index.php';
header( 'Request-URI: '.$url );
header( 'Content-Location: '.$url );
header( 'Location: '.$url );
exit();
?>

View file

@ -0,0 +1,78 @@
<?php
// +-----------------------------------------------------------------------+
// | 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 |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
// | last update : $Date: 2006-07-18 23:38:54 +0200 (mar., 18 juil. 2006) $
// | last modifier : $Author: rub $
// | revision : $Revision: 1481 $
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
if ((!defined('PHPWG_ROOT_PATH')) or (!(defined('IN_ADMIN') and IN_ADMIN)))
{
die('Hacking attempt!');
}
class AdminAddIndex extends AddIndex
{
function loading_lang()
{
global $lang;
include(get_language_filepath('plugin.lang.php', $this->path));
}
function array_advanced_features($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'
));
return $advanced_features;
}
function array_site_manager_plugin_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_CAPTION' => l10n('Manager_Add_Index'),
'U_HINT' => l10n('Add_Index')
));
}
return $site_manager_plugin_links;
}
}
$add_index = new AdminAddIndex();
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);
?>

View file

@ -0,0 +1,74 @@
<?php
/*
Plugin Name: Add Index
Version: 1.1.0.0
Description: Add file index.php file on all sub-directories of local galleries pictures. / Ajoute le fichier index.php sur les sous-répertoires de galeries d'images locales.
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 |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
// | last update : $Date: 2006-07-18 23:38:54 +0200 (mar., 18 juil. 2006) $
// | last modifier : $Author: rub $
// | revision : $Revision: 1481 $
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
if (!defined('PHPWG_ROOT_PATH'))
{
die('Hacking attempt!');
}
class AddIndex
{
var $path;
function AddIndex()
{
$this->path = dirname(__FILE__).'/';
}
function get_popup_help_content($popup_help_content, $page)
{
$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;
}
}
}
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);
}
?>

View file

@ -13,7 +13,9 @@ function set_admin_advice()
// This Plugin works only on the Admin page
if ( isset($page['body_id']) and $page['body_id']=='theAdminPage'
and isset($page['page']) and $page['page'] == 'intro' )
and isset($page['page']['name']) and $page['page']['name'] == 'intro'
and isset($page['page']['type']) and $page['page']['type'] == 'standard'
)
{
// Setup Advice Language (Maybe there is already a variable)
$advlang = ( isset($user['language']) ) ?