Changeset 1704 for trunk


Ignore:
Timestamp:
Jan 9, 2007, 7:01:49 AM (18 years ago)
Author:
rub
Message:

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

Change name of news triggers.
Replace & by &
Improve a little add_index plugin implementation.
Add parameters pages (under construction) for add_index plugin

Location:
trunk
Files:
5 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/advanced_feature.php

    r1699 r1704  
    7272  (
    7373    'CAPTION' => l10n('Elements_not_linked'),
    74     'URL' => get_root_url().'admin.php?page=element_set&cat=not_linked'
     74    'URL' => get_root_url().'admin.php?page=element_set&cat=not_linked'
    7575  ));
    7676
     
    7979  (
    8080    'CAPTION' => l10n('Duplicates'),
    81     'URL' => get_root_url().'admin.php?page=element_set&cat=duplicates'
     81    'URL' => get_root_url().'admin.php?page=element_set&cat=duplicates'
    8282  ));
    8383
    8484//$advanced_features is array of array composed of CAPTION & URL
    8585$advanced_features =
    86     trigger_event('array_advanced_features', $advanced_features);
     86    trigger_event('get_admin_advanced_features_links', $advanced_features);
    8787
    8888// +-----------------------------------------------------------------------+
  • trunk/admin/site_manager.php

    r1699 r1704  
    298298  //$plugin_links is array of array composed of U_HREF, U_HINT & U_CAPTION
    299299  $plugin_links =
    300     trigger_event('array_site_manager_plugin_links',
     300    trigger_event('get_admins_site_links',
    301301      $plugin_links, $row['id'], $is_remote);
    302302
  • trunk/plugins/add_index/admin/main_page.php

    r1699 r1704  
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    55// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
    6 // | Copyright (C) 2006 Ruben ARNAUD - team@phpwebgallery.net              |
     6// | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net         |
    77// +-----------------------------------------------------------------------+
    88// | last modifier : $Author: rub $
     
    2424// +-----------------------------------------------------------------------+
    2525
    26 // +-----------------------------------------------------------------------+
    27 // | Here before to modify by user                                         |
    28 // +-----------------------------------------------------------------------+
    29 // Name of index file (index.php or index.htm or index.html)
    30 if (!isset($conf['index']['file_name']))
    31 {
    32   $conf['index']['file_name'] = 'index.php';
    33 }
    34 // Name of index file (index.php or index.htm or index.html)
    35 if (!isset($conf['index']['source_directory_name']))
    36 {
    37   // Name of the directoty use in order to copy index file
    38   $conf['index']['source_directory_name'] = 'include/index.php';
     26if ((!defined('PHPWG_ROOT_PATH')) or (!(defined('IN_ADMIN') and IN_ADMIN)))
     27{
     28  die('Hacking attempt!');
    3929}
    4030
     
    4232// | include                                                               |
    4333// +-----------------------------------------------------------------------+
    44 
    45 if (!defined('PHPWG_ROOT_PATH'))
    46 {
    47   die ("Hacking attempt!");
    48 }
    49 
    5034include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
    5135include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
     
    10286// | Main                                                                  |
    10387// +-----------------------------------------------------------------------+
    104 $index_file_src=PHPWG_ROOT_PATH.$conf['index']['source_directory_name'];
     88// Compute values
     89$index_file_src=$conf['add_index_source_directory_path'].$conf['add_index_filename'];
    10590$overwrite_file=isset($_GET['overwrite']);
    10691$site_id = (isset($_GET['site_id']) and is_numeric($_GET['site_id'])
     
    10893            : 0);
    10994
     95// Init values
    11096$add_index_results = array();
    11197$count_copy = 0;
     
    141127        foreach (get_add_index_directories($galleries_url) as $dir_galleries)
    142128        {
    143           $file_dest = $dir_galleries.'/'.$conf['index']['file_name'];
     129          $file_dest = $dir_galleries.'/'.$conf['add_index_filename'];
    144130          if ($overwrite_file or !@file_exists($file_dest))
    145131          {
     
    175161  }
    176162
    177   if ($count_copy != 0)
     163  // Show always an result, defaut (0 copy, $count_copy == $count_skip == 0)
     164  if (($count_copy != 0) or ($count_skip == 0))
    178165  {
    179166    array_push($add_index_results,
  • trunk/plugins/add_index/language/en_UK.iso-8859-1/help/advanced_feature.html

    r1699 r1704  
    33  <li>
    44    <strong>Add and overwrite "index" files for all local sites:</strong>
    5     Overwrite copy the file ./include/index.php in all sub-directories of gallerie local sites.
     5    Overwrite copy the file ./include/index.php to all sub-directories of gallerie local sites.
    66  </li>
    77<ul>
  • trunk/plugins/add_index/language/en_UK.iso-8859-1/help/site_manager.html

    r1699 r1704  
    33  <li>
    44    <strong>Add "index" files for local site:</strong>
    5     Copy the file ./include/index.php in all sub-directories of selected local site.
     5    Copy the file ./include/index.php to all sub-directories of selected local site.
    66  </li>
    77<ul>
  • trunk/plugins/add_index/language/en_UK.iso-8859-1/plugin.lang.php

    r1699 r1704  
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    55// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    6 // | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net              |
     6// | Copyright (C) 2007 Ruben ARNAUD - team@phpwebgallery.net              |
    77// +-----------------------------------------------------------------------+
    88// | branch        : BSF (Best So Far)
     
    3030$lang['Advanced_Add_Index'] = 'Add and overwrite "index" files for all local sites';
    3131$lang['Manager_Add_Index'] = 'add "index"';
     32$lang['Menu_Add_Index'] = 'Add "index"';
    3233
    3334$lang['add_index_file_copied'] = '%s copied';
     
    4243$lang['add_index_src_file_dont_exists'] = 'Source file %s don\'t esists, cannot duplicate this file';
    4344
     45$lang['add_index_Description_1'] = 'Add "index" files allows to copy "index" file from source directory to all sub-directories of gallerie local sites.';
     46$lang['add_index_Description_2'] = '"index" file prevents to list contents of a directory.';
     47$lang['add_index_Parameters'] = 'Parameters';
     48$lang['add_index_filename'] = 'File name';
     49$lang['add_index_source_directory_path'] = 'Path of source directory';
     50
     51
    4452?>
  • trunk/plugins/add_index/language/fr_FR.iso-8859-1/plugin.lang.php

    r1699 r1704  
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    55// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    6 // | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net              |
     6// | Copyright (C) 2007 Ruben ARNAUD - team@phpwebgallery.net              |
    77// +-----------------------------------------------------------------------+
    88// | branch        : BSF (Best So Far)
     
    3030$lang['Advanced_Add_Index'] = 'Ajout et écrasement des fichiers "index" pour tous les sites locaux';
    3131$lang['Manager_Add_Index'] = 'ajout des "index"';
     32$lang['Menu_Add_Index'] = 'Add "index"';
    3233
    3334$lang['add_index_file_copied'] = '%s copié';
     
    4243$lang['add_index_src_file_dont_exists'] = 'Le fichier source n\'existe pas, la duplication de ce fichier n\'est pas possible';
    4344
     45$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.';
     46$lang['add_index_Description_2'] = 'Le fichier "index" empêche de lister le contenu d\'un répertoire.';
     47$lang['add_index_Parameters'] = 'Paramètres';
     48$lang['add_index_filename'] = 'Nom du fichier';
     49$lang['add_index_source_directory_path'] = 'Chemin du répertoire source';
     50
    4451?>
  • trunk/plugins/add_index/main.admin.inc.php

    r1699 r1704  
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    55// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    6 // | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net              |
     6// | Copyright (C) 2007 Ruben ARNAUD - team@phpwebgallery.net              |
    77// +-----------------------------------------------------------------------+
    88// | branch        : BSF (Best So Far)
     
    3434class AdminAddIndex extends AddIndex
    3535{
     36  function load_params()
     37  {
     38    global $conf;
     39    // Name of index file (index.php or index.htm or index.html)
     40    if (!isset($conf['add_index_filename']))
     41    {
     42      $conf['add_index_filename'] = 'index.php';
     43    }
     44    // Name of index file (index.php or index.htm or index.html)
     45    if (!isset($conf['add_index_source_directory_path']))
     46    {
     47      // Name of the directoty use in order to copy index file
     48      $conf['add_index_source_directory_path'] = PHPWG_ROOT_PATH.'include/';
     49    }
     50  }
     51
    3652  function loading_lang()
    3753  {
     
    4157  }
    4258
    43   function array_advanced_features($advanced_features)
     59  function get_admin_advanced_features_links($advanced_features)
    4460  {
    4561    array_push($advanced_features,
     
    4763      (
    4864        'CAPTION' => l10n('Advanced_Add_Index'),
    49         'URL' => get_root_url().'admin.php?page=main_page&page_type=plugin&plugin_id=add_index&overwrite'
     65        'URL' => get_root_url().'admin.php?page=main_page&amp;page_type=plugin&amp;plugin_id=add_index&amp;overwrite'
    5066      ));
    5167
     
    5369  }
    5470
    55   function array_site_manager_plugin_links($site_manager_plugin_links, $site_id, $is_remote)
     71  function get_admins_site_links($site_manager_plugin_links, $site_id, $is_remote)
    5672  {
    5773    if (!$is_remote)
     
    6076        array
    6177        (
    62           'U_HREF' => get_root_url().'admin.php?page=main_page&page_type=plugin&plugin_id=add_index&site_id='.$site_id,
     78          'U_HREF' => get_root_url().'admin.php?page=main_page&amp;page_type=plugin&amp;plugin_id=add_index&amp;site_id='.$site_id,
    6379          'U_CAPTION' => l10n('Manager_Add_Index'),
    6480          'U_HINT' => l10n('Add_Index')
     
    6884    return $site_manager_plugin_links;
    6985  }
     86
     87  function plugin_admin_menu()
     88  {
     89    add_plugin_admin_menu(l10n('Menu_Add_Index'), array(&$this, 'do_plugin_admin_menu'));
     90  }
     91
     92  function do_plugin_admin_menu($my_url)
     93  {
     94    include_once(dirname(__FILE__).'/admin/'.'admin_menu.php');
     95  }
     96
    7097}
    7198
     99// Create object
    72100$add_index = new AdminAddIndex();
    73101
     102// Load Add Index parameters
     103$add_index->load_params();
     104
     105// Add events
    74106add_event_handler('loading_lang', array(&$add_index, 'loading_lang'));
    75 add_event_handler('array_advanced_features', array(&$add_index, 'array_advanced_features'));
    76 add_event_handler('array_site_manager_plugin_links', array(&$add_index, 'array_site_manager_plugin_links'), EVENT_HANDLER_PRIORITY_NEUTRAL, 3);
     107add_event_handler('get_admin_advanced_features_links', array(&$add_index, 'get_admin_advanced_features_links'));
     108add_event_handler('get_admins_site_links', array(&$add_index, 'get_admins_site_links'), EVENT_HANDLER_PRIORITY_NEUTRAL, 3);
     109add_event_handler('plugin_admin_menu', array(&$add_index, 'plugin_admin_menu') );
    77110
    78111?>
  • trunk/plugins/add_index/main.inc.php

    r1699 r1704  
    1010// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    1111// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    12 // | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net              |
     12// | Copyright (C) 2007 Ruben ARNAUD - team@phpwebgallery.net              |
    1313// +-----------------------------------------------------------------------+
    1414// | branch        : BSF (Best So Far)
     
    3838}
    3939
    40 class AddIndex
     40if (in_array(script_basename(), array('popuphelp', 'admin')))
    4141{
    42   var $path;
    43  
    44   function AddIndex()
     42  if (defined('IN_ADMIN') and IN_ADMIN)
    4543  {
    46     $this->path = dirname(__FILE__).'/';
     44    include_once(dirname(__FILE__).'/'.'main.base.inc.php');
     45    include_once(dirname(__FILE__).'/'.'main.admin.inc.php');
    4746  }
    48 
    49   function get_popup_help_content($popup_help_content, $page)
     47  else
    5048  {
    51     $help_content =
    52       @file_get_contents(get_language_filepath('help/'.$page.'.html', $this->path));
    53       if ($help_content == false)
    54       {
    55         return $popup_help_content;
    56       }
    57       else
    58       {
    59         return $popup_help_content.$help_content;
    60       }
     49    include_once(dirname(__FILE__).'/'.'main.base.inc.php');
     50    include_once(dirname(__FILE__).'/'.'main.normal.inc.php');
    6151  }
    6252}
    6353
    64 if (defined('IN_ADMIN') and IN_ADMIN)
    65 {
    66   include_once(dirname(__FILE__).'/'.'main.admin.inc.php');
    67 }
    68 else
    69 {
    70   $add_index = new AddIndex();
    71   add_event_handler('get_popup_help_content', array(&$add_index, 'get_popup_help_content'), EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    72 }
    73 
    7454?>
Note: See TracChangeset for help on using the changeset viewer.